[llvm] 91cf2a9 - [RISCV][NFC] Use sub operator to generate register list
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 6 20:31:18 PST 2022
Author: wangpc
Date: 2022-01-07T12:29:58+08:00
New Revision: 91cf2a9b6c3ca3a205988b6f752944d76fc2fac4
URL: https://github.com/llvm/llvm-project/commit/91cf2a9b6c3ca3a205988b6f752944d76fc2fac4
DIFF: https://github.com/llvm/llvm-project/commit/91cf2a9b6c3ca3a205988b6f752944d76fc2fac4.diff
LOG: [RISCV][NFC] Use sub operator to generate register list
There are several duplicated lines for generating GPRXXX's
register list that can be eliminated by using `sub` operator.
Reviewed By: asb
Differential Revision: https://reviews.llvm.org/D116729
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 20903b317180e..79370791efa24 100644
--- a/llvm/lib/Target/RISCV/RISCVRegisterInfo.td
+++ b/llvm/lib/Target/RISCV/RISCVRegisterInfo.td
@@ -138,27 +138,11 @@ def GPRX0 : RegisterClass<"RISCV", [XLenVT], 32, (add X0)> {
let RegInfos = XLenRI;
}
-// The order of registers represents the preferred allocation sequence.
-// Registers are listed in the order caller-save, callee-save, specials.
-def GPRNoX0 : RegisterClass<"RISCV", [XLenVT], 32, (add
- (sequence "X%u", 10, 17),
- (sequence "X%u", 5, 7),
- (sequence "X%u", 28, 31),
- (sequence "X%u", 8, 9),
- (sequence "X%u", 18, 27),
- (sequence "X%u", 1, 4)
- )> {
+def GPRNoX0 : RegisterClass<"RISCV", [XLenVT], 32, (sub GPR, X0)> {
let RegInfos = XLenRI;
}
-def GPRNoX0X2 : RegisterClass<"RISCV", [XLenVT], 32, (add
- (sequence "X%u", 10, 17),
- (sequence "X%u", 5, 7),
- (sequence "X%u", 28, 31),
- (sequence "X%u", 8, 9),
- (sequence "X%u", 18, 27),
- X1, X3, X4
- )> {
+def GPRNoX0X2 : RegisterClass<"RISCV", [XLenVT], 32, (sub GPR, X0, X2)> {
let RegInfos = XLenRI;
}
@@ -166,13 +150,7 @@ def GPRNoX0X2 : RegisterClass<"RISCV", [XLenVT], 32, (add
// stack on some microarchitectures. Also remove the reserved registers X0, X2,
// X3, and X4 as it reduces the number of register classes that get synthesized
// by tablegen.
-def GPRJALR : RegisterClass<"RISCV", [XLenVT], 32, (add
- (sequence "X%u", 10, 17),
- (sequence "X%u", 6, 7),
- (sequence "X%u", 28, 31),
- (sequence "X%u", 8, 9),
- (sequence "X%u", 18, 27)
- )> {
+def GPRJALR : RegisterClass<"RISCV", [XLenVT], 32, (sub GPR, (sequence "X%u", 0, 5))> {
let RegInfos = XLenRI;
}
More information about the llvm-commits
mailing list