summaryrefslogtreecommitdiffstats
path: root/llvm/tools
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-08-31 08:08:50 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-08-31 08:08:50 +0000
commitb12b33051db0f333fa3ee527dd1894c9d827e5a5 (patch)
tree0b3d0a1f903b2641bb272917f4f5d407690b4b7b /llvm/tools
parent73da11ebdad9a22afacb3f7755e3cd9ec2182920 (diff)
downloadbcm5719-llvm-b12b33051db0f333fa3ee527dd1894c9d827e5a5.tar.gz
bcm5719-llvm-b12b33051db0f333fa3ee527dd1894c9d827e5a5.zip
llvm-mc: Remove MCAsmParser::Parse[Paren]RelocatableExpression.
llvm-svn: 80576
Diffstat (limited to 'llvm/tools')
-rw-r--r--llvm/tools/llvm-mc/AsmParser.cpp60
-rw-r--r--llvm/tools/llvm-mc/AsmParser.h4
2 files changed, 27 insertions, 37 deletions
diff --git a/llvm/tools/llvm-mc/AsmParser.cpp b/llvm/tools/llvm-mc/AsmParser.cpp
index 78cab38b4ff..0387857c247 100644
--- a/llvm/tools/llvm-mc/AsmParser.cpp
+++ b/llvm/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");
diff --git a/llvm/tools/llvm-mc/AsmParser.h b/llvm/tools/llvm-mc/AsmParser.h
index 2e328d9f6fd..fda79ca8426 100644
--- a/llvm/tools/llvm-mc/AsmParser.h
+++ b/llvm/tools/llvm-mc/AsmParser.h
@@ -74,10 +74,6 @@ public:
virtual bool ParseAbsoluteExpression(int64_t &Res);
- virtual bool ParseRelocatableExpression(MCValue &Res);
-
- virtual bool ParseParenRelocatableExpression(MCValue &Res);
-
/// }
private:
OpenPOWER on IntegriCloud