[llvm-commits] [PATCH] partial codgen support for ByVal arguments

Chris Lattner clattner at apple.com
Fri Aug 3 13:53:11 PDT 2007


On Aug 3, 2007, at 9:22 AM, Rafael Espindola wrote:

> The attached patch implements code generation of byval arguments on
> the callee. For now only the case were the struct is in the stack is
> handle correctly.

I think this patch is looking very good.  As it can only affect  
things marked 'byval', please feel free to commit what you have.

As a next step, it would be good to implement passing of a struct  
into a call by-val.

-Chris

> With the patch, the function
> ---------------------------------------------------
> %struct.s = type { i64, i64, i64 }
>
> define i64 @f(%struct.s* byval %a) {
> entry:
>         %tmp2 = getelementptr %struct.s* %a, i32 0, i32 0]
>         %tmp3 = load i64* %tmp2
>         ret i64 %tmp3
> }
> ------------------------
> Correctly compiles to
>
> f:
>         movq    8(%rsp), %rax
>         ret
>
> There is still a lot to implement and debug, but I would like to know
> any comments one might have.
>
> Cheers,
> -- 
> Rafael Avila de Espindola
>
> Google Ireland Ltd.
> Gordon House
> Barrow Street
> Dublin 4
> Ireland
>
> Registered in Dublin, Ireland
> Registration Number: 368047
> <llvm.patch>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list