-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[RISCV] Use Subtarget member variable instead of getting it from MachineFunction. NFC #159664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@llvm/pr-subscribers-backend-risc-v Author: Craig Topper (topperc) ChangesFull diff: https://github.com/llvm/llvm-project/pull/159664.diff 1 Files Affected:
diff --git a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
index 29c8e92e888b3..0aff839ff7516 100644
--- a/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
+++ b/llvm/lib/Target/RISCV/RISCVISelLowering.cpp
@@ -23449,7 +23449,6 @@ RISCVTargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
const SmallVectorImpl<SDValue> &OutVals,
const SDLoc &DL, SelectionDAG &DAG) const {
MachineFunction &MF = DAG.getMachineFunction();
- const RISCVSubtarget &STI = MF.getSubtarget<RISCVSubtarget>();
// Stores the assignment of the return value to a location.
SmallVector<CCValAssign, 16> RVLocs;
@@ -23484,8 +23483,8 @@ RISCVTargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
Register RegLo = VA.getLocReg();
Register RegHi = RVLocs[++i].getLocReg();
- if (STI.isRegisterReservedByUser(RegLo) ||
- STI.isRegisterReservedByUser(RegHi))
+ if (Subtarget.isRegisterReservedByUser(RegLo) ||
+ Subtarget.isRegisterReservedByUser(RegHi))
MF.getFunction().getContext().diagnose(DiagnosticInfoUnsupported{
MF.getFunction(),
"Return value register required, but has been reserved."});
@@ -23501,7 +23500,7 @@ RISCVTargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
Val = convertValVTToLocVT(DAG, Val, VA, DL, Subtarget);
Chain = DAG.getCopyToReg(Chain, DL, VA.getLocReg(), Val, Glue);
- if (STI.isRegisterReservedByUser(VA.getLocReg()))
+ if (Subtarget.isRegisterReservedByUser(VA.getLocReg()))
MF.getFunction().getContext().diagnose(DiagnosticInfoUnsupported{
MF.getFunction(),
"Return value register required, but has been reserved."});
@@ -23538,11 +23537,11 @@ RISCVTargetLowering::LowerReturn(SDValue Chain, CallingConv::ID CallConv,
if (Kind == "supervisor")
RetOpc = RISCVISD::SRET_GLUE;
else if (Kind == "rnmi") {
- assert(STI.hasFeature(RISCV::FeatureStdExtSmrnmi) &&
+ assert(Subtarget.hasFeature(RISCV::FeatureStdExtSmrnmi) &&
"Need Smrnmi extension for rnmi");
RetOpc = RISCVISD::MNRET_GLUE;
} else if (Kind == "qci-nest" || Kind == "qci-nonest") {
- assert(STI.hasFeature(RISCV::FeatureVendorXqciint) &&
+ assert(Subtarget.hasFeature(RISCV::FeatureVendorXqciint) &&
"Need Xqciint for qci-(no)nest");
RetOpc = RISCVISD::QC_C_MILEAVERET_GLUE;
} else
@@ -23556,10 +23555,9 @@ void RISCVTargetLowering::validateCCReservedRegs(
const SmallVectorImpl<std::pair<llvm::Register, llvm::SDValue>> &Regs,
MachineFunction &MF) const {
const Function &F = MF.getFunction();
- const RISCVSubtarget &STI = MF.getSubtarget<RISCVSubtarget>();
- if (llvm::any_of(Regs, [&STI](auto Reg) {
- return STI.isRegisterReservedByUser(Reg.first);
+ if (llvm::any_of(Regs, [this](auto Reg) {
+ return Subtarget.isRegisterReservedByUser(Reg.first);
}))
F.getContext().diagnose(DiagnosticInfoUnsupported{
F, "Argument register required, but has been reserved."});
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
…ineFunction. NFC (llvm#159664)
…ineFunction. NFC (llvm#159664)
No description provided.