On Fri, Dec 11, 2015 at 6:05 PM, Tom de Vries <tom_devr...@mentor.com> wrote: > 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?
I've had a similar patch in my dev tree for quite some while but never pushed it because of "formatting"... That said, + if (gimple_in_ssa_p (fun)) Please add flags & TDF_ALIAS here to avoid issues with dump-file scanning. + { + 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); Rather than # DEFAULT_DEF d_4(D) I'd print d_4(D) = GIMPLE_NOP; (or how gimple-nop is printed - that is, just print the def-stmt). My local patch simply adjusted the dumping of function locals, thus I amended the existing if (gimple_in_ssa_p (cfun)) for (ix = 1; ix < num_ssa_names; ++ix) { tree name = ssa_name (ix); if (name && !SSA_NAME_VAR (name)) { loop. Of course that intermixed default-defs with other anonymous SSA vars which might be a little confusing. But prepending the list of locals with type d_4(D) = NOP(); together with SSA info might be the best. Note there is also the static chain and the result decl (if DECL_BY_REFERENCE) to print. Richard. + fprintf (file, "\n"); + arg = DECL_CHAIN (arg); + } + } - Tom