ARM: fix assert on unpredictable POP instruction.
authorTim Northover <tnorthover@apple.com>
Thu, 24 Oct 2013 09:37:18 +0000 (09:37 +0000)
committerTim Northover <tnorthover@apple.com>
Thu, 24 Oct 2013 09:37:18 +0000 (09:37 +0000)
POP instructions are aliased to the ARM LDM variants but have different syntax.
This caused two problems: we tried to access a non-existent operand to annotate
the '!', and the error message didn't make much sense.

With some vigorous hand-waving in the error message both problems can be
fixed.

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

lib/Target/ARM/AsmParser/ARMAsmParser.cpp
test/MC/ARM/diagnostics.s
test/MC/ARM/thumb-diagnostics.s

index 534771b0a21f9369f13ee6ad9c5a1cba27c3851b..97b9db9236315db35d23c772d1268b3837287ee1 100644 (file)
@@ -5466,9 +5466,8 @@ validateInstruction(MCInst &Inst,
   case ARM::t2STMIA_UPD:
   case ARM::t2STMDB_UPD: {
     if (listContainsReg(Inst, 3, Inst.getOperand(0).getReg()))
-      return Error(Operands[4]->getStartLoc(),
-                   "writeback operator '!' not allowed when base register "
-                   "in register list");
+      return Error(Operands.back()->getStartLoc(),
+                   "writeback register not allowed in register list");
     break;
   }
   case ARM::tMUL: {
index 5eae4d216e40ef57b11532113a32c1c6e6043aff..4942ba06cf8363f6babdaa69794fcc758dbc2727 100644 (file)
         ldm r2!, {r2, r3}
         ldmdb r2!, {r2, r3}
         ldmda r2!, {r2, r3}
-@ CHECK-ERRORS: error: writeback operator '!' not allowed when base register in register list
-@ CHECK-ERRORS: error: writeback operator '!' not allowed when base register in register list
-@ CHECK-ERRORS: error: writeback operator '!' not allowed when base register in register list
+        popeq {sp}
+@ CHECK-ERRORS: error: writeback register not allowed in register list
+@ CHECK-ERRORS: error: writeback register not allowed in register list
+@ CHECK-ERRORS: error: writeback register not allowed in register list
+@ CHECK-ERRORS: error: writeback register not allowed in register list
index 8b55e3740dac2ee16f6d11f2f535b66852f7b50f..19d17c2deef6fd73f7a44f1fa4a956d0c73d645c 100644 (file)
@@ -71,7 +71,7 @@ error: invalid operand for instruction
 @ CHECK-ERRORS-V8: error: writeback operator '!' not allowed when base register in register list
 @ CHECK-ERRORS-V8:         ldm r2!, {r2, r3, r4, r10}
 @ CHECK-ERRORS-V8:               ^
-@ CHECK-ERRORS-V8: error: writeback operator '!' not allowed when base register in register list
+@ CHECK-ERRORS-V8: error: writeback register not allowed in register list
 @ CHECK-ERRORS-V8:         ldmdb r2!, {r2, r3, r4}
 @ CHECK-ERRORS-V8:                 ^
 
@@ -100,7 +100,7 @@ error: invalid operand for instruction
 @ CHECK-ERRORS-V8: error: writeback operator '!' not allowed when base register in register list
 @ CHECK-ERRORS-V8:         stm r2!, {r2, r9}
 @ CHECK-ERRORS-V8:                  ^
-@ CHECK-ERRORS-V8: error: writeback operator '!' not allowed when base register in register list
+@ CHECK-ERRORS-V8: error: writeback register not allowed in register list
 @ CHECK-ERRORS-V8:         stmdb r2!, {r0, r2}
 @ CHECK-ERRORS-V8:                  ^