10b57cec5SDimitry Andric//===-- RISCVRegisterInfo.td - RISC-V Register defs --------*- tablegen -*-===// 20b57cec5SDimitry Andric// 30b57cec5SDimitry Andric// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric// See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric// 70b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric 90b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 100b57cec5SDimitry Andric// Declarations that describe the RISC-V register files 110b57cec5SDimitry Andric//===----------------------------------------------------------------------===// 120b57cec5SDimitry Andric 130b57cec5SDimitry Andriclet Namespace = "RISCV" in { 140b57cec5SDimitry Andricclass RISCVReg<bits<5> Enc, string n, list<string> alt = []> : Register<n> { 150b57cec5SDimitry Andric let HWEncoding{4-0} = Enc; 160b57cec5SDimitry Andric let AltNames = alt; 170b57cec5SDimitry Andric} 180b57cec5SDimitry Andric 19e8d8bef9SDimitry Andricclass RISCVReg16<bits<5> Enc, string n, list<string> alt = []> : Register<n> { 200b57cec5SDimitry Andric let HWEncoding{4-0} = Enc; 210b57cec5SDimitry Andric let AltNames = alt; 220b57cec5SDimitry Andric} 230b57cec5SDimitry Andric 24e8d8bef9SDimitry Andricdef sub_16 : SubRegIndex<16>; 25e8d8bef9SDimitry Andricclass RISCVReg32<RISCVReg16 subreg> : Register<""> { 26e8d8bef9SDimitry Andric let HWEncoding{4-0} = subreg.HWEncoding{4-0}; 27e8d8bef9SDimitry Andric let SubRegs = [subreg]; 28e8d8bef9SDimitry Andric let SubRegIndices = [sub_16]; 29e8d8bef9SDimitry Andric let AsmName = subreg.AsmName; 30e8d8bef9SDimitry Andric let AltNames = subreg.AltNames; 31e8d8bef9SDimitry Andric} 32e8d8bef9SDimitry Andric 330b57cec5SDimitry Andric// Because RISCVReg64 register have AsmName and AltNames that alias with their 34e8d8bef9SDimitry Andric// 16/32-bit sub-register, RISCVAsmParser will need to coerce a register number 35e8d8bef9SDimitry Andric// from a RISCVReg16/RISCVReg32 to the equivalent RISCVReg64 when appropriate. 360b57cec5SDimitry Andricdef sub_32 : SubRegIndex<32>; 370b57cec5SDimitry Andricclass RISCVReg64<RISCVReg32 subreg> : Register<""> { 380b57cec5SDimitry Andric let HWEncoding{4-0} = subreg.HWEncoding{4-0}; 390b57cec5SDimitry Andric let SubRegs = [subreg]; 400b57cec5SDimitry Andric let SubRegIndices = [sub_32]; 410b57cec5SDimitry Andric let AsmName = subreg.AsmName; 420b57cec5SDimitry Andric let AltNames = subreg.AltNames; 430b57cec5SDimitry Andric} 440b57cec5SDimitry Andric 455ffd83dbSDimitry Andricclass RISCVRegWithSubRegs<bits<5> Enc, string n, list<Register> subregs, 465ffd83dbSDimitry Andric list<string> alt = []> 475ffd83dbSDimitry Andric : RegisterWithSubRegs<n, subregs> { 485ffd83dbSDimitry Andric let HWEncoding{4-0} = Enc; 495ffd83dbSDimitry Andric let AltNames = alt; 505ffd83dbSDimitry Andric} 515ffd83dbSDimitry Andric 520b57cec5SDimitry Andricdef ABIRegAltName : RegAltNameIndex; 535ffd83dbSDimitry Andric 54fe6060f1SDimitry Andricdef sub_vrm4_0 : SubRegIndex<256>; 55fe6060f1SDimitry Andricdef sub_vrm4_1 : SubRegIndex<256, 256>; 56fe6060f1SDimitry Andricdef sub_vrm2_0 : SubRegIndex<128>; 57fe6060f1SDimitry Andricdef sub_vrm2_1 : SubRegIndex<128, 128>; 58fe6060f1SDimitry Andricdef sub_vrm2_2 : ComposedSubRegIndex<sub_vrm4_1, sub_vrm2_0>; 59fe6060f1SDimitry Andricdef sub_vrm2_3 : ComposedSubRegIndex<sub_vrm4_1, sub_vrm2_1>; 60fe6060f1SDimitry Andricdef sub_vrm1_0 : SubRegIndex<64>; 61fe6060f1SDimitry Andricdef sub_vrm1_1 : SubRegIndex<64, 64>; 62fe6060f1SDimitry Andricdef sub_vrm1_2 : ComposedSubRegIndex<sub_vrm2_1, sub_vrm1_0>; 63fe6060f1SDimitry Andricdef sub_vrm1_3 : ComposedSubRegIndex<sub_vrm2_1, sub_vrm1_1>; 64fe6060f1SDimitry Andricdef sub_vrm1_4 : ComposedSubRegIndex<sub_vrm2_2, sub_vrm1_0>; 65fe6060f1SDimitry Andricdef sub_vrm1_5 : ComposedSubRegIndex<sub_vrm2_2, sub_vrm1_1>; 66fe6060f1SDimitry Andricdef sub_vrm1_6 : ComposedSubRegIndex<sub_vrm2_3, sub_vrm1_0>; 67fe6060f1SDimitry Andricdef sub_vrm1_7 : ComposedSubRegIndex<sub_vrm2_3, sub_vrm1_1>; 68e8d8bef9SDimitry Andric 690b57cec5SDimitry Andric} // Namespace = "RISCV" 700b57cec5SDimitry Andric 710b57cec5SDimitry Andric// Integer registers 720b57cec5SDimitry Andric// CostPerUse is set higher for registers that may not be compressible as they 730b57cec5SDimitry Andric// are not part of GPRC, the most restrictive register class used by the 740b57cec5SDimitry Andric// compressed instruction set. This will influence the greedy register 750b57cec5SDimitry Andric// allocator to reduce the use of registers that can't be encoded in 16 bit 76*04eeddc0SDimitry Andric// instructions. 770b57cec5SDimitry Andric 780b57cec5SDimitry Andriclet RegAltNameIndices = [ABIRegAltName] in { 790b57cec5SDimitry Andric def X0 : RISCVReg<0, "x0", ["zero"]>, DwarfRegNum<[0]>; 80*04eeddc0SDimitry Andric let CostPerUse = [0, 1] in { 810b57cec5SDimitry Andric def X1 : RISCVReg<1, "x1", ["ra"]>, DwarfRegNum<[1]>; 820b57cec5SDimitry Andric def X2 : RISCVReg<2, "x2", ["sp"]>, DwarfRegNum<[2]>; 830b57cec5SDimitry Andric def X3 : RISCVReg<3, "x3", ["gp"]>, DwarfRegNum<[3]>; 840b57cec5SDimitry Andric def X4 : RISCVReg<4, "x4", ["tp"]>, DwarfRegNum<[4]>; 850b57cec5SDimitry Andric def X5 : RISCVReg<5, "x5", ["t0"]>, DwarfRegNum<[5]>; 860b57cec5SDimitry Andric def X6 : RISCVReg<6, "x6", ["t1"]>, DwarfRegNum<[6]>; 870b57cec5SDimitry Andric def X7 : RISCVReg<7, "x7", ["t2"]>, DwarfRegNum<[7]>; 880b57cec5SDimitry Andric } 890b57cec5SDimitry Andric def X8 : RISCVReg<8, "x8", ["s0", "fp"]>, DwarfRegNum<[8]>; 900b57cec5SDimitry Andric def X9 : RISCVReg<9, "x9", ["s1"]>, DwarfRegNum<[9]>; 910b57cec5SDimitry Andric def X10 : RISCVReg<10,"x10", ["a0"]>, DwarfRegNum<[10]>; 920b57cec5SDimitry Andric def X11 : RISCVReg<11,"x11", ["a1"]>, DwarfRegNum<[11]>; 930b57cec5SDimitry Andric def X12 : RISCVReg<12,"x12", ["a2"]>, DwarfRegNum<[12]>; 940b57cec5SDimitry Andric def X13 : RISCVReg<13,"x13", ["a3"]>, DwarfRegNum<[13]>; 950b57cec5SDimitry Andric def X14 : RISCVReg<14,"x14", ["a4"]>, DwarfRegNum<[14]>; 960b57cec5SDimitry Andric def X15 : RISCVReg<15,"x15", ["a5"]>, DwarfRegNum<[15]>; 97*04eeddc0SDimitry Andric let CostPerUse = [0, 1] in { 980b57cec5SDimitry Andric def X16 : RISCVReg<16,"x16", ["a6"]>, DwarfRegNum<[16]>; 990b57cec5SDimitry Andric def X17 : RISCVReg<17,"x17", ["a7"]>, DwarfRegNum<[17]>; 1000b57cec5SDimitry Andric def X18 : RISCVReg<18,"x18", ["s2"]>, DwarfRegNum<[18]>; 1010b57cec5SDimitry Andric def X19 : RISCVReg<19,"x19", ["s3"]>, DwarfRegNum<[19]>; 1020b57cec5SDimitry Andric def X20 : RISCVReg<20,"x20", ["s4"]>, DwarfRegNum<[20]>; 1030b57cec5SDimitry Andric def X21 : RISCVReg<21,"x21", ["s5"]>, DwarfRegNum<[21]>; 1040b57cec5SDimitry Andric def X22 : RISCVReg<22,"x22", ["s6"]>, DwarfRegNum<[22]>; 1050b57cec5SDimitry Andric def X23 : RISCVReg<23,"x23", ["s7"]>, DwarfRegNum<[23]>; 1060b57cec5SDimitry Andric def X24 : RISCVReg<24,"x24", ["s8"]>, DwarfRegNum<[24]>; 1070b57cec5SDimitry Andric def X25 : RISCVReg<25,"x25", ["s9"]>, DwarfRegNum<[25]>; 1080b57cec5SDimitry Andric def X26 : RISCVReg<26,"x26", ["s10"]>, DwarfRegNum<[26]>; 1090b57cec5SDimitry Andric def X27 : RISCVReg<27,"x27", ["s11"]>, DwarfRegNum<[27]>; 1100b57cec5SDimitry Andric def X28 : RISCVReg<28,"x28", ["t3"]>, DwarfRegNum<[28]>; 1110b57cec5SDimitry Andric def X29 : RISCVReg<29,"x29", ["t4"]>, DwarfRegNum<[29]>; 1120b57cec5SDimitry Andric def X30 : RISCVReg<30,"x30", ["t5"]>, DwarfRegNum<[30]>; 1130b57cec5SDimitry Andric def X31 : RISCVReg<31,"x31", ["t6"]>, DwarfRegNum<[31]>; 1140b57cec5SDimitry Andric } 1150b57cec5SDimitry Andric} 1160b57cec5SDimitry Andric 117e8d8bef9SDimitry Andricdef XLenVT : ValueTypeByHwMode<[RV32, RV64], 118e8d8bef9SDimitry Andric [i32, i64]>; 119fe6060f1SDimitry Andricdef XLenRI : RegInfoByHwMode< 120fe6060f1SDimitry Andric [RV32, RV64], 121fe6060f1SDimitry Andric [RegInfo<32,32,32>, RegInfo<64,64,64>]>; 1220b57cec5SDimitry Andric 1230b57cec5SDimitry Andric// The order of registers represents the preferred allocation sequence. 1240b57cec5SDimitry Andric// Registers are listed in the order caller-save, callee-save, specials. 1250b57cec5SDimitry Andricdef GPR : RegisterClass<"RISCV", [XLenVT], 32, (add 1260b57cec5SDimitry Andric (sequence "X%u", 10, 17), 1270b57cec5SDimitry Andric (sequence "X%u", 5, 7), 1280b57cec5SDimitry Andric (sequence "X%u", 28, 31), 1290b57cec5SDimitry Andric (sequence "X%u", 8, 9), 1300b57cec5SDimitry Andric (sequence "X%u", 18, 27), 1310b57cec5SDimitry Andric (sequence "X%u", 0, 4) 1320b57cec5SDimitry Andric )> { 133fe6060f1SDimitry Andric let RegInfos = XLenRI; 1340b57cec5SDimitry Andric} 1350b57cec5SDimitry Andric 1368bcb0991SDimitry Andricdef GPRX0 : RegisterClass<"RISCV", [XLenVT], 32, (add X0)> { 137fe6060f1SDimitry Andric let RegInfos = XLenRI; 1388bcb0991SDimitry Andric} 1398bcb0991SDimitry Andric 140*04eeddc0SDimitry Andricdef GPRNoX0 : RegisterClass<"RISCV", [XLenVT], 32, (sub GPR, X0)> { 141fe6060f1SDimitry Andric let RegInfos = XLenRI; 1420b57cec5SDimitry Andric} 1430b57cec5SDimitry Andric 144*04eeddc0SDimitry Andricdef GPRNoX0X2 : RegisterClass<"RISCV", [XLenVT], 32, (sub GPR, X0, X2)> { 145fe6060f1SDimitry Andric let RegInfos = XLenRI; 146fe6060f1SDimitry Andric} 147fe6060f1SDimitry Andric 148fe6060f1SDimitry Andric// Don't use X1 or X5 for JALR since that is a hint to pop the return address 149fe6060f1SDimitry Andric// stack on some microarchitectures. Also remove the reserved registers X0, X2, 150fe6060f1SDimitry Andric// X3, and X4 as it reduces the number of register classes that get synthesized 151fe6060f1SDimitry Andric// by tablegen. 152*04eeddc0SDimitry Andricdef GPRJALR : RegisterClass<"RISCV", [XLenVT], 32, (sub GPR, (sequence "X%u", 0, 5))> { 153fe6060f1SDimitry Andric let RegInfos = XLenRI; 1540b57cec5SDimitry Andric} 1550b57cec5SDimitry Andric 1560b57cec5SDimitry Andricdef GPRC : RegisterClass<"RISCV", [XLenVT], 32, (add 1570b57cec5SDimitry Andric (sequence "X%u", 10, 15), 1580b57cec5SDimitry Andric (sequence "X%u", 8, 9) 1590b57cec5SDimitry Andric )> { 160fe6060f1SDimitry Andric let RegInfos = XLenRI; 1610b57cec5SDimitry Andric} 1620b57cec5SDimitry Andric 1630b57cec5SDimitry Andric// For indirect tail calls, we can't use callee-saved registers, as they are 1640b57cec5SDimitry Andric// restored to the saved value before the tail call, which would clobber a call 165fe6060f1SDimitry Andric// address. We shouldn't use x5 since that is a hint for to pop the return 166fe6060f1SDimitry Andric// address stack on some microarchitectures. 1670b57cec5SDimitry Andricdef GPRTC : RegisterClass<"RISCV", [XLenVT], 32, (add 168fe6060f1SDimitry Andric (sequence "X%u", 6, 7), 1690b57cec5SDimitry Andric (sequence "X%u", 10, 17), 1700b57cec5SDimitry Andric (sequence "X%u", 28, 31) 1710b57cec5SDimitry Andric )> { 172fe6060f1SDimitry Andric let RegInfos = XLenRI; 1730b57cec5SDimitry Andric} 1740b57cec5SDimitry Andric 1750b57cec5SDimitry Andricdef SP : RegisterClass<"RISCV", [XLenVT], 32, (add X2)> { 176fe6060f1SDimitry Andric let RegInfos = XLenRI; 1770b57cec5SDimitry Andric} 1780b57cec5SDimitry Andric 1790b57cec5SDimitry Andric// Floating point registers 1800b57cec5SDimitry Andriclet RegAltNameIndices = [ABIRegAltName] in { 181e8d8bef9SDimitry Andric def F0_H : RISCVReg16<0, "f0", ["ft0"]>, DwarfRegNum<[32]>; 182e8d8bef9SDimitry Andric def F1_H : RISCVReg16<1, "f1", ["ft1"]>, DwarfRegNum<[33]>; 183e8d8bef9SDimitry Andric def F2_H : RISCVReg16<2, "f2", ["ft2"]>, DwarfRegNum<[34]>; 184e8d8bef9SDimitry Andric def F3_H : RISCVReg16<3, "f3", ["ft3"]>, DwarfRegNum<[35]>; 185e8d8bef9SDimitry Andric def F4_H : RISCVReg16<4, "f4", ["ft4"]>, DwarfRegNum<[36]>; 186e8d8bef9SDimitry Andric def F5_H : RISCVReg16<5, "f5", ["ft5"]>, DwarfRegNum<[37]>; 187e8d8bef9SDimitry Andric def F6_H : RISCVReg16<6, "f6", ["ft6"]>, DwarfRegNum<[38]>; 188e8d8bef9SDimitry Andric def F7_H : RISCVReg16<7, "f7", ["ft7"]>, DwarfRegNum<[39]>; 189e8d8bef9SDimitry Andric def F8_H : RISCVReg16<8, "f8", ["fs0"]>, DwarfRegNum<[40]>; 190e8d8bef9SDimitry Andric def F9_H : RISCVReg16<9, "f9", ["fs1"]>, DwarfRegNum<[41]>; 191e8d8bef9SDimitry Andric def F10_H : RISCVReg16<10,"f10", ["fa0"]>, DwarfRegNum<[42]>; 192e8d8bef9SDimitry Andric def F11_H : RISCVReg16<11,"f11", ["fa1"]>, DwarfRegNum<[43]>; 193e8d8bef9SDimitry Andric def F12_H : RISCVReg16<12,"f12", ["fa2"]>, DwarfRegNum<[44]>; 194e8d8bef9SDimitry Andric def F13_H : RISCVReg16<13,"f13", ["fa3"]>, DwarfRegNum<[45]>; 195e8d8bef9SDimitry Andric def F14_H : RISCVReg16<14,"f14", ["fa4"]>, DwarfRegNum<[46]>; 196e8d8bef9SDimitry Andric def F15_H : RISCVReg16<15,"f15", ["fa5"]>, DwarfRegNum<[47]>; 197e8d8bef9SDimitry Andric def F16_H : RISCVReg16<16,"f16", ["fa6"]>, DwarfRegNum<[48]>; 198e8d8bef9SDimitry Andric def F17_H : RISCVReg16<17,"f17", ["fa7"]>, DwarfRegNum<[49]>; 199e8d8bef9SDimitry Andric def F18_H : RISCVReg16<18,"f18", ["fs2"]>, DwarfRegNum<[50]>; 200e8d8bef9SDimitry Andric def F19_H : RISCVReg16<19,"f19", ["fs3"]>, DwarfRegNum<[51]>; 201e8d8bef9SDimitry Andric def F20_H : RISCVReg16<20,"f20", ["fs4"]>, DwarfRegNum<[52]>; 202e8d8bef9SDimitry Andric def F21_H : RISCVReg16<21,"f21", ["fs5"]>, DwarfRegNum<[53]>; 203e8d8bef9SDimitry Andric def F22_H : RISCVReg16<22,"f22", ["fs6"]>, DwarfRegNum<[54]>; 204e8d8bef9SDimitry Andric def F23_H : RISCVReg16<23,"f23", ["fs7"]>, DwarfRegNum<[55]>; 205e8d8bef9SDimitry Andric def F24_H : RISCVReg16<24,"f24", ["fs8"]>, DwarfRegNum<[56]>; 206e8d8bef9SDimitry Andric def F25_H : RISCVReg16<25,"f25", ["fs9"]>, DwarfRegNum<[57]>; 207e8d8bef9SDimitry Andric def F26_H : RISCVReg16<26,"f26", ["fs10"]>, DwarfRegNum<[58]>; 208e8d8bef9SDimitry Andric def F27_H : RISCVReg16<27,"f27", ["fs11"]>, DwarfRegNum<[59]>; 209e8d8bef9SDimitry Andric def F28_H : RISCVReg16<28,"f28", ["ft8"]>, DwarfRegNum<[60]>; 210e8d8bef9SDimitry Andric def F29_H : RISCVReg16<29,"f29", ["ft9"]>, DwarfRegNum<[61]>; 211e8d8bef9SDimitry Andric def F30_H : RISCVReg16<30,"f30", ["ft10"]>, DwarfRegNum<[62]>; 212e8d8bef9SDimitry Andric def F31_H : RISCVReg16<31,"f31", ["ft11"]>, DwarfRegNum<[63]>; 213e8d8bef9SDimitry Andric 214e8d8bef9SDimitry Andric foreach Index = 0-31 in { 215e8d8bef9SDimitry Andric def F#Index#_F : RISCVReg32<!cast<RISCVReg16>("F"#Index#"_H")>, 216e8d8bef9SDimitry Andric DwarfRegNum<[!add(Index, 32)]>; 217e8d8bef9SDimitry Andric } 2180b57cec5SDimitry Andric 2190b57cec5SDimitry Andric foreach Index = 0-31 in { 2208bcb0991SDimitry Andric def F#Index#_D : RISCVReg64<!cast<RISCVReg32>("F"#Index#"_F")>, 2210b57cec5SDimitry Andric DwarfRegNum<[!add(Index, 32)]>; 2220b57cec5SDimitry Andric } 2230b57cec5SDimitry Andric} 2240b57cec5SDimitry Andric 2250b57cec5SDimitry Andric// The order of registers represents the preferred allocation sequence, 2260b57cec5SDimitry Andric// meaning caller-save regs are listed before callee-save. 227e8d8bef9SDimitry Andricdef FPR16 : RegisterClass<"RISCV", [f16], 16, (add 228e8d8bef9SDimitry Andric (sequence "F%u_H", 0, 7), 229e8d8bef9SDimitry Andric (sequence "F%u_H", 10, 17), 230e8d8bef9SDimitry Andric (sequence "F%u_H", 28, 31), 231e8d8bef9SDimitry Andric (sequence "F%u_H", 8, 9), 232e8d8bef9SDimitry Andric (sequence "F%u_H", 18, 27) 233e8d8bef9SDimitry Andric)>; 234e8d8bef9SDimitry Andric 2350b57cec5SDimitry Andricdef FPR32 : RegisterClass<"RISCV", [f32], 32, (add 2368bcb0991SDimitry Andric (sequence "F%u_F", 0, 7), 2378bcb0991SDimitry Andric (sequence "F%u_F", 10, 17), 2388bcb0991SDimitry Andric (sequence "F%u_F", 28, 31), 2398bcb0991SDimitry Andric (sequence "F%u_F", 8, 9), 2408bcb0991SDimitry Andric (sequence "F%u_F", 18, 27) 2410b57cec5SDimitry Andric)>; 2420b57cec5SDimitry Andric 2430b57cec5SDimitry Andricdef FPR32C : RegisterClass<"RISCV", [f32], 32, (add 2448bcb0991SDimitry Andric (sequence "F%u_F", 10, 15), 2458bcb0991SDimitry Andric (sequence "F%u_F", 8, 9) 2460b57cec5SDimitry Andric)>; 2470b57cec5SDimitry Andric 2480b57cec5SDimitry Andric// The order of registers represents the preferred allocation sequence, 2490b57cec5SDimitry Andric// meaning caller-save regs are listed before callee-save. 2500b57cec5SDimitry Andricdef FPR64 : RegisterClass<"RISCV", [f64], 64, (add 2518bcb0991SDimitry Andric (sequence "F%u_D", 0, 7), 2528bcb0991SDimitry Andric (sequence "F%u_D", 10, 17), 2538bcb0991SDimitry Andric (sequence "F%u_D", 28, 31), 2548bcb0991SDimitry Andric (sequence "F%u_D", 8, 9), 2558bcb0991SDimitry Andric (sequence "F%u_D", 18, 27) 2560b57cec5SDimitry Andric)>; 2570b57cec5SDimitry Andric 2580b57cec5SDimitry Andricdef FPR64C : RegisterClass<"RISCV", [f64], 64, (add 2598bcb0991SDimitry Andric (sequence "F%u_D", 10, 15), 2608bcb0991SDimitry Andric (sequence "F%u_D", 8, 9) 2610b57cec5SDimitry Andric)>; 2625ffd83dbSDimitry Andric 263e8d8bef9SDimitry Andric// Vector type mapping to LLVM types. 264e8d8bef9SDimitry Andric// 265fe6060f1SDimitry Andric// The V vector extension requires that VLEN >= 128 and <= 65536. 266e8d8bef9SDimitry Andric// Additionally, the only supported ELEN values are 32 and 64, 267e8d8bef9SDimitry Andric// thus `vscale` can be defined as VLEN/64, 268e8d8bef9SDimitry Andric// allowing the same types with either ELEN value. 269e8d8bef9SDimitry Andric// 270e8d8bef9SDimitry Andric// MF8 MF4 MF2 M1 M2 M4 M8 271e8d8bef9SDimitry Andric// i64* N/A N/A N/A nxv1i64 nxv2i64 nxv4i64 nxv8i64 272e8d8bef9SDimitry Andric// i32 N/A N/A nxv1i32 nxv2i32 nxv4i32 nxv8i32 nxv16i32 273e8d8bef9SDimitry Andric// i16 N/A nxv1i16 nxv2i16 nxv4i16 nxv8i16 nxv16i16 nxv32i16 274e8d8bef9SDimitry Andric// i8 nxv1i8 nxv2i8 nxv4i8 nxv8i8 nxv16i8 nxv32i8 nxv64i8 275e8d8bef9SDimitry Andric// double* N/A N/A N/A nxv1f64 nxv2f64 nxv4f64 nxv8f64 276e8d8bef9SDimitry Andric// float N/A N/A nxv1f32 nxv2f32 nxv4f32 nxv8f32 nxv16f32 277e8d8bef9SDimitry Andric// half N/A nxv1f16 nxv2f16 nxv4f16 nxv8f16 nxv16f16 nxv32f16 278e8d8bef9SDimitry Andric// * ELEN=64 279e8d8bef9SDimitry Andric 280e8d8bef9SDimitry Andricdefvar vint8mf8_t = nxv1i8; 281e8d8bef9SDimitry Andricdefvar vint8mf4_t = nxv2i8; 282e8d8bef9SDimitry Andricdefvar vint8mf2_t = nxv4i8; 283e8d8bef9SDimitry Andricdefvar vint8m1_t = nxv8i8; 284e8d8bef9SDimitry Andricdefvar vint8m2_t = nxv16i8; 285e8d8bef9SDimitry Andricdefvar vint8m4_t = nxv32i8; 286e8d8bef9SDimitry Andricdefvar vint8m8_t = nxv64i8; 287e8d8bef9SDimitry Andric 288e8d8bef9SDimitry Andricdefvar vint16mf4_t = nxv1i16; 289e8d8bef9SDimitry Andricdefvar vint16mf2_t = nxv2i16; 290e8d8bef9SDimitry Andricdefvar vint16m1_t = nxv4i16; 291e8d8bef9SDimitry Andricdefvar vint16m2_t = nxv8i16; 292e8d8bef9SDimitry Andricdefvar vint16m4_t = nxv16i16; 293e8d8bef9SDimitry Andricdefvar vint16m8_t = nxv32i16; 294e8d8bef9SDimitry Andric 295e8d8bef9SDimitry Andricdefvar vint32mf2_t = nxv1i32; 296e8d8bef9SDimitry Andricdefvar vint32m1_t = nxv2i32; 297e8d8bef9SDimitry Andricdefvar vint32m2_t = nxv4i32; 298e8d8bef9SDimitry Andricdefvar vint32m4_t = nxv8i32; 299e8d8bef9SDimitry Andricdefvar vint32m8_t = nxv16i32; 300e8d8bef9SDimitry Andric 301e8d8bef9SDimitry Andricdefvar vint64m1_t = nxv1i64; 302e8d8bef9SDimitry Andricdefvar vint64m2_t = nxv2i64; 303e8d8bef9SDimitry Andricdefvar vint64m4_t = nxv4i64; 304e8d8bef9SDimitry Andricdefvar vint64m8_t = nxv8i64; 305e8d8bef9SDimitry Andric 306e8d8bef9SDimitry Andricdefvar vfloat16mf4_t = nxv1f16; 307e8d8bef9SDimitry Andricdefvar vfloat16mf2_t = nxv2f16; 308e8d8bef9SDimitry Andricdefvar vfloat16m1_t = nxv4f16; 309e8d8bef9SDimitry Andricdefvar vfloat16m2_t = nxv8f16; 310e8d8bef9SDimitry Andricdefvar vfloat16m4_t = nxv16f16; 311e8d8bef9SDimitry Andricdefvar vfloat16m8_t = nxv32f16; 312e8d8bef9SDimitry Andric 313e8d8bef9SDimitry Andricdefvar vfloat32mf2_t = nxv1f32; 314e8d8bef9SDimitry Andricdefvar vfloat32m1_t = nxv2f32; 315e8d8bef9SDimitry Andricdefvar vfloat32m2_t = nxv4f32; 316e8d8bef9SDimitry Andricdefvar vfloat32m4_t = nxv8f32; 317e8d8bef9SDimitry Andricdefvar vfloat32m8_t = nxv16f32; 318e8d8bef9SDimitry Andric 319e8d8bef9SDimitry Andricdefvar vfloat64m1_t = nxv1f64; 320e8d8bef9SDimitry Andricdefvar vfloat64m2_t = nxv2f64; 321e8d8bef9SDimitry Andricdefvar vfloat64m4_t = nxv4f64; 322e8d8bef9SDimitry Andricdefvar vfloat64m8_t = nxv8f64; 323e8d8bef9SDimitry Andric 324e8d8bef9SDimitry Andricdefvar vbool1_t = nxv64i1; 325e8d8bef9SDimitry Andricdefvar vbool2_t = nxv32i1; 326e8d8bef9SDimitry Andricdefvar vbool4_t = nxv16i1; 327e8d8bef9SDimitry Andricdefvar vbool8_t = nxv8i1; 328e8d8bef9SDimitry Andricdefvar vbool16_t = nxv4i1; 329e8d8bef9SDimitry Andricdefvar vbool32_t = nxv2i1; 330e8d8bef9SDimitry Andricdefvar vbool64_t = nxv1i1; 331e8d8bef9SDimitry Andric 332e8d8bef9SDimitry Andric// There is no need to define register classes for fractional LMUL. 333e8d8bef9SDimitry Andricdef LMULList { 334e8d8bef9SDimitry Andric list<int> m = [1, 2, 4, 8]; 335e8d8bef9SDimitry Andric} 336e8d8bef9SDimitry Andric 337e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 338e8d8bef9SDimitry Andric// Utility classes for segment load/store. 339e8d8bef9SDimitry Andric//===----------------------------------------------------------------------===// 340e8d8bef9SDimitry Andric// The set of legal NF for LMUL = lmul. 341e8d8bef9SDimitry Andric// LMUL == 1, NF = 2, 3, 4, 5, 6, 7, 8 342e8d8bef9SDimitry Andric// LMUL == 2, NF = 2, 3, 4 343e8d8bef9SDimitry Andric// LMUL == 4, NF = 2 344e8d8bef9SDimitry Andricclass NFList<int lmul> { 345e8d8bef9SDimitry Andric list<int> L = !cond(!eq(lmul, 1): [2, 3, 4, 5, 6, 7, 8], 346e8d8bef9SDimitry Andric !eq(lmul, 2): [2, 3, 4], 347e8d8bef9SDimitry Andric !eq(lmul, 4): [2], 348e8d8bef9SDimitry Andric !eq(lmul, 8): []); 349e8d8bef9SDimitry Andric} 350e8d8bef9SDimitry Andric 351e8d8bef9SDimitry Andric// Generate [start, end) SubRegIndex list. 352349cc55cSDimitry Andricclass SubRegSet<int nf, int lmul> { 353e8d8bef9SDimitry Andric list<SubRegIndex> L = !foldl([]<SubRegIndex>, 354e8d8bef9SDimitry Andric [0, 1, 2, 3, 4, 5, 6, 7], 355e8d8bef9SDimitry Andric AccList, i, 356e8d8bef9SDimitry Andric !listconcat(AccList, 357e8d8bef9SDimitry Andric !if(!lt(i, nf), 358e8d8bef9SDimitry Andric [!cast<SubRegIndex>("sub_vrm" # lmul # "_" # i)], 359e8d8bef9SDimitry Andric []))); 360e8d8bef9SDimitry Andric} 361e8d8bef9SDimitry Andric 362349cc55cSDimitry Andric// Collect the valid indexes into 'R' under NF and LMUL values from TUPLE_INDEX. 363349cc55cSDimitry Andric// When NF = 2, the valid TUPLE_INDEX is 0 and 1. 364349cc55cSDimitry Andric// For example, when LMUL = 4, the potential valid indexes is 365349cc55cSDimitry Andric// [8, 12, 16, 20, 24, 28, 4]. However, not all these indexes are valid under 366349cc55cSDimitry Andric// NF = 2. For example, 28 is not valid under LMUL = 4, NF = 2 and TUPLE_INDEX = 0. 367349cc55cSDimitry Andric// The filter is 368349cc55cSDimitry Andric// (tuple_index + i) x lmul <= (tuple_index x lmul) + 32 - (nf x lmul) 369349cc55cSDimitry Andric// 370349cc55cSDimitry Andric// Use START = 0, LMUL = 4 and NF = 2 as the example, 371349cc55cSDimitry Andric// i x 4 <= 24 372349cc55cSDimitry Andric// The class will return [8, 12, 16, 20, 24, 4]. 373349cc55cSDimitry Andric// Use START = 1, LMUL = 4 and NF = 2 as the example, 374349cc55cSDimitry Andric// (1 + i) x 4 <= 28 375349cc55cSDimitry Andric// The class will return [12, 16, 20, 24, 28, 8]. 376349cc55cSDimitry Andric// 377349cc55cSDimitry Andricclass IndexSet<int tuple_index, int nf, int lmul, bit isV0 = false> { 378e8d8bef9SDimitry Andric list<int> R = 379e8d8bef9SDimitry Andric !foldl([]<int>, 380349cc55cSDimitry Andric !if(isV0, [0], 381349cc55cSDimitry Andric !cond( 382349cc55cSDimitry Andric !eq(lmul, 1): 383349cc55cSDimitry Andric [8, 9, 10, 11, 12, 13, 14, 15, 384349cc55cSDimitry Andric 16, 17, 18, 19, 20, 21, 22, 23, 385349cc55cSDimitry Andric 24, 25, 26, 27, 28, 29, 30, 31, 386349cc55cSDimitry Andric 1, 2, 3, 4, 5, 6, 7], 387349cc55cSDimitry Andric !eq(lmul, 2): 388349cc55cSDimitry Andric [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 1, 2, 3], 389349cc55cSDimitry Andric !eq(lmul, 4): 390349cc55cSDimitry Andric [2, 3, 4, 5, 6, 7, 1])), 391e8d8bef9SDimitry Andric L, i, 392e8d8bef9SDimitry Andric !listconcat(L, 393349cc55cSDimitry Andric !if(!le(!mul(!add(i, tuple_index), lmul), 394349cc55cSDimitry Andric !sub(!add(32, !mul(tuple_index, lmul)), !mul(nf, lmul))), 395349cc55cSDimitry Andric [!mul(!add(i, tuple_index), lmul)], []))); 396e8d8bef9SDimitry Andric} 397e8d8bef9SDimitry Andric 398349cc55cSDimitry Andric// This class returns a list of vector register collections. 399349cc55cSDimitry Andric// For example, for NF = 2 and LMUL = 4, 400349cc55cSDimitry Andric// it will return 401349cc55cSDimitry Andric// ([ V8M4, V12M4, V16M4, V20M4, V24M4, V4M4], 402349cc55cSDimitry Andric// [V12M4, V16M4, V20M4, V24M4, V28M4, V8M4]) 403349cc55cSDimitry Andric// 404349cc55cSDimitry Andricclass VRegList<list<dag> LIn, int start, int nf, int lmul, bit isV0> { 405e8d8bef9SDimitry Andric list<dag> L = 406e8d8bef9SDimitry Andric !if(!ge(start, nf), 407e8d8bef9SDimitry Andric LIn, 408e8d8bef9SDimitry Andric !listconcat( 409e8d8bef9SDimitry Andric [!dag(add, 410349cc55cSDimitry Andric !foreach(i, IndexSet<start, nf, lmul, isV0>.R, 411e8d8bef9SDimitry Andric !cast<Register>("V" # i # !cond(!eq(lmul, 2): "M2", 412e8d8bef9SDimitry Andric !eq(lmul, 4): "M4", 413e8d8bef9SDimitry Andric true: ""))), 414fe6060f1SDimitry Andric !listsplat("", 415349cc55cSDimitry Andric !size(IndexSet<start, nf, lmul, isV0>.R)))], 416349cc55cSDimitry Andric VRegList<LIn, !add(start, 1), nf, lmul, isV0>.L)); 417e8d8bef9SDimitry Andric} 418e8d8bef9SDimitry Andric 4195ffd83dbSDimitry Andric// Vector registers 4205ffd83dbSDimitry Andriclet RegAltNameIndices = [ABIRegAltName] in { 4215ffd83dbSDimitry Andric foreach Index = 0-31 in { 422e8d8bef9SDimitry Andric def V#Index : RISCVReg<Index, "v"#Index, ["v"#Index]>, DwarfRegNum<[!add(Index, 96)]>; 4235ffd83dbSDimitry Andric } 4245ffd83dbSDimitry Andric 4255ffd83dbSDimitry Andric foreach Index = [0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 4265ffd83dbSDimitry Andric 24, 26, 28, 30] in { 4275ffd83dbSDimitry Andric def V#Index#M2 : RISCVRegWithSubRegs<Index, "v"#Index, 4285ffd83dbSDimitry Andric [!cast<Register>("V"#Index), 4295ffd83dbSDimitry Andric !cast<Register>("V"#!add(Index, 1))], 4305ffd83dbSDimitry Andric ["v"#Index]>, 4315ffd83dbSDimitry Andric DwarfRegAlias<!cast<Register>("V"#Index)> { 432e8d8bef9SDimitry Andric let SubRegIndices = [sub_vrm1_0, sub_vrm1_1]; 4335ffd83dbSDimitry Andric } 4345ffd83dbSDimitry Andric } 4355ffd83dbSDimitry Andric 4365ffd83dbSDimitry Andric foreach Index = [0, 4, 8, 12, 16, 20, 24, 28] in { 4375ffd83dbSDimitry Andric def V#Index#M4 : RISCVRegWithSubRegs<Index, "v"#Index, 4385ffd83dbSDimitry Andric [!cast<Register>("V"#Index#"M2"), 4395ffd83dbSDimitry Andric !cast<Register>("V"#!add(Index, 2)#"M2")], 4405ffd83dbSDimitry Andric ["v"#Index]>, 4415ffd83dbSDimitry Andric DwarfRegAlias<!cast<Register>("V"#Index)> { 442e8d8bef9SDimitry Andric let SubRegIndices = [sub_vrm2_0, sub_vrm2_1]; 4435ffd83dbSDimitry Andric } 4445ffd83dbSDimitry Andric } 4455ffd83dbSDimitry Andric 4465ffd83dbSDimitry Andric foreach Index = [0, 8, 16, 24] in { 4475ffd83dbSDimitry Andric def V#Index#M8 : RISCVRegWithSubRegs<Index, "v"#Index, 4485ffd83dbSDimitry Andric [!cast<Register>("V"#Index#"M4"), 4495ffd83dbSDimitry Andric !cast<Register>("V"#!add(Index, 4)#"M4")], 4505ffd83dbSDimitry Andric ["v"#Index]>, 4515ffd83dbSDimitry Andric DwarfRegAlias<!cast<Register>("V"#Index)> { 452e8d8bef9SDimitry Andric let SubRegIndices = [sub_vrm4_0, sub_vrm4_1]; 4535ffd83dbSDimitry Andric } 4545ffd83dbSDimitry Andric } 4555ffd83dbSDimitry Andric 4565ffd83dbSDimitry Andric def VTYPE : RISCVReg<0, "vtype", ["vtype"]>; 4575ffd83dbSDimitry Andric def VL : RISCVReg<0, "vl", ["vl"]>; 458e8d8bef9SDimitry Andric def VXSAT : RISCVReg<0, "vxsat", ["vxsat"]>; 459e8d8bef9SDimitry Andric def VXRM : RISCVReg<0, "vxrm", ["vxrm"]>; 4604824e7fdSDimitry Andric def VLENB : RISCVReg<0, "vlenb", ["vlenb"]>, 4614824e7fdSDimitry Andric DwarfRegNum<[!add(4096, SysRegVLENB.Encoding)]>; 4625ffd83dbSDimitry Andric} 4635ffd83dbSDimitry Andric 464e8d8bef9SDimitry Andricforeach m = [1, 2, 4] in { 465e8d8bef9SDimitry Andric foreach n = NFList<m>.L in { 466fe6060f1SDimitry Andric def "VN" # n # "M" # m # "NoV0": RegisterTuples< 467349cc55cSDimitry Andric SubRegSet<n, m>.L, 468349cc55cSDimitry Andric VRegList<[], 0, n, m, false>.L>; 469fe6060f1SDimitry Andric def "VN" # n # "M" # m # "V0" : RegisterTuples< 470349cc55cSDimitry Andric SubRegSet<n, m>.L, 471349cc55cSDimitry Andric VRegList<[], 0, n, m, true>.L>; 472e8d8bef9SDimitry Andric } 4735ffd83dbSDimitry Andric} 4745ffd83dbSDimitry Andric 475e8d8bef9SDimitry Andricclass VReg<list<ValueType> regTypes, dag regList, int Vlmul> 476e8d8bef9SDimitry Andric : RegisterClass<"RISCV", 477e8d8bef9SDimitry Andric regTypes, 478e8d8bef9SDimitry Andric 64, // The maximum supported ELEN is 64. 479e8d8bef9SDimitry Andric regList> { 480e8d8bef9SDimitry Andric int VLMul = Vlmul; 481e8d8bef9SDimitry Andric int Size = !mul(Vlmul, 64); 482e8d8bef9SDimitry Andric} 483e8d8bef9SDimitry Andric 484fe6060f1SDimitry Andricdef VR : VReg<[vint8m1_t, vint16m1_t, vint32m1_t, vint64m1_t, 485fe6060f1SDimitry Andric vfloat16m1_t, vfloat32m1_t, vfloat64m1_t, 486fe6060f1SDimitry Andric vint8mf2_t, vint8mf4_t, vint8mf8_t, 487e8d8bef9SDimitry Andric vint16mf2_t, vint16mf4_t, vint32mf2_t, 488fe6060f1SDimitry Andric vfloat16mf4_t, vfloat16mf2_t, vfloat32mf2_t, 489e8d8bef9SDimitry Andric vbool64_t, vbool32_t, vbool16_t, vbool8_t, vbool4_t, 490e8d8bef9SDimitry Andric vbool2_t, vbool1_t], 491349cc55cSDimitry Andric (add (sequence "V%u", 8, 31), 492e8d8bef9SDimitry Andric (sequence "V%u", 0, 7)), 1>; 4935ffd83dbSDimitry Andric 494fe6060f1SDimitry Andricdef VRNoV0 : VReg<[vint8m1_t, vint16m1_t, vint32m1_t, vint64m1_t, 495fe6060f1SDimitry Andric vfloat16m1_t, vfloat32m1_t, vfloat64m1_t, 496fe6060f1SDimitry Andric vint8mf2_t, vint8mf4_t, vint8mf8_t, 497e8d8bef9SDimitry Andric vint16mf2_t, vint16mf4_t, vint32mf2_t, 498fe6060f1SDimitry Andric vfloat16mf4_t, vfloat16mf2_t, vfloat32mf2_t, 499e8d8bef9SDimitry Andric vbool64_t, vbool32_t, vbool16_t, vbool8_t, vbool4_t, 500e8d8bef9SDimitry Andric vbool2_t, vbool1_t], 501349cc55cSDimitry Andric (add (sequence "V%u", 8, 31), 502e8d8bef9SDimitry Andric (sequence "V%u", 1, 7)), 1>; 503e8d8bef9SDimitry Andric 504e8d8bef9SDimitry Andricdef VRM2 : VReg<[vint8m2_t, vint16m2_t, vint32m2_t, vint64m2_t, 505e8d8bef9SDimitry Andric vfloat16m2_t, vfloat32m2_t, vfloat64m2_t], 506349cc55cSDimitry Andric (add (sequence "V%uM2", 8, 31, 2), 507349cc55cSDimitry Andric (sequence "V%uM2", 0, 7, 2)), 2>; 5085ffd83dbSDimitry Andric 509e8d8bef9SDimitry Andricdef VRM2NoV0 : VReg<[vint8m2_t, vint16m2_t, vint32m2_t, vint64m2_t, 510e8d8bef9SDimitry Andric vfloat16m2_t, vfloat32m2_t, vfloat64m2_t], 511349cc55cSDimitry Andric (add (sequence "V%uM2", 8, 31, 2), 512349cc55cSDimitry Andric (sequence "V%uM2", 2, 7, 2)), 2>; 5135ffd83dbSDimitry Andric 514e8d8bef9SDimitry Andricdef VRM4 : VReg<[vint8m4_t, vint16m4_t, vint32m4_t, vint64m4_t, 515e8d8bef9SDimitry Andric vfloat16m4_t, vfloat32m4_t, vfloat64m4_t], 516349cc55cSDimitry Andric (add V8M4, V12M4, V16M4, V20M4, V24M4, V28M4, V0M4, V4M4), 4>; 5175ffd83dbSDimitry Andric 518e8d8bef9SDimitry Andricdef VRM4NoV0 : VReg<[vint8m4_t, vint16m4_t, vint32m4_t, vint64m4_t, 519e8d8bef9SDimitry Andric vfloat16m4_t, vfloat32m4_t, vfloat64m4_t], 520349cc55cSDimitry Andric (add V8M4, V12M4, V16M4, V20M4, V24M4, V28M4, V4M4), 4>; 5215ffd83dbSDimitry Andric 522e8d8bef9SDimitry Andricdef VRM8 : VReg<[vint8m8_t, vint16m8_t, vint32m8_t, vint64m8_t, 523e8d8bef9SDimitry Andric vfloat16m8_t, vfloat32m8_t, vfloat64m8_t], 524e8d8bef9SDimitry Andric (add V8M8, V16M8, V24M8, V0M8), 8>; 525e8d8bef9SDimitry Andric 526e8d8bef9SDimitry Andricdef VRM8NoV0 : VReg<[vint8m8_t, vint16m8_t, vint32m8_t, vint64m8_t, 527e8d8bef9SDimitry Andric vfloat16m8_t, vfloat32m8_t, vfloat64m8_t], 528e8d8bef9SDimitry Andric (add V8M8, V16M8, V24M8), 8>; 529e8d8bef9SDimitry Andric 5300eae32dcSDimitry Andricdefvar VMaskVTs = [vbool1_t, vbool2_t, vbool4_t, vbool8_t, vbool16_t, 5310eae32dcSDimitry Andric vbool32_t, vbool64_t]; 532e8d8bef9SDimitry Andric 533e8d8bef9SDimitry Andricdef VMV0 : RegisterClass<"RISCV", VMaskVTs, 64, (add V0)> { 5345ffd83dbSDimitry Andric let Size = 64; 5355ffd83dbSDimitry Andric} 5365ffd83dbSDimitry Andric 537fe6060f1SDimitry Andric// The register class is added for inline assembly for vector mask types. 5380eae32dcSDimitry Andricdef VM : VReg<VMaskVTs, 539349cc55cSDimitry Andric (add (sequence "V%u", 8, 31), 540fe6060f1SDimitry Andric (sequence "V%u", 0, 7)), 1>; 541fe6060f1SDimitry Andric 542e8d8bef9SDimitry Andricforeach m = LMULList.m in { 543e8d8bef9SDimitry Andric foreach nf = NFList<m>.L in { 544fe6060f1SDimitry Andric def "VRN" # nf # "M" # m # "NoV0": VReg<[untyped], 545fe6060f1SDimitry Andric (add !cast<RegisterTuples>("VN" # nf # "M" # m # "NoV0")), 546e8d8bef9SDimitry Andric !mul(nf, m)>; 547349cc55cSDimitry Andric def "VRN" # nf # "M" # m: VReg<[untyped], 548349cc55cSDimitry Andric (add !cast<RegisterTuples>("VN" # nf # "M" # m # "NoV0"), 549349cc55cSDimitry Andric !cast<RegisterTuples>("VN" # nf # "M" # m # "V0")), 550349cc55cSDimitry Andric !mul(nf, m)>; 551e8d8bef9SDimitry Andric } 5525ffd83dbSDimitry Andric} 553fe6060f1SDimitry Andric 554fe6060f1SDimitry Andric// Special registers 555fe6060f1SDimitry Andricdef FFLAGS : RISCVReg<0, "fflags">; 556fe6060f1SDimitry Andricdef FRM : RISCVReg<0, "frm">; 557349cc55cSDimitry Andric 558349cc55cSDimitry Andric// Any type register. Used for .insn directives when we don't know what the 559349cc55cSDimitry Andric// register types could be. 560349cc55cSDimitry Andric// NOTE: The alignment and size are bogus values. The Size needs to be non-zero 561349cc55cSDimitry Andric// or tablegen will use "untyped" to determine the size which will assert. 562349cc55cSDimitry Andriclet isAllocatable = 0 in 563349cc55cSDimitry Andricdef AnyReg : RegisterClass<"RISCV", [untyped], 32, 564349cc55cSDimitry Andric (add (sequence "X%u", 0, 31), 565349cc55cSDimitry Andric (sequence "F%u_D", 0, 31), 566349cc55cSDimitry Andric (sequence "V%u", 0, 31))> { 567349cc55cSDimitry Andric let Size = 32; 568349cc55cSDimitry Andric} 569