Re: Retrieving argument value from __attribute__

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2013/2/26 naga raj <gnuuser.raj@xxxxxxxxx>:
>
> 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..
>
> Ex:
> 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
>    .....
> }
> main()
> {
>    ...
>    ...
>   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,
> Nagaraju

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,
jasonwucj


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux