Skip to content

Commit 4265733

Browse files
authored
[RISCV] Use RISCVRegisterInfo::isRVVRegClass to replace IsScalableVector in storeRegToStackSlot/loadRegFromStackSlot. NFC (#139979)
1 parent cd72777 commit 4265733

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

llvm/lib/Target/RISCV/RISCVInstrInfo.cpp

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -651,29 +651,21 @@ void RISCVInstrInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
651651
MachineFrameInfo &MFI = MF->getFrameInfo();
652652

653653
unsigned Opcode;
654-
bool IsScalableVector = true;
655654
if (RISCV::GPRRegClass.hasSubClassEq(RC)) {
656655
Opcode = TRI->getRegSizeInBits(RISCV::GPRRegClass) == 32 ?
657656
RISCV::SW : RISCV::SD;
658-
IsScalableVector = false;
659657
} else if (RISCV::GPRF16RegClass.hasSubClassEq(RC)) {
660658
Opcode = RISCV::SH_INX;
661-
IsScalableVector = false;
662659
} else if (RISCV::GPRF32RegClass.hasSubClassEq(RC)) {
663660
Opcode = RISCV::SW_INX;
664-
IsScalableVector = false;
665661
} else if (RISCV::GPRPairRegClass.hasSubClassEq(RC)) {
666662
Opcode = RISCV::PseudoRV32ZdinxSD;
667-
IsScalableVector = false;
668663
} else if (RISCV::FPR16RegClass.hasSubClassEq(RC)) {
669664
Opcode = RISCV::FSH;
670-
IsScalableVector = false;
671665
} else if (RISCV::FPR32RegClass.hasSubClassEq(RC)) {
672666
Opcode = RISCV::FSW;
673-
IsScalableVector = false;
674667
} else if (RISCV::FPR64RegClass.hasSubClassEq(RC)) {
675668
Opcode = RISCV::FSD;
676-
IsScalableVector = false;
677669
} else if (RISCV::VRRegClass.hasSubClassEq(RC)) {
678670
Opcode = RISCV::VS1R_V;
679671
} else if (RISCV::VRM2RegClass.hasSubClassEq(RC)) {
@@ -707,7 +699,7 @@ void RISCVInstrInfo::storeRegToStackSlot(MachineBasicBlock &MBB,
707699
else
708700
llvm_unreachable("Can't store this register to stack slot");
709701

710-
if (IsScalableVector) {
702+
if (RISCVRegisterInfo::isRVVRegClass(RC)) {
711703
MachineMemOperand *MMO = MF->getMachineMemOperand(
712704
MachinePointerInfo::getFixedStack(*MF, FI), MachineMemOperand::MOStore,
713705
TypeSize::getScalable(MFI.getObjectSize(FI)), MFI.getObjectAlign(FI));
@@ -743,29 +735,21 @@ void RISCVInstrInfo::loadRegFromStackSlot(
743735
Flags & MachineInstr::FrameDestroy ? MBB.findDebugLoc(I) : DebugLoc();
744736

745737
unsigned Opcode;
746-
bool IsScalableVector = true;
747738
if (RISCV::GPRRegClass.hasSubClassEq(RC)) {
748739
Opcode = TRI->getRegSizeInBits(RISCV::GPRRegClass) == 32 ?
749740
RISCV::LW : RISCV::LD;
750-
IsScalableVector = false;
751741
} else if (RISCV::GPRF16RegClass.hasSubClassEq(RC)) {
752742
Opcode = RISCV::LH_INX;
753-
IsScalableVector = false;
754743
} else if (RISCV::GPRF32RegClass.hasSubClassEq(RC)) {
755744
Opcode = RISCV::LW_INX;
756-
IsScalableVector = false;
757745
} else if (RISCV::GPRPairRegClass.hasSubClassEq(RC)) {
758746
Opcode = RISCV::PseudoRV32ZdinxLD;
759-
IsScalableVector = false;
760747
} else if (RISCV::FPR16RegClass.hasSubClassEq(RC)) {
761748
Opcode = RISCV::FLH;
762-
IsScalableVector = false;
763749
} else if (RISCV::FPR32RegClass.hasSubClassEq(RC)) {
764750
Opcode = RISCV::FLW;
765-
IsScalableVector = false;
766751
} else if (RISCV::FPR64RegClass.hasSubClassEq(RC)) {
767752
Opcode = RISCV::FLD;
768-
IsScalableVector = false;
769753
} else if (RISCV::VRRegClass.hasSubClassEq(RC)) {
770754
Opcode = RISCV::VL1RE8_V;
771755
} else if (RISCV::VRM2RegClass.hasSubClassEq(RC)) {
@@ -799,7 +783,7 @@ void RISCVInstrInfo::loadRegFromStackSlot(
799783
else
800784
llvm_unreachable("Can't load this register from stack slot");
801785

802-
if (IsScalableVector) {
786+
if (RISCVRegisterInfo::isRVVRegClass(RC)) {
803787
MachineMemOperand *MMO = MF->getMachineMemOperand(
804788
MachinePointerInfo::getFixedStack(*MF, FI), MachineMemOperand::MOLoad,
805789
TypeSize::getScalable(MFI.getObjectSize(FI)), MFI.getObjectAlign(FI));

0 commit comments

Comments
 (0)