Skip to content

Commit 446a490

Browse files
authored
[RISCV] Use Subtarget member variable instead of getting it from MachineFunction. NFC (#159664)
1 parent 7a77127 commit 446a490

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
@@ -23464,7 +23464,6 @@ RISCVTargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
2346423464
const SmallVectorImpl<SDValue> &OutVals,
2346523465
const SDLoc &DL, SelectionDAG &DAG) const {
2346623466
MachineFunction &MF = DAG.getMachineFunction();
23467-
const RISCVSubtarget &STI = MF.getSubtarget<RISCVSubtarget>();
2346823467

2346923468
// Stores the assignment of the return value to a location.
2347023469
SmallVector<CCValAssign, 16> RVLocs;
@@ -23499,8 +23498,8 @@ RISCVTargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
2349923498
Register RegLo = VA.getLocReg();
2350023499
Register RegHi = RVLocs[++i].getLocReg();
2350123500

23502-
if (STI.isRegisterReservedByUser(RegLo) ||
23503-
STI.isRegisterReservedByUser(RegHi))
23501+
if (Subtarget.isRegisterReservedByUser(RegLo) ||
23502+
Subtarget.isRegisterReservedByUser(RegHi))
2350423503
MF.getFunction().getContext().diagnose(DiagnosticInfoUnsupported{
2350523504
MF.getFunction(),
2350623505
"Return value register required, but has been reserved."});
@@ -23516,7 +23515,7 @@ RISCVTargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
2351623515
Val = convertValVTToLocVT(DAG, Val, VA, DL, Subtarget);
2351723516
Chain = DAG.getCopyToReg(Chain, DL, VA.getLocReg(), Val, Glue);
2351823517

23519-
if (STI.isRegisterReservedByUser(VA.getLocReg()))
23518+
if (Subtarget.isRegisterReservedByUser(VA.getLocReg()))
2352023519
MF.getFunction().getContext().diagnose(DiagnosticInfoUnsupported{
2352123520
MF.getFunction(),
2352223521
"Return value register required, but has been reserved."});
@@ -23553,11 +23552,11 @@ RISCVTargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
2355323552
if (Kind == "supervisor")
2355423553
RetOpc = RISCVISD::SRET_GLUE;
2355523554
else if (Kind == "rnmi") {
23556-
assert(STI.hasFeature(RISCV::FeatureStdExtSmrnmi) &&
23555+
assert(Subtarget.hasFeature(RISCV::FeatureStdExtSmrnmi) &&
2355723556
"Need Smrnmi extension for rnmi");
2355823557
RetOpc = RISCVISD::MNRET_GLUE;
2355923558
} else if (Kind == "qci-nest" || Kind == "qci-nonest") {
23560-
assert(STI.hasFeature(RISCV::FeatureVendorXqciint) &&
23559+
assert(Subtarget.hasFeature(RISCV::FeatureVendorXqciint) &&
2356123560
"Need Xqciint for qci-(no)nest");
2356223561
RetOpc = RISCVISD::QC_C_MILEAVERET_GLUE;
2356323562
} else
@@ -23571,10 +23570,9 @@ void RISCVTargetLowering::validateCCReservedRegs(
2357123570
const SmallVectorImpl<std::pair<llvm::Register, llvm::SDValue>> &Regs,
2357223571
MachineFunction &MF) const {
2357323572
const Function &F = MF.getFunction();
23574-
const RISCVSubtarget &STI = MF.getSubtarget<RISCVSubtarget>();
2357523573

23576-
if (llvm::any_of(Regs, [&STI](auto Reg) {
23577-
return STI.isRegisterReservedByUser(Reg.first);
23574+
if (llvm::any_of(Regs, [this](auto Reg) {
23575+
return Subtarget.isRegisterReservedByUser(Reg.first);
2357823576
}))
2357923577
F.getContext().diagnose(DiagnosticInfoUnsupported{
2358023578
F, "Argument register required, but has been reserved."});

0 commit comments

Comments
 (0)