Nested IT blocks are UNPREDICTABLE. Mark them as such when disassembling them.
authorOwen Anderson <resistor@mac.com>
Wed, 14 Sep 2011 21:06:21 +0000 (21:06 +0000)
committerOwen Anderson <resistor@mac.com>
Wed, 14 Sep 2011 21:06:21 +0000 (21:06 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139736 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/Disassembler/ARMDisassembler.cpp

index 9d4449a4aa1f82fc227e309251de0669a3f0f463..6b86e41c45231909d067a4405d3e7a93d81c6579 100644 (file)
@@ -567,6 +567,10 @@ DecodeStatus ThumbDisassembler::getInstruction(MCInst &MI, uint64_t &Size,
     // code and mask operands so that we can apply them correctly
     // to the subsequent instructions.
     if (MI.getOpcode() == ARM::t2IT) {
+      // Nested IT blocks are UNPREDICTABLE.
+      if (!ITBlock.empty())
+        return MCDisassembler::SoftFail;
+
       // (3 - the number of trailing zeros) is the number of then / else.
       unsigned firstcond = MI.getOperand(0).getImm();
       unsigned Mask = MI.getOperand(1).getImm();