Lauro Ramos Venancio
2007-Feb-08 18:46 UTC
[LLVMdev] problem with function arguments in ARM EABI
I'm facing a problem with functions arguments. ARM EABI defines that 8-bytes arguments must be 8-bytes aligned. For example: void @f(i32 %a, i64 %b) ARM EABI: r0 <- %a r2,r3 <- %b Darwin: r0 <- %a r1,r2 <- %b void @g(i32 %a, i32 %b, i32 %c) ARM EABI or Darwin: r0 <- %a r1 <- %b r2 <- %c The problem is: I can't differ a i64 argument of two i32 arguments in ISD::CALL (ARM doesn't have i64 registers). The function TargetLowering::LowerCallTo transforms all i64 arguments in two i32 arguments. A possible solution is override TargetLowering::LowerCallTo and do not expand i64 arguments. I don't know if it's a good solution. None backend overrides this function. Any ideas? Lauro
On Feb 8, 2007, at 10:46 AM, Lauro Ramos Venancio wrote:> I'm facing a problem with functions arguments. ARM EABI defines that > 8-bytes arguments must be 8-bytes aligned. For example: > > void @f(i32 %a, i64 %b) > > ARM EABI: > r0 <- %a > r2,r3 <- %bOk. I suppose this makes it easier to use 64 bit store instructions.> > Darwin: > r0 <- %a > r1,r2 <- %b > > void @g(i32 %a, i32 %b, i32 %c) > > ARM EABI or Darwin: > r0 <- %a > r1 <- %b > r2 <- %c > > The problem is: I can't differ a i64 argument of two i32 arguments in > ISD::CALL (ARM doesn't have i64 registers). The function > TargetLowering::LowerCallTo transforms all i64 arguments in two i32 > arguments. > > A possible solution is override TargetLowering::LowerCallTo and do not > expand i64 arguments. I don't know if it's a good solution. None > backend overrides this function.Yes, you need to override both LowerArguments and LowerCallTo. All of the current targets / abi's use the default implementation in SelectionDAGISel.cpp But I guess ARM EABI will be the first. :-) As far as I can see, this is the only clean way to do it. I expect the ARM EABI specific implementation will be quite a bit simpler than the default implementation though. Evan> > Any ideas? > > Lauro > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Lauro Ramos Venancio
2007-Feb-09 21:57 UTC
[LLVMdev] problem with function arguments in ARM EABI
> > Yes, you need to override both LowerArguments and LowerCallTo. All of > the current targets / abi's use the default implementation in > SelectionDAGISel.cpp But I guess ARM EABI will be the first. :-) As > far as I can see, this is the only clean way to do it. I expect the > ARM EABI specific implementation will be quite a bit simpler than the > default implementation though. >If I override these functions, I would copy a lot of code and change only few lines. I found another solution: adding two items to arguments Flags. Flags[27:24] = number of pieces that an argument was expanded. Flags[31:28] = sequential piece ID. What do you think? May I add these items? Lauro