[llvm-commits] [llvm] r94345 - in /llvm/trunk: lib/MC/MCParser/AsmParser.cpp lib/Target/X86/AsmParser/X86AsmParser.cpp test/MC/AsmParser/exprs.s

Chris Lattner sabre at nondot.org
Sat Jan 23 17:07:34 PST 2010


Author: lattner
Date: Sat Jan 23 19:07:33 2010
New Revision: 94345

URL: http://llvm.org/viewvc/llvm-project?rev=94345&view=rev
Log:
fix a parsing problem on instructions like:
movw	$8, (_cost_table_-L97$pb)+66(%eax)

After the parens, we could still have a binop.


Modified:
    llvm/trunk/lib/MC/MCParser/AsmParser.cpp
    llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
    llvm/trunk/test/MC/AsmParser/exprs.s

Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=94345&r1=94344&r2=94345&view=diff

==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Sat Jan 23 19:07:33 2010
@@ -331,10 +331,9 @@
 }
 
 bool AsmParser::ParseParenExpression(const MCExpr *&Res, SMLoc &EndLoc) {
-  if (ParseParenExpr(Res, EndLoc))
-    return true;
-
-  return false;
+  Res = 0;
+  return ParseParenExpr(Res, EndLoc) ||
+         ParseBinOpRHS(1, Res, EndLoc);
 }
 
 bool AsmParser::ParseAbsoluteExpression(int64_t &Res) {

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=94345&r1=94344&r2=94345&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp (original)
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp Sat Jan 23 19:07:33 2010
@@ -300,8 +300,8 @@
   
   // We have to disambiguate a parenthesized expression "(4+5)" from the start
   // of a memory operand with a missing displacement "(%ebx)" or "(,%eax)".  The
-  // only way to do this without lookahead is to eat the ( and see what is after
-  // it.
+  // only way to do this without lookahead is to eat the '(' and see what is
+  // after it.
   const MCExpr *Disp = MCConstantExpr::Create(0, getParser().getContext());
   if (getLexer().isNot(AsmToken::LParen)) {
     SMLoc ExprEnd;

Modified: llvm/trunk/test/MC/AsmParser/exprs.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/exprs.s?rev=94345&r1=94344&r2=94345&view=diff

==============================================================================
--- llvm/trunk/test/MC/AsmParser/exprs.s (original)
+++ llvm/trunk/test/MC/AsmParser/exprs.s Sat Jan 23 19:07:33 2010
@@ -60,3 +60,4 @@
         nop
         
         
+        movw	$8, (42)+66(%eax)





More information about the llvm-commits mailing list