This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa][PATCH]: Have tree-sra dump info about why something wasn't scalarized
- From: Daniel Berlin <dberlin at dberlin dot org>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Diego Novillo <dnovillo at redhat dot com>
- Date: Sun, 30 Nov 2003 23:51:15 -0500
- Subject: [tree-ssa][PATCH]: Have tree-sra dump info about why something wasn't scalarized
This patch is helpful when trying to figure out why something wasn't
scalarized.
We could be even more detailed if we really wanted to, but it would
require knowing the internals of is_gimple_non_addressable_var.
Diego, tree-sra is yours (I think), so is this okay?
I don't want to step on any toes :P
2003-11-31 Daniel Berlin <dberlin@dberlin.org>
* tree-sra.c (can_be_scalarized_p): Print details about why something
could not be scalarized to the dump file.
Index: tree-sra.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-sra.c,v
retrieving revision 1.1.2.3
diff -u -3 -p -r1.1.2.3 tree-sra.c
--- tree-sra.c 21 Nov 2003 23:12:35 -0000 1.1.2.3
+++ tree-sra.c 1 Dec 2003 04:47:22 -0000
@@ -166,7 +166,16 @@ can_be_scalarized_p (tree var)
int nfields;
if (!is_gimple_non_addressable (var))
- return false;
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Cannot scalarize variable ");
+ print_generic_expr (dump_file, var, 0);
+ fprintf (dump_file,
+ " because it is not a GIMPLE addressable var\n");
+ }
+ return false;
+ }
type = TREE_TYPE (var);
nfields = 0;
@@ -176,18 +185,51 @@ can_be_scalarized_p (tree var)
continue;
if (AGGREGATE_TYPE_P (TREE_TYPE (field)))
- return false;
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Cannot scalarize variable ");
+ print_generic_expr (dump_file, var, 0);
+ fprintf (dump_file,
+ " because it contains an aggregate type field, ");
+ print_generic_expr (dump_file, field, 0);
+ fprintf (dump_file, "\n");
+ }
+ return false;
+ }
/* FIXME. We don't scalarize structures with bit fields yet. To
support this, we should make sure that all the fields fit in one
word and modify every operation done on the scalarized bit fields
to mask them properly. */
if (DECL_BIT_FIELD (field))
- return false;
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Cannot scalarize variable ");
+ print_generic_expr (dump_file, var, 0);
+ fprintf (dump_file,
+ " because it contains a bit-field, ");
+ print_generic_expr (dump_file, field, 0);
+ fprintf (dump_file, "\n");
+ }
+ return false;
+ }
+
nfields++;
if (nfields > MAX_NFIELDS_FOR_SRA)
- return false;
+ {
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ fprintf (dump_file, "Cannot scalarize variable ");
+ print_generic_expr (dump_file, var, 0);
+ fprintf (dump_file,
+ " because it contains more than %d fields\n",
+ MAX_NFIELDS_FOR_SRA);
+ }
+ return false;
+ }
}
/* If the structure had no FIELD_DECLs, then don't bother