From: Daniel Sanders Date: Sat, 1 Nov 2014 17:44:51 +0000 (+0000) Subject: [mips] Removed MipsCC::fixedArgFn(). NFC X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=commitdiff_plain;h=f814c6418dea9393838cd40935431172cd2448a1 [mips] Removed MipsCC::fixedArgFn(). NFC Summary: There is one remaining trace of it in MipsCC::analyzeCallOperands() where Mips16 might override the calling convention. This will moved into tablegen-erated code later. Depends on D5965 Reviewers: vmedic Reviewed By: vmedic Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D5966 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@221053 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Target/Mips/MipsISelLowering.cpp b/lib/Target/Mips/MipsISelLowering.cpp index 0b258b718e5..b61b74dfb68 100644 --- a/lib/Target/Mips/MipsISelLowering.cpp +++ b/lib/Target/Mips/MipsISelLowering.cpp @@ -2548,9 +2548,7 @@ MipsTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI, SmallVector ArgLocs; CCState CCInfo(CallConv, IsVarArg, DAG.getMachineFunction(), ArgLocs, *DAG.getContext()); - MipsCC::SpecialCallingConvType SpecialCallingConv = - getSpecialCallingConv(Callee); - MipsCC MipsCCInfo(CallConv, Subtarget, CCInfo, SpecialCallingConv); + MipsCC MipsCCInfo(CallConv, Subtarget, CCInfo); MipsCCInfo.analyzeCallOperands(Outs, IsVarArg, Subtarget.abiUsesSoftFloat(), @@ -3515,11 +3513,12 @@ static bool originalTypeIsF128(const Type *Ty, const SDNode *CallNode) { } MipsTargetLowering::MipsCC::SpecialCallingConvType - MipsTargetLowering::getSpecialCallingConv(SDValue Callee) const { +MipsTargetLowering::MipsCC::getSpecialCallingConv(const SDNode *Callee) const { MipsCC::SpecialCallingConvType SpecialCallingConv = MipsCC::NoSpecialCallingConv; if (Subtarget.inMips16HardFloat()) { - if (GlobalAddressSDNode *G = dyn_cast(Callee)) { + if (const GlobalAddressSDNode *G = + dyn_cast(Callee)) { llvm::StringRef Sym = G->getGlobal()->getName(); Function *F = G->getGlobal()->getParent()->getFunction(Sym); if (F && F->hasFnAttribute("__Mips16RetHelper")) { @@ -3530,11 +3529,10 @@ MipsTargetLowering::MipsCC::SpecialCallingConvType return SpecialCallingConv; } -MipsTargetLowering::MipsCC::MipsCC( - CallingConv::ID CC, const MipsSubtarget &Subtarget_, CCState &Info, - MipsCC::SpecialCallingConvType SpecialCallingConv_) - : CCInfo(Info), CallConv(CC), Subtarget(Subtarget_), - SpecialCallingConv(SpecialCallingConv_) { +MipsTargetLowering::MipsCC::MipsCC(CallingConv::ID CC, + const MipsSubtarget &Subtarget_, + CCState &Info) + : CCInfo(Info), CallConv(CC), Subtarget(Subtarget_) { // Pre-allocate reserved argument area. CCInfo.AllocateStack(reservedArgArea(), 1); } @@ -3544,11 +3542,16 @@ void MipsTargetLowering::MipsCC:: analyzeCallOperands(const SmallVectorImpl &Args, bool IsVarArg, bool IsSoftFloat, const SDNode *CallNode, std::vector &FuncArgs) { + MipsCC::SpecialCallingConvType SpecialCallingConv = + getSpecialCallingConv(CallNode); assert((CallConv != CallingConv::Fast || !IsVarArg) && "CallingConv::Fast shouldn't be used for vararg functions."); unsigned NumOpnds = Args.size(); - llvm::CCAssignFn *FixedFn = fixedArgFn(); + llvm::CCAssignFn *FixedFn = CC_Mips_FixedArg; + if (CallConv != CallingConv::Fast && + SpecialCallingConv == Mips16RetHelperConv) + FixedFn = CC_Mips16RetHelper; for (unsigned I = 0; I != NumOpnds; ++I) { MVT ArgVT = Args[I].VT; @@ -3582,7 +3585,6 @@ void MipsTargetLowering::MipsCC:: analyzeFormalArguments(const SmallVectorImpl &Args, bool IsSoftFloat, Function::const_arg_iterator FuncArg) { unsigned NumArgs = Args.size(); - llvm::CCAssignFn *FixedFn = fixedArgFn(); unsigned CurArgIdx = 0; for (unsigned I = 0; I != NumArgs; ++I) { @@ -3598,7 +3600,7 @@ analyzeFormalArguments(const SmallVectorImpl &Args, MVT RegVT = getRegVT(ArgVT, FuncArg->getType(), nullptr, IsSoftFloat); - if (!FixedFn(I, ArgVT, RegVT, CCValAssign::Full, ArgFlags, CCInfo)) + if (!CC_Mips_FixedArg(I, ArgVT, RegVT, CCValAssign::Full, ArgFlags, CCInfo)) continue; #ifndef NDEBUG @@ -3643,14 +3645,6 @@ const ArrayRef MipsTargetLowering::MipsCC::intArgRegs() const { return makeArrayRef(Mips64IntRegs); } -llvm::CCAssignFn *MipsTargetLowering::MipsCC::fixedArgFn() const { - if (CallConv != CallingConv::Fast && - SpecialCallingConv == Mips16RetHelperConv) - return CC_Mips16RetHelper; - - return CC_Mips_FixedArg; -} - const MCPhysReg *MipsTargetLowering::MipsCC::shadowRegs() const { return Subtarget.isABI_O32() ? O32IntRegs : Mips64DPRegs; } diff --git a/lib/Target/Mips/MipsISelLowering.h b/lib/Target/Mips/MipsISelLowering.h index d9e490d7dbd..a35946dac3c 100644 --- a/lib/Target/Mips/MipsISelLowering.h +++ b/lib/Target/Mips/MipsISelLowering.h @@ -357,8 +357,7 @@ namespace llvm { }; MipsCC(CallingConv::ID CallConv, const MipsSubtarget &Subtarget, - CCState &Info, - SpecialCallingConvType SpecialCallingConv = NoSpecialCallingConv); + CCState &Info); void analyzeCallOperands(const SmallVectorImpl &Outs, bool IsVarArg, bool IsSoftFloat, @@ -393,9 +392,6 @@ namespace llvm { /// use of registers to pass byval arguments. bool useRegsForByval() const { return CallConv != CallingConv::Fast; } - /// Return the function that analyzes fixed argument list functions. - llvm::CCAssignFn *fixedArgFn() const; - const MCPhysReg *shadowRegs() const; void allocateRegs(ByValArgInfo &ByVal, unsigned ByValSize, @@ -412,10 +408,11 @@ namespace llvm { void analyzeReturn(const SmallVectorImpl &RetVals, bool IsSoftFloat, const SDNode *CallNode, const Type *RetTy) const; + SpecialCallingConvType getSpecialCallingConv(const SDNode *Callee) const; + CCState &CCInfo; CallingConv::ID CallConv; const MipsSubtarget &Subtarget; - SpecialCallingConvType SpecialCallingConv; SmallVector ByValArgs; }; protected: @@ -446,8 +443,6 @@ namespace llvm { SDValue getTargetNode(ConstantPoolSDNode *N, EVT Ty, SelectionDAG &DAG, unsigned Flag) const; - MipsCC::SpecialCallingConvType getSpecialCallingConv(SDValue Callee) const; - // Lower Operand helpers SDValue LowerCallResult(SDValue Chain, SDValue InFlag, CallingConv::ID CallConv, bool isVarArg,