Skip to content

Commit d7ac1fb

Browse files
authored
[RISCV] Use DecodeSimpleRegisterClass in 2 more cases. NFC (llvm#177680)
1 parent 90161c9 commit d7ac1fb

2 files changed

Lines changed: 6 additions & 24 deletions

File tree

llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -213,17 +213,6 @@ static DecodeStatus DecodeSR07RegisterClass(MCInst &Inst, uint32_t RegNo,
213213
return MCDisassembler::Success;
214214
}
215215

216-
static DecodeStatus DecodeVRRegisterClass(MCInst &Inst, uint32_t RegNo,
217-
uint64_t Address,
218-
const MCDisassembler *Decoder) {
219-
if (RegNo >= 32)
220-
return MCDisassembler::Fail;
221-
222-
MCRegister Reg = RISCV::V0 + RegNo;
223-
Inst.addOperand(MCOperand::createReg(Reg));
224-
return MCDisassembler::Success;
225-
}
226-
227216
static DecodeStatus DecodeVRM2RegisterClass(MCInst &Inst, uint32_t RegNo,
228217
uint64_t Address,
229218
const MCDisassembler *Decoder) {
@@ -285,17 +274,6 @@ static DecodeStatus DecodeVMV0RegisterClass(MCInst &Inst, uint32_t RegNo,
285274
return MCDisassembler::Success;
286275
}
287276

288-
static DecodeStatus DecodeTRRegisterClass(MCInst &Inst, uint32_t RegNo,
289-
uint64_t Address,
290-
const MCDisassembler *Decoder) {
291-
if (RegNo > 15)
292-
return MCDisassembler::Fail;
293-
294-
MCRegister Reg = RISCV::T0 + RegNo;
295-
Inst.addOperand(MCOperand::createReg(Reg));
296-
return MCDisassembler::Success;
297-
}
298-
299277
static DecodeStatus DecodeTRM2RegisterClass(MCInst &Inst, uint32_t RegNo,
300278
uint64_t Address,
301279
const MCDisassembler *Decoder) {

llvm/lib/Target/RISCV/RISCVRegisterInfo.td

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -856,7 +856,9 @@ defvar VM8VTs = [vint8m8_t, vint16m8_t, vint32m8_t, vint64m8_t,
856856

857857
def VR : VReg<!listconcat(VM1VTs, VMaskVTs),
858858
(add (sequence "V%u", 8, 31),
859-
(sequence "V%u", 7, 0)), 1>;
859+
(sequence "V%u", 7, 0)), 1> {
860+
let DecoderMethod = "DecodeSimpleRegisterClass<RISCV::V0, 32>";
861+
}
860862

861863
def VRNoV0 : VReg<!listconcat(VM1VTs, VMaskVTs), (sub VR, V0), 1>;
862864

@@ -961,7 +963,9 @@ foreach Index = 0-15 in
961963
DwarfRegNum<[!add(Index, 3072)]>;
962964

963965
let RegInfos = XLenRI in {
964-
def TR : RISCVRegisterClass<[untyped], 32, (add (sequence "T%u", 0, 15))>;
966+
def TR : RISCVRegisterClass<[untyped], 32, (add (sequence "T%u", 0, 15))> {
967+
let DecoderMethod = "DecodeSimpleRegisterClass<RISCV::T0, 16>";
968+
}
965969
def TRM2 : RISCVRegisterClass<[untyped], 32, (add (decimate TR, 2))>;
966970
def TRM4 : RISCVRegisterClass<[untyped], 32, (add (decimate TR, 4))>;
967971
}

0 commit comments

Comments
 (0)