[ms-inline asm] Reset the opcode prior to parsing a statement.
authorChad Rosier <mcrosier@apple.com>
Fri, 19 Oct 2012 22:57:33 +0000 (22:57 +0000)
committerChad Rosier <mcrosier@apple.com>
Fri, 19 Oct 2012 22:57:33 +0000 (22:57 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166349 91177308-0d34-0410-b5e6-96231b3b80d8

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

index 6669780c7dbd55dc2b6f5452725bf7ec7ea9af79..690684f50ae28752f011211b1bcaa802d6db5757 100644 (file)
@@ -319,6 +319,7 @@ private:
   // MS-style inline assembly parsing.
   bool isInstruction() { return Opcode != (unsigned)~0x0; }
   unsigned getOpcode() { return Opcode; }
+  void setOpcode(unsigned Value) { Opcode = Value; }
 };
 
 /// \brief Generic implementations of directive handling, etc. which is shared
@@ -3615,7 +3616,11 @@ bool AsmParser::ParseMSInlineAsm(void *AsmLoc, std::string &AsmString,
   unsigned InputIdx = 0;
   unsigned OutputIdx = 0;
   while (getLexer().isNot(AsmToken::Eof)) {
-    if (ParseStatement()) return true;
+    // Clear the opcode.
+    setOpcode(~0x0);
+
+    if (ParseStatement())
+      return true;
 
     if (isInstruction()) {
       const MCInstrDesc &Desc = MII->get(getOpcode());
index 70f6ef766f88d944c8613ad8fa86af1e460b1f6c..e07fafcb20736244a2d59d3a9accb113880c7d67 100644 (file)
@@ -1553,9 +1553,6 @@ MatchAndEmitInstruction(SMLoc IDLoc, unsigned &Opcode,
   assert(Op->isToken() && "Leading operand should always be a mnemonic!");
   ArrayRef<SMRange> EmptyRanges = ArrayRef<SMRange>();
 
-  // Clear the opcode.
-  Opcode = ~0x0;
-
   // First, handle aliases that expand to multiple instructions.
   // FIXME: This should be replaced with a real .td file alias mechanism.
   // Also, MatchInstructionImpl should actually *do* the EmitInstruction