code generation for passing arguments

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

code generation for passing arguments

shreyas krishnan
Hi
  I find that in some case clang when passing pointer arguments first
stores the arguments to stack location and subsequently accesses these
stack locations.
I only see this happening when there are other global pointers in the
code. Can some one pls let me know whats the rationale behind this?
Also,  can some one point me to clang code where this is done?


thanks
shrey
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: code generation for passing arguments

Douglas Gregor

On Jun 29, 2010, at 10:29 PM, shreyas krishnan wrote:

> Hi
>  I find that in some case clang when passing pointer arguments first
> stores the arguments to stack location and subsequently accesses these
> stack locations.
> I only see this happening when there are other global pointers in the
> code. Can some one pls let me know whats the rationale behind this?

How arguments are passed to functions is dictated by the ABI.

> Also,  can some one point me to clang code where this is done?


Look in Clang's CodeGen library, at ABIInfo and its various implementations that describe how to pass arguments for each target.

        - Doug
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev