[llvm] 0971819 - [RISCV] Don't lookup TII in RISCVInstrInfo::getVLENFactoredAmount. NFCI
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue May 3 19:41:46 PDT 2022
Author: Craig Topper
Date: 2022-05-03T19:35:21-07:00
New Revision: 097181974067ff9372faccfd419a51f9ba662443
URL: https://github.com/llvm/llvm-project/commit/097181974067ff9372faccfd419a51f9ba662443
DIFF: https://github.com/llvm/llvm-project/commit/097181974067ff9372faccfd419a51f9ba662443.diff
LOG: [RISCV] Don't lookup TII in RISCVInstrInfo::getVLENFactoredAmount. NFCI
We're already inside of our implementation of TII.
Added:
Modified:
llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
index 337fb77ea9d95..67e7038ed2ecc 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
@@ -1762,11 +1762,10 @@ Register RISCVInstrInfo::getVLENFactoredAmount(MachineFunction &MF,
"Reserve the stack by the multiple of one vector size.");
MachineRegisterInfo &MRI = MF.getRegInfo();
- const RISCVInstrInfo *TII = MF.getSubtarget<RISCVSubtarget>().getInstrInfo();
int64_t NumOfVReg = Amount / 8;
Register VL = MRI.createVirtualRegister(&RISCV::GPRRegClass);
- BuildMI(MBB, II, DL, TII->get(RISCV::PseudoReadVLENB), VL)
+ BuildMI(MBB, II, DL, get(RISCV::PseudoReadVLENB), VL)
.setMIFlag(Flag);
assert(isInt<32>(NumOfVReg) &&
"Expect the number of vector registers within 32-bits.");
@@ -1774,29 +1773,29 @@ Register RISCVInstrInfo::getVLENFactoredAmount(MachineFunction &MF,
uint32_t ShiftAmount = Log2_32(NumOfVReg);
if (ShiftAmount == 0)
return VL;
- BuildMI(MBB, II, DL, TII->get(RISCV::SLLI), VL)
+ BuildMI(MBB, II, DL, get(RISCV::SLLI), VL)
.addReg(VL, RegState::Kill)
.addImm(ShiftAmount)
.setMIFlag(Flag);
} else if (isPowerOf2_32(NumOfVReg - 1)) {
Register ScaledRegister = MRI.createVirtualRegister(&RISCV::GPRRegClass);
uint32_t ShiftAmount = Log2_32(NumOfVReg - 1);
- BuildMI(MBB, II, DL, TII->get(RISCV::SLLI), ScaledRegister)
+ BuildMI(MBB, II, DL, get(RISCV::SLLI), ScaledRegister)
.addReg(VL)
.addImm(ShiftAmount)
.setMIFlag(Flag);
- BuildMI(MBB, II, DL, TII->get(RISCV::ADD), VL)
+ BuildMI(MBB, II, DL, get(RISCV::ADD), VL)
.addReg(ScaledRegister, RegState::Kill)
.addReg(VL, RegState::Kill)
.setMIFlag(Flag);
} else if (isPowerOf2_32(NumOfVReg + 1)) {
Register ScaledRegister = MRI.createVirtualRegister(&RISCV::GPRRegClass);
uint32_t ShiftAmount = Log2_32(NumOfVReg + 1);
- BuildMI(MBB, II, DL, TII->get(RISCV::SLLI), ScaledRegister)
+ BuildMI(MBB, II, DL, get(RISCV::SLLI), ScaledRegister)
.addReg(VL)
.addImm(ShiftAmount)
.setMIFlag(Flag);
- BuildMI(MBB, II, DL, TII->get(RISCV::SUB), VL)
+ BuildMI(MBB, II, DL, get(RISCV::SUB), VL)
.addReg(ScaledRegister, RegState::Kill)
.addReg(VL, RegState::Kill)
.setMIFlag(Flag);
@@ -1805,16 +1804,16 @@ Register RISCVInstrInfo::getVLENFactoredAmount(MachineFunction &MF,
if (!isInt<12>(NumOfVReg))
movImm(MBB, II, DL, N, NumOfVReg);
else {
- BuildMI(MBB, II, DL, TII->get(RISCV::ADDI), N)
+ BuildMI(MBB, II, DL, get(RISCV::ADDI), N)
.addReg(RISCV::X0)
.addImm(NumOfVReg)
.setMIFlag(Flag);
}
- if (!MF.getSubtarget<RISCVSubtarget>().hasStdExtM())
+ if (!STI.hasStdExtM())
MF.getFunction().getContext().diagnose(DiagnosticInfoUnsupported{
MF.getFunction(),
"M-extension must be enabled to calculate the vscaled size/offset."});
- BuildMI(MBB, II, DL, TII->get(RISCV::MUL), VL)
+ BuildMI(MBB, II, DL, get(RISCV::MUL), VL)
.addReg(VL, RegState::Kill)
.addReg(N, RegState::Kill)
.setMIFlag(Flag);
More information about the llvm-commits
mailing list