Skip to content

Commit faed70d

Browse files
committed
[RISCV] Remove XLen field from RISCVSubtarget [nfc]
The isRV64 field contains the same information, and we can derive XLen from that. Differential Revision: https://reviews.llvm.org/D159306
1 parent b96d069 commit faed70d

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

llvm/lib/Target/RISCV/RISCVSubtarget.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,6 @@ RISCVSubtarget::initializeSubtargetDependencies(const Triple &TT, StringRef CPU,
6666
TuneCPU = CPU;
6767

6868
ParseSubtargetFeatures(CPU, TuneCPU, FS);
69-
if (Is64Bit)
70-
XLen = 64;
71-
7269
TargetABI = RISCVABI::computeTargetABI(TT, getFeatureBits(), ABIName);
7370
RISCVFeatures::validate(TT, getFeatureBits());
7471
return *this;

llvm/lib/Target/RISCV/RISCVSubtarget.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ class RISCVSubtarget : public RISCVGenSubtargetInfo {
4848
bool ATTRIBUTE = DEFAULT;
4949
#include "RISCVGenSubtargetInfo.inc"
5050

51-
unsigned XLen = 32;
5251
unsigned ZvlLen = 0;
5352
unsigned RVVVectorBitsMin;
5453
unsigned RVVVectorBitsMax;
@@ -127,12 +126,10 @@ class RISCVSubtarget : public RISCVGenSubtargetInfo {
127126
}
128127
bool is64Bit() const { return IsRV64; }
129128
MVT getXLenVT() const {
130-
return MVT::getIntegerVT(getXLen());
129+
return is64Bit() ? MVT::i64 : MVT::i32;
131130
}
132131
unsigned getXLen() const {
133-
assert((XLen == 32 || XLen == 64) &&
134-
"unexpected xlen");
135-
return XLen;
132+
return is64Bit() ? 64 : 32;
136133
}
137134
unsigned getFLen() const {
138135
if (HasStdExtD)

0 commit comments

Comments
 (0)