Better error-handling for DisassembleThumb2DPSoReg() where the 3-reg operand
authorJohnny Chen <johnny.chen@apple.com>
Mon, 19 Apr 2010 17:16:40 +0000 (17:16 +0000)
committerJohnny Chen <johnny.chen@apple.com>
Mon, 19 Apr 2010 17:16:40 +0000 (17:16 +0000)
instructions should have Rd (Inst{11-8}) != 0b1111.

Ref: A6.3 32-bit Thumb instruction encoding
     A6.3.11 Data-processing (shifted register)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@101788 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/Disassembler/ThumbDisassemblerCore.h

index 3a6a3926f241ca8b827dd30a37c38883a15643e5..001d0c6dff5a368fd414930afb9961b4eaae7137 100644 (file)
@@ -1340,12 +1340,15 @@ static bool DisassembleThumb2DPSoReg(MCInst &MI, unsigned Opcode, uint32_t insn,
     if ((Idx = TID.getOperandConstraint(OpIdx, TOI::TIED_TO)) != -1) {
       // Process tied_to operand constraint.
       MI.addOperand(MI.getOperand(Idx));
-    } else {
-      assert(!NoDstReg && "Internal error");
+      ++OpIdx;
+    } else if (!NoDstReg) {
       MI.addOperand(MCOperand::CreateReg(getRegisterEnum(B, ARM::GPRRegClassID,
                                                          decodeRn(insn))));
+      ++OpIdx;
+    } else {
+      DEBUG(errs() << "Thumb encoding error: d==15 for three-reg operands.\n");
+      return false;
     }
-    ++OpIdx;
   }
 
   MI.addOperand(MCOperand::CreateReg(getRegisterEnum(B, ARM::GPRRegClassID,