Skip to content

Commit

Permalink
[RISCV][GISEL] Add vector RegisterBanks and vector support in getRegB…
Browse files Browse the repository at this point in the history
…ankFromRegClass

Vector Register banks are created for the various register vector
register groupings. getRegBankFromRegClass is implemented to go from
vector TargetRegisterClass to the corresponding vector RegisterBank.
  • Loading branch information
michaelmaitland committed Nov 15, 2023
1 parent f219e03 commit dbd884c
Show file tree
Hide file tree
Showing 4 changed files with 1,277 additions and 3 deletions.
3 changes: 0 additions & 3 deletions llvm/lib/CodeGen/MachineVerifier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1966,9 +1966,6 @@ void MachineVerifier::visitMachineInstrBefore(const MachineInstr *MI) {
if (SrcReg.isVirtual() && DstReg.isPhysical() && SrcSize.isScalable() &&
!DstSize.isScalable())
break;
if (SrcReg.isVirtual() && DstReg.isPhysical() && SrcSize.isScalable() &&
!DstSize.isScalable())
break;

if (SrcSize.isNonZero() && DstSize.isNonZero() && SrcSize != DstSize) {
if (!DstOp.getSubReg() && !SrcOp.getSubReg()) {
Expand Down
14 changes: 14 additions & 0 deletions llvm/lib/Target/RISCV/GISel/RISCVRegisterBankInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,20 @@ RISCVRegisterBankInfo::getRegBankFromRegClass(const TargetRegisterClass &RC,
case RISCV::FPR64CRegClassID:
case RISCV::FPR32CRegClassID:
return getRegBank(RISCV::FPRBRegBankID);
case RISCV::VMRegClassID:
case RISCV::VRRegClassID:
case RISCV::VRNoV0RegClassID:
case RISCV::VRM2RegClassID:
case RISCV::VRM2NoV0RegClassID:
case RISCV::VRM4RegClassID:
case RISCV::VRM4NoV0RegClassID:
case RISCV::VMV0RegClassID:
case RISCV::VRM2_with_sub_vrm1_0_in_VMV0RegClassID:
case RISCV::VRM4_with_sub_vrm1_0_in_VMV0RegClassID:
case RISCV::VRM8RegClassID:
case RISCV::VRM8NoV0RegClassID:
case RISCV::VRM8_with_sub_vrm1_0_in_VMV0RegClassID:
return getRegBank(RISCV::VRBRegBankID);
}
}

Expand Down
4 changes: 4 additions & 0 deletions llvm/lib/Target/RISCV/GISel/RISCVRegisterBanks.td
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ def GPRBRegBank : RegisterBank<"GPRB", [GPR]>;

/// Floating Point Registers: F.
def FPRBRegBank : RegisterBank<"FPRB", [FPR64]>;

/// Vector Registers : V.
def VRBRegBank : RegisterBank<"VRB", [VRM8]>;

Loading

0 comments on commit dbd884c

Please sign in to comment.