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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@253193
91177308-0d34-0410-b5e6-
96231b3b80d8
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(
// 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: ^