[llvm-commits] [llvm] r166523 - /llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp

Chad Rosier mcrosier at apple.com
Tue Oct 23 16:31:33 PDT 2012


Author: mcrosier
Date: Tue Oct 23 18:31:33 2012
New Revision: 166523

URL: http://llvm.org/viewvc/llvm-project?rev=166523&view=rev
Log:
[ms-inline asm] When parsing inline assembly we set the base register to a
non-zero value as we don't know the actual value at this point.  This is
necessary to get the matching correct in some cases.  However, the actual value
set as the base register doesn't matter, since we're just matching not emitting.

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=166523&r1=166522&r2=166523&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Tue Oct 23 18:31:33 2012
@@ -808,8 +808,15 @@
       NeedSizeDir = Size > 0;
     }
   }
-  return X86Operand::CreateMem(Disp, Start, End, OffsetOfLoc, Size, OffsetOf,
-                               NeedSizeDir);
+  if (!isParsingInlineAsm())
+    return X86Operand::CreateMem(Disp, Start, End, OffsetOfLoc, Size);
+  else
+    // When parsing inline assembly we set the basereg to a non-zero value as we
+    // don't know the actualy value at this time.  This is necessary to get the
+    // matching correct in some cases.
+    return X86Operand::CreateMem(/*SegReg*/0, Disp, /*BaseReg*/1, /*IndexReg*/0,
+                                 /*Scale*/1, Start, End, OffsetOfLoc, Size,
+                                 OffsetOf, NeedSizeDir);
 }
 
 X86Operand *X86AsmParser::ParseIntelOperand() {





More information about the llvm-commits mailing list