diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2009-07-02 02:09:07 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-02 02:09:07 +0000 |
| commit | 9bff6531fd344adc7b3ab441aadadbfb3c8c6e7e (patch) | |
| tree | a61d8b77d6104bc8e983f075d77b28a32695dbda /llvm/tools/llvm-mc/AsmParser.cpp | |
| parent | 36a20070593d0f48c2b9550e5be1ea90b586d4c3 (diff) | |
| download | bcm5719-llvm-9bff6531fd344adc7b3ab441aadadbfb3c8c6e7e.tar.gz bcm5719-llvm-9bff6531fd344adc7b3ab441aadadbfb3c8c6e7e.zip | |
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.
llvm-svn: 74685
Diffstat (limited to 'llvm/tools/llvm-mc/AsmParser.cpp')
| -rw-r--r-- | llvm/tools/llvm-mc/AsmParser.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/tools/llvm-mc/AsmParser.cpp b/llvm/tools/llvm-mc/AsmParser.cpp index 931e460ab16..339a16db8c2 100644 --- a/llvm/tools/llvm-mc/AsmParser.cpp +++ b/llvm/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) { |

