diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-12-17 01:07:28 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-12-17 01:07:28 +0000 |
commit | 204e3b65eba7f8205a4160865224ffb0a471cd97 (patch) | |
tree | 09ca7c235890504c966ad32763d4d1f878d1016e /lib/MC/MCExpr.cpp | |
parent | f249e5d5d71d50323e7a60af1ee555de14378515 (diff) |
MC: Simplify (remove unnecessary MCAssembler argument, obsoleted by containment
in MCAsmLayout).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122011 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/MC/MCExpr.cpp')
-rw-r--r-- | lib/MC/MCExpr.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/lib/MC/MCExpr.cpp b/lib/MC/MCExpr.cpp index f7ed35374e..3e43cd8d97 100644 --- a/lib/MC/MCExpr.cpp +++ b/lib/MC/MCExpr.cpp @@ -304,8 +304,7 @@ bool MCExpr::EvaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm, /// /// \returns True on success, false if the result is not representable in an /// MCValue. -static bool EvaluateSymbolicAdd(const MCAssembler *Asm, - const MCAsmLayout *Layout, +static bool EvaluateSymbolicAdd(const MCAsmLayout *Layout, const SectionAddrMap *Addrs, bool InSet, const MCValue &LHS,const MCSymbolRefExpr *RHS_A, @@ -337,17 +336,14 @@ static bool EvaluateSymbolicAdd(const MCAssembler *Asm, // Absolutize symbol differences between defined symbols when we have a // layout object and the target requests it. - - assert((!Layout || Asm) && - "Must have an assembler object if layout is given!"); - - if (Asm && A && B) { + if (Layout && A && B) { + const MCAssembler &Asm = Layout->getAssembler(); const MCSymbol &SA = A->getSymbol(); const MCSymbol &SB = B->getSymbol(); - const MCObjectFormat &F = Asm->getBackend().getObjectFormat(); + const MCObjectFormat &F = Asm.getBackend().getObjectFormat(); if (SA.isDefined() && SB.isDefined() && F.isAbsolute(InSet, SA, SB)) { - MCSymbolData &AD = Asm->getSymbolData(A->getSymbol()); - MCSymbolData &BD = Asm->getSymbolData(B->getSymbol()); + MCSymbolData &AD = Asm.getSymbolData(A->getSymbol()); + MCSymbolData &BD = Asm.getSymbolData(B->getSymbol()); if (AD.getFragment() == BD.getFragment()) { Res = MCValue::get(+ AD.getOffset() @@ -474,13 +470,13 @@ bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res, return false; case MCBinaryExpr::Sub: // Negate RHS and add. - return EvaluateSymbolicAdd(Asm, Layout, Addrs, InSet, LHSValue, + return EvaluateSymbolicAdd(Layout, Addrs, InSet, LHSValue, RHSValue.getSymB(), RHSValue.getSymA(), -RHSValue.getConstant(), Res); case MCBinaryExpr::Add: - return EvaluateSymbolicAdd(Asm, Layout, Addrs, InSet, LHSValue, + return EvaluateSymbolicAdd(Layout, Addrs, InSet, LHSValue, RHSValue.getSymA(), RHSValue.getSymB(), RHSValue.getConstant(), Res); |