[llvm] 77e25b5 - [RISCV] Remove RV32 HwMode. Use DefaultMode for RV32
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 20 11:16:23 PST 2020
Author: Craig Topper
Date: 2020-11-20T11:16:06-08:00
New Revision: 77e25b5bc8860e23395f617dcca4940489f6355c
URL: https://github.com/llvm/llvm-project/commit/77e25b5bc8860e23395f617dcca4940489f6355c
DIFF: https://github.com/llvm/llvm-project/commit/77e25b5bc8860e23395f617dcca4940489f6355c.diff
LOG: [RISCV] Remove RV32 HwMode. Use DefaultMode for RV32
Prior to this the DefaultMode was never selected, but RISCVGenDAGISel.inc, RISCVGenRegisterInfo.inc, RISCVGenGlobalISel.inc all ended up with extra table entries for that mode.
This patch removes the RV32 and uses DefaultMode for RV32. This impressively reduces the size of my release+asserts llc binary by about 270K. About 15K from RISCVGenDAGISel.inc, 1-2K from RISCVGenRegisterInfo.inc, but the vast majority from RISCVGenGlobalISel.inc.
Differential Revision: https://reviews.llvm.org/D90973
Added:
Modified:
llvm/lib/Target/RISCV/RISCV.td
llvm/lib/Target/RISCV/RISCVRegisterInfo.td
Removed:
################################################################################
diff --git a/llvm/lib/Target/RISCV/RISCV.td b/llvm/lib/Target/RISCV/RISCV.td
index 2ab8ba8fe704..f8093ff6a440 100644
--- a/llvm/lib/Target/RISCV/RISCV.td
+++ b/llvm/lib/Target/RISCV/RISCV.td
@@ -181,8 +181,8 @@ def IsRV32 : Predicate<"!Subtarget->is64Bit()">,
AssemblerPredicate<(all_of (not Feature64Bit)),
"RV32I Base Instruction Set">;
+defvar RV32 = DefaultMode;
def RV64 : HwMode<"+64bit">;
-def RV32 : HwMode<"-64bit">;
def FeatureRV32E
: SubtargetFeature<"e", "IsRV32E", "true",
diff --git a/llvm/lib/Target/RISCV/RISCVRegisterInfo.td b/llvm/lib/Target/RISCV/RISCVRegisterInfo.td
index 2b44847104a0..b4561af3ca33 100644
--- a/llvm/lib/Target/RISCV/RISCVRegisterInfo.td
+++ b/llvm/lib/Target/RISCV/RISCVRegisterInfo.td
@@ -97,8 +97,8 @@ let RegAltNameIndices = [ABIRegAltName] in {
}
}
-def XLenVT : ValueTypeByHwMode<[RV32, RV64, DefaultMode],
- [i32, i64, i32]>;
+def XLenVT : ValueTypeByHwMode<[RV64, RV32],
+ [i64, i32]>;
// The order of registers represents the preferred allocation sequence.
// Registers are listed in the order caller-save, callee-save, specials.
@@ -111,14 +111,14 @@ def GPR : RegisterClass<"RISCV", [XLenVT], 32, (add
(sequence "X%u", 0, 4)
)> {
let RegInfos = RegInfoByHwMode<
- [RV32, RV64, DefaultMode],
- [RegInfo<32,32,32>, RegInfo<64,64,64>, RegInfo<32,32,32>]>;
+ [RV64, RV32],
+ [RegInfo<64,64,64>, RegInfo<32,32,32>]>;
}
def GPRX0 : RegisterClass<"RISCV", [XLenVT], 32, (add X0)> {
let RegInfos = RegInfoByHwMode<
- [RV32, RV64, DefaultMode],
- [RegInfo<32,32,32>, RegInfo<64,64,64>, RegInfo<32,32,32>]>;
+ [RV64, RV32],
+ [RegInfo<64,64,64>, RegInfo<32,32,32>]>;
}
// The order of registers represents the preferred allocation sequence.
@@ -132,8 +132,8 @@ def GPRNoX0 : RegisterClass<"RISCV", [XLenVT], 32, (add
(sequence "X%u", 1, 4)
)> {
let RegInfos = RegInfoByHwMode<
- [RV32, RV64, DefaultMode],
- [RegInfo<32,32,32>, RegInfo<64,64,64>, RegInfo<32,32,32>]>;
+ [RV64, RV32],
+ [RegInfo<64,64,64>, RegInfo<32,32,32>]>;
}
def GPRNoX0X2 : RegisterClass<"RISCV", [XLenVT], 32, (add
@@ -145,8 +145,8 @@ def GPRNoX0X2 : RegisterClass<"RISCV", [XLenVT], 32, (add
X1, X3, X4
)> {
let RegInfos = RegInfoByHwMode<
- [RV32, RV64, DefaultMode],
- [RegInfo<32,32,32>, RegInfo<64,64,64>, RegInfo<32,32,32>]>;
+ [RV64, RV32],
+ [RegInfo<64,64,64>, RegInfo<32,32,32>]>;
}
def GPRC : RegisterClass<"RISCV", [XLenVT], 32, (add
@@ -154,8 +154,8 @@ def GPRC : RegisterClass<"RISCV", [XLenVT], 32, (add
(sequence "X%u", 8, 9)
)> {
let RegInfos = RegInfoByHwMode<
- [RV32, RV64, DefaultMode],
- [RegInfo<32,32,32>, RegInfo<64,64,64>, RegInfo<32,32,32>]>;
+ [RV64, RV32],
+ [RegInfo<64,64,64>, RegInfo<32,32,32>]>;
}
// For indirect tail calls, we can't use callee-saved registers, as they are
@@ -167,14 +167,14 @@ def GPRTC : RegisterClass<"RISCV", [XLenVT], 32, (add
(sequence "X%u", 28, 31)
)> {
let RegInfos = RegInfoByHwMode<
- [RV32, RV64, DefaultMode],
- [RegInfo<32,32,32>, RegInfo<64,64,64>, RegInfo<32,32,32>]>;
+ [RV64, RV32],
+ [RegInfo<64,64,64>, RegInfo<32,32,32>]>;
}
def SP : RegisterClass<"RISCV", [XLenVT], 32, (add X2)> {
let RegInfos = RegInfoByHwMode<
- [RV32, RV64, DefaultMode],
- [RegInfo<32,32,32>, RegInfo<64,64,64>, RegInfo<32,32,32>]>;
+ [RV64, RV32],
+ [RegInfo<64,64,64>, RegInfo<32,32,32>]>;
}
// Floating point registers
More information about the llvm-commits
mailing list