aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2011-09-13 17:59:19 +0000
committerOwen Anderson <resistor@mac.com>2011-09-13 17:59:19 +0000
commitb6b7f515e2b90c9f9b6cdd5b9648121f6ad2b3a1 (patch)
tree469e4935325e2852fe7dc4c455d74471ee4bfd80
parentabcc73e8ba3131c7c4f198840ece31453a0101ac (diff)
Teach the Thumb ASM parser that BKPT is allowed in IT blocks, even though it is always executed unconditionally.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139610 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/ARM/AsmParser/ARMAsmParser.cpp5
-rw-r--r--test/MC/ARM/basic-thumb2-instructions.s8
2 files changed, 12 insertions, 1 deletions
diff --git a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index df5e0c9cde..08a42f1248 100644
--- a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -3532,7 +3532,10 @@ validateInstruction(MCInst &Inst,
MCInstrDesc &MCID = getInstDesc(Inst.getOpcode());
SMLoc Loc = Operands[0]->getStartLoc();
// Check the IT block state first.
- if (inITBlock()) {
+ // NOTE: In Thumb mode, the BKPT instruction has the interesting property of
+ // being allowed in IT blocks, but not being predicable. It just always
+ // executes.
+ if (inITBlock() && Inst.getOpcode() != ARM::tBKPT) {
unsigned bit = 1;
if (ITState.FirstCond)
ITState.FirstCond = false;
diff --git a/test/MC/ARM/basic-thumb2-instructions.s b/test/MC/ARM/basic-thumb2-instructions.s
index 8293d4c01c..5da74024bb 100644
--- a/test/MC/ARM/basic-thumb2-instructions.s
+++ b/test/MC/ARM/basic-thumb2-instructions.s
@@ -259,6 +259,14 @@ _func:
@ CHECK: bic.w r8, r8, r5, asr #15 @ encoding: [0x28,0xea,0xe5,0x38]
@ CHECK: bic.w r12, r12, r6, ror #29 @ encoding: [0x2c,0xea,0x76,0x7c]
+@------------------------------------------------------------------------------
+@ BKPT
+@------------------------------------------------------------------------------
+ it pl
+ bkpt #234
+
+@ CHECK: it pl @ encoding: [0x58,0xbf]
+@ CHECK: bkpt #234 @ encoding: [0xea,0xbe]
@------------------------------------------------------------------------------
@ BXJ