ARM asm parsing should handle pre-indexed writeback w/o immediate.
authorJim Grosbach <grosbach@apple.com>
Mon, 19 Sep 2011 18:42:21 +0000 (18:42 +0000)
committerJim Grosbach <grosbach@apple.com>
Mon, 19 Sep 2011 18:42:21 +0000 (18:42 +0000)
For example, 'ldrb r9, [sp]!' is odd, but valid.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140035 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/AsmParser/ARMAsmParser.cpp

index 30bed29949cba9e3598cf163b06be2879d5cad16..7646c5c31ca7b6a36c74002e439933519d749bdb 100644 (file)
@@ -2807,6 +2807,13 @@ parseMemory(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
     Operands.push_back(ARMOperand::CreateMem(BaseRegNum, 0, 0, ARM_AM::no_shift,
                                              0, false, S, E));
 
+    // If there's a pre-indexing writeback marker, '!', just add it as a token
+    // operand. It's rather odd, but syntactically valid.
+    if (Parser.getTok().is(AsmToken::Exclaim)) {
+      Operands.push_back(ARMOperand::CreateToken("!",Parser.getTok().getLoc()));
+      Parser.Lex(); // Eat the '!'.
+    }
+
     return false;
   }