diff options
author | Oliver Stannard <oliver.stannard@arm.com> | 2015-11-16 10:25:19 +0000 |
---|---|---|
committer | Oliver Stannard <oliver.stannard@arm.com> | 2015-11-16 10:25:19 +0000 |
commit | db9081bf89aa2b603d660896bd6f933a5f011e3b (patch) | |
tree | f92c28b0b242a0be7b89d7fdedd6b32f0389deb8 | |
parent | d4d2357f266ef563e6609ad00d2524ec7de91826 (diff) | |
download | bcm5719-llvm-db9081bf89aa2b603d660896bd6f933a5f011e3b.tar.gz bcm5719-llvm-db9081bf89aa2b603d660896bd6f933a5f011e3b.zip |
[AArch64] ldr= pseudo-instruction silently ignored if register invalid
The AArch64 assembler was silently ignoring instructions like this:
ldr foo, =bar
AArch64AsmParser::parseOperand was returning true as the parse failed, but was
not calling AArch64AsmParser::Error to report this to the user, so the
instruction was ignored without printing an error message.
Differential Revision: http://reviews.llvm.org/D14651
llvm-svn: 253193
-rw-r--r-- | llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp | 2 | ||||
-rw-r--r-- | llvm/test/MC/AArch64/ldr-pseudo-diagnostics.s | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp index 278c4b8f489..a1f32e099e3 100644 --- a/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp +++ b/llvm/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp @@ -3178,7 +3178,7 @@ bool AArch64AsmParser::parseOperand(OperandVector &Operands, bool isCondCode, if (Operands.size() < 2 || !static_cast<AArch64Operand &>(*Operands[1]).isReg()) - return true; + return Error(Loc, "Only valid when first operand is register"); bool IsXReg = AArch64MCRegisterClasses[AArch64::GPR64allRegClassID].contains( diff --git a/llvm/test/MC/AArch64/ldr-pseudo-diagnostics.s b/llvm/test/MC/AArch64/ldr-pseudo-diagnostics.s index e32c5167952..e83ca93f6d2 100644 --- a/llvm/test/MC/AArch64/ldr-pseudo-diagnostics.s +++ b/llvm/test/MC/AArch64/ldr-pseudo-diagnostics.s @@ -12,3 +12,21 @@ f2: // CHECK-ERROR: error: Immediate too large for register // CHECK-ERROR: ldr w0, =-0x80000001 // CHECK-ERROR: ^ + +f3: + ldr foo, =1 +// CHECK-ERROR: error: Only valid when first operand is register +// CHECK-ERROR: ldr foo, =1 +// CHECK-ERROR: ^ + +f4: + add r0, r0, =1 +// CHECK-ERROR: error: unexpected token in operand +// CHECK-ERROR: add r0, r0, =1 +// CHECK-ERROR: ^ + +f5: + ldr x0, =()) +// CHECK-ERROR: error: unknown token in expression +// CHECK-ERROR: ldr x0, =()) +// CHECK-ERROR: ^ |