Skip to content

Commit a4f8551

Browse files
authored
[Hexagon] Remove custom vararg tracking (NFCI) (#154089)
This information is now directly available, use the generic CCIfArgVarArg.
1 parent b2fae5b commit a4f8551

File tree

2 files changed

+4
-30
lines changed

2 files changed

+4
-30
lines changed

llvm/lib/Target/Hexagon/HexagonCallingConv.td

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
class CCIfArgIsVarArg<CCAction A>
10-
: CCIf<"State.isVarArg() && "
11-
"ValNo >= static_cast<HexagonCCState&>(State)"
12-
".getNumNamedVarArgParams()", A>;
13-
149
def CC_HexagonStack: CallingConv<[
1510
CCIfType<[i32,v2i16,v4i8],
1611
CCAssignToStack<4,4>>,
@@ -28,7 +23,7 @@ def CC_Hexagon_Legacy: CallingConv<[
2823

2924
CCIfByVal<
3025
CCPassByVal<8,8>>,
31-
CCIfArgIsVarArg<
26+
CCIfArgVarArg<
3227
CCDelegateTo<CC_HexagonStack>>,
3328

3429
// Pass split values in pairs, allocate odd register if necessary.
@@ -58,7 +53,7 @@ def CC_Hexagon: CallingConv<[
5853

5954
CCIfByVal<
6055
CCPassByVal<8,1>>,
61-
CCIfArgIsVarArg<
56+
CCIfArgVarArg<
6257
CCDelegateTo<CC_HexagonStack>>,
6358

6459
// Pass split values in pairs, allocate odd register if necessary.

llvm/lib/Target/Hexagon/HexagonISelLowering.cpp

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -116,23 +116,6 @@ static cl::opt<bool>
116116
cl::desc("Disable minimum alignment of 1 for "
117117
"arguments passed by value on stack"));
118118

119-
namespace {
120-
121-
class HexagonCCState : public CCState {
122-
unsigned NumNamedVarArgParams = 0;
123-
124-
public:
125-
HexagonCCState(CallingConv::ID CC, bool IsVarArg, MachineFunction &MF,
126-
SmallVectorImpl<CCValAssign> &locs, LLVMContext &C,
127-
unsigned NumNamedArgs)
128-
: CCState(CC, IsVarArg, MF, locs, C),
129-
NumNamedVarArgParams(NumNamedArgs) {}
130-
unsigned getNumNamedVarArgParams() const { return NumNamedVarArgParams; }
131-
};
132-
133-
} // end anonymous namespace
134-
135-
136119
// Implement calling convention for Hexagon.
137120

138121
static bool CC_SkipOdd(unsigned &ValNo, MVT &ValVT, MVT &LocVT,
@@ -497,7 +480,6 @@ HexagonTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
497480
MachineFrameInfo &MFI = MF.getFrameInfo();
498481
auto PtrVT = getPointerTy(MF.getDataLayout());
499482

500-
unsigned NumParams = CLI.CB ? CLI.CB->getFunctionType()->getNumParams() : 0;
501483
if (GlobalAddressSDNode *GAN = dyn_cast<GlobalAddressSDNode>(Callee))
502484
Callee = DAG.getTargetGlobalAddress(GAN->getGlobal(), dl, MVT::i32);
503485

@@ -506,8 +488,7 @@ HexagonTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
506488

507489
// Analyze operands of the call, assigning locations to each operand.
508490
SmallVector<CCValAssign, 16> ArgLocs;
509-
HexagonCCState CCInfo(CallConv, TreatAsVarArg, MF, ArgLocs, *DAG.getContext(),
510-
NumParams);
491+
CCState CCInfo(CallConv, TreatAsVarArg, MF, ArgLocs, *DAG.getContext());
511492

512493
if (Subtarget.useHVXOps())
513494
CCInfo.AnalyzeCallOperands(Outs, CC_Hexagon_HVX);
@@ -880,9 +861,7 @@ SDValue HexagonTargetLowering::LowerFormalArguments(
880861

881862
// Assign locations to all of the incoming arguments.
882863
SmallVector<CCValAssign, 16> ArgLocs;
883-
HexagonCCState CCInfo(CallConv, TreatAsVarArg, MF, ArgLocs,
884-
*DAG.getContext(),
885-
MF.getFunction().getFunctionType()->getNumParams());
864+
CCState CCInfo(CallConv, TreatAsVarArg, MF, ArgLocs, *DAG.getContext());
886865

887866
if (Subtarget.useHVXOps())
888867
CCInfo.AnalyzeFormalArguments(Ins, CC_Hexagon_HVX);

0 commit comments

Comments
 (0)