[X86] Recognize "flags" as an identifier, not a register in Intel-syntax inline asm
authorMichael Kuperstein <michael.m.kuperstein@intel.com>
Thu, 30 Jul 2015 10:10:25 +0000 (10:10 +0000)
committerMichael Kuperstein <michael.m.kuperstein@intel.com>
Thu, 30 Jul 2015 10:10:25 +0000 (10:10 +0000)
Patch by: marina.yatsina@intel.com
Differential Revision: http://reviews.llvm.org/D11512

llvm-svn: 243630

llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp

index 6b3c4d8..6376291 100644 (file)
@@ -912,6 +912,11 @@ bool X86AsmParser::ParseRegister(unsigned &RegNo,
   if (RegNo == 0)
     RegNo = MatchRegisterName(Tok.getString().lower());
 
+  // The "flags" register cannot be referenced directly.
+  // Treat it as an identifier instead.
+  if (isParsingInlineAsm() && isParsingIntelSyntax() && RegNo == X86::EFLAGS)
+    RegNo = 0;
+
   if (!is64BitMode()) {
     // FIXME: This should be done using Requires<Not64BitMode> and
     // Requires<In64BitMode> so "eiz" usage in 64-bit instructions can be also