diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-08-31 08:08:50 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-08-31 08:08:50 +0000 |
commit | b6a03e093598d90c10c8d1cab8425e3d107b12cf (patch) | |
tree | 66fb07eb3e48ef9cf7d9dce87adaf2a3a702fc3f /tools/llvm-mc/AsmParser.cpp | |
parent | 6e96621a502ddebc12cd4d139756b7a90fd1ca8a (diff) | |
download | external_llvm-b6a03e093598d90c10c8d1cab8425e3d107b12cf.zip external_llvm-b6a03e093598d90c10c8d1cab8425e3d107b12cf.tar.gz external_llvm-b6a03e093598d90c10c8d1cab8425e3d107b12cf.tar.bz2 |
llvm-mc: Remove MCAsmParser::Parse[Paren]RelocatableExpression.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80576 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/llvm-mc/AsmParser.cpp')
-rw-r--r-- | tools/llvm-mc/AsmParser.cpp | 60 |
1 files changed, 27 insertions, 33 deletions
diff --git a/tools/llvm-mc/AsmParser.cpp b/tools/llvm-mc/AsmParser.cpp index 78cab38..0387857 100644 --- a/tools/llvm-mc/AsmParser.cpp +++ b/tools/llvm-mc/AsmParser.cpp @@ -279,32 +279,6 @@ bool AsmParser::ParseAbsoluteExpression(int64_t &Res) { return false; } -bool AsmParser::ParseRelocatableExpression(MCValue &Res) { - const MCExpr *Expr; - - SMLoc StartLoc = Lexer.getLoc(); - if (ParseExpression(Expr)) - return true; - - if (!Expr->EvaluateAsRelocatable(Ctx, Res)) - return Error(StartLoc, "expected relocatable expression"); - - return false; -} - -bool AsmParser::ParseParenRelocatableExpression(MCValue &Res) { - const MCExpr *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(AsmToken::TokenKind K, MCBinaryExpr::Opcode &Kind) { switch (K) { @@ -739,9 +713,14 @@ bool AsmParser::ParseAssignment(const StringRef &Name, bool IsDotSet) { SMLoc EqualLoc = Lexer.getLoc(); MCValue Value; - if (ParseRelocatableExpression(Value)) + const MCExpr *Expr; + SMLoc StartLoc = Lexer.getLoc(); + if (ParseExpression(Expr)) return true; + if (!Expr->EvaluateAsRelocatable(Ctx, Value)) + return Error(StartLoc, "expected relocatable expression"); + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in assignment"); @@ -958,11 +937,16 @@ bool AsmParser::ParseDirectiveAscii(bool ZeroTerminated) { bool AsmParser::ParseDirectiveValue(unsigned Size) { if (Lexer.isNot(AsmToken::EndOfStatement)) { for (;;) { - MCValue Expr; - if (ParseRelocatableExpression(Expr)) + MCValue Value; + const MCExpr *Expr; + SMLoc StartLoc = Lexer.getLoc(); + if (ParseExpression(Expr)) return true; - Out.EmitValue(Expr, Size); + if (!Expr->EvaluateAsRelocatable(Ctx, Value)) + return Error(StartLoc, "expected relocatable expression"); + + Out.EmitValue(Value, Size); if (Lexer.is(AsmToken::EndOfStatement)) break; @@ -1054,9 +1038,14 @@ bool AsmParser::ParseDirectiveFill() { /// ::= .org expression [ , expression ] bool AsmParser::ParseDirectiveOrg() { MCValue Offset; - if (ParseRelocatableExpression(Offset)) + const MCExpr *Expr; + SMLoc StartLoc = Lexer.getLoc(); + if (ParseExpression(Expr)) return true; + if (!Expr->EvaluateAsRelocatable(Ctx, Offset)) + return Error(StartLoc, "expected relocatable expression"); + // Parse optional fill expression. int64_t FillExpr = 0; if (Lexer.isNot(AsmToken::EndOfStatement)) { @@ -1428,10 +1417,15 @@ bool AsmParser::ParseDirectiveDarwinLsym() { return TokError("unexpected token in '.lsym' directive"); Lexer.Lex(); - MCValue Expr; - if (ParseRelocatableExpression(Expr)) + MCValue Value; + const MCExpr *Expr; + SMLoc StartLoc = Lexer.getLoc(); + if (ParseExpression(Expr)) return true; + if (!Expr->EvaluateAsRelocatable(Ctx, Value)) + return Error(StartLoc, "expected relocatable expression"); + if (Lexer.isNot(AsmToken::EndOfStatement)) return TokError("unexpected token in '.lsym' directive"); |