[LLVMdev] Accessing arguments in a caller
Carlo Alberto Ferraris
cafxx at strayorange.com
Mon Aug 22 03:08:45 PDT 2011
Nella citazione lunedì 22 agosto 2011 11:53:29, Duncan Sands ha scritto:
> Hi Carlo, rather than declaring individual stack variables
> int x;
> int y;
> int z;
> and so on, which requires you to pass each one, or a pointer to each one,
> to your function, declare one stack variable of struct type that holds
> them all:
> struct StackObjects {
> int x;
> int y;
> int z;
> ...
> };
> ...
> struct StackObjects stack;
> then pass the address of stack to your function, enabling it to access all
> of the objects on the callers stack. This way you only need to copy a single
> pointer. This is what GCC's nested function implementation does for example to
> enable child functions to access variables on the parent's stack.
Hi Duncan,
this is what I'm already doing (see
http://stackoverflow.com/questions/7144733/argument-forwarding-in-llvm,
the code I posted is in pseudo-C but I'm actually working on LLVM-IR in
my pass) but this in
curs the boxing-unboxing penalty and I was
wondering if there is a way to avoid it.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: cafxx.vcf
Type: text/x-vcard
Size: 230 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110822/72c8d993/attachment.vcf>
More information about the llvm-dev
mailing list