[ms-inline asm] Have the target AsmParser create the asmrewrite for the offsetof
authorChad Rosier <mcrosier@apple.com>
Fri, 26 Oct 2012 16:09:20 +0000 (16:09 +0000)
committerChad Rosier <mcrosier@apple.com>
Fri, 26 Oct 2012 16:09:20 +0000 (16:09 +0000)
operator.

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

lib/MC/MCParser/AsmParser.cpp
lib/Target/X86/AsmParser/X86AsmParser.cpp

index b47a6bdb54075e8a3115fadd2b3a2eda2c0dbf37..0a657205493e47c83fa27b497f78332a7226f694 100644 (file)
@@ -3667,12 +3667,6 @@ bool AsmParser::ParseMSInlineAsm(void *AsmLoc, std::string &AsmString,
             AsmStrRewrites.push_back(AsmRewrite(AOK_SizeDirective,
                                                 Operand->getStartLoc(), 0,
                                                 Operand->getMemSize()));
-
-          // Don't emit the offset directive.
-          if (Operand->isOffsetOf())
-            AsmStrRewrites.push_back(AsmRewrite(AOK_Skip,
-                                                Operand->getOffsetOfLoc(), 7));
-
           if (isOutput) {
             std::string Constraint = "=";
             ++InputIdx;
index 7f47ef4c63ec2fa6659a9b4b60d8581e5e9760d9..a3e90af71ad9bd84fcd7bc982b10d6254343c514 100644 (file)
@@ -879,13 +879,16 @@ X86Operand *X86AsmParser::ParseIntelOffsetOfOperator(SMLoc Start) {
   Start = Parser.getTok().getLoc();
   assert (Parser.getTok().is(AsmToken::Identifier) && "Expected an identifier");
 
-  SMLoc End;  
+  SMLoc End;
   const MCExpr *Val;
   if (getParser().ParseExpression(Val, End))
     return 0;
 
   End = Parser.getTok().getLoc();
 
+  // Don't emit the offset operator.
+  InstInfo->AsmRewrites->push_back(AsmRewrite(AOK_Skip, OffsetOfLoc, 7));
+
   // The offset operator will have an 'r' constraint, thus we need to create
   // register operand to ensure proper matching.  Just pick a GPR based on
   // the size of a pointer.