[PATCH] D13592: [MC] Fixed parsing of macro arguments where expressions with spaces are present.

Scott Egerton via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 9 06:31:44 PDT 2015


s.egerton created this revision.
s.egerton added reviewers: dsanders, vkalintiris.
s.egerton added a subscriber: llvm-commits.

Fixed an issue for mips where an instruction such as:
sdc1 $f1, SC_FPREGS+8(a0) would return an error as SC_FPREGS and +8 are
interpreted as two arguments instead of an expression.
The reason that the test case has been changed is so that the expected
output matches the output of the GNU assembler.

http://reviews.llvm.org/D13592

Files:
  lib/MC/MCParser/AsmParser.cpp
  test/MC/AsmParser/macros-gas.s

Index: test/MC/AsmParser/macros-gas.s
===================================================================
--- test/MC/AsmParser/macros-gas.s
+++ test/MC/AsmParser/macros-gas.s
@@ -39,10 +39,10 @@
 .ascii "\_a \_b \_c"
 .endm
 
-// CHECK: .ascii "1 (23) "
+// CHECK: .ascii "1 (2 3) "
 test3_prime 1, (2 3)
 
-// CHECK: .ascii "1 (23) "
+// CHECK: .ascii "1 (2 3) "
 test3_prime 1 (2 3)
 
 // CHECK: .ascii "1 2 "
Index: lib/MC/MCParser/AsmParser.cpp
===================================================================
--- lib/MC/MCParser/AsmParser.cpp
+++ lib/MC/MCParser/AsmParser.cpp
@@ -1996,7 +1996,7 @@
     if (ParenLevel == 0 && Lexer.is(AsmToken::Comma))
       break;
 
-    if (Lexer.is(AsmToken::Space)) {
+    if (ParenLevel == 0 && Lexer.is(AsmToken::Space)) {
       Lex(); // Eat spaces
 
       // Spaces can delimit parameters, but could also be part an expression.
@@ -2011,9 +2011,8 @@
             AddTokens = 2;
         }
 
-        if (!AddTokens && ParenLevel == 0) {
+        if (!AddTokens)
           break;
-        }
       }
     }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13592.36944.patch
Type: text/x-patch
Size: 1064 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151009/98ae3ff5/attachment.bin>


More information about the llvm-commits mailing list