Try harder to evaluate expressions when printing assembly.

When printing assembly we don't have a Layout object, but we can still
try to fold some constants.

Testcase by Ulrich Weigand.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@203677 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Rafael Espindola
2014-03-12 16:55:59 +00:00
parent a3802ac246
commit 3b8cc2299b
9 changed files with 23 additions and 20 deletions

View File

@@ -122,7 +122,7 @@ uint64_t MCAsmLayout::getSymbolOffset(const MCSymbolData *SD) const {
// If this is a variable, then recursively evaluate now.
if (S.isVariable()) {
MCValue Target;
if (!S.getVariableValue()->EvaluateAsRelocatable(Target, *this))
if (!S.getVariableValue()->EvaluateAsRelocatable(Target, this))
report_fatal_error("unable to evaluate offset for variable '" +
S.getName() + "'");
@@ -357,7 +357,7 @@ bool MCAssembler::evaluateFixup(const MCAsmLayout &Layout,
MCValue &Target, uint64_t &Value) const {
++stats::evaluateFixup;
if (!Fixup.getValue()->EvaluateAsRelocatable(Target, Layout))
if (!Fixup.getValue()->EvaluateAsRelocatable(Target, &Layout))
getContext().FatalError(Fixup.getLoc(), "expected relocatable expression");
bool IsPCRel = Backend.getFixupKindInfo(