aboutsummaryrefslogtreecommitdiff
path: root/tools/llvm-mc/AsmParser.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-06-22 06:35:58 +0000
committerChris Lattner <sabre@nondot.org>2009-06-22 06:35:58 +0000
commit7031806fe236537a07a76b3936e540744c96b5ef (patch)
tree1d532820cfc01dc953473e2559fb2da176b5248b /tools/llvm-mc/AsmParser.cpp
parent74ec1a3b115a889e1a70dd22d8dcc6a5e753a5d2 (diff)
process memory operands with a parenthesized expression for a displacement,
like "(4+5)(%eax)". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73878 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-mc/AsmParser.cpp')
-rw-r--r--tools/llvm-mc/AsmParser.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/tools/llvm-mc/AsmParser.cpp b/tools/llvm-mc/AsmParser.cpp
index 397c5fe9c7..715ff3932b 100644
--- a/tools/llvm-mc/AsmParser.cpp
+++ b/tools/llvm-mc/AsmParser.cpp
@@ -167,8 +167,18 @@ bool AsmParser::ParseX86MemOperand(X86Operand &Op) {
// 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();
}
}