Lauro Ramos Venancio
2007-Feb-26 14:41 UTC
[LLVMdev] another problem with function arguments aligment
The ARM EABI (AAPCS) defines: - i64 values are 8-bytes aligned - "The alignment of an aggregate shall be the alignment of its most-aligned component." So, struct ss { int x; int y; }; void f(int a, struct ss b); r0 <- a r1-r2 <- b void g(int a, long long b); r0 <- a r2-r3 <- b The problem is: llvm-gcc generates the same bytecode for both functions: declare void @f(i32, i64) declare void @g(i32, i64) I can't differ an i64 argument from a struct argument. Lauro
Evan Cheng
2007-Feb-26 18:02 UTC
[LLVMdev] another problem with function arguments aligment
This is a known deficiency of llvm which we haven't had time to deal with. At llvm level, function arguments are lowered to integer types so some of these type information are lost. I think adding a short term workaround is possible until we fix this "the right way". It involves adding the alignment information to ParameterAttributes. This will involve llvm language level and llvm- gcc changes. Evan On Feb 26, 2007, at 6:41 AM, Lauro Ramos Venancio wrote:> The ARM EABI (AAPCS) defines: > - i64 values are 8-bytes aligned > - "The alignment of an aggregate shall be the alignment of its > most-aligned component." > > So, > > struct ss { > int x; > int y; > }; > > void f(int a, struct ss b); > r0 <- a > r1-r2 <- b > > void g(int a, long long b); > r0 <- a > r2-r3 <- b > > The problem is: llvm-gcc generates the same bytecode for both > functions: > > declare void @f(i32, i64) > declare void @g(i32, i64) > > I can't differ an i64 argument from a struct argument. > > > Lauro > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Chris Lattner
2007-Feb-26 19:53 UTC
[LLVMdev] another problem with function arguments aligment
On Mon, 26 Feb 2007, Lauro Ramos Venancio wrote:> The problem is: llvm-gcc generates the same bytecode for both functions: > > declare void @f(i32, i64) > declare void @g(i32, i64) > > I can't differ an i64 argument from a struct argument.Oops. You can fix this by changing llvm-gcc: gcc/llvm-abi.h Grep for instances of Int64Ty there. I can help answer any q's you might have. -Chris -- http://nondot.org/sabre/ http://llvm.org/
Lauro Ramos Venancio
2007-Feb-27 19:02 UTC
[LLVMdev] another problem with function arguments aligment
I think, we must move function arguments lowering from frontend to LLVM core. This lowering is generating machine dependent bytecode. See http://llvm.org/bugs/show_bug.cgi?id=1230 Lauro 2007/2/26, Chris Lattner <sabre at nondot.org>:> On Mon, 26 Feb 2007, Lauro Ramos Venancio wrote: > > The problem is: llvm-gcc generates the same bytecode for both functions: > > > > declare void @f(i32, i64) > > declare void @g(i32, i64) > > > > I can't differ an i64 argument from a struct argument. > > Oops. You can fix this by changing llvm-gcc: gcc/llvm-abi.h > > Grep for instances of Int64Ty there. I can help answer any q's you might > have. > > -Chris > > -- > http://nondot.org/sabre/ > http://llvm.org/ > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Seemingly Similar Threads
- [LLVMdev] another problem with function arguments aligment
- [LLVMdev] another problem with function arguments aligment
- [LLVMdev] [patch] arm: external weak in constant pool
- [LLVMdev] [patch] arm: external weak in constant pool
- [LLVMdev] problem with function arguments in ARM EABI