[PATCH] D12279: [mips][microMIPS] Implement ADDIUR1SP, ADDIUR2, ADDIUS5 and ADDIUSP instructions

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 05:23:39 PDT 2015


dsanders added a comment.

I'm pretty sure I see the problem. Not sure why it didn't see it before.


================
Comment at: lib/Target/Mips/Disassembler/MipsDisassembler.cpp:839-851
@@ -838,6 +838,15 @@
 
-    DEBUG(dbgs() << "Trying MicroMips16 table (16-bit instructions):\n");
-    // Calling the auto-generated decoder function.
-    Result = decodeInstruction(DecoderTableMicroMips16, Instr, Insn, Address,
-                               this, STI);
+    if (hasMips32r6()) {
+      DEBUG(dbgs() << "Trying MicroMipsR616 table (16-bit instructions):\n");
+      // Calling the auto-generated decoder function for microMIPS32R6
+      // (and microMIPS64R6) 16-bit instructions.
+      Result = decodeInstruction(DecoderTableMicroMipsR616, Instr, Insn,
+                                 Address, this, STI);
+    } else {
+      DEBUG(dbgs() << "Trying MicroMips16 table (16-bit instructions):\n");
+      // Calling the auto-generated decoder function for microMIPS 16-bit
+      // instructions.
+      Result = decodeInstruction(DecoderTableMicroMips16, Instr, Insn, Address,
+                                this, STI);
+    }
     if (Result != MCDisassembler::Fail) {
----------------
This is incorrectly picking between two tables. It should be trying the DecoderTableMicroMipsR616, then if that fails it should try DecoderTableMicroMips16, then if that fails it should try DecoderTableMicroMipsR632, then DecoderTableMicroMips32, and so on.

See line 904 and 934 for the corresponding standard encoding implementation.


http://reviews.llvm.org/D12279





More information about the llvm-commits mailing list