fix a parsing problem on instructions like:
authorChris Lattner <sabre@nondot.org>
Sun, 24 Jan 2010 01:07:33 +0000 (01:07 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 24 Jan 2010 01:07:33 +0000 (01:07 +0000)
movw $8, (_cost_table_-L97$pb)+66(%eax)

After the parens, we could still have a binop.

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

lib/MC/MCParser/AsmParser.cpp
lib/Target/X86/AsmParser/X86AsmParser.cpp
test/MC/AsmParser/exprs.s

index dd438b76124f4ae1880674cc790f28a6a98421a0..077d2dffa65ab2ee697c456aa5cc486579fd4ac3 100644 (file)
@@ -331,10 +331,9 @@ bool AsmParser::ParseExpression(const MCExpr *&Res, SMLoc &EndLoc) {
 }
 
 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) {
index 7a9218e743c15a8ca0a2529388d05870025691d5..19fbf85e4affb9b1af0ddd54d7c38d4d8272d5be 100644 (file)
@@ -300,8 +300,8 @@ X86Operand *X86ATTAsmParser::ParseMemOperand() {
   
   // 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;
index 5fa4a371c3d077b41a57e40d41a78b8702c273e5..62b11c2d4e4e4c8599d5bde927c3572f0aa828ca 100644 (file)
@@ -60,3 +60,4 @@ n:
         nop
         
         
+        movw   $8, (42)+66(%eax)