Skip to content

Commit d6fbffa

Browse files
committed
[MC] evaluateAsRelocatable: remove the Fixup argument
Commit 752b91b added the argument for PowerPC to evaluate @l/@ha as constant in 2014. However, this is not needed and has been cleaned up by commit 8560da2. Mips also had an inappropriate use, which has been fixed by 79d84a8
1 parent 0bd8a75 commit d6fbffa

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

llvm/include/llvm/MC/MCExpr.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ class MCExpr {
6363
}
6464

6565
bool evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
66-
const MCFixup *Fixup,
6766
const SectionAddrMap *Addrs, bool InSet) const;
6867

6968
unsigned getSubclassData() const { return SubclassData; }

llvm/lib/MC/MCExpr.cpp

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,7 @@ bool MCExpr::evaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
285285
return true;
286286
}
287287

288-
bool IsRelocatable =
289-
evaluateAsRelocatableImpl(Value, Asm, nullptr, Addrs, InSet);
288+
bool IsRelocatable = evaluateAsRelocatableImpl(Value, Asm, Addrs, InSet);
290289

291290
// Record the current value.
292291
Res = Value.getConstant();
@@ -496,11 +495,11 @@ static bool evaluateSymbolicAdd(const MCAssembler *Asm,
496495

497496
bool MCExpr::evaluateAsRelocatable(MCValue &Res, const MCAssembler *Asm,
498497
const MCFixup *Fixup) const {
499-
return evaluateAsRelocatableImpl(Res, Asm, Fixup, nullptr, false);
498+
return evaluateAsRelocatableImpl(Res, Asm, nullptr, false);
500499
}
501500

502501
bool MCExpr::evaluateAsValue(MCValue &Res, const MCAssembler &Asm) const {
503-
return evaluateAsRelocatableImpl(Res, &Asm, nullptr, nullptr, true);
502+
return evaluateAsRelocatableImpl(Res, &Asm, nullptr, true);
504503
}
505504

506505
static bool canExpand(const MCSymbol &Sym, bool InSet) {
@@ -520,13 +519,13 @@ static bool canExpand(const MCSymbol &Sym, bool InSet) {
520519
}
521520

522521
bool MCExpr::evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
523-
const MCFixup *Fixup,
524522
const SectionAddrMap *Addrs,
525523
bool InSet) const {
526524
++stats::MCExprEvaluate;
527525
switch (getKind()) {
528526
case Target:
529-
return cast<MCTargetExpr>(this)->evaluateAsRelocatableImpl(Res, Asm, Fixup);
527+
return cast<MCTargetExpr>(this)->evaluateAsRelocatableImpl(Res, Asm,
528+
nullptr);
530529

531530
case Constant:
532531
Res = MCValue::get(cast<MCConstantExpr>(this)->getValue());
@@ -542,8 +541,8 @@ bool MCExpr::evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
542541
if (Sym.isVariable() && (Kind == MCSymbolRefExpr::VK_None || Layout) &&
543542
canExpand(Sym, InSet)) {
544543
bool IsMachO = SRE->hasSubsectionsViaSymbols();
545-
if (Sym.getVariableValue()->evaluateAsRelocatableImpl(
546-
Res, Asm, Fixup, Addrs, InSet || IsMachO)) {
544+
if (Sym.getVariableValue()->evaluateAsRelocatableImpl(Res, Asm, Addrs,
545+
InSet || IsMachO)) {
547546
if (Kind != MCSymbolRefExpr::VK_None) {
548547
if (Res.isAbsolute()) {
549548
Res = MCValue::get(SRE, nullptr, 0);
@@ -588,8 +587,7 @@ bool MCExpr::evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
588587
const MCUnaryExpr *AUE = cast<MCUnaryExpr>(this);
589588
MCValue Value;
590589

591-
if (!AUE->getSubExpr()->evaluateAsRelocatableImpl(Value, Asm, Fixup, Addrs,
592-
InSet))
590+
if (!AUE->getSubExpr()->evaluateAsRelocatableImpl(Value, Asm, Addrs, InSet))
593591
return false;
594592

595593
switch (AUE->getOpcode()) {
@@ -624,9 +622,9 @@ bool MCExpr::evaluateAsRelocatableImpl(MCValue &Res, const MCAssembler *Asm,
624622
const MCBinaryExpr *ABE = cast<MCBinaryExpr>(this);
625623
MCValue LHSValue, RHSValue;
626624

627-
if (!ABE->getLHS()->evaluateAsRelocatableImpl(LHSValue, Asm, Fixup, Addrs,
625+
if (!ABE->getLHS()->evaluateAsRelocatableImpl(LHSValue, Asm, Addrs,
628626
InSet) ||
629-
!ABE->getRHS()->evaluateAsRelocatableImpl(RHSValue, Asm, Fixup, Addrs,
627+
!ABE->getRHS()->evaluateAsRelocatableImpl(RHSValue, Asm, Addrs,
630628
InSet)) {
631629
// Check if both are Target Expressions, see if we can compare them.
632630
if (const MCTargetExpr *L = dyn_cast<MCTargetExpr>(ABE->getLHS())) {

0 commit comments

Comments
 (0)