Be stricter in enforcing IT instruction predicate values, so that we don't end up...
authorOwen Anderson <resistor@mac.com>
Wed, 24 Aug 2011 17:21:43 +0000 (17:21 +0000)
committerOwen Anderson <resistor@mac.com>
Wed, 24 Aug 2011 17:21:43 +0000 (17:21 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@138443 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMInstrThumb2.td
lib/Target/ARM/Disassembler/ARMDisassembler.cpp

index ca5f176d7234ebdbe8bb0308a6523a2ec53a200d..d7e92db89df5595c3a63ef496d258fe4ee797419 100644 (file)
@@ -14,6 +14,7 @@
 // IT block predicate field
 def it_pred : Operand<i32> {
   let PrintMethod = "printMandatoryPredicateOperand";
+  let DecoderMethod = "DecodeITCond";
 }
 
 // IT block condition mask
index c4b2f613cc7b8e65b2e465c85f6b59451be98b22..346bd2b04a4e5761112e355b616afc4c9e36b4ac 100644 (file)
@@ -228,6 +228,8 @@ static DecodeStatus DecodeThumbBCCTargetOperand(llvm::MCInst &Inst,unsigned Val,
                                 uint64_t Address, const void *Decoder);
 static DecodeStatus DecodeThumbBLTargetOperand(llvm::MCInst &Inst, unsigned Val,
                                 uint64_t Address, const void *Decoder);
+static DecodeStatus DecodeITCond(llvm::MCInst &Inst, unsigned Val,
+                                uint64_t Address, const void *Decoder);
 
 #include "ARMGenDisassemblerTables.inc"
 #include "ARMGenInstrInfo.inc"
@@ -3289,3 +3291,15 @@ static DecodeStatus DecodeVMOVRRS(llvm::MCInst &Inst, unsigned Insn,
   return S;
 }
 
+static DecodeStatus DecodeITCond(llvm::MCInst &Inst, unsigned Cond,
+                                 uint64_t Address, const void *Decoder) {
+  DecodeStatus S = Success;
+  if (Cond == 0xF) {
+    Cond = 0xE;
+    CHECK(S, Unpredictable);
+  }
+
+  Inst.addOperand(MCOperand::CreateImm(Cond));
+  return S;
+}
+