aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom de Vries <tom@codesourcery.com>2015-12-14 19:29:48 +0000
committerTom de Vries <vries@gcc.gnu.org>2015-12-14 19:29:48 +0000
commit0482b001d456f04130084df8a841bb7159b3d383 (patch)
treed2ea519d48685aff6d60a5381ab876c40bc43bc7
parent44eba92d0a0594bda5b53fcb3c8f84f164c653b6 (diff)
downloadgcc-0482b001d456f04130084df8a841bb7159b3d383.zip
gcc-0482b001d456f04130084df8a841bb7159b3d383.tar.gz
gcc-0482b001d456f04130084df8a841bb7159b3d383.tar.bz2
Dump default defs for arguments, static chain and decl-by-reference
2015-12-14 Tom de Vries <tom@codesourcery.com> PR other/68882 * gimple-pretty-print.c (dump_ssaname_info_to_file): New function. * gimple-pretty-print.h (dump_ssaname_info_to_file): Declare. * tree-cfg.c (dump_default_def): New function. (dump_function_to_file): Dump default defs for arguments, static chain, and decl-by-reference. From-SVN: r231630
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/gimple-pretty-print.c11
-rw-r--r--gcc/gimple-pretty-print.h1
-rw-r--r--gcc/tree-cfg.c46
4 files changed, 67 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e1fcab6..f21f69c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+2015-12-14 Tom de Vries <tom@codesourcery.com>
+
+ PR other/68882
+ * gimple-pretty-print.c (dump_ssaname_info_to_file): New function.
+ * gimple-pretty-print.h (dump_ssaname_info_to_file): Declare.
+ * tree-cfg.c (dump_default_def): New function.
+ (dump_function_to_file): Dump default defs for arguments, static chain,
+ and decl-by-reference.
+
2015-12-14 Nathan Sidwell <nathan@acm.org>
* config/nvptx/nvptx.h (PARM_BOUNDARY): Set to 32.
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index f1abf5c..01e9b6b 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1887,6 +1887,17 @@ dump_ssaname_info (pretty_printer *buffer, tree node, int spc)
}
}
+/* As dump_ssaname_info, but dump to FILE. */
+
+void
+dump_ssaname_info_to_file (FILE *file, tree node, int spc)
+{
+ pretty_printer buffer;
+ pp_needs_newline (&buffer) = true;
+ buffer.buffer->stream = file;
+ dump_ssaname_info (&buffer, node, spc);
+ pp_flush (&buffer);
+}
/* Dump a PHI node PHI. BUFFER, SPC and FLAGS are as in pp_gimple_stmt_1.
The caller is responsible for calling pp_flush on BUFFER to finalize
diff --git a/gcc/gimple-pretty-print.h b/gcc/gimple-pretty-print.h
index 1ab24b8..740965f 100644
--- a/gcc/gimple-pretty-print.h
+++ b/gcc/gimple-pretty-print.h
@@ -34,5 +34,6 @@ extern void print_gimple_expr (FILE *, gimple *, int, int);
extern void pp_gimple_stmt_1 (pretty_printer *, gimple *, int, int);
extern void gimple_dump_bb (FILE *, basic_block, int, int);
extern void gimple_dump_bb_for_graph (pretty_printer *, basic_block);
+extern void dump_ssaname_info_to_file (FILE *, tree, int);
#endif /* ! GCC_GIMPLE_PRETTY_PRINT_H */
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c
index 0c624aa..5aad9ee 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -7312,6 +7312,23 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb,
return bb;
}
+/* Dump default def DEF to file FILE using FLAGS and indentation
+ SPC. */
+
+static void
+dump_default_def (FILE *file, tree def, int spc, int flags)
+{
+ for (int i = 0; i < spc; ++i)
+ fprintf (file, " ");
+ dump_ssaname_info_to_file (file, def, spc);
+
+ print_generic_expr (file, TREE_TYPE (def), flags);
+ fprintf (file, " ");
+ print_generic_expr (file, def, flags);
+ fprintf (file, " = ");
+ print_generic_expr (file, SSA_NAME_VAR (def), flags);
+ fprintf (file, ";\n");
+}
/* Dump FUNCTION_DECL FN to file FILE using FLAGS (see TDF_* in dumpfile.h)
*/
@@ -7391,6 +7408,35 @@ dump_function_to_file (tree fndecl, FILE *file, int flags)
ignore_topmost_bind = true;
fprintf (file, "{\n");
+ if (gimple_in_ssa_p (fun)
+ && (flags & TDF_ALIAS))
+ {
+ for (arg = DECL_ARGUMENTS (fndecl); arg != NULL;
+ arg = DECL_CHAIN (arg))
+ {
+ tree def = ssa_default_def (fun, arg);
+ if (def)
+ dump_default_def (file, def, 2, flags);
+ }
+
+ tree res = DECL_RESULT (fun->decl);
+ if (res != NULL_TREE
+ && DECL_BY_REFERENCE (res))
+ {
+ tree def = ssa_default_def (fun, res);
+ if (def)
+ dump_default_def (file, def, 2, flags);
+ }
+
+ tree static_chain = fun->static_chain_decl;
+ if (static_chain != NULL_TREE)
+ {
+ tree def = ssa_default_def (fun, static_chain);
+ if (def)
+ dump_default_def (file, def, 2, flags);
+ }
+ }
+
if (!vec_safe_is_empty (fun->local_decls))
FOR_EACH_LOCAL_DECL (fun, ix, var)
{