MCAsmBackend: Remove MCSubtargetInfo argument
After #141311 removed the MCSubtargetInfo argument from shouldForceRelocation, addReloc does not need this argument, either. In a rare scenario that the information is needed, the target should check the MCFragment subclass and get it from MCDataFragment/MCRelaxableFragment.
This commit is contained in:
@@ -117,8 +117,7 @@ public:
|
||||
|
||||
virtual bool addReloc(MCAssembler &Asm, const MCFragment &F,
|
||||
const MCFixup &Fixup, const MCValue &Target,
|
||||
uint64_t &FixedValue, bool IsResolved,
|
||||
const MCSubtargetInfo *);
|
||||
uint64_t &FixedValue, bool IsResolved);
|
||||
|
||||
/// Apply the \p Value for given \p Fixup into the provided data fragment, at
|
||||
/// the offset specified by the fixup and following the fixup kind as
|
||||
|
||||
@@ -120,8 +120,7 @@ bool MCAsmBackend::fixupNeedsRelaxationAdvanced(const MCAssembler &,
|
||||
|
||||
bool MCAsmBackend::addReloc(MCAssembler &Asm, const MCFragment &F,
|
||||
const MCFixup &Fixup, const MCValue &Target,
|
||||
uint64_t &FixedValue, bool IsResolved,
|
||||
const MCSubtargetInfo *STI) {
|
||||
uint64_t &FixedValue, bool IsResolved) {
|
||||
if (IsResolved && shouldForceRelocation(Asm, Fixup, Target))
|
||||
IsResolved = false;
|
||||
if (!IsResolved)
|
||||
|
||||
@@ -199,7 +199,7 @@ bool MCAssembler::evaluateFixup(const MCFixup &Fixup, const MCFragment *DF,
|
||||
if (IsResolved && mc::isRelocRelocation(Fixup.getKind()))
|
||||
IsResolved = false;
|
||||
IsResolved = getBackend().addReloc(const_cast<MCAssembler &>(*this), *DF,
|
||||
Fixup, Target, Value, IsResolved, STI);
|
||||
Fixup, Target, Value, IsResolved);
|
||||
getBackend().applyFixup(*this, Fixup, Target, Contents, Value, IsResolved,
|
||||
STI);
|
||||
return true;
|
||||
|
||||
@@ -370,8 +370,7 @@ AVRAsmBackend::createObjectTargetWriter() const {
|
||||
|
||||
bool AVRAsmBackend::addReloc(MCAssembler &Asm, const MCFragment &F,
|
||||
const MCFixup &Fixup, const MCValue &Target,
|
||||
uint64_t &FixedValue, bool IsResolved,
|
||||
const MCSubtargetInfo *STI) {
|
||||
uint64_t &FixedValue, bool IsResolved) {
|
||||
// AVR sets the fixup value to bypass the assembly time overflow with a
|
||||
// relocation.
|
||||
if (IsResolved) {
|
||||
|
||||
@@ -38,8 +38,8 @@ public:
|
||||
createObjectTargetWriter() const override;
|
||||
|
||||
bool addReloc(MCAssembler &Asm, const MCFragment &F, const MCFixup &Fixup,
|
||||
const MCValue &Target, uint64_t &FixedValue, bool IsResolved,
|
||||
const MCSubtargetInfo *) override;
|
||||
const MCValue &Target, uint64_t &FixedValue,
|
||||
bool IsResolved) override;
|
||||
|
||||
void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
|
||||
const MCValue &Target, MutableArrayRef<char> Data,
|
||||
|
||||
@@ -437,11 +437,10 @@ bool LoongArchAsmBackend::writeNopData(raw_ostream &OS, uint64_t Count,
|
||||
|
||||
bool LoongArchAsmBackend::addReloc(MCAssembler &Asm, const MCFragment &F,
|
||||
const MCFixup &Fixup, const MCValue &Target,
|
||||
uint64_t &FixedValue, bool IsResolved,
|
||||
const MCSubtargetInfo *CurSTI) {
|
||||
uint64_t &FixedValue, bool IsResolved) {
|
||||
auto Fallback = [&]() {
|
||||
return MCAsmBackend::addReloc(Asm, F, Fixup, Target, FixedValue, IsResolved,
|
||||
CurSTI);
|
||||
return MCAsmBackend::addReloc(Asm, F, Fixup, Target, FixedValue,
|
||||
IsResolved);
|
||||
};
|
||||
uint64_t FixedValueA, FixedValueB;
|
||||
if (Target.getSubSym()) {
|
||||
|
||||
@@ -36,8 +36,8 @@ public:
|
||||
const MCTargetOptions &Options);
|
||||
|
||||
bool addReloc(MCAssembler &Asm, const MCFragment &F, const MCFixup &Fixup,
|
||||
const MCValue &Target, uint64_t &FixedValue, bool IsResolved,
|
||||
const MCSubtargetInfo *) override;
|
||||
const MCValue &Target, uint64_t &FixedValue,
|
||||
bool IsResolved) override;
|
||||
|
||||
void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
|
||||
const MCValue &Target, MutableArrayRef<char> Data,
|
||||
|
||||
@@ -135,15 +135,15 @@ public:
|
||||
}
|
||||
|
||||
bool addReloc(MCAssembler &Asm, const MCFragment &F, const MCFixup &Fixup,
|
||||
const MCValue &TargetVal, uint64_t &FixedValue, bool IsResolved,
|
||||
const MCSubtargetInfo *STI) override {
|
||||
const MCValue &TargetVal, uint64_t &FixedValue,
|
||||
bool IsResolved) override {
|
||||
// In PPC64 ELFv1, .quad .TOC.@tocbase in the .opd section is expected to
|
||||
// reference the null symbol.
|
||||
auto Target = TargetVal;
|
||||
if (Target.getSpecifier() == PPCMCExpr::VK_TOCBASE)
|
||||
Target.setAddSym(nullptr);
|
||||
return MCAsmBackend::addReloc(Asm, F, Fixup, Target, FixedValue, IsResolved,
|
||||
STI);
|
||||
return MCAsmBackend::addReloc(Asm, F, Fixup, Target, FixedValue,
|
||||
IsResolved);
|
||||
}
|
||||
|
||||
void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
|
||||
|
||||
@@ -620,8 +620,7 @@ bool RISCVAsmBackend::evaluateTargetFixup(const MCAssembler &Asm,
|
||||
|
||||
bool RISCVAsmBackend::addReloc(MCAssembler &Asm, const MCFragment &F,
|
||||
const MCFixup &Fixup, const MCValue &Target,
|
||||
uint64_t &FixedValue, bool IsResolved,
|
||||
const MCSubtargetInfo *STI) {
|
||||
uint64_t &FixedValue, bool IsResolved) {
|
||||
uint64_t FixedValueA, FixedValueB;
|
||||
if (Target.getSubSym()) {
|
||||
assert(Target.getSpecifier() == 0 &&
|
||||
@@ -668,8 +667,8 @@ bool RISCVAsmBackend::addReloc(MCAssembler &Asm, const MCFragment &F,
|
||||
if (IsResolved &&
|
||||
(getFixupKindInfo(Fixup.getKind()).Flags & MCFixupKindInfo::FKF_IsPCRel))
|
||||
IsResolved = isPCRelFixupResolved(Asm, Target.getAddSym(), F);
|
||||
IsResolved = MCAsmBackend::addReloc(Asm, F, Fixup, Target, FixedValue,
|
||||
IsResolved, STI);
|
||||
IsResolved =
|
||||
MCAsmBackend::addReloc(Asm, F, Fixup, Target, FixedValue, IsResolved);
|
||||
|
||||
if (Fixup.isLinkerRelaxable()) {
|
||||
auto FA = MCFixup::create(Fixup.getOffset(), nullptr, ELF::R_RISCV_RELAX);
|
||||
|
||||
@@ -50,8 +50,8 @@ public:
|
||||
uint64_t &Value) override;
|
||||
|
||||
bool addReloc(MCAssembler &Asm, const MCFragment &F, const MCFixup &Fixup,
|
||||
const MCValue &Target, uint64_t &FixedValue, bool IsResolved,
|
||||
const MCSubtargetInfo *) override;
|
||||
const MCValue &Target, uint64_t &FixedValue,
|
||||
bool IsResolved) override;
|
||||
|
||||
void applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
|
||||
const MCValue &Target, MutableArrayRef<char> Data,
|
||||
|
||||
Reference in New Issue
Block a user