[llvm] 9d37e80 - [SystemZ] Remove custom CCState pre-analysis (#154091)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 19 00:28:12 PDT 2025
Author: Nikita Popov
Date: 2025-08-19T09:28:09+02:00
New Revision: 9d37e80d3cfafe3d33f752e9a21a50a2f5a27b8e
URL: https://github.com/llvm/llvm-project/commit/9d37e80d3cfafe3d33f752e9a21a50a2f5a27b8e
DIFF: https://github.com/llvm/llvm-project/commit/9d37e80d3cfafe3d33f752e9a21a50a2f5a27b8e.diff
LOG: [SystemZ] Remove custom CCState pre-analysis (#154091)
The calling convention lowering now has access to OrigTy, so use that to
detect short vectors.
Added:
Modified:
llvm/lib/Target/SystemZ/SystemZCallingConv.h
llvm/lib/Target/SystemZ/SystemZCallingConv.td
llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/SystemZ/SystemZCallingConv.h b/llvm/lib/Target/SystemZ/SystemZCallingConv.h
index fbb98ffd38734..f5ffbf5c04d60 100644
--- a/llvm/lib/Target/SystemZ/SystemZCallingConv.h
+++ b/llvm/lib/Target/SystemZ/SystemZCallingConv.h
@@ -29,50 +29,6 @@ namespace SystemZ {
extern const MCPhysReg XPLINK64ArgFPRs[XPLINK64NumArgFPRs];
} // end namespace SystemZ
-class SystemZCCState : public CCState {
-private:
- /// Records whether the value was widened from a short vector type.
- SmallVector<bool, 4> ArgIsShortVector;
-
- // Check whether ArgVT is a short vector type.
- bool IsShortVectorType(EVT ArgVT) {
- return ArgVT.isVector() && ArgVT.getStoreSize() <= 8;
- }
-
-public:
- SystemZCCState(CallingConv::ID CC, bool isVarArg, MachineFunction &MF,
- SmallVectorImpl<CCValAssign> &locs, LLVMContext &C)
- : CCState(CC, isVarArg, MF, locs, C) {}
-
- void AnalyzeFormalArguments(const SmallVectorImpl<ISD::InputArg> &Ins,
- CCAssignFn Fn) {
- // Record whether the call operand was a short vector.
- ArgIsShortVector.clear();
- for (unsigned i = 0; i < Ins.size(); ++i)
- ArgIsShortVector.push_back(IsShortVectorType(Ins[i].ArgVT));
-
- CCState::AnalyzeFormalArguments(Ins, Fn);
- }
-
- void AnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs,
- CCAssignFn Fn) {
- // Record whether the call operand was a short vector.
- ArgIsShortVector.clear();
- for (unsigned i = 0; i < Outs.size(); ++i)
- ArgIsShortVector.push_back(IsShortVectorType(Outs[i].ArgVT));
-
- CCState::AnalyzeCallOperands(Outs, Fn);
- }
-
- // This version of AnalyzeCallOperands in the base class is not usable
- // since we must provide a means of accessing ISD::OutputArg::IsShortVector.
- void AnalyzeCallOperands(const SmallVectorImpl<MVT> &Outs,
- SmallVectorImpl<ISD::ArgFlagsTy> &Flags,
- CCAssignFn Fn) = delete;
-
- bool IsShortVector(unsigned ValNo) { return ArgIsShortVector[ValNo]; }
-};
-
// Handle i128 argument types. These need to be passed by implicit
// reference. This could be as simple as the following .td line:
// CCIfType<[i128], CCPassIndirect<i64>>,
diff --git a/llvm/lib/Target/SystemZ/SystemZCallingConv.td b/llvm/lib/Target/SystemZ/SystemZCallingConv.td
index 059f31f6aec30..2795de5eeeb66 100644
--- a/llvm/lib/Target/SystemZ/SystemZCallingConv.td
+++ b/llvm/lib/Target/SystemZ/SystemZCallingConv.td
@@ -18,7 +18,7 @@ class CCIfSubtarget<string F, CCAction A>
// Match if this specific argument was widened from a short vector type.
class CCIfShortVector<CCAction A>
- : CCIf<"static_cast<SystemZCCState *>(&State)->IsShortVector(ValNo)", A>;
+ : CCIf<"OrigTy->isVectorTy() && OrigTy->getPrimitiveSizeInBits() <= 64", A>;
//===----------------------------------------------------------------------===//
diff --git a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
index 2f8637642d5c6..c73dc3021eb42 100644
--- a/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZISelLowering.cpp
@@ -1941,7 +1941,7 @@ SDValue SystemZTargetLowering::LowerFormalArguments(
// Assign locations to all of the incoming arguments.
SmallVector<CCValAssign, 16> ArgLocs;
- SystemZCCState CCInfo(CallConv, IsVarArg, MF, ArgLocs, *DAG.getContext());
+ CCState CCInfo(CallConv, IsVarArg, MF, ArgLocs, *DAG.getContext());
CCInfo.AnalyzeFormalArguments(Ins, CC_SystemZ);
FuncInfo->setSizeOfFnParams(CCInfo.getStackSize());
@@ -2251,7 +2251,7 @@ SystemZTargetLowering::LowerCall(CallLoweringInfo &CLI,
// Analyze the operands of the call, assigning locations to each operand.
SmallVector<CCValAssign, 16> ArgLocs;
- SystemZCCState ArgCCInfo(CallConv, IsVarArg, MF, ArgLocs, Ctx);
+ CCState ArgCCInfo(CallConv, IsVarArg, MF, ArgLocs, Ctx);
ArgCCInfo.AnalyzeCallOperands(Outs, CC_SystemZ);
// We don't support GuaranteedTailCallOpt, only automatically-detected
More information about the llvm-commits
mailing list