mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 19:23:23 +01:00
Hexagon: Remove global state.
llvm-svn: 193499
This commit is contained in:
parent
66de6c5eec
commit
5ce5ed74af
@ -43,7 +43,20 @@ static cl::opt<bool>
|
||||
EmitJumpTables("hexagon-emit-jump-tables", cl::init(true), cl::Hidden,
|
||||
cl::desc("Control jump table emission on Hexagon target"));
|
||||
|
||||
int NumNamedVarArgParams = -1;
|
||||
namespace {
|
||||
class HexagonCCState : public CCState {
|
||||
int NumNamedVarArgParams;
|
||||
|
||||
public:
|
||||
HexagonCCState(CallingConv::ID CC, bool isVarArg, MachineFunction &MF,
|
||||
const TargetMachine &TM, SmallVectorImpl<CCValAssign> &locs,
|
||||
LLVMContext &C, int NumNamedVarArgParams)
|
||||
: CCState(CC, isVarArg, MF, TM, locs, C),
|
||||
NumNamedVarArgParams(NumNamedVarArgParams) {}
|
||||
|
||||
int getNumNamedVarArgParams() const { return NumNamedVarArgParams; }
|
||||
};
|
||||
}
|
||||
|
||||
// Implement calling convention for Hexagon.
|
||||
static bool
|
||||
@ -80,12 +93,13 @@ static bool
|
||||
CC_Hexagon_VarArg (unsigned ValNo, MVT ValVT,
|
||||
MVT LocVT, CCValAssign::LocInfo LocInfo,
|
||||
ISD::ArgFlagsTy ArgFlags, CCState &State) {
|
||||
HexagonCCState &HState = static_cast<HexagonCCState &>(State);
|
||||
|
||||
// NumNamedVarArgParams can not be zero for a VarArg function.
|
||||
assert ( (NumNamedVarArgParams > 0) &&
|
||||
"NumNamedVarArgParams is not bigger than zero.");
|
||||
assert((HState.getNumNamedVarArgParams() > 0) &&
|
||||
"NumNamedVarArgParams is not bigger than zero.");
|
||||
|
||||
if ( (int)ValNo < NumNamedVarArgParams ) {
|
||||
if ((int)ValNo < HState.getNumNamedVarArgParams()) {
|
||||
// Deal with named arguments.
|
||||
return CC_Hexagon(ValNo, ValVT, LocVT, LocInfo, ArgFlags, State);
|
||||
}
|
||||
@ -392,13 +406,8 @@ HexagonTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
||||
|
||||
bool IsStructRet = (Outs.empty()) ? false : Outs[0].Flags.isSRet();
|
||||
|
||||
// Analyze operands of the call, assigning locations to each operand.
|
||||
SmallVector<CCValAssign, 16> ArgLocs;
|
||||
CCState CCInfo(CallConv, isVarArg, DAG.getMachineFunction(),
|
||||
getTargetMachine(), ArgLocs, *DAG.getContext());
|
||||
|
||||
// Check for varargs.
|
||||
NumNamedVarArgParams = -1;
|
||||
int NumNamedVarArgParams = -1;
|
||||
if (GlobalAddressSDNode *GA = dyn_cast<GlobalAddressSDNode>(Callee))
|
||||
{
|
||||
const Function* CalleeFn = NULL;
|
||||
@ -415,6 +424,12 @@ HexagonTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
||||
}
|
||||
}
|
||||
|
||||
// Analyze operands of the call, assigning locations to each operand.
|
||||
SmallVector<CCValAssign, 16> ArgLocs;
|
||||
HexagonCCState CCInfo(CallConv, isVarArg, DAG.getMachineFunction(),
|
||||
getTargetMachine(), ArgLocs, *DAG.getContext(),
|
||||
NumNamedVarArgParams);
|
||||
|
||||
if (NumNamedVarArgParams > 0)
|
||||
CCInfo.AnalyzeCallOperands(Outs, CC_Hexagon_VarArg);
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user