[llvm-commits] [llvm] r80576 - in /llvm/trunk: include/llvm/MC/MCAsmParser.h tools/llvm-mc/AsmParser.cpp tools/llvm-mc/AsmParser.h
Daniel Dunbar
daniel at zuster.org
Mon Aug 31 01:08:50 PDT 2009
Author: ddunbar
Date: Mon Aug 31 03:08:50 2009
New Revision: 80576
URL: http://llvm.org/viewvc/llvm-project?rev=80576&view=rev
Log:
llvm-mc: Remove MCAsmParser::Parse[Paren]RelocatableExpression.
Modified:
llvm/trunk/include/llvm/MC/MCAsmParser.h
llvm/trunk/tools/llvm-mc/AsmParser.cpp
llvm/trunk/tools/llvm-mc/AsmParser.h
Modified: llvm/trunk/include/llvm/MC/MCAsmParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/MC/MCAsmParser.h?rev=80576&r1=80575&r2=80576&view=diff
==============================================================================
--- llvm/trunk/include/llvm/MC/MCAsmParser.h (original)
+++ llvm/trunk/include/llvm/MC/MCAsmParser.h Mon Aug 31 03:08:50 2009
@@ -68,24 +68,6 @@
/// on error.
/// @result - False on success.
virtual bool ParseAbsoluteExpression(int64_t &Res) = 0;
-
- /// ParseRelocatableExpression - Parse an expression which must be
- /// relocatable.
- ///
- /// @param Res - The relocatable expression value. The result is undefined on
- /// error.
- /// @result - False on success.
- virtual bool ParseRelocatableExpression(MCValue &Res) = 0;
-
- /// ParseParenRelocatableExpression - Parse an expression which must be
- /// relocatable, assuming that an initial '(' has already been consumed.
- ///
- /// @param Res - The relocatable expression value. The result is undefined on
- /// error.
- /// @result - False on success.
- ///
- /// @see ParseRelocatableExpression, ParseParenExpr.
- virtual bool ParseParenRelocatableExpression(MCValue &Res) = 0;
};
} // End llvm namespace
Modified: llvm/trunk/tools/llvm-mc/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.cpp?rev=80576&r1=80575&r2=80576&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmParser.cpp (original)
+++ llvm/trunk/tools/llvm-mc/AsmParser.cpp Mon Aug 31 03:08:50 2009
@@ -279,32 +279,6 @@
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 @@
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::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 @@
/// ::= .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 @@
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");
Modified: llvm/trunk/tools/llvm-mc/AsmParser.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-mc/AsmParser.h?rev=80576&r1=80575&r2=80576&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-mc/AsmParser.h (original)
+++ llvm/trunk/tools/llvm-mc/AsmParser.h Mon Aug 31 03:08:50 2009
@@ -74,10 +74,6 @@
virtual bool ParseAbsoluteExpression(int64_t &Res);
- virtual bool ParseRelocatableExpression(MCValue &Res);
-
- virtual bool ParseParenRelocatableExpression(MCValue &Res);
-
/// }
private:
More information about the llvm-commits
mailing list