Hi,
atm, we dump ssa-name info for lhs-es of statements. That leaves out the
ssa names with default defs.
This proof-of-concept patch prints the ssa-name info for default defs,
in the following format:
...
__attribute__((noclone, noinline))
bar (intD.6 * cD.1755, intD.6 * dD.1756)
# PT = nonlocal
# DEFAULT_DEF c_2(D)
# PT = { D.1762 } (nonlocal)
# ALIGN = 4, MISALIGN = 0
# DEFAULT_DEF d_4(D)
{
;; basic block 2, loop depth 0, count 0, freq 10000, maybe hot
;; prev block 0, next block 1, flags: (NEW, REACHABLE)
;; pred: ENTRY [100.0%] (FALLTHRU,EXECUTABLE)
# .MEM_3 = VDEF <.MEM_1(D)>
*c_2(D) = 1;
# .MEM_5 = VDEF <.MEM_3>
*d_4(D) = 2;
# VUSE <.MEM_5>
return;
;; succ: EXIT [100.0%] (EXECUTABLE)
}
...
Good idea? Any further comments, f.i. on formatting?
Thanks,
- Tom
Dump ssaname info for default defs
---
gcc/gimple-pretty-print.c | 11 +++++++++++
gcc/tree-cfg.c | 16 ++++++++++++++++
2 files changed, 27 insertions(+)
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index f1abf5c..75a3036 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)
}
}
+extern void dump_ssaname_info_to_file (FILE *, tree);
+
+void
+dump_ssaname_info_to_file (FILE *file, tree node)
+{
+ pretty_printer buffer;
+ pp_needs_newline (&buffer) = true;
+ buffer.buffer->stream = file;
+ dump_ssaname_info (&buffer, node, 0);
+ 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/tree-cfg.c b/gcc/tree-cfg.c
index 0c624aa..21cf7a1 100644
--- a/gcc/tree-cfg.c
+++ b/gcc/tree-cfg.c
@@ -7312,6 +7312,7 @@ move_sese_region_to_fn (struct function *dest_cfun, basic_block entry_bb,
return bb;
}
+extern void dump_ssaname_info_to_file (FILE *, tree);
/* Dump FUNCTION_DECL FN to file FILE using FLAGS (see TDF_* in dumpfile.h)
*/
@@ -7369,6 +7370,21 @@ dump_function_to_file (tree fndecl, FILE *file, int flags)
}
fprintf (file, ")\n");
+ if (gimple_in_ssa_p (fun))
+ {
+ arg = DECL_ARGUMENTS (fndecl);
+ while (arg)
+ {
+ tree def = ssa_default_def (fun, arg);
+ if (flags & TDF_ALIAS)
+ dump_ssaname_info_to_file (file, def);
+ fprintf (file, "# DEFAULT_DEF ");
+ print_generic_expr (file, def, dump_flags);
+ fprintf (file, "\n");
+ arg = DECL_CHAIN (arg);
+ }
+ }
+
if (flags & TDF_VERBOSE)
print_node (file, "", fndecl, 2);