summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2010-09-30 16:42:21 +0000
committerKevin Enderby <enderby@apple.com>2010-09-30 16:42:21 +0000
commitdce906c77f86a0e3fa7ae74a01a2bfb678e216bd (patch)
tree3797501172ff7fa9f6ddab7878f7a5a8b5770e35 /llvm/lib
parentadc0dbe470198a1a8a4b77b698dc7eec1ac52b1b (diff)
downloadbcm5719-llvm-dce906c77f86a0e3fa7ae74a01a2bfb678e216bd.tar.gz
bcm5719-llvm-dce906c77f86a0e3fa7ae74a01a2bfb678e216bd.zip
Changes EvaluateAsAbsolute() to return the "current value" of the expression
if we are given a Layout object, even in cases when the value is not fixed. This will be needed by the final patch for the dwarf .loc support to size a new MCDwarf fragment needed to build and emit dwarf line number tables. llvm-svn: 115155
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/MC/MCExpr.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/llvm/lib/MC/MCExpr.cpp b/llvm/lib/MC/MCExpr.cpp
index ddd82f3f622..e9a6062fe7d 100644
--- a/llvm/lib/MC/MCExpr.cpp
+++ b/llvm/lib/MC/MCExpr.cpp
@@ -215,8 +215,23 @@ bool MCExpr::EvaluateAsAbsolute(int64_t &Res, const MCAsmLayout *Layout) const {
return true;
}
- if (!EvaluateAsRelocatable(Value, Layout) || !Value.isAbsolute())
+ if (!EvaluateAsRelocatable(Value, Layout) || !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->getSymbolAddress(
+ &Layout->getAssembler().getSymbolData(Value.getSymA()->getSymbol()));
+ }
+ if (Value.getSymB()) {
+ Res -= Layout->getSymbolAddress(
+ &Layout->getAssembler().getSymbolData(Value.getSymB()->getSymbol()));
+ }
+ }
return false;
+ }
Res = Value.getConstant();
return true;
OpenPOWER on IntegriCloud