]> granicus.if.org Git - llvm/commitdiff
Revert "[X86][InlineAsm][Ms Compatibility]Prefer variable name over a register when...
authorReid Kleckner <rnk@google.com>
Mon, 24 Jul 2017 20:48:15 +0000 (20:48 +0000)
committerReid Kleckner <rnk@google.com>
Mon, 24 Jul 2017 20:48:15 +0000 (20:48 +0000)
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.

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

lib/Target/X86/AsmParser/X86AsmParser.cpp

index 31951c928f2121ea4ee9845b8d565a19c11ad3ea..c1d216c8b7af8a92e030d20c09626868911aa9f0 100644 (file)
@@ -944,8 +944,7 @@ bool X86AsmParser::ParseRegister(unsigned &RegNo,
   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(unsigned &RegNo,
   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)