Given target assembler parsers a chance to handle variant expressions

first. Use this to turn the PPC modifiers into PPC specific expressions,
allowing them to work on constants.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189400 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Joerg Sonnenberger
2013-08-27 20:23:19 +00:00
parent b0bb2d6636
commit 66b7139b1b
6 changed files with 49 additions and 3 deletions

View File

@@ -54,7 +54,7 @@ PPCMCExpr::EvaluateAsRelocatableImpl(MCValue &Res,
const MCAsmLayout *Layout) const {
MCValue Value;
if (!getSubExpr()->EvaluateAsRelocatable(Value, *Layout))
if (Layout && !getSubExpr()->EvaluateAsRelocatable(Value, *Layout))
return false;
if (Value.isAbsolute()) {
@@ -85,7 +85,7 @@ PPCMCExpr::EvaluateAsRelocatableImpl(MCValue &Res,
break;
}
Res = MCValue::get(Result);
} else {
} else if (Layout) {
MCContext &Context = Layout->getAssembler().getContext();
const MCSymbolRefExpr *Sym = Value.getSymA();
MCSymbolRefExpr::VariantKind Modifier = Sym->getKind();
@@ -118,7 +118,8 @@ PPCMCExpr::EvaluateAsRelocatableImpl(MCValue &Res,
}
Sym = MCSymbolRefExpr::Create(&Sym->getSymbol(), Modifier, Context);
Res = MCValue::get(Sym, Value.getSymB(), Value.getConstant());
}
} else
return false;
return true;
}