On 03/29/2018 04:23 AM, Tom de Vries wrote:
> [ Fix ENOPATCH ]
> 
> On 03/29/2018 12:17 PM, Tom de Vries wrote:
>> Hi,
>>
>> when we compile a function with attributes:
>> ...
>> int __attribute__((noinline, noclone))
>> foo (void)
>> {
>>    return 2;
>> }
>> ...
>>
>> like this:
>> ...
>> gcc main.c -fdump-tree-all -fdump-rtl-all
>> ...
>>
>> we find the function attributes starting from foo.c.004t.gimple:
>> ...
>> __attribute__((noclone, noinline))
>> foo ()
>> {
>>    int D.1961;
>>
>>    D.1961 = 2;
>>    return D.1961;
>> }
>> ...
>> to foo.c.232t.optimized.
>>
>>
>> But we don't find the attributes in the rtl dumps:
>> ...
>> $ grep __attribute__ foo.c.*r.*
>> $
>> ...
>>
>> This patch adds printing of the function attributes in the rtl dump,
>> f.i. foo.c.235r.vregs looks like this :
>> ...
>> ;; Function foo (foo, funcdef_no=0, decl_uid=1958, cgraph_uid=0,
>> symbol_order=0)
>>
>> function foo attributes: __attribute__((noclone, noinline))
>> (note 1 0 3 NOTE_INSN_DELETED)
>> (note 3 1 2 2 [bb 2] NOTE_INSN_BASIC_BLOCK)
>> (note 2 3 5 2 NOTE_INSN_FUNCTION_BEG)
>> (insn 5 2 8 2 (set (reg:SI 87 [ _1 ])
>>          (const_int 2 [0x2])) "foo.c":4 86 {*movsi_internal}
>>       (nil))
>> (insn 8 5 12 2 (set (reg:SI 88 [ <retval> ])
>>          (reg:SI 87 [ _1 ])) "foo.c":4 86 {*movsi_internal}
>>       (nil))
>> (insn 12 8 13 2 (set (reg/i:SI 0 ax)
>>          (reg:SI 88 [ <retval> ])) "foo.c":5 86 {*movsi_internal}
>>       (nil))
>> (insn 13 12 0 2 (use (reg/i:SI 0 ax)) "foo.c":5 -1
>>       (nil))
>> ...
>>
>> I've added the "function foo attributes" prefix because in other rtl
>> dumps there may be quite a number of lines between the ";; Function
>> foo" header and the first insn.
>>
>> OK for stage1 if bootstrap and reg-test on x86 succeeds?
>>
>> Thanks,
>> - Tom
> 
> 
> 0001-Print-function-attributes-in-rtl-dump.patch
> 
> 
> Print function attributes in rtl dump
> 
> 2018-03-29  Tom de Vries  <t...@codesourcery.com>
> 
>       * passes.c (execute_function_dump): Call dump_function_attributes before
>       print_rtl_with_bb.
>       * tree-cfg.c (dump_function_attributes): New function, factored out of
>       ...
>       (dump_function_to_file): ... here.
>       * tree-cfg.h (dump_function_attributes): Declare.
So I think the RTL front-end needs updating to parse the attributes.

With that supported added this will be OK.

Jeff

Reply via email to