llvm-mc/X86: Parse '*' correctly (in the way the matcher expects).
authorDaniel Dunbar <daniel@zuster.org>
Tue, 11 Aug 2009 05:00:25 +0000 (05:00 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 11 Aug 2009 05:00:25 +0000 (05:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@78642 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/AsmParser/X86AsmParser.cpp
test/MC/AsmParser/x86_instructions.s

index c3e292eb7e935462a46aae2a83517e8e6dc77fa1..4643211867113d79fbe24f547c951472bad04f22 100644 (file)
@@ -263,17 +263,6 @@ bool X86ATTAsmParser::ParseOperand(X86Operand &Op) {
     Op = X86Operand::CreateImm(Val);
     return false;
   }
-  case AsmToken::Star:
-    getLexer().Lex(); // Eat the star.
-    
-    if (getLexer().is(AsmToken::Register)) {
-      if (ParseRegister(Op))
-        return true;
-    } else if (ParseMemOperand(Op))
-      return true;
-
-    // FIXME: Note the '*' in the operand for use by the matcher.
-    return false;
   }
 }
 
@@ -406,6 +395,13 @@ bool X86ATTAsmParser::ParseInstruction(const StringRef &Name, MCInst &Inst) {
 
   SMLoc Loc = getLexer().getTok().getLoc();
   if (getLexer().isNot(AsmToken::EndOfStatement)) {
+
+    // Parse '*' modifier.
+    if (getLexer().is(AsmToken::Star)) {
+      getLexer().Lex(); // Eat the star.
+      Operands.push_back(X86Operand::CreateToken("*"));
+    }
+
     // Read the first operand.
     Operands.push_back(X86Operand());
     if (ParseOperand(Operands.back()))
index 436e2e08fb8b2b4ce4bc7ef9073ff598e8a0e9cb..0d3367a03fab9c4770b849b47171f1e4c9c2d6a8 100644 (file)
@@ -49,3 +49,6 @@
 // RUN: grep {MCInst(opcode=.*, operands=.reg:21, reg:0, reg:19.)} %t
         subl %eax, %ebx
         
+// FIXME: Check that this matches the correct instruction.
+// RUN: grep {MCInst(opcode=.*, operands=.reg:80.)} %t
+        call *%rax