Skip to content

Commit afaee02

Browse files
committed
[RISCV] Use Subtarget member variable instead of getting it from MachineFunction. NFC
1 parent cdd7898 commit afaee02

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23449,7 +23449,6 @@ RISCVTargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
2344923449
const SmallVectorImpl<SDValue> &OutVals,
2345023450
const SDLoc &DL, SelectionDAG &DAG) const {
2345123451
MachineFunction &MF = DAG.getMachineFunction();
23452-
const RISCVSubtarget &STI = MF.getSubtarget<RISCVSubtarget>();
2345323452

2345423453
// Stores the assignment of the return value to a location.
2345523454
SmallVector<CCValAssign, 16> RVLocs;
@@ -23484,8 +23483,8 @@ RISCVTargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
2348423483
Register RegLo = VA.getLocReg();
2348523484
Register RegHi = RVLocs[++i].getLocReg();
2348623485

23487-
if (STI.isRegisterReservedByUser(RegLo) ||
23488-
STI.isRegisterReservedByUser(RegHi))
23486+
if (Subtarget.isRegisterReservedByUser(RegLo) ||
23487+
Subtarget.isRegisterReservedByUser(RegHi))
2348923488
MF.getFunction().getContext().diagnose(DiagnosticInfoUnsupported{
2349023489
MF.getFunction(),
2349123490
"Return value register required, but has been reserved."});
@@ -23501,7 +23500,7 @@ RISCVTargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
2350123500
Val = convertValVTToLocVT(DAG, Val, VA, DL, Subtarget);
2350223501
Chain = DAG.getCopyToReg(Chain, DL, VA.getLocReg(), Val, Glue);
2350323502

23504-
if (STI.isRegisterReservedByUser(VA.getLocReg()))
23503+
if (Subtarget.isRegisterReservedByUser(VA.getLocReg()))
2350523504
MF.getFunction().getContext().diagnose(DiagnosticInfoUnsupported{
2350623505
MF.getFunction(),
2350723506
"Return value register required, but has been reserved."});
@@ -23538,11 +23537,11 @@ RISCVTargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
2353823537
if (Kind == "supervisor")
2353923538
RetOpc = RISCVISD::SRET_GLUE;
2354023539
else if (Kind == "rnmi") {
23541-
assert(STI.hasFeature(RISCV::FeatureStdExtSmrnmi) &&
23540+
assert(Subtarget.hasFeature(RISCV::FeatureStdExtSmrnmi) &&
2354223541
"Need Smrnmi extension for rnmi");
2354323542
RetOpc = RISCVISD::MNRET_GLUE;
2354423543
} else if (Kind == "qci-nest" || Kind == "qci-nonest") {
23545-
assert(STI.hasFeature(RISCV::FeatureVendorXqciint) &&
23544+
assert(Subtarget.hasFeature(RISCV::FeatureVendorXqciint) &&
2354623545
"Need Xqciint for qci-(no)nest");
2354723546
RetOpc = RISCVISD::QC_C_MILEAVERET_GLUE;
2354823547
} else
@@ -23556,10 +23555,9 @@ void RISCVTargetLowering::validateCCReservedRegs(
2355623555
const SmallVectorImpl<std::pair<llvm::Register, llvm::SDValue>> &Regs,
2355723556
MachineFunction &MF) const {
2355823557
const Function &F = MF.getFunction();
23559-
const RISCVSubtarget &STI = MF.getSubtarget<RISCVSubtarget>();
2356023558

23561-
if (llvm::any_of(Regs, [&STI](auto Reg) {
23562-
return STI.isRegisterReservedByUser(Reg.first);
23559+
if (llvm::any_of(Regs, [this](auto Reg) {
23560+
return Subtarget.isRegisterReservedByUser(Reg.first);
2356323561
}))
2356423562
F.getContext().diagnose(DiagnosticInfoUnsupported{
2356523563
F, "Argument register required, but has been reserved."});

0 commit comments

Comments
 (0)