From cdd776d13f799da1aff4b2c9c58a236bee74ea2e Mon Sep 17 00:00:00 2001 From: Tim Northover Date: Thu, 24 Oct 2013 09:37:18 +0000 Subject: [PATCH] ARM: fix assert on unpredictable POP instruction. 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 | 5 ++--- test/MC/ARM/diagnostics.s | 8 +++++--- test/MC/ARM/thumb-diagnostics.s | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index 534771b0a21..97b9db92363 100644 --- a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -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: { diff --git a/test/MC/ARM/diagnostics.s b/test/MC/ARM/diagnostics.s index 5eae4d216e4..4942ba06cf8 100644 --- a/test/MC/ARM/diagnostics.s +++ b/test/MC/ARM/diagnostics.s @@ -433,6 +433,8 @@ 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 diff --git a/test/MC/ARM/thumb-diagnostics.s b/test/MC/ARM/thumb-diagnostics.s index 8b55e3740da..19d17c2deef 100644 --- a/test/MC/ARM/thumb-diagnostics.s +++ b/test/MC/ARM/thumb-diagnostics.s @@ -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: ^