Skip to content

Commit 9d37e80

Browse files
authored
[SystemZ] Remove custom CCState pre-analysis (#154091)
The calling convention lowering now has access to OrigTy, so use that to detect short vectors.
1 parent a4f8551 commit 9d37e80

File tree

3 files changed

+3
-47
lines changed

3 files changed

+3
-47
lines changed

llvm/lib/Target/SystemZ/SystemZCallingConv.h

Lines changed: 0 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -29,50 +29,6 @@ namespace SystemZ {
2929
extern const MCPhysReg XPLINK64ArgFPRs[XPLINK64NumArgFPRs];
3030
} // end namespace SystemZ
3131

32-
class SystemZCCState : public CCState {
33-
private:
34-
/// Records whether the value was widened from a short vector type.
35-
SmallVector<bool, 4> ArgIsShortVector;
36-
37-
// Check whether ArgVT is a short vector type.
38-
bool IsShortVectorType(EVT ArgVT) {
39-
return ArgVT.isVector() && ArgVT.getStoreSize() <= 8;
40-
}
41-
42-
public:
43-
SystemZCCState(CallingConv::ID CC, bool isVarArg, MachineFunction &MF,
44-
SmallVectorImpl<CCValAssign> &locs, LLVMContext &C)
45-
: CCState(CC, isVarArg, MF, locs, C) {}
46-
47-
void AnalyzeFormalArguments(const SmallVectorImpl<ISD::InputArg> &Ins,
48-
CCAssignFn Fn) {
49-
// Record whether the call operand was a short vector.
50-
ArgIsShortVector.clear();
51-
for (unsigned i = 0; i < Ins.size(); ++i)
52-
ArgIsShortVector.push_back(IsShortVectorType(Ins[i].ArgVT));
53-
54-
CCState::AnalyzeFormalArguments(Ins, Fn);
55-
}
56-
57-
void AnalyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs,
58-
CCAssignFn Fn) {
59-
// Record whether the call operand was a short vector.
60-
ArgIsShortVector.clear();
61-
for (unsigned i = 0; i < Outs.size(); ++i)
62-
ArgIsShortVector.push_back(IsShortVectorType(Outs[i].ArgVT));
63-
64-
CCState::AnalyzeCallOperands(Outs, Fn);
65-
}
66-
67-
// This version of AnalyzeCallOperands in the base class is not usable
68-
// since we must provide a means of accessing ISD::OutputArg::IsShortVector.
69-
void AnalyzeCallOperands(const SmallVectorImpl<MVT> &Outs,
70-
SmallVectorImpl<ISD::ArgFlagsTy> &Flags,
71-
CCAssignFn Fn) = delete;
72-
73-
bool IsShortVector(unsigned ValNo) { return ArgIsShortVector[ValNo]; }
74-
};
75-
7632
// Handle i128 argument types. These need to be passed by implicit
7733
// reference. This could be as simple as the following .td line:
7834
// CCIfType<[i128], CCPassIndirect<i64>>,

llvm/lib/Target/SystemZ/SystemZCallingConv.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class CCIfSubtarget<string F, CCAction A>
1818

1919
// Match if this specific argument was widened from a short vector type.
2020
class CCIfShortVector<CCAction A>
21-
: CCIf<"static_cast<SystemZCCState *>(&State)->IsShortVector(ValNo)", A>;
21+
: CCIf<"OrigTy->isVectorTy() && OrigTy->getPrimitiveSizeInBits() <= 64", A>;
2222

2323

2424
//===----------------------------------------------------------------------===//

llvm/lib/Target/SystemZ/SystemZISelLowering.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1941,7 +1941,7 @@ SDValue SystemZTargetLowering::LowerFormalArguments(
19411941

19421942
// Assign locations to all of the incoming arguments.
19431943
SmallVector<CCValAssign, 16> ArgLocs;
1944-
SystemZCCState CCInfo(CallConv, IsVarArg, MF, ArgLocs, *DAG.getContext());
1944+
CCState CCInfo(CallConv, IsVarArg, MF, ArgLocs, *DAG.getContext());
19451945
CCInfo.AnalyzeFormalArguments(Ins, CC_SystemZ);
19461946
FuncInfo->setSizeOfFnParams(CCInfo.getStackSize());
19471947

@@ -2251,7 +2251,7 @@ SystemZTargetLowering::LowerCall(CallLoweringInfo &CLI,
22512251

22522252
// Analyze the operands of the call, assigning locations to each operand.
22532253
SmallVector<CCValAssign, 16> ArgLocs;
2254-
SystemZCCState ArgCCInfo(CallConv, IsVarArg, MF, ArgLocs, Ctx);
2254+
CCState ArgCCInfo(CallConv, IsVarArg, MF, ArgLocs, Ctx);
22552255
ArgCCInfo.AnalyzeCallOperands(Outs, CC_SystemZ);
22562256

22572257
// We don't support GuaranteedTailCallOpt, only automatically-detected

0 commit comments

Comments
 (0)