On Mon, Dec 14, 2015 at 11:50 AM, Tom de Vries <[email protected]> wrote:
> On 14/12/15 09:47, Richard Biener wrote:
>>
>> On Fri, Dec 11, 2015 at 6:05 PM, Tom de Vries <[email protected]>
>> 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.
>>
>
> Done.
>
>
>> + {
>> + 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.
>
>
> Done.
>
> In addition, I added printing of SSA_NAME_VAR(def) as argument to NOP.
> I think that's even more clear: the var is printed in the same format as in
> the arguments list, so it makes it easier to relate the two:
Indeed. Note that I'd drop the "NOP()" then, an assignment from the
parameter decl is clear enough a "nop".
Ok with that change.
Richard.
> ...
> __attribute__((noclone, noinline))
> bar (intD.6 * cD.1755, intD.6 * dD.1756)
> {
> # PT = nonlocal
> intD.6 * c_2(D) = NOP(cD.1755);
> # PT = { D.1762 } (nonlocal)
> # ALIGN = 4, MISALIGN = 0
> intD.6 * d_4(D) = NOP(dD.1756);
> intD.6 _6;
> intD.6 _7;
> ...
>
>> Note there is also the
>> static chain and the result decl (if DECL_BY_REFERENCE) to print.
>>
>
> Done, though I haven't tested that bit yet.
>
> Thanks,
> - Tom