[llvm-commits] [llvm-gcc][arm][patch] Lower function signatures a bit more
Rafael Espindola
espindola at google.com
Wed Sep 8 23:01:57 PDT 2010
With the recent improvements Chris did to the optimization of shifts I
thought that an old patch I wrote for PR6059 might have gained some
extra usefulness. The patch lowers the function signatures a bit more
so that it is explicit in the IL that the arguments are being split
into 32 bit chunks. For example, the C code
-------------------------------------------------
struct foo {double a; int b;};
void f(int, struct foo);
void g(int a, double b, int c) {
struct foo x = {b, c};
f(a, x);
}
-------------------------------------------------
Is currently lowered to
--------------------------------
define void @g(i32 %a, double %b, i32 %c) nounwind optsize {
entry:
%tmp11 = bitcast double %b to i64
%tmp5 = zext i32 %c to i64
tail call void @f(i32 %a, i64 %tmp11, i64 %tmp5) nounwind
ret void
}
declare void @f(i32, i64, i64)
------------------------------
And with the patch it is lowered to
--------------------------------------------------------------------------------
define void @g(i32 %a.0, i32, i32 %b.0, i32 %b.1, i32 %c.0) nounwind optsize {
entry:
tail call void @f(i32 %a.0, i32 undef, i32 %b.0, i32 %b.1, i32 %c.0,
i32 0) nounwind
ret void
}
declare void @f(i32, i32, i32, i32, i32, i32)
-----------------------------------------------------------------------------------
I tested with Debian's gcc 4.3.2 compatibility test suite:
make ALT_CC_UNDER_TEST=/home/espindola/llvm-gcc-inst/bin/llvm-gcc
check-gcc RUNTESTFLAGS="compat.exp"
I understand if there is not a lot of interest in optimizing llvm-gcc.
I will just try to remember to to check what clang does when I get the
time to work with it.
Cheers,
--
Rafael Ávila de Espíndola
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr6059.patch
Type: text/x-patch
Size: 9810 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100909/b23031d8/attachment.bin>
More information about the llvm-commits
mailing list