[llvm] r308926 - Revert "[X86][InlineAsm][Ms Compatibility]Prefer variable name over a register when the two collides"

Reid Kleckner via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 24 13:48:15 PDT 2017


Author: rnk
Date: Mon Jul 24 13:48:15 2017
New Revision: 308926

URL: http://llvm.org/viewvc/llvm-project?rev=308926&view=rev
Log:
Revert "[X86][InlineAsm][Ms Compatibility]Prefer variable name over a register when the two collides"

This reverts r308867 and r308866.

It broke the sanitizer-windows buildbot on C++ code similar to the
following:

  namespace cl { }
  void f() {
    __asm {
      mov al, cl
    }
  }

t.cpp(4,13):  error: unexpected namespace name 'cl': expected expression
    mov al, cl
            ^

In this case, MSVC parses 'cl' as a register, not a namespace.

Modified:
    llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp

Modified: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp?rev=308926&r1=308925&r2=308926&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Mon Jul 24 13:48:15 2017
@@ -944,8 +944,7 @@ bool X86AsmParser::ParseRegister(unsigne
   EndLoc = Tok.getEndLoc();
 
   if (Tok.isNot(AsmToken::Identifier)) {
-    if (isParsingIntelSyntax())
-      return true;
+    if (isParsingIntelSyntax()) return true;
     return Error(StartLoc, "invalid register name",
                  SMRange(StartLoc, EndLoc));
   }
@@ -956,16 +955,6 @@ bool X86AsmParser::ParseRegister(unsigne
   if (RegNo == 0)
     RegNo = MatchRegisterName(Tok.getString().lower());
 
-  // In MS inline-asm we allow variables to be named as registers, and
-  // give them precedence over actual registers
-  // However - we require the match to be case sensitive
-  if (isParsingInlineAsm() && isParsingIntelSyntax() && RegNo) {
-    StringRef LineBuf(Tok.getIdentifier().data());
-    InlineAsmIdentifierInfo Info;
-    if (SemaCallback->LookupInlineAsmIdentifier(LineBuf, Info, false))
-      return true;
-  }
-
   // The "flags" register cannot be referenced directly.
   // Treat it as an identifier instead.
   if (isParsingInlineAsm() && isParsingIntelSyntax() && RegNo == X86::EFLAGS)




More information about the llvm-commits mailing list