[llvm] r301165 - [Arch64AsmParser] better diagnostic for isb
Sjoerd Meijer via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 24 01:22:20 PDT 2017
Author: sjoerdmeijer
Date: Mon Apr 24 03:22:20 2017
New Revision: 301165
URL: http://llvm.org/viewvc/llvm-project?rev=301165&view=rev
Log:
[Arch64AsmParser] better diagnostic for isb
Instruction isb takes as an operand either 'sy' or an immediate value. This
improves the diagnostic when the string is not 'sy' and adds a test case for
this which was missing. This also adds tests to check invalid inputs for dsb
and dmb.
Differential Revision: https://reviews.llvm.org/D32227
Modified:
llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
llvm/trunk/test/MC/AArch64/basic-a64-diagnostics.s
Modified: llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp?rev=301165&r1=301164&r2=301165&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp Mon Apr 24 03:22:20 2017
@@ -2473,16 +2473,14 @@ AArch64AsmParser::tryParseBarrierOperand
return MatchOperand_ParseFail;
}
- auto DB = AArch64DB::lookupDBByName(Tok.getString());
- if (!DB) {
- TokError("invalid barrier option name");
- return MatchOperand_ParseFail;
- }
-
// The only valid named option for ISB is 'sy'
- if (Mnemonic == "isb" && DB->Encoding != AArch64DB::sy) {
+ auto DB = AArch64DB::lookupDBByName(Tok.getString());
+ if (Mnemonic == "isb" && (!DB || DB->Encoding != AArch64DB::sy)) {
TokError("'sy' or #imm operand expected");
return MatchOperand_ParseFail;
+ } else if (!DB) {
+ TokError("invalid barrier option name");
+ return MatchOperand_ParseFail;
}
Operands.push_back(AArch64Operand::CreateBarrier(
Modified: llvm/trunk/test/MC/AArch64/basic-a64-diagnostics.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AArch64/basic-a64-diagnostics.s?rev=301165&r1=301164&r2=301165&view=diff
==============================================================================
--- llvm/trunk/test/MC/AArch64/basic-a64-diagnostics.s (original)
+++ llvm/trunk/test/MC/AArch64/basic-a64-diagnostics.s Mon Apr 24 03:22:20 2017
@@ -3273,29 +3273,41 @@
dsb #-1
dsb #16
+ dsb foo
dmb #-1
dmb #16
+ dmb foo
// CHECK-ERROR-NEXT: error: {{Invalid immediate for instruction|barrier operand out of range}}
// CHECK-ERROR-NEXT: dsb #-1
// CHECK-ERROR-NEXT: ^
// CHECK-ERROR-NEXT: error: {{Invalid immediate for instruction|barrier operand out of range}}
// CHECK-ERROR-NEXT: dsb #16
// CHECK-ERROR-NEXT: ^
+// CHECK-ERROR-NEXT: error: invalid barrier option name
+// CHECK-ERROR-NEXT: dsb foo
+// CHECK-ERROR-NEXT: ^
// CHECK-ERROR-NEXT: error: {{Invalid immediate for instruction|barrier operand out of range}}
// CHECK-ERROR-NEXT: dmb #-1
// CHECK-ERROR-NEXT: ^
// CHECK-ERROR-NEXT: error: {{Invalid immediate for instruction|barrier operand out of range}}
// CHECK-ERROR-NEXT: dmb #16
// CHECK-ERROR-NEXT: ^
+// CHECK-ERROR-NEXT: error: invalid barrier option name
+// CHECK-ERROR-NEXT: dmb foo
+// CHECK-ERROR-NEXT: ^
isb #-1
isb #16
+ isb foo
// CHECK-ERROR-NEXT: error: {{Invalid immediate for instruction|barrier operand out of range}}
// CHECK-ERROR-NEXT: isb #-1
// CHECK-ERROR-NEXT: ^
// CHECK-ERROR-NEXT: error: {{Invalid immediate for instruction|barrier operand out of range}}
// CHECK-ERROR-NEXT: isb #16
// CHECK-ERROR-NEXT: ^
+// CHECK-ERROR-NEXT: error: 'sy' or #imm operand expected
+// CHECK-ERROR-NEXT: isb foo
+// CHECK-ERROR-NEXT: ^
msr daifset, x4
msr spsel, #-1
More information about the llvm-commits
mailing list