[PATCH] D30462: [ARM] Fix parsing of special register masks
Oliver Stannard via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 28 08:19:05 PST 2017
olista01 created this revision.
Herald added a subscriber: aemerson.
This parsing code was incorrectly checking for invalid characters, so an invalid instruction like:
msr spsr_w
would be emitted as:
msr spsr_cxsf
Repository:
rL LLVM
https://reviews.llvm.org/D30462
Files:
lib/Target/ARM/AsmParser/ARMAsmParser.cpp
test/MC/ARM/invalid-special-reg.s
Index: test/MC/ARM/invalid-special-reg.s
===================================================================
--- /dev/null
+++ test/MC/ARM/invalid-special-reg.s
@@ -0,0 +1,11 @@
+@ RUN: not llvm-mc -triple armv7a--none-eabi < %s |& FileCheck %s
+@ RUN: not llvm-mc -triple thumbv7a--none-eabi < %s |& FileCheck %s
+
+ msr apsr_c, r0
+@ CHECK: invalid operand for instruction
+ msr cpsr_w
+@ CHECK: invalid operand for instruction
+ msr cpsr_cc
+@ CHECK: invalid operand for instruction
+ msr xpsr_c
+@ CHECK: invalid operand for instruction
Index: lib/Target/ARM/AsmParser/ARMAsmParser.cpp
===================================================================
--- lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -4330,7 +4330,7 @@
// If some specific flag is already set, it means that some letter is
// present more than once, this is not acceptable.
- if (FlagsVal == ~0U || (FlagsVal & Flag))
+ if (Flag == ~0U || (FlagsVal & Flag))
return MatchOperand_NoMatch;
FlagsVal |= Flag;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D30462.90040.patch
Type: text/x-patch
Size: 1077 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170228/285b3e57/attachment.bin>
More information about the llvm-commits
mailing list