mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 20:32:21 +00:00
Merged from r221518:
[mips] Remove MipsCC::analyzeCallOperands in favour of CCState::AnalyzeCallOperands. NFC Summary: In addition to the usual f128 workaround, it was also necessary to provide a means of accessing ArgListEntry::IsFixed. Reviewers: theraven, vmedic Reviewed By: vmedic Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D6111 git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_35@223048 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8283cd9f05
commit
d2e0bdc3ff
@ -67,6 +67,9 @@ class CCIfSplit<CCAction A> : CCIf<"ArgFlags.isSplit()", A> {}
|
|||||||
/// the specified action.
|
/// the specified action.
|
||||||
class CCIfSRet<CCAction A> : CCIf<"ArgFlags.isSRet()", A> {}
|
class CCIfSRet<CCAction A> : CCIf<"ArgFlags.isSRet()", A> {}
|
||||||
|
|
||||||
|
/// CCIfVarArg - If the current function is vararg - apply the action
|
||||||
|
class CCIfVarArg<CCAction A> : CCIf<"State.isVarArg()", A> {}
|
||||||
|
|
||||||
/// CCIfNotVarArg - If the current function is not vararg - apply the action
|
/// CCIfNotVarArg - If the current function is not vararg - apply the action
|
||||||
class CCIfNotVarArg<CCAction A> : CCIf<"!State.isVarArg()", A> {}
|
class CCIfNotVarArg<CCAction A> : CCIf<"!State.isVarArg()", A> {}
|
||||||
|
|
||||||
|
@ -343,6 +343,13 @@ def CC_Mips_VarArg : CallingConv<[
|
|||||||
CCDelegateTo<CC_MipsN_VarArg>
|
CCDelegateTo<CC_MipsN_VarArg>
|
||||||
]>;
|
]>;
|
||||||
|
|
||||||
|
def CC_Mips : CallingConv<[
|
||||||
|
CCIfVarArg<
|
||||||
|
CCIf<"!static_cast<MipsCCState *>(&State)->IsCallOperandFixed(ValNo)",
|
||||||
|
CCDelegateTo<CC_Mips_VarArg>>>,
|
||||||
|
CCDelegateTo<CC_Mips_FixedArg>
|
||||||
|
]>;
|
||||||
|
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
// Callee-saved register lists.
|
// Callee-saved register lists.
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
@ -117,12 +117,15 @@ private:
|
|||||||
|
|
||||||
/// Identify lowered values that originated from f128 arguments and record
|
/// Identify lowered values that originated from f128 arguments and record
|
||||||
/// this.
|
/// this.
|
||||||
void PreAnalyzeCallOperandsForF128(
|
void PreAnalyzeCallOperands(
|
||||||
const SmallVectorImpl<ISD::OutputArg> &Outs,
|
const SmallVectorImpl<ISD::OutputArg> &Outs,
|
||||||
std::vector<TargetLowering::ArgListEntry> &FuncArgs, SDNode *CallNode) {
|
std::vector<TargetLowering::ArgListEntry> &FuncArgs,
|
||||||
for (unsigned i = 0; i < Outs.size(); ++i)
|
const SDNode *CallNode) {
|
||||||
|
for (unsigned i = 0; i < Outs.size(); ++i) {
|
||||||
OriginalArgWasF128.push_back(
|
OriginalArgWasF128.push_back(
|
||||||
originalTypeIsF128(FuncArgs[Outs[i].OrigArgIndex].Ty, CallNode));
|
originalTypeIsF128(FuncArgs[Outs[i].OrigArgIndex].Ty, CallNode));
|
||||||
|
CallOperandIsFixed.push_back(Outs[i].IsFixed);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Identify lowered values that originated from f128 arguments and record
|
/// Identify lowered values that originated from f128 arguments and record
|
||||||
@ -151,21 +154,15 @@ private:
|
|||||||
/// Records whether the value has been lowered from an f128.
|
/// Records whether the value has been lowered from an f128.
|
||||||
SmallVector<bool, 4> OriginalArgWasF128;
|
SmallVector<bool, 4> OriginalArgWasF128;
|
||||||
|
|
||||||
|
/// Records whether the value was a fixed argument.
|
||||||
|
/// See ISD::OutputArg::IsFixed,
|
||||||
|
SmallVector<bool, 4> CallOperandIsFixed;
|
||||||
|
|
||||||
// Used to handle MIPS16-specific calling convention tweaks.
|
// Used to handle MIPS16-specific calling convention tweaks.
|
||||||
// FIXME: This should probably be a fully fledged calling convention.
|
// FIXME: This should probably be a fully fledged calling convention.
|
||||||
SpecialCallingConvType SpecialCallingConv;
|
SpecialCallingConvType SpecialCallingConv;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// FIXME: Remove this from a public inteface ASAP. It's a temporary trap door
|
|
||||||
// to allow analyzeCallOperands to be removed incrementally.
|
|
||||||
void PreAnalyzeCallOperandsForF128_(
|
|
||||||
const SmallVectorImpl<ISD::OutputArg> &Outs,
|
|
||||||
std::vector<TargetLowering::ArgListEntry> &FuncArgs, SDNode *CallNode) {
|
|
||||||
PreAnalyzeCallOperandsForF128(Outs, FuncArgs, CallNode);
|
|
||||||
}
|
|
||||||
// FIXME: Remove this from a public inteface ASAP. It's a temporary trap door
|
|
||||||
// to clean up after the above functions.
|
|
||||||
void ClearOriginalArgWasF128() { OriginalArgWasF128.clear(); }
|
|
||||||
|
|
||||||
MipsCCState(CallingConv::ID CC, bool isVarArg, MachineFunction &MF,
|
MipsCCState(CallingConv::ID CC, bool isVarArg, MachineFunction &MF,
|
||||||
const TargetMachine &TM, SmallVectorImpl<CCValAssign> &locs,
|
const TargetMachine &TM, SmallVectorImpl<CCValAssign> &locs,
|
||||||
@ -173,6 +170,26 @@ public:
|
|||||||
SpecialCallingConvType SpecialCC = NoSpecialCallingConv)
|
SpecialCallingConvType SpecialCC = NoSpecialCallingConv)
|
||||||
: CCState(CC, isVarArg, MF, TM, locs, C), SpecialCallingConv(SpecialCC) {}
|
: CCState(CC, isVarArg, MF, TM, locs, C), SpecialCallingConv(SpecialCC) {}
|
||||||
|
|
||||||
|
void
|
||||||
|
AnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs,
|
||||||
|
CCAssignFn Fn,
|
||||||
|
std::vector<TargetLowering::ArgListEntry> &FuncArgs,
|
||||||
|
const SDNode *CallNode) {
|
||||||
|
PreAnalyzeCallOperands(Outs, FuncArgs, CallNode);
|
||||||
|
CCState::AnalyzeCallOperands(Outs, Fn);
|
||||||
|
OriginalArgWasF128.clear();
|
||||||
|
CallOperandIsFixed.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
// The AnalyzeCallOperands in the base class is not usable since we must
|
||||||
|
// provide a means of accessing ArgListEntry::IsFixed. Delete them from this
|
||||||
|
// class. This doesn't stop them being used via the base class though.
|
||||||
|
void AnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs,
|
||||||
|
CCAssignFn Fn) = delete;
|
||||||
|
void AnalyzeCallOperands(const SmallVectorImpl<MVT> &Outs,
|
||||||
|
SmallVectorImpl<ISD::ArgFlagsTy> &Flags,
|
||||||
|
CCAssignFn Fn) = delete;
|
||||||
|
|
||||||
void AnalyzeFormalArguments(const SmallVectorImpl<ISD::InputArg> &Ins,
|
void AnalyzeFormalArguments(const SmallVectorImpl<ISD::InputArg> &Ins,
|
||||||
CCAssignFn Fn) {
|
CCAssignFn Fn) {
|
||||||
PreAnalyzeFormalArgumentsForF128(Ins);
|
PreAnalyzeFormalArgumentsForF128(Ins);
|
||||||
@ -204,6 +221,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool WasOriginalArgF128(unsigned ValNo) { return OriginalArgWasF128[ValNo]; }
|
bool WasOriginalArgF128(unsigned ValNo) { return OriginalArgWasF128[ValNo]; }
|
||||||
|
bool IsCallOperandFixed(unsigned ValNo) { return CallOperandIsFixed[ValNo]; }
|
||||||
SpecialCallingConvType getSpecialCallingConv() { return SpecialCallingConv; }
|
SpecialCallingConvType getSpecialCallingConv() { return SpecialCallingConv; }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -2616,9 +2634,7 @@ MipsTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
|||||||
MipsCCState::getSpecialCallingConvForCallee(Callee.getNode(), Subtarget));
|
MipsCCState::getSpecialCallingConvForCallee(Callee.getNode(), Subtarget));
|
||||||
MipsCC MipsCCInfo(CallConv, Subtarget, CCInfo);
|
MipsCC MipsCCInfo(CallConv, Subtarget, CCInfo);
|
||||||
|
|
||||||
CCInfo.PreAnalyzeCallOperandsForF128_(Outs, CLI.getArgs(), Callee.getNode());
|
CCInfo.AnalyzeCallOperands(Outs, CC_Mips, CLI.getArgs(), Callee.getNode());
|
||||||
MipsCCInfo.analyzeCallOperands(Outs, CLI.getArgs(), CCInfo);
|
|
||||||
CCInfo.ClearOriginalArgWasF128();
|
|
||||||
|
|
||||||
// Get a count of how many bytes are to be pushed on the stack.
|
// Get a count of how many bytes are to be pushed on the stack.
|
||||||
unsigned NextStackOffset = CCInfo.getNextStackOffset();
|
unsigned NextStackOffset = CCInfo.getNextStackOffset();
|
||||||
@ -3599,34 +3615,6 @@ MipsTargetLowering::MipsCC::MipsCC(CallingConv::ID CC,
|
|||||||
Info.AllocateStack(reservedArgArea(), 1);
|
Info.AllocateStack(reservedArgArea(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MipsTargetLowering::MipsCC::analyzeCallOperands(
|
|
||||||
const SmallVectorImpl<ISD::OutputArg> &Args,
|
|
||||||
std::vector<ArgListEntry> &FuncArgs, CCState &State) {
|
|
||||||
assert((CallConv != CallingConv::Fast || !State.isVarArg()) &&
|
|
||||||
"CallingConv::Fast shouldn't be used for vararg functions.");
|
|
||||||
|
|
||||||
unsigned NumOpnds = Args.size();
|
|
||||||
|
|
||||||
for (unsigned I = 0; I != NumOpnds; ++I) {
|
|
||||||
MVT ArgVT = Args[I].VT;
|
|
||||||
ISD::ArgFlagsTy ArgFlags = Args[I].Flags;
|
|
||||||
bool R;
|
|
||||||
|
|
||||||
if (State.isVarArg() && !Args[I].IsFixed)
|
|
||||||
R = CC_Mips_VarArg(I, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, State);
|
|
||||||
else
|
|
||||||
R = CC_Mips_FixedArg(I, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, State);
|
|
||||||
|
|
||||||
if (R) {
|
|
||||||
#ifndef NDEBUG
|
|
||||||
dbgs() << "Call operand #" << I << " has unhandled type "
|
|
||||||
<< EVT(ArgVT).getEVTString();
|
|
||||||
#endif
|
|
||||||
llvm_unreachable(nullptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned MipsTargetLowering::MipsCC::reservedArgArea() const {
|
unsigned MipsTargetLowering::MipsCC::reservedArgArea() const {
|
||||||
return (Subtarget.isABI_O32() && (CallConv != CallingConv::Fast)) ? 16 : 0;
|
return (Subtarget.isABI_O32() && (CallConv != CallingConv::Fast)) ? 16 : 0;
|
||||||
}
|
}
|
||||||
|
@ -347,10 +347,6 @@ namespace llvm {
|
|||||||
MipsCC(CallingConv::ID CallConv, const MipsSubtarget &Subtarget,
|
MipsCC(CallingConv::ID CallConv, const MipsSubtarget &Subtarget,
|
||||||
CCState &Info);
|
CCState &Info);
|
||||||
|
|
||||||
void analyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs,
|
|
||||||
std::vector<ArgListEntry> &FuncArgs,
|
|
||||||
CCState &State);
|
|
||||||
|
|
||||||
/// reservedArgArea - The size of the area the caller reserves for
|
/// reservedArgArea - The size of the area the caller reserves for
|
||||||
/// register arguments. This is 16-byte if ABI is O32.
|
/// register arguments. This is 16-byte if ABI is O32.
|
||||||
unsigned reservedArgArea() const;
|
unsigned reservedArgArea() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user