[llvm-commits] CVS: llvm/lib/Target/ARM/ARMISelLowering.cpp ARMTargetMachine.cpp
Evan Cheng
evan.cheng at apple.com
Tue Feb 13 09:20:41 PST 2007
Hi Lauro,
This is wrong for Mac OS X. Please back out the patch until it is
fixed. Make sure you conditionalize base on the ABI of choice
Please add an ABI enum ABIType to ARMSubtarget.h and the
corresponding methods. Looking at llvm-gcc/gcc/config/arm/arm.h, I
see there are 5 ARM abi's:
ARM_ABI_APCS,
ARM_ABI_ATPCS,
ARM_ABI_AAPCS,
ARM_ABI_IWMMXT,
ARM_ABI_AAPCS_LINUX
The default is ARM_ABI_APCS, I suppose ARM EABI is ARM_ABI_AAPCS_LINUX?
Thanks,
Evan
On Feb 13, 2007, at 6:07 AM, Lauro Ramos Venancio wrote:
>
>
> Changes in directory llvm/lib/Target/ARM:
>
> ARMISelLowering.cpp updated: 1.13 -> 1.14
> ARMTargetMachine.cpp updated: 1.20 -> 1.21
> ---
> Log message:
>
> According to ARM EABI, 8-bytes function arguments must be 8-bytes
> aligned.
>
>
> ---
> Diffs of the changes: (+53 -30)
>
> ARMISelLowering.cpp | 79 +++++++++++++++++++++++++++++++
> +-------------------
> ARMTargetMachine.cpp | 4 +-
> 2 files changed, 53 insertions(+), 30 deletions(-)
>
>
> Index: llvm/lib/Target/ARM/ARMISelLowering.cpp
> diff -u llvm/lib/Target/ARM/ARMISelLowering.cpp:1.13 llvm/lib/
> Target/ARM/ARMISelLowering.cpp:1.14
> --- llvm/lib/Target/ARM/ARMISelLowering.cpp:1.13 Sat Feb 3
> 02:53:01 2007
> +++ llvm/lib/Target/ARM/ARMISelLowering.cpp Tue Feb 13 08:07:13 2007
> @@ -338,29 +338,36 @@
> }
>
> static void
> -HowToPassArgument(MVT::ValueType ObjectVT,
> - unsigned NumGPRs, unsigned &ObjSize, unsigned
> &ObjGPRs) {
> - ObjSize = 0;
> - ObjGPRs = 0;
> -
> +HowToPassArgument(MVT::ValueType ObjectVT, unsigned NumGPRs,
> + unsigned StackOffset, unsigned &NeededGPRs,
> + unsigned &NeededStackSize, unsigned &GPRPad,
> + unsigned &StackPad, unsigned Flags) {
> + NeededStackSize = 0;
> + NeededGPRs = 0;
> + StackPad = 0;
> + GPRPad = 0;
> + unsigned align = (Flags >> 27);
> + GPRPad = NumGPRs % ((align + 3)/4);
> + StackPad = StackOffset % align;
> + unsigned firstGPR = NumGPRs + GPRPad;
> switch (ObjectVT) {
> default: assert(0 && "Unhandled argument type!");
> case MVT::i32:
> case MVT::f32:
> - if (NumGPRs < 4)
> - ObjGPRs = 1;
> + if (firstGPR < 4)
> + NeededGPRs = 1;
> else
> - ObjSize = 4;
> + NeededStackSize = 4;
> break;
> case MVT::i64:
> case MVT::f64:
> - if (NumGPRs < 3)
> - ObjGPRs = 2;
> - else if (NumGPRs == 3) {
> - ObjGPRs = 1;
> - ObjSize = 4;
> + if (firstGPR < 3)
> + NeededGPRs = 2;
> + else if (firstGPR == 3) {
> + NeededGPRs = 1;
> + NeededStackSize = 4;
> } else
> - ObjSize = 8;
> + NeededStackSize = 8;
> }
> }
>
> @@ -383,12 +390,16 @@
>
> // Add up all the space actually used.
> for (unsigned i = 0; i < NumOps; ++i) {
> - unsigned ObjSize = 0;
> - unsigned ObjGPRs = 0;
> + unsigned ObjSize;
> + unsigned ObjGPRs;
> + unsigned StackPad;
> + unsigned GPRPad;
> MVT::ValueType ObjectVT = Op.getOperand(5+2*i).getValueType();
> - HowToPassArgument(ObjectVT, NumGPRs, ObjSize, ObjGPRs);
> - NumBytes += ObjSize;
> - NumGPRs += ObjGPRs;
> + unsigned Flags = Op.getConstantOperandVal(5+2*i+1);
> + HowToPassArgument(ObjectVT, NumGPRs, NumBytes, ObjGPRs, ObjSize,
> + GPRPad, StackPad, Flags);
> + NumBytes += ObjSize + StackPad;
> + NumGPRs += ObjGPRs + GPRPad;
> }
>
> // Adjust the stack pointer for the new arguments...
> @@ -407,18 +418,24 @@
> std::vector<SDOperand> MemOpChains;
> for (unsigned i = 0; i != NumOps; ++i) {
> SDOperand Arg = Op.getOperand(5+2*i);
> + unsigned Flags = Op.getConstantOperandVal(5+2*i+1);
> MVT::ValueType ArgVT = Arg.getValueType();
>
> - unsigned ObjSize = 0;
> - unsigned ObjGPRs = 0;
> - HowToPassArgument(ArgVT, NumGPRs, ObjSize, ObjGPRs);
> + unsigned ObjSize;
> + unsigned ObjGPRs;
> + unsigned GPRPad;
> + unsigned StackPad;
> + HowToPassArgument(ArgVT, NumGPRs, ArgOffset, ObjGPRs,
> + ObjSize, GPRPad, StackPad, Flags);
> + NumGPRs += GPRPad;
> + ArgOffset += StackPad;
> if (ObjGPRs > 0) {
> switch (ArgVT) {
> default: assert(0 && "Unexpected ValueType for argument!");
> case MVT::i32:
> RegsToPass.push_back(std::make_pair(GPRArgRegs[NumGPRs],
> Arg));
> break;
> - case MVT::f32:
> + case MVT::f32:
> RegsToPass.push_back(std::make_pair(GPRArgRegs[NumGPRs],
> DAG.getNode(ISD::BIT_CONVERT,
> MVT::i32, Arg)));
> break;
> @@ -436,7 +453,7 @@
> MemOpChains.push_back(DAG.getStore(Chain, Hi, PtrOff,
> NULL, 0));
> }
> break;
> - }
> + }
> case MVT::f64: {
> SDOperand Cvt = DAG.getNode(ARMISD::FMRRD,
> DAG.getVTList(MVT::i32,
> MVT::i32),
> @@ -715,7 +732,7 @@
> }
>
> static SDOperand LowerFORMAL_ARGUMENT(SDOperand Op, SelectionDAG
> &DAG,
> - unsigned *vRegs, unsigned ArgNo,
> + unsigned *vRegs, unsigned
> ArgNo,
> unsigned &NumGPRs, unsigned
> &ArgOffset) {
> MachineFunction &MF = DAG.getMachineFunction();
> MVT::ValueType ObjectVT = Op.getValue(ArgNo).getValueType();
> @@ -727,9 +744,15 @@
> ARM::R0, ARM::R1, ARM::R2, ARM::R3
> };
>
> - unsigned ObjSize = 0;
> - unsigned ObjGPRs = 0;
> - HowToPassArgument(ObjectVT, NumGPRs, ObjSize, ObjGPRs);
> + unsigned ObjSize;
> + unsigned ObjGPRs;
> + unsigned GPRPad;
> + unsigned StackPad;
> + unsigned Flags = Op.getConstantOperandVal(ArgNo + 3);
> + HowToPassArgument(ObjectVT, NumGPRs, ArgOffset, ObjGPRs,
> + ObjSize, GPRPad, StackPad, Flags);
> + NumGPRs += GPRPad;
> + ArgOffset += StackPad;
>
> SDOperand ArgValue;
> if (ObjGPRs == 1) {
>
>
> Index: llvm/lib/Target/ARM/ARMTargetMachine.cpp
> diff -u llvm/lib/Target/ARM/ARMTargetMachine.cpp:1.20 llvm/lib/
> Target/ARM/ARMTargetMachine.cpp:1.21
> --- llvm/lib/Target/ARM/ARMTargetMachine.cpp:1.20 Wed Jan 31
> 20:18:36 2007
> +++ llvm/lib/Target/ARM/ARMTargetMachine.cpp Tue Feb 13 08:07:13 2007
> @@ -39,8 +39,8 @@
> std::string("e-p:32:32-d:32:32-l:32:32-s:16:32-b:8:32-B:
> 8:32-A:32") :
> std::string("e-p:32:32-d:32:32-l:32:32")) :
> (Subtarget.isThumb() ?
> - std::string("e-p:32:32-d:32:64-l:32:64-s:16:32-b:8:32-B:
> 8:32-A:32") :
> - std::string("e-p:32:32-d:32:64-l:32:64"))),
> + std::string("e-p:32:32-d:32:64-l:64:64-s:16:32-b:8:32-B:
> 8:32-A:32") :
> + std::string("e-p:32:32-d:32:64-l:64:64"))),
> InstrInfo(Subtarget),
> FrameInfo(Subtarget) {}
>
>
>
>
> _______________________________________________
> 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