summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJozef Kolek <jozef.kolek@imgtec.com>2015-04-20 14:40:38 +0000
committerJozef Kolek <jozef.kolek@imgtec.com>2015-04-20 14:40:38 +0000
commit676d60125c48f7fc2725692669836538287bca10 (patch)
tree1b7301aee207b94c48a40425efe30eee4885bbde
parent97df86ceb1dfc701e0d5a900156b6a322c922562 (diff)
downloadbcm5719-llvm-676d60125c48f7fc2725692669836538287bca10.tar.gz
bcm5719-llvm-676d60125c48f7fc2725692669836538287bca10.zip
[mips][microMIPSr6] Implement disassembler support
Implement disassembler support for microMIPS32r6. Differential Revision: http://reviews.llvm.org/D8490 llvm-svn: 235307
-rw-r--r--llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp15
-rw-r--r--llvm/lib/Target/Mips/MicroMips32r6InstrInfo.td2
-rw-r--r--llvm/test/MC/Disassembler/Mips/micromips32r6.txt7
3 files changed, 20 insertions, 4 deletions
diff --git a/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp b/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp
index 8849366e837..f9d00291419 100644
--- a/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp
+++ b/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp
@@ -837,10 +837,17 @@ DecodeStatus MipsDisassembler::getInstruction(MCInst &Instr, uint64_t &Size,
if (Result == MCDisassembler::Fail)
return MCDisassembler::Fail;
- DEBUG(dbgs() << "Trying MicroMips32 table (32-bit instructions):\n");
- // Calling the auto-generated decoder function.
- Result = decodeInstruction(DecoderTableMicroMips32, Instr, Insn, Address,
- this, STI);
+ if (hasMips32r6()) {
+ DEBUG(dbgs() << "Trying MicroMips32r632 table (32-bit instructions):\n");
+ // Calling the auto-generated decoder function.
+ Result = decodeInstruction(DecoderTableMicroMips32r632, Instr, Insn, Address,
+ this, STI);
+ } else {
+ DEBUG(dbgs() << "Trying MicroMips32 table (32-bit instructions):\n");
+ // Calling the auto-generated decoder function.
+ Result = decodeInstruction(DecoderTableMicroMips32, Instr, Insn, Address,
+ this, STI);
+ }
if (Result != MCDisassembler::Fail) {
Size = 4;
return Result;
diff --git a/llvm/lib/Target/Mips/MicroMips32r6InstrInfo.td b/llvm/lib/Target/Mips/MicroMips32r6InstrInfo.td
index ed97aae014f..e1c065447ce 100644
--- a/llvm/lib/Target/Mips/MicroMips32r6InstrInfo.td
+++ b/llvm/lib/Target/Mips/MicroMips32r6InstrInfo.td
@@ -46,5 +46,7 @@ class BC_MMR6_DESC : BC_MMR6_DESC_BASE<"bc", brtarget26>;
//
//===----------------------------------------------------------------------===//
+let DecoderNamespace = "MicroMips32r6" in {
def BALC_MMR6 : R6MMR6Rel, BALC_MMR6_ENC, BALC_MMR6_DESC, ISA_MICROMIPS32R6;
def BC_MMR6 : R6MMR6Rel, BC_MMR6_ENC, BC_MMR6_DESC, ISA_MICROMIPS32R6;
+}
diff --git a/llvm/test/MC/Disassembler/Mips/micromips32r6.txt b/llvm/test/MC/Disassembler/Mips/micromips32r6.txt
new file mode 100644
index 00000000000..0b1b78f33b0
--- /dev/null
+++ b/llvm/test/MC/Disassembler/Mips/micromips32r6.txt
@@ -0,0 +1,7 @@
+# RUN: llvm-mc --disassemble %s -triple=mips-unknown-linux -mcpu=mips32r6 -mattr=micromips | FileCheck %s
+
+# CHECK: balc 14572256
+0xb4 0x37 0x96 0xb8
+
+# CHECK: bc 14572256
+0x94 0x37 0x96 0xb8
OpenPOWER on IntegriCloud