aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-cfg.c
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 /gcc/tree-cfg.c
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
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r--gcc/tree-cfg.c46
1 files changed, 46 insertions, 0 deletions
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)
{