summaryrefslogtreecommitdiffstats
path: root/llvm/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
commit1d1fe918de14c3021e60ee232ad9520d0a26c7eb (patch)
tree1886d386828c43eb9979027a8644899a613b8560 /llvm/tools/llvm-mc/AsmParser.cpp
parent7fdbce7a6008615c8c72f508eea6a48bc07c2cb9 (diff)
downloadbcm5719-llvm-1d1fe918de14c3021e60ee232ad9520d0a26c7eb.tar.gz
bcm5719-llvm-1d1fe918de14c3021e60ee232ad9520d0a26c7eb.zip
process memory operands with a parenthesized expression for a displacement,
like "(4+5)(%eax)". llvm-svn: 73878
Diffstat (limited to 'llvm/tools/llvm-mc/AsmParser.cpp')
-rw-r--r--llvm/tools/llvm-mc/AsmParser.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/tools/llvm-mc/AsmParser.cpp b/llvm/tools/llvm-mc/AsmParser.cpp
index 397c5fe9c7c..715ff3932bc 100644
--- a/llvm/tools/llvm-mc/AsmParser.cpp
+++ b/llvm/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();
}
}
OpenPOWER on IntegriCloud