[Lanai] Use ArgFlags to distinguish fixed parameters (#154278)
Whether the argument is fixed is now available via ArgFlags, so make use of it. The previous implementation was quite problematic, because it stored the number of fixed arguments in a global variable, which is not thread safe.
This commit is contained in:
parent
9df7ca1f0f
commit
5dbf73f54d
@ -353,7 +353,6 @@ void LanaiTargetLowering::LowerAsmOperandForConstraint(
|
||||
|
||||
#include "LanaiGenCallingConv.inc"
|
||||
|
||||
static unsigned NumFixedArgs;
|
||||
static bool CC_Lanai32_VarArg(unsigned ValNo, MVT ValVT, MVT LocVT,
|
||||
CCValAssign::LocInfo LocInfo,
|
||||
ISD::ArgFlagsTy ArgFlags, Type *OrigTy,
|
||||
@ -361,9 +360,8 @@ static bool CC_Lanai32_VarArg(unsigned ValNo, MVT ValVT, MVT LocVT,
|
||||
// Handle fixed arguments with default CC.
|
||||
// Note: Both the default and fast CC handle VarArg the same and hence the
|
||||
// calling convention of the function is not considered here.
|
||||
if (ValNo < NumFixedArgs) {
|
||||
if (!ArgFlags.isVarArg())
|
||||
return CC_Lanai32(ValNo, ValVT, LocVT, LocInfo, ArgFlags, OrigTy, State);
|
||||
}
|
||||
|
||||
// Promote i8/i16 args to i32
|
||||
if (LocVT == MVT::i8 || LocVT == MVT::i16) {
|
||||
@ -604,15 +602,9 @@ SDValue LanaiTargetLowering::LowerCCCCallTo(
|
||||
GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee);
|
||||
MachineFrameInfo &MFI = DAG.getMachineFunction().getFrameInfo();
|
||||
|
||||
NumFixedArgs = 0;
|
||||
if (IsVarArg && G) {
|
||||
const Function *CalleeFn = dyn_cast<Function>(G->getGlobal());
|
||||
if (CalleeFn)
|
||||
NumFixedArgs = CalleeFn->getFunctionType()->getNumParams();
|
||||
}
|
||||
if (NumFixedArgs)
|
||||
if (IsVarArg) {
|
||||
CCInfo.AnalyzeCallOperands(Outs, CC_Lanai32_VarArg);
|
||||
else {
|
||||
} else {
|
||||
if (CallConv == CallingConv::Fast)
|
||||
CCInfo.AnalyzeCallOperands(Outs, CC_Lanai32_Fast);
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user