Retrieving argument value from __attribute__
Wed Feb 27 11:49:00 GMT 2013
On Wed, Feb 27, 2013 at 9:19 AM, Chung-Ju Wu <email@example.com> wrote:
> 2013/2/26 naga raj <firstname.lastname@example.org>:
>> Is it possible to the compiler to get the information about the
>> attributes when a function is called. so that I can move the attribute
>> value to the temp register at function call itself instead of moving
>> it in the prologue..
>> void matrix_const(int ) __attribute__((svc_handler(777)));
>> matrix_const(int a)
>> ..... -------------------------> Currently with your suggestion
>> I am able to move 777 to temp register at function prologue
>> matrix_const(10); ------> Is it possible to find out about the
>> attributes of calling function matrix_const at this point??
>> What I have observed is that compiler code is using only current
>> function tree information. Does it maintain information about the
>> functions that it is going to call.
>> Does Gcc maintains any information.. Can you please help me in finding
>> the correct tree attribute to understand this.
>> Thanks in Advance,
> At the time when you calculate frame size or generate prologue,
> a tree variable 'current_function_decl' may be helpful to you.
> For example:
> attrs = DECL_ATTRIBUTES (current_function_decl);
> By that, you can save any attribute information of current function in
> particular sections,
> (Certainly you have to traverse and parse tree list by yourself.)
> and then generate some assembly code to access content from the sections.
> There might be a better solution, but so far using particular sections
> is one apporach I can figure out.
> For more information of using tree structure in GCC,
> refer to the 'Chapter 11 GENERIC' of GCC Internals documentation.
> Best regards,
Thanks for the reply. I will dig depper with your inputs.
More information about the Gcc-help