aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2010-12-21 20:51:42 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2010-12-21 20:51:42 +0000
commit64b441219671d80dc42859ef37d30727591a5e2d (patch)
tree9ac9b61d26cbb0469153b2e880d50109a010764d
parent7a45903bf40a023ce96f4da953bb6cb2cb1a1b50 (diff)
downloadexternal_llvm-64b441219671d80dc42859ef37d30727591a5e2d.zip
external_llvm-64b441219671d80dc42859ef37d30727591a5e2d.tar.gz
external_llvm-64b441219671d80dc42859ef37d30727591a5e2d.tar.bz2
Simplify EvaluateAsAbsolute now that EvaluateAsRelocatableImpl does all
the folding it can. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122359 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/MC/MCExpr.cpp24
1 files changed, 5 insertions, 19 deletions
diff --git a/lib/MC/MCExpr.cpp b/lib/MC/MCExpr.cpp
index 879728f..e487416 100644
--- a/lib/MC/MCExpr.cpp
+++ b/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().