mirror of
https://github.com/RPCS3/llvm.git
synced 2025-02-03 17:24:24 +00:00
MC: Simplify (remove unnecessary MCAssembler argument, obsoleted by containment
in MCAsmLayout). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122011 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f249e5d5d7
commit
204e3b65eb
@ -304,8 +304,7 @@ bool MCExpr::EvaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
|
|||||||
///
|
///
|
||||||
/// \returns True on success, false if the result is not representable in an
|
/// \returns True on success, false if the result is not representable in an
|
||||||
/// MCValue.
|
/// MCValue.
|
||||||
static bool EvaluateSymbolicAdd(const MCAssembler *Asm,
|
static bool EvaluateSymbolicAdd(const MCAsmLayout *Layout,
|
||||||
const MCAsmLayout *Layout,
|
|
||||||
const SectionAddrMap *Addrs,
|
const SectionAddrMap *Addrs,
|
||||||
bool InSet,
|
bool InSet,
|
||||||
const MCValue &LHS,const MCSymbolRefExpr *RHS_A,
|
const MCValue &LHS,const MCSymbolRefExpr *RHS_A,
|
||||||
@ -337,17 +336,14 @@ static bool EvaluateSymbolicAdd(const MCAssembler *Asm,
|
|||||||
|
|
||||||
// Absolutize symbol differences between defined symbols when we have a
|
// Absolutize symbol differences between defined symbols when we have a
|
||||||
// layout object and the target requests it.
|
// layout object and the target requests it.
|
||||||
|
if (Layout && A && B) {
|
||||||
assert((!Layout || Asm) &&
|
const MCAssembler &Asm = Layout->getAssembler();
|
||||||
"Must have an assembler object if layout is given!");
|
|
||||||
|
|
||||||
if (Asm && A && B) {
|
|
||||||
const MCSymbol &SA = A->getSymbol();
|
const MCSymbol &SA = A->getSymbol();
|
||||||
const MCSymbol &SB = B->getSymbol();
|
const MCSymbol &SB = B->getSymbol();
|
||||||
const MCObjectFormat &F = Asm->getBackend().getObjectFormat();
|
const MCObjectFormat &F = Asm.getBackend().getObjectFormat();
|
||||||
if (SA.isDefined() && SB.isDefined() && F.isAbsolute(InSet, SA, SB)) {
|
if (SA.isDefined() && SB.isDefined() && F.isAbsolute(InSet, SA, SB)) {
|
||||||
MCSymbolData &AD = Asm->getSymbolData(A->getSymbol());
|
MCSymbolData &AD = Asm.getSymbolData(A->getSymbol());
|
||||||
MCSymbolData &BD = Asm->getSymbolData(B->getSymbol());
|
MCSymbolData &BD = Asm.getSymbolData(B->getSymbol());
|
||||||
|
|
||||||
if (AD.getFragment() == BD.getFragment()) {
|
if (AD.getFragment() == BD.getFragment()) {
|
||||||
Res = MCValue::get(+ AD.getOffset()
|
Res = MCValue::get(+ AD.getOffset()
|
||||||
@ -474,13 +470,13 @@ bool MCExpr::EvaluateAsRelocatableImpl(MCValue &Res,
|
|||||||
return false;
|
return false;
|
||||||
case MCBinaryExpr::Sub:
|
case MCBinaryExpr::Sub:
|
||||||
// Negate RHS and add.
|
// Negate RHS and add.
|
||||||
return EvaluateSymbolicAdd(Asm, Layout, Addrs, InSet, LHSValue,
|
return EvaluateSymbolicAdd(Layout, Addrs, InSet, LHSValue,
|
||||||
RHSValue.getSymB(), RHSValue.getSymA(),
|
RHSValue.getSymB(), RHSValue.getSymA(),
|
||||||
-RHSValue.getConstant(),
|
-RHSValue.getConstant(),
|
||||||
Res);
|
Res);
|
||||||
|
|
||||||
case MCBinaryExpr::Add:
|
case MCBinaryExpr::Add:
|
||||||
return EvaluateSymbolicAdd(Asm, Layout, Addrs, InSet, LHSValue,
|
return EvaluateSymbolicAdd(Layout, Addrs, InSet, LHSValue,
|
||||||
RHSValue.getSymA(), RHSValue.getSymB(),
|
RHSValue.getSymA(), RHSValue.getSymB(),
|
||||||
RHSValue.getConstant(),
|
RHSValue.getConstant(),
|
||||||
Res);
|
Res);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user