[llvm-branch-commits] [llvm-branch] r223063 - Merged from r221528:

Daniel Sanders daniel.sanders at imgtec.com
Mon Dec 1 10:57:45 PST 2014


Author: dsanders
Date: Mon Dec  1 12:57:45 2014
New Revision: 223063

URL: http://llvm.org/viewvc/llvm-project?rev=223063&view=rev
Log:
Merged from r221528:

[mips] Remove MipsCC::reservedArgArea() in favour of MipsABIInfo::GetCalleeAllocdArgSizeInBytes(). NFC.

Summary:

Reviewers: theraven, vmedic

Reviewed By: vmedic

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D6115



Modified:
    llvm/branches/release_35/lib/Target/Mips/MipsABIInfo.cpp
    llvm/branches/release_35/lib/Target/Mips/MipsABIInfo.h
    llvm/branches/release_35/lib/Target/Mips/MipsISelLowering.cpp
    llvm/branches/release_35/lib/Target/Mips/MipsISelLowering.h

Modified: llvm/branches/release_35/lib/Target/Mips/MipsABIInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_35/lib/Target/Mips/MipsABIInfo.cpp?rev=223063&r1=223062&r2=223063&view=diff
==============================================================================
--- llvm/branches/release_35/lib/Target/Mips/MipsABIInfo.cpp (original)
+++ llvm/branches/release_35/lib/Target/Mips/MipsABIInfo.cpp Mon Dec  1 12:57:45 2014
@@ -35,3 +35,11 @@ const ArrayRef<MCPhysReg> MipsABIInfo::G
     return makeArrayRef(Mips64IntRegs);
   llvm_unreachable("Unhandled ABI");
 }
+
+unsigned MipsABIInfo::GetCalleeAllocdArgSizeInBytes(CallingConv::ID CC) const {
+  if (IsO32())
+    return CC != CallingConv::Fast ? 16 : 0;
+  if (IsN32() || IsN64() || IsEABI())
+    return 0;
+  llvm_unreachable("Unhandled ABI");
+}

Modified: llvm/branches/release_35/lib/Target/Mips/MipsABIInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_35/lib/Target/Mips/MipsABIInfo.h?rev=223063&r1=223062&r2=223063&view=diff
==============================================================================
--- llvm/branches/release_35/lib/Target/Mips/MipsABIInfo.h (original)
+++ llvm/branches/release_35/lib/Target/Mips/MipsABIInfo.h Mon Dec  1 12:57:45 2014
@@ -12,6 +12,7 @@
 
 #include "llvm/ADT/ArrayRef.h"
 #include "llvm/MC/MCRegisterInfo.h"
+#include "llvm/IR/CallingConv.h"
 
 namespace llvm {
 
@@ -44,6 +45,10 @@ public:
   /// The registers to use for the variable argument list.
   const ArrayRef<MCPhysReg> GetVarArgRegs() const;
 
+  /// Obtain the size of the area allocated by the callee for arguments.
+  /// CallingConv::FastCall affects the value for O32.
+  unsigned GetCalleeAllocdArgSizeInBytes(CallingConv::ID CC) const;
+
   /// Ordering of ABI's
   /// MipsGenSubtargetInfo.inc will use this to resolve conflicts when given
   /// multiple ABI options.

Modified: llvm/branches/release_35/lib/Target/Mips/MipsISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_35/lib/Target/Mips/MipsISelLowering.cpp?rev=223063&r1=223062&r2=223063&view=diff
==============================================================================
--- llvm/branches/release_35/lib/Target/Mips/MipsISelLowering.cpp (original)
+++ llvm/branches/release_35/lib/Target/Mips/MipsISelLowering.cpp Mon Dec  1 12:57:45 2014
@@ -2780,7 +2780,7 @@ MipsTargetLowering::LowerFormalArguments
              "ByVal args of size 0 should have been ignored by front-end.");
       assert(ByValIdx < CCInfo.getInRegsParamsCount());
       copyByValRegs(Chain, DL, OutChains, DAG, Flags, InVals, &*FuncArg,
-                    MipsCCInfo, FirstByValReg, LastByValReg, VA);
+                    MipsCCInfo, FirstByValReg, LastByValReg, VA, CCInfo);
       CCInfo.nextInRegsParam();
       continue;
     }
@@ -3404,18 +3404,14 @@ MipsTargetLowering::MipsCC::MipsCC(Calli
                                    CCState &Info)
     : CallConv(CC), Subtarget(Subtarget_) {
   // Pre-allocate reserved argument area.
-  Info.AllocateStack(reservedArgArea(), 1);
-}
-
-unsigned MipsTargetLowering::MipsCC::reservedArgArea() const {
-  return (Subtarget.isABI_O32() && (CallConv != CallingConv::Fast)) ? 16 : 0;
+  Info.AllocateStack(Subtarget.getABI().GetCalleeAllocdArgSizeInBytes(CC), 1);
 }
 
 void MipsTargetLowering::copyByValRegs(
     SDValue Chain, SDLoc DL, std::vector<SDValue> &OutChains, SelectionDAG &DAG,
     const ISD::ArgFlagsTy &Flags, SmallVectorImpl<SDValue> &InVals,
     const Argument *FuncArg, const MipsCC &CC, unsigned FirstReg,
-    unsigned LastReg, const CCValAssign &VA) const {
+    unsigned LastReg, const CCValAssign &VA, MipsCCState &State) const {
   MachineFunction &MF = DAG.getMachineFunction();
   MachineFrameInfo *MFI = MF.getFrameInfo();
   unsigned GPRSizeInBytes = Subtarget.getGPRSizeInBytes();
@@ -3423,11 +3419,13 @@ void MipsTargetLowering::copyByValRegs(
   unsigned RegAreaSize = NumRegs * GPRSizeInBytes;
   unsigned FrameObjSize = std::max(Flags.getByValSize(), RegAreaSize);
   int FrameObjOffset;
-  ArrayRef<MCPhysReg> ByValArgRegs = Subtarget.getABI().GetByValArgRegs();
+  const MipsABIInfo &ABI = Subtarget.getABI();
+  ArrayRef<MCPhysReg> ByValArgRegs = ABI.GetByValArgRegs();
 
   if (RegAreaSize)
-    FrameObjOffset = (int)CC.reservedArgArea() -
-                     (int)((ByValArgRegs.size() - FirstReg) * GPRSizeInBytes);
+    FrameObjOffset =
+        (int)ABI.GetCalleeAllocdArgSizeInBytes(State.getCallingConv()) -
+        (int)((ByValArgRegs.size() - FirstReg) * GPRSizeInBytes);
   else
     FrameObjOffset = VA.getLocMemOffset();
 
@@ -3570,9 +3568,12 @@ void MipsTargetLowering::writeVarArgRegs
   if (ArgRegs.size() == Idx)
     VaArgOffset =
         RoundUpToAlignment(State.getNextStackOffset(), RegSizeInBytes);
-  else
-    VaArgOffset = (int)CC.reservedArgArea() -
-                  (int)(RegSizeInBytes * (ArgRegs.size() - Idx));
+  else {
+    const MipsABIInfo &ABI = Subtarget.getABI();
+    VaArgOffset =
+        (int)ABI.GetCalleeAllocdArgSizeInBytes(State.getCallingConv()) -
+        (int)(RegSizeInBytes * (ArgRegs.size() - Idx));
+  }
 
   // Record the frame index of the first variable argument
   // which is a value necessary to VASTART.

Modified: llvm/branches/release_35/lib/Target/Mips/MipsISelLowering.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/release_35/lib/Target/Mips/MipsISelLowering.h?rev=223063&r1=223062&r2=223063&view=diff
==============================================================================
--- llvm/branches/release_35/lib/Target/Mips/MipsISelLowering.h (original)
+++ llvm/branches/release_35/lib/Target/Mips/MipsISelLowering.h Mon Dec  1 12:57:45 2014
@@ -210,6 +210,7 @@ namespace llvm {
   //===--------------------------------------------------------------------===//
   class MipsFunctionInfo;
   class MipsSubtarget;
+  class MipsCCState;
 
   class MipsTargetLowering : public TargetLowering  {
     bool isMicroMips;
@@ -347,10 +348,6 @@ namespace llvm {
       MipsCC(CallingConv::ID CallConv, const MipsSubtarget &Subtarget,
              CCState &Info);
 
-      /// reservedArgArea - The size of the area the caller reserves for
-      /// register arguments. This is 16-byte if ABI is O32.
-      unsigned reservedArgArea() const;
-
     private:
       CallingConv::ID CallConv;
       const MipsSubtarget &Subtarget;
@@ -430,7 +427,7 @@ namespace llvm {
                        SmallVectorImpl<SDValue> &InVals,
                        const Argument *FuncArg, const MipsCC &CC,
                        unsigned FirstReg, unsigned LastReg,
-                       const CCValAssign &VA) const;
+                       const CCValAssign &VA, MipsCCState &State) const;
 
     /// passByValArg - Pass a byval argument in registers or on stack.
     void passByValArg(SDValue Chain, SDLoc DL,





More information about the llvm-branch-commits mailing list