[llvm] a6e6487 - [Mips][XCore] Use MCRegisterClass::getRegister() instead of begin()+RegNo. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 31 12:04:58 PDT 2025
Author: Craig Topper
Date: 2025-08-31T12:00:32-07:00
New Revision: a6e6487048097dff09ae764c678e9adc8d1d6263
URL: https://github.com/llvm/llvm-project/commit/a6e6487048097dff09ae764c678e9adc8d1d6263
DIFF: https://github.com/llvm/llvm-project/commit/a6e6487048097dff09ae764c678e9adc8d1d6263.diff
LOG: [Mips][XCore] Use MCRegisterClass::getRegister() instead of begin()+RegNo. NFC
Added:
Modified:
llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp
llvm/lib/Target/XCore/Disassembler/XCoreDisassembler.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp b/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp
index cf5bd90b04b90..fa6cc0e3f0187 100644
--- a/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp
+++ b/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp
@@ -105,7 +105,7 @@ LLVMInitializeMipsDisassembler() {
static unsigned getReg(const MCDisassembler *D, unsigned RC, unsigned RegNo) {
const MCRegisterInfo *RegInfo = D->getContext().getRegisterInfo();
- return *(RegInfo->getRegClass(RC).begin() + RegNo);
+ return RegInfo->getRegClass(RC).getRegister(RegNo);
}
static DecodeStatus DecodeHWRegsRegisterClass(MCInst &Inst, unsigned RegNo,
uint64_t Address,
diff --git a/llvm/lib/Target/XCore/Disassembler/XCoreDisassembler.cpp b/llvm/lib/Target/XCore/Disassembler/XCoreDisassembler.cpp
index 1002d1c8dcc87..096ad08d8a3c9 100644
--- a/llvm/lib/Target/XCore/Disassembler/XCoreDisassembler.cpp
+++ b/llvm/lib/Target/XCore/Disassembler/XCoreDisassembler.cpp
@@ -71,7 +71,7 @@ static bool readInstruction32(ArrayRef<uint8_t> Bytes, uint64_t Address,
static unsigned getReg(const MCDisassembler *D, unsigned RC, unsigned RegNo) {
const MCRegisterInfo *RegInfo = D->getContext().getRegisterInfo();
- return *(RegInfo->getRegClass(RC).begin() + RegNo);
+ return RegInfo->getRegClass(RC).getRegister(RegNo);
}
static DecodeStatus DecodeGRRegsRegisterClass(MCInst &Inst, unsigned RegNo,
More information about the llvm-commits
mailing list