[llvm] [Hexagon] Remove custom vararg tracking (NFCI) (PR #154089)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 18 03:41:28 PDT 2025
https://github.com/nikic created https://github.com/llvm/llvm-project/pull/154089
This information is now directly available, use the generic CCIfArgVarArg.
>From 7c1f91f9202320c254638d71feba77c933293c9d Mon Sep 17 00:00:00 2001
From: Nikita Popov <npopov at redhat.com>
Date: Mon, 18 Aug 2025 12:38:11 +0200
Subject: [PATCH] [Hexagon] Remove custom vararg tracking (NFCI)
This information is now directly available, use the generic
CCIfArgVarArg.
---
llvm/lib/Target/Hexagon/HexagonCallingConv.td | 9 ++-----
.../Target/Hexagon/HexagonISelLowering.cpp | 25 ++-----------------
2 files changed, 4 insertions(+), 30 deletions(-)
diff --git a/llvm/lib/Target/Hexagon/HexagonCallingConv.td b/llvm/lib/Target/Hexagon/HexagonCallingConv.td
index e0302b85fa948..fd6d873dd4188 100644
--- a/llvm/lib/Target/Hexagon/HexagonCallingConv.td
+++ b/llvm/lib/Target/Hexagon/HexagonCallingConv.td
@@ -6,11 +6,6 @@
//
//===----------------------------------------------------------------------===//
-class CCIfArgIsVarArg<CCAction A>
- : CCIf<"State.isVarArg() && "
- "ValNo >= static_cast<HexagonCCState&>(State)"
- ".getNumNamedVarArgParams()", A>;
-
def CC_HexagonStack: CallingConv<[
CCIfType<[i32,v2i16,v4i8],
CCAssignToStack<4,4>>,
@@ -28,7 +23,7 @@ def CC_Hexagon_Legacy: CallingConv<[
CCIfByVal<
CCPassByVal<8,8>>,
- CCIfArgIsVarArg<
+ CCIfArgVarArg<
CCDelegateTo<CC_HexagonStack>>,
// Pass split values in pairs, allocate odd register if necessary.
@@ -58,7 +53,7 @@ def CC_Hexagon: CallingConv<[
CCIfByVal<
CCPassByVal<8,1>>,
- CCIfArgIsVarArg<
+ CCIfArgVarArg<
CCDelegateTo<CC_HexagonStack>>,
// Pass split values in pairs, allocate odd register if necessary.
diff --git a/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp b/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp
index facea646d4b68..c54b67ccd8843 100644
--- a/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp
@@ -116,23 +116,6 @@ static cl::opt<bool>
cl::desc("Disable minimum alignment of 1 for "
"arguments passed by value on stack"));
-namespace {
-
- class HexagonCCState : public CCState {
- unsigned NumNamedVarArgParams = 0;
-
- public:
- HexagonCCState(CallingConv::ID CC, bool IsVarArg, MachineFunction &MF,
- SmallVectorImpl<CCValAssign> &locs, LLVMContext &C,
- unsigned NumNamedArgs)
- : CCState(CC, IsVarArg, MF, locs, C),
- NumNamedVarArgParams(NumNamedArgs) {}
- unsigned getNumNamedVarArgParams() const { return NumNamedVarArgParams; }
- };
-
-} // end anonymous namespace
-
-
// Implement calling convention for Hexagon.
static bool CC_SkipOdd(unsigned &ValNo, MVT &ValVT, MVT &LocVT,
@@ -497,7 +480,6 @@ HexagonTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
MachineFrameInfo &MFI = MF.getFrameInfo();
auto PtrVT = getPointerTy(MF.getDataLayout());
- unsigned NumParams = CLI.CB ? CLI.CB->getFunctionType()->getNumParams() : 0;
if (GlobalAddressSDNode *GAN = dyn_cast<GlobalAddressSDNode>(Callee))
Callee = DAG.getTargetGlobalAddress(GAN->getGlobal(), dl, MVT::i32);
@@ -506,8 +488,7 @@ HexagonTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
// Analyze operands of the call, assigning locations to each operand.
SmallVector<CCValAssign, 16> ArgLocs;
- HexagonCCState CCInfo(CallConv, TreatAsVarArg, MF, ArgLocs, *DAG.getContext(),
- NumParams);
+ CCState CCInfo(CallConv, TreatAsVarArg, MF, ArgLocs, *DAG.getContext());
if (Subtarget.useHVXOps())
CCInfo.AnalyzeCallOperands(Outs, CC_Hexagon_HVX);
@@ -880,9 +861,7 @@ SDValue HexagonTargetLowering::LowerFormalArguments(
// Assign locations to all of the incoming arguments.
SmallVector<CCValAssign, 16> ArgLocs;
- HexagonCCState CCInfo(CallConv, TreatAsVarArg, MF, ArgLocs,
- *DAG.getContext(),
- MF.getFunction().getFunctionType()->getNumParams());
+ CCState CCInfo(CallConv, TreatAsVarArg, MF, ArgLocs, *DAG.getContext());
if (Subtarget.useHVXOps())
CCInfo.AnalyzeFormalArguments(Ins, CC_Hexagon_HVX);
More information about the llvm-commits
mailing list