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

Rafael Espindola espindola at google.com
Fri Aug 3 09:22:21 PDT 2007


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.

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: llvm.patch
Type: text/x-patch
Size: 5384 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20070803/0c3d4e6a/attachment.bin>


More information about the llvm-commits mailing list