From e00b011e6a2597fcc3da88da91a8ffda6eebfcda Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Fri, 16 Oct 2009 01:57:52 +0000 Subject: [PATCH] MC: Remove unneeded context argument to MCExpr::Evaluate*. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84233 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/MC/MCExpr.h | 4 ++-- lib/MC/MCExpr.cpp | 14 +++++++------- lib/MC/MCMachOStreamer.cpp | 3 +-- tools/llvm-mc/AsmParser.cpp | 2 +- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/include/llvm/MC/MCExpr.h b/include/llvm/MC/MCExpr.h index 19a32e7adde..7ae3ba2b17c 100644 --- a/include/llvm/MC/MCExpr.h +++ b/include/llvm/MC/MCExpr.h @@ -62,14 +62,14 @@ public: /// /// @param Res - The absolute value, if evaluation succeeds. /// @result - True on success. - bool EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const; + bool EvaluateAsAbsolute(int64_t &Res) const; /// EvaluateAsRelocatable - Try to evaluate the expression to a relocatable /// value, i.e. an expression of the fixed form (a - b + constant). /// /// @param Res - The relocatable value, if evaluation succeeds. /// @result - True on success. - bool EvaluateAsRelocatable(MCContext &Ctx, MCValue &Res) const; + bool EvaluateAsRelocatable(MCValue &Res) const; /// @} diff --git a/lib/MC/MCExpr.cpp b/lib/MC/MCExpr.cpp index d6e545fa78c..c950ff2ff5c 100644 --- a/lib/MC/MCExpr.cpp +++ b/lib/MC/MCExpr.cpp @@ -141,10 +141,10 @@ const MCSymbolRefExpr *MCSymbolRefExpr::Create(const StringRef &Name, /* *** */ -bool MCExpr::EvaluateAsAbsolute(MCContext &Ctx, int64_t &Res) const { +bool MCExpr::EvaluateAsAbsolute(int64_t &Res) const { MCValue Value; - if (!EvaluateAsRelocatable(Ctx, Value) || !Value.isAbsolute()) + if (!EvaluateAsRelocatable(Value) || !Value.isAbsolute()) return false; Res = Value.getConstant(); @@ -173,7 +173,7 @@ static bool EvaluateSymbolicAdd(const MCValue &LHS, const MCSymbol *RHS_A, return true; } -bool MCExpr::EvaluateAsRelocatable(MCContext &Ctx, MCValue &Res) const { +bool MCExpr::EvaluateAsRelocatable(MCValue &Res) const { switch (getKind()) { case Constant: Res = MCValue::get(cast(this)->getValue()); @@ -184,7 +184,7 @@ bool MCExpr::EvaluateAsRelocatable(MCContext &Ctx, MCValue &Res) const { // Evaluate recursively if this is a variable. if (Sym.isVariable()) - return Sym.getValue()->EvaluateAsRelocatable(Ctx, Res); + return Sym.getValue()->EvaluateAsRelocatable(Res); Res = MCValue::get(&Sym, 0, 0); return true; @@ -194,7 +194,7 @@ bool MCExpr::EvaluateAsRelocatable(MCContext &Ctx, MCValue &Res) const { const MCUnaryExpr *AUE = cast(this); MCValue Value; - if (!AUE->getSubExpr()->EvaluateAsRelocatable(Ctx, Value)) + if (!AUE->getSubExpr()->EvaluateAsRelocatable(Value)) return false; switch (AUE->getOpcode()) { @@ -227,8 +227,8 @@ bool MCExpr::EvaluateAsRelocatable(MCContext &Ctx, MCValue &Res) const { const MCBinaryExpr *ABE = cast(this); MCValue LHSValue, RHSValue; - if (!ABE->getLHS()->EvaluateAsRelocatable(Ctx, LHSValue) || - !ABE->getRHS()->EvaluateAsRelocatable(Ctx, RHSValue)) + if (!ABE->getLHS()->EvaluateAsRelocatable(LHSValue) || + !ABE->getRHS()->EvaluateAsRelocatable(RHSValue)) return false; // We only support a few operations on non-constant expressions, handle diff --git a/lib/MC/MCMachOStreamer.cpp b/lib/MC/MCMachOStreamer.cpp index e04bd1fd1cb..b592391c512 100644 --- a/lib/MC/MCMachOStreamer.cpp +++ b/lib/MC/MCMachOStreamer.cpp @@ -346,8 +346,7 @@ void MCMachOStreamer::EmitValueToOffset(const MCExpr *Offset, unsigned char Value) { MCValue RelocOffset; - if (!AddValueSymbols(Offset)->EvaluateAsRelocatable(getContext(), - RelocOffset)) + if (!AddValueSymbols(Offset)->EvaluateAsRelocatable(RelocOffset)) return llvm_report_error("expected relocatable expression"); new MCOrgFragment(RelocOffset, Value, CurSectionData); diff --git a/tools/llvm-mc/AsmParser.cpp b/tools/llvm-mc/AsmParser.cpp index 02b7c396a4b..436f17d423b 100644 --- a/tools/llvm-mc/AsmParser.cpp +++ b/tools/llvm-mc/AsmParser.cpp @@ -292,7 +292,7 @@ bool AsmParser::ParseAbsoluteExpression(int64_t &Res) { if (ParseExpression(Expr)) return true; - if (!Expr->EvaluateAsAbsolute(Ctx, Res)) + if (!Expr->EvaluateAsAbsolute(Res)) return Error(StartLoc, "expected absolute expression"); return false;