[PATCH] D41579: [X86] A fix for pr35741 - can't use comments with instr prefixes

Andrew V. Tischenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 26 02:57:46 PST 2017


avt77 created this revision.
avt77 added reviewers: RKSimon, dim, craig.topper.

After general commit covering several issues with x86 prefixes we lost a possibility to use comments if there is a prefix on a dedicated line. This tiny patch fixes this issue.


https://reviews.llvm.org/D41579

Files:
  lib/Target/X86/AsmParser/X86AsmParser.cpp
  test/MC/X86/x86-64.s


Index: test/MC/X86/x86-64.s
===================================================================
--- test/MC/X86/x86-64.s
+++ test/MC/X86/x86-64.s
@@ -99,6 +99,10 @@
 // CHECK: shll $2, %eax
         sall $2, %eax
 
+// CHECK: rep movsb
+rep     # comment
+movsb
+
 // CHECK: rep
 // CHECK: insb
         rep;insb
Index: lib/Target/X86/AsmParser/X86AsmParser.cpp
===================================================================
--- lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -2377,10 +2377,11 @@
     Flags |= Prefix;
     Name = Parser.getTok().getString();
     Parser.Lex(); // eat the prefix
-    // Hack: we could have something like
+    // Hack: we could have something like "rep # some comment" or
     //    "lock; cmpxchg16b $1" or "lock\0A\09incl" or "lock/incl"
     while (Name.startswith(";") || Name.startswith("\n") ||
-           Name.startswith("\t") || Name.startswith("/")) {
+           Name.startswith("#") || Name.startswith("\t") ||
+           Name.startswith("/")) {
       Name = Parser.getTok().getString();
       Parser.Lex(); // go to next prefix or instr
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41579.128157.patch
Type: text/x-patch
Size: 1144 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171226/7ecfd1d1/attachment.bin>


More information about the llvm-commits mailing list