[llvm] a67e989 - [RISCV] Add FallbackRegAltNameIndex to ABIRegAltName.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 22 10:13:57 PDT 2023
Author: Craig Topper
Date: 2023-03-22T10:11:00-07:00
New Revision: a67e989cd2a730ea778102f2a0d965daed0182bd
URL: https://github.com/llvm/llvm-project/commit/a67e989cd2a730ea778102f2a0d965daed0182bd
DIFF: https://github.com/llvm/llvm-project/commit/a67e989cd2a730ea778102f2a0d965daed0182bd.diff
LOG: [RISCV] Add FallbackRegAltNameIndex to ABIRegAltName.
Remove now redundant fake ABI names from vector registers.
This also fixes a crash that occurs if you use fflags as an instruction
operand in the assembly and use -debug. It's not a valid register
for any instruction since this wouldn't be common. It doesn't have
an ABI name so it crashes the register printing in the debug output.
Added:
Modified:
llvm/lib/Target/RISCV/RISCVRegisterInfo.td
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCVRegisterInfo.td b/llvm/lib/Target/RISCV/RISCVRegisterInfo.td
index 301f2ad77d00..7e91441e91f4 100644
--- a/llvm/lib/Target/RISCV/RISCVRegisterInfo.td
+++ b/llvm/lib/Target/RISCV/RISCVRegisterInfo.td
@@ -45,6 +45,7 @@ class RISCVReg64<RISCVReg32 subreg>
let SubRegIndices = [sub_32];
}
+let FallbackRegAltNameIndex = NoRegAltName in
def ABIRegAltName : RegAltNameIndex;
def sub_vrm4_0 : SubRegIndex<256>;
@@ -415,51 +416,46 @@ class VRegList<list<dag> LIn, int start, int nf, int lmul, bit isV0> {
}
// Vector registers
-let RegAltNameIndices = [ABIRegAltName] in {
- foreach Index = 0-31 in {
- def V#Index : RISCVReg<Index, "v"#Index, ["v"#Index]>, DwarfRegNum<[!add(Index, 96)]>;
- }
+foreach Index = 0-31 in {
+ def V#Index : RISCVReg<Index, "v"#Index>, DwarfRegNum<[!add(Index, 96)]>;
+}
- foreach Index = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22,
- 24, 26, 28, 30] in {
- def V#Index#M2 : RISCVRegWithSubRegs<Index, "v"#Index,
- [!cast<Register>("V"#Index),
- !cast<Register>("V"#!add(Index, 1))],
- ["v"#Index]>,
- DwarfRegAlias<!cast<Register>("V"#Index)> {
- let SubRegIndices = [sub_vrm1_0, sub_vrm1_1];
- }
+foreach Index = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22,
+ 24, 26, 28, 30] in {
+ def V#Index#M2 : RISCVRegWithSubRegs<Index, "v"#Index,
+ [!cast<Register>("V"#Index),
+ !cast<Register>("V"#!add(Index, 1))]>,
+ DwarfRegAlias<!cast<Register>("V"#Index)> {
+ let SubRegIndices = [sub_vrm1_0, sub_vrm1_1];
}
+}
- foreach Index = [0, 4, 8, 12, 16, 20, 24, 28] in {
- def V#Index#M4 : RISCVRegWithSubRegs<Index, "v"#Index,
- [!cast<Register>("V"#Index#"M2"),
- !cast<Register>("V"#!add(Index, 2)#"M2")],
- ["v"#Index]>,
- DwarfRegAlias<!cast<Register>("V"#Index)> {
- let SubRegIndices = [sub_vrm2_0, sub_vrm2_1];
- }
+foreach Index = [0, 4, 8, 12, 16, 20, 24, 28] in {
+ def V#Index#M4 : RISCVRegWithSubRegs<Index, "v"#Index,
+ [!cast<Register>("V"#Index#"M2"),
+ !cast<Register>("V"#!add(Index, 2)#"M2")]>,
+ DwarfRegAlias<!cast<Register>("V"#Index)> {
+ let SubRegIndices = [sub_vrm2_0, sub_vrm2_1];
}
+}
- foreach Index = [0, 8, 16, 24] in {
- def V#Index#M8 : RISCVRegWithSubRegs<Index, "v"#Index,
- [!cast<Register>("V"#Index#"M4"),
- !cast<Register>("V"#!add(Index, 4)#"M4")],
- ["v"#Index]>,
- DwarfRegAlias<!cast<Register>("V"#Index)> {
- let SubRegIndices = [sub_vrm4_0, sub_vrm4_1];
- }
+foreach Index = [0, 8, 16, 24] in {
+ def V#Index#M8 : RISCVRegWithSubRegs<Index, "v"#Index,
+ [!cast<Register>("V"#Index#"M4"),
+ !cast<Register>("V"#!add(Index, 4)#"M4")]>,
+ DwarfRegAlias<!cast<Register>("V"#Index)> {
+ let SubRegIndices = [sub_vrm4_0, sub_vrm4_1];
}
-
- def VTYPE : RISCVReg<0, "vtype", ["vtype"]>;
- def VL : RISCVReg<0, "vl", ["vl"]>;
- def VXSAT : RISCVReg<0, "vxsat", ["vxsat"]>;
- def VXRM : RISCVReg<0, "vxrm", ["vxrm"]>;
- let isConstant = true in
- def VLENB : RISCVReg<0, "vlenb", ["vlenb"]>,
- DwarfRegNum<[!add(4096, SysRegVLENB.Encoding)]>;
}
+def VTYPE : RISCVReg<0, "vtype">;
+def VL : RISCVReg<0, "vl">;
+def VXSAT : RISCVReg<0, "vxsat">;
+def VXRM : RISCVReg<0, "vxrm">;
+let isConstant = true in
+def VLENB : RISCVReg<0, "vlenb">,
+ DwarfRegNum<[!add(4096, SysRegVLENB.Encoding)]>;
+
def VCSR : RegisterClass<"RISCV", [XLenVT], 32,
(add VTYPE, VL, VLENB)> {
let RegInfos = XLenRI;
More information about the llvm-commits
mailing list