[ms-inline asm] Add support for creating AsmRewrites in the target specific
AsmParser logic.  To be used/tested in a subsequent commit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166714 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp
index 5e4447a..b47a6bd 100644
--- a/lib/MC/MCParser/AsmParser.cpp
+++ b/lib/MC/MCParser/AsmParser.cpp
@@ -86,7 +86,7 @@
                      MemoryBuffer *I);
 };
 
-struct AsmRewrite;
+//struct AsmRewrite;
 struct ParseStatementInfo {
   /// ParsedOperands - The parsed operands from the last parsed statement.
   SmallVector<MCParsedAsmOperand*, 8> ParsedOperands;
@@ -1365,8 +1365,9 @@
   for (unsigned i = 0, e = IDVal.size(); i != e; ++i)
     OpcodeStr.push_back(tolower(IDVal[i]));
 
-  bool HadError = getTargetParser().ParseInstruction(OpcodeStr.str(), IDLoc,
-                                                     Info.ParsedOperands);
+  ParseInstructionInfo IInfo(Info.AsmRewrites);
+  bool HadError = getTargetParser().ParseInstruction(IInfo, OpcodeStr.str(),
+                                                     IDLoc,Info.ParsedOperands);
 
   // Dump the parsed representation, if requested.
   if (getShowParsedOperands()) {
@@ -3583,27 +3584,6 @@
   return false;
 }
 
-namespace {
-enum AsmRewriteKind {
-   AOK_Imm,
-   AOK_Input,
-   AOK_Output,
-   AOK_SizeDirective,
-   AOK_Emit,
-   AOK_Skip
-};
-
-struct AsmRewrite {
-  AsmRewriteKind Kind;
-  SMLoc Loc;
-  unsigned Len;
-  unsigned Size;
-public:
-  AsmRewrite(AsmRewriteKind kind, SMLoc loc, unsigned len, unsigned size = 0)
-    : Kind(kind), Loc(loc), Len(len), Size(size) { }
-};
-}
-
 bool AsmParser::ParseDirectiveEmit(SMLoc IDLoc, ParseStatementInfo &Info) {
   const MCExpr *Value;
   SMLoc ExprLoc = getLexer().getLoc();
@@ -3780,7 +3760,7 @@
       OS << OutputIdx++;
       break;
     case AOK_SizeDirective:
-      switch((*I).Size) {
+      switch((*I).Val) {
       default: break;
       case 8:  OS << "byte ptr "; break;
       case 16: OS << "word ptr "; break;
@@ -3794,6 +3774,9 @@
     case AOK_Emit:
       OS << ".byte";
       break;
+    case AOK_DotOperator:
+      OS << (*I).Val;
+      break;
     }
 
     // Skip the original expression.