[PATCH] D96649: [RISCV] Use XLenRI alias for RegInfoByHwMode instances
Jessica Clarke via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 13 08:41:46 PST 2021
jrtc27 created this revision.
jrtc27 added reviewers: asb, craig.topper, luismarques.
Herald added subscribers: vkmr, frasercrmck, evandro, apazos, sameer.abuasal, s.egerton, Jim, benna, psnobl, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, shiva0217, kito-cheng, niosHD, sabuasal, simoncook, johnrusso, rbar, hiraditya.
jrtc27 requested review of this revision.
Herald added subscribers: llvm-commits, MaskRay.
Herald added a project: LLVM.
This avoids tedious repetition and matches what we do for the
ValueTypeByHwMode uses.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D96649
Files:
llvm/lib/Target/RISCV/RISCVRegisterInfo.td
Index: llvm/lib/Target/RISCV/RISCVRegisterInfo.td
===================================================================
--- llvm/lib/Target/RISCV/RISCVRegisterInfo.td
+++ llvm/lib/Target/RISCV/RISCVRegisterInfo.td
@@ -117,6 +117,9 @@
def XLenVT : ValueTypeByHwMode<[RV32, RV64],
[i32, i64]>;
+def XLenRI : RegInfoByHwMode<
+ [RV32, RV64],
+ [RegInfo<32,32,32>, RegInfo<64,64,64>]>;
// The order of registers represents the preferred allocation sequence.
// Registers are listed in the order caller-save, callee-save, specials.
@@ -128,15 +131,11 @@
(sequence "X%u", 18, 27),
(sequence "X%u", 0, 4)
)> {
- let RegInfos = RegInfoByHwMode<
- [RV32, RV64],
- [RegInfo<32,32,32>, RegInfo<64,64,64>]>;
+ let RegInfos = XLenRI;
}
def GPRX0 : RegisterClass<"RISCV", [XLenVT], 32, (add X0)> {
- let RegInfos = RegInfoByHwMode<
- [RV32, RV64],
- [RegInfo<32,32,32>, RegInfo<64,64,64>]>;
+ let RegInfos = XLenRI;
}
// The order of registers represents the preferred allocation sequence.
@@ -149,9 +148,7 @@
(sequence "X%u", 18, 27),
(sequence "X%u", 1, 4)
)> {
- let RegInfos = RegInfoByHwMode<
- [RV32, RV64],
- [RegInfo<32,32,32>, RegInfo<64,64,64>]>;
+ let RegInfos = XLenRI;
}
def GPRNoX0X2 : RegisterClass<"RISCV", [XLenVT], 32, (add
@@ -162,18 +159,14 @@
(sequence "X%u", 18, 27),
X1, X3, X4
)> {
- let RegInfos = RegInfoByHwMode<
- [RV32, RV64],
- [RegInfo<32,32,32>, RegInfo<64,64,64>]>;
+ let RegInfos = XLenRI;
}
def GPRC : RegisterClass<"RISCV", [XLenVT], 32, (add
(sequence "X%u", 10, 15),
(sequence "X%u", 8, 9)
)> {
- let RegInfos = RegInfoByHwMode<
- [RV32, RV64],
- [RegInfo<32,32,32>, RegInfo<64,64,64>]>;
+ let RegInfos = XLenRI;
}
// For indirect tail calls, we can't use callee-saved registers, as they are
@@ -184,15 +177,11 @@
(sequence "X%u", 10, 17),
(sequence "X%u", 28, 31)
)> {
- let RegInfos = RegInfoByHwMode<
- [RV32, RV64],
- [RegInfo<32,32,32>, RegInfo<64,64,64>]>;
+ let RegInfos = XLenRI;
}
def SP : RegisterClass<"RISCV", [XLenVT], 32, (add X2)> {
- let RegInfos = RegInfoByHwMode<
- [RV32, RV64],
- [RegInfo<32,32,32>, RegInfo<64,64,64>]>;
+ let RegInfos = XLenRI;
}
// Floating point registers
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96649.323559.patch
Type: text/x-patch
Size: 2449 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210213/c226052d/attachment.bin>
More information about the llvm-commits
mailing list