]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Dump default defs for arguments, static chain and decl-by-reference
authorvries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 14 Dec 2015 19:29:48 +0000 (19:29 +0000)
committervries <vries@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 14 Dec 2015 19:29:48 +0000 (19:29 +0000)
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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231630 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/gimple-pretty-print.c
gcc/gimple-pretty-print.h
gcc/tree-cfg.c

index e1fcab6242c91aaf94d2524f8a01fa0854f62b25..f21f69cbea9d452c9c0f62f5df11776efa857e56 100644 (file)
@@ -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.
index f1abf5c4aea522d0d41a4676a3c5a19eff4e88e8..01e9b6b004c8f7f65274189821db2f75c7dd9432 100644 (file)
@@ -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
index 1ab24b8dbfd2de8ae9fdb8151eb9dfe1b0ad8832..740965f96f47599bf0b56d8322a1630dbaf58085 100644 (file)
@@ -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 */
index 0c624aa3f3ed0e49b8fec8158e7f703fbcbd96c1..5aad9ee3149695bc7aa0c501ff95573580a0e1f8 100644 (file)
@@ -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)
          {