summaryrefslogtreecommitdiff
path: root/tools/llvm-mc/AsmParser.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-07-02 02:09:07 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-07-02 02:09:07 +0000
commit2c3f00cd948345b9a6b48401f319ee3fdf907269 (patch)
tree236f920f671e85be986c4d43031e004d1addfc7c /tools/llvm-mc/AsmParser.cpp
parent46b6c5266ef055acc861b8d086c33fa01ab465bd (diff)
downloadllvm-2c3f00cd948345b9a6b48401f319ee3fdf907269.tar.gz
llvm-2c3f00cd948345b9a6b48401f319ee3fdf907269.tar.bz2
llvm-2c3f00cd948345b9a6b48401f319ee3fdf907269.tar.xz
llvm-mc/x86: Fix bug in disambiguation of displacement operand, introduced by me
(I think). - We weren't properly parsing the leading parenthesized expression in something like 'push (4)(%eax)'. - Added ParseParenRelocatableExpression to support this. I suspect we should just use lookahead, though. - Test case to follow. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74685 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-mc/AsmParser.cpp')
-rw-r--r--tools/llvm-mc/AsmParser.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/llvm-mc/AsmParser.cpp b/tools/llvm-mc/AsmParser.cpp
index 931e460ab1..339a16db8c 100644
--- a/tools/llvm-mc/AsmParser.cpp
+++ b/tools/llvm-mc/AsmParser.cpp
@@ -167,6 +167,19 @@ bool AsmParser::ParseRelocatableExpression(MCValue &Res) {
return false;
}
+bool AsmParser::ParseParenRelocatableExpression(MCValue &Res) {
+ AsmExpr *Expr;
+
+ SMLoc StartLoc = Lexer.getLoc();
+ if (ParseParenExpr(Expr))
+ return true;
+
+ if (!Expr->EvaluateAsRelocatable(Ctx, Res))
+ return Error(StartLoc, "expected relocatable expression");
+
+ return false;
+}
+
static unsigned getBinOpPrecedence(asmtok::TokKind K,
AsmBinaryExpr::Opcode &Kind) {
switch (K) {