aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp')
-rw-r--r--llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp b/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
index 0f18600..2649f1b 100644
--- a/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
+++ b/llvm/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp
@@ -105,6 +105,31 @@ static DecodeStatus DecodeFPR32RegisterClass(MCInst &Inst, uint64_t RegNo,
return MCDisassembler::Success;
}
+static const unsigned FPR64DecoderTable[] = {
+ RISCV::F0_64, RISCV::F1_64, RISCV::F2_64, RISCV::F3_64,
+ RISCV::F4_64, RISCV::F5_64, RISCV::F6_64, RISCV::F7_64,
+ RISCV::F8_64, RISCV::F9_64, RISCV::F10_64, RISCV::F11_64,
+ RISCV::F12_64, RISCV::F13_64, RISCV::F14_64, RISCV::F15_64,
+ RISCV::F16_64, RISCV::F17_64, RISCV::F18_64, RISCV::F19_64,
+ RISCV::F20_64, RISCV::F21_64, RISCV::F22_64, RISCV::F23_64,
+ RISCV::F24_64, RISCV::F25_64, RISCV::F26_64, RISCV::F27_64,
+ RISCV::F28_64, RISCV::F29_64, RISCV::F30_64, RISCV::F31_64
+};
+
+static DecodeStatus DecodeFPR64RegisterClass(MCInst &Inst, uint64_t RegNo,
+ uint64_t Address,
+ const void *Decoder) {
+ if (RegNo > sizeof(FPR64DecoderTable))
+ return MCDisassembler::Fail;
+
+ // We must define our own mapping from RegNo to register identifier.
+ // Accessing index RegNo in the register class will work in the case that
+ // registers were added in ascending order, but not in general.
+ unsigned Reg = FPR64DecoderTable[RegNo];
+ Inst.addOperand(MCOperand::createReg(Reg));
+ return MCDisassembler::Success;
+}
+
template <unsigned N>
static DecodeStatus decodeUImmOperand(MCInst &Inst, uint64_t Imm,
int64_t Address, const void *Decoder) {