diff options
author | Rafael Espindola <rafael.espindola@gmail.com> | 2010-12-21 20:51:42 +0000 |
---|---|---|
committer | Rafael Espindola <rafael.espindola@gmail.com> | 2010-12-21 20:51:42 +0000 |
commit | a468ae02cbf7ec02ba73ced0d245e3091897ad91 (patch) | |
tree | 3f0203d36a42e92b80baeb3435d5ca96fb9892e8 /llvm/lib/MC | |
parent | 6bdb49ded82cd406f0a9409e9c3c2e02dd1856d3 (diff) | |
download | bcm5719-llvm-a468ae02cbf7ec02ba73ced0d245e3091897ad91.tar.gz bcm5719-llvm-a468ae02cbf7ec02ba73ced0d245e3091897ad91.zip |
Simplify EvaluateAsAbsolute now that EvaluateAsRelocatableImpl does all
the folding it can.
llvm-svn: 122359
Diffstat (limited to 'llvm/lib/MC')
-rw-r--r-- | llvm/lib/MC/MCExpr.cpp | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp index 879728f2fee..e487416fe0b 100644 --- a/llvm/lib/MC/MCExpr.cpp +++ b/llvm/lib/MC/MCExpr.cpp @@ -269,27 +269,13 @@ bool MCExpr::EvaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm, // FIXME: The use if InSet = Addrs is a hack. Setting InSet causes us // absolutize differences across sections and that is what the MachO writer // uses Addrs for. - if (!EvaluateAsRelocatableImpl(Value, Asm, Layout, Addrs, /*InSet*/ Addrs) || - !Value.isAbsolute()) { - // EvaluateAsAbsolute is defined to return the "current value" of - // the expression if we are given a Layout object, even in cases - // when the value is not fixed. - if (Layout) { - Res = Value.getConstant(); - if (Value.getSymA()) { - Res += Layout->getSymbolOffset( - &Layout->getAssembler().getSymbolData(Value.getSymA()->getSymbol())); - } - if (Value.getSymB()) { - Res -= Layout->getSymbolOffset( - &Layout->getAssembler().getSymbolData(Value.getSymB()->getSymbol())); - } - } - return false; - } + bool IsRelocatable = + EvaluateAsRelocatableImpl(Value, Asm, Layout, Addrs, /*InSet*/ Addrs); + // Record the current value. Res = Value.getConstant(); - return true; + + return IsRelocatable && Value.isAbsolute(); } /// \brief Helper method for \see EvaluateSymbolAdd(). |