[llvm-commits] [llvm] r73878 - /llvm/trunk/tools/llvm-mc/AsmParser.cpp

Chris Lattner sabre at nondot.org
Sun Jun 21 23:35:59 PDT 2009


Author: lattner
Date: Mon Jun 22 01:35:58 2009
New Revision: 73878

URL: http://llvm.org/viewvc/llvm-project?rev=73878&view=rev
Log:
process memory operands with a parenthesized expression for a displacement,
like "(4+5)(%eax)".


Modified:
    llvm/trunk/tools/llvm-mc/AsmParser.cpp

Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=73878&r1=73877&r2=73878&view=diff

==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original)
+++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Jun 22 01:35:58 2009
@@ -167,8 +167,18 @@
       // Nothing to do here, fall into the code below with the '(' part of the
       // memory operand consumed.
     } else {
-      // FIXME: Call ParseParenExpression with the leading ( consumed.
-      return TokError("FIXME: Paren expr not implemented yet!");
+      // It must be an parenthesized expression, parse it now.
+      if (ParseParenExpr(Disp)) return true;
+      
+      // After parsing the base expression we could either have a parenthesized
+      // memory address or not.  If not, return now.  If so, eat the (.
+      if (Lexer.isNot(asmtok::LParen)) {
+        Op = X86Operand::CreateMem(SegReg, Disp, 0, 0, 0);
+        return false;
+      }
+      
+      // Eat the '('.
+      Lexer.Lex();
     }
   }
   





More information about the llvm-commits mailing list