Skip to content

Commit

Permalink
Simplify the processFixupValue interface. NFC.
Browse files Browse the repository at this point in the history
llvm-svn: 306202
espindola committed Jun 24, 2017
1 parent 25d51d6 commit 6418856
Showing 8 changed files with 18 additions and 35 deletions.
7 changes: 2 additions & 5 deletions llvm/include/llvm/MC/MCAsmBackend.h
Original file line number Diff line number Diff line change
@@ -63,11 +63,8 @@ class MCAsmBackend {
/// Target hook to adjust the literal value of a fixup if necessary.
/// IsResolved signals whether the caller believes a relocation is needed; the
/// target can modify the value. The default does nothing.
virtual void processFixupValue(const MCAssembler &Asm,
const MCAsmLayout &Layout,
const MCFixup &Fixup, const MCFragment *DF,
const MCValue &Target, uint64_t &Value,
bool &IsResolved) {}
virtual void processFixupValue(const MCAssembler &Asm, const MCFixup &Fixup,
const MCValue &Target, 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
3 changes: 1 addition & 2 deletions llvm/lib/MC/MCAssembler.cpp
Original file line number Diff line number Diff line change
@@ -263,8 +263,7 @@ bool MCAssembler::evaluateFixup(const MCAsmLayout &Layout,

// Let the backend adjust the fixup value if necessary, including whether
// we need a relocation.
Backend.processFixupValue(*this, Layout, Fixup, DF, Target, Value,
IsResolved);
Backend.processFixupValue(*this, Fixup, Target, IsResolved);

return IsResolved;
}
14 changes: 6 additions & 8 deletions llvm/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp
Original file line number Diff line number Diff line change
@@ -541,16 +541,14 @@ class ELFAArch64AsmBackend : public AArch64AsmBackend {
return createAArch64ELFObjectWriter(OS, OSABI, IsLittleEndian, IsILP32);
}

void processFixupValue(const MCAssembler &Asm, const MCAsmLayout &Layout,
const MCFixup &Fixup, const MCFragment *DF,
const MCValue &Target, uint64_t &Value,
bool &IsResolved) override;
void processFixupValue(const MCAssembler &Asm, const MCFixup &Fixup,
const MCValue &Target, bool &IsResolved) override;
};

void ELFAArch64AsmBackend::processFixupValue(
const MCAssembler &Asm, const MCAsmLayout &Layout, const MCFixup &Fixup,
const MCFragment *DF, const MCValue &Target, uint64_t &Value,
bool &IsResolved) {
void ELFAArch64AsmBackend::processFixupValue(const MCAssembler &Asm,
const MCFixup &Fixup,
const MCValue &Target,
bool &IsResolved) {
// The ADRP instruction adds some multiple of 0x1000 to the current PC &
// ~0xfff. This means that the required offset to reach a symbol can vary by
// up to one step depending on where the ADRP is in memory. For example:
5 changes: 1 addition & 4 deletions llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp
Original file line number Diff line number Diff line change
@@ -739,11 +739,8 @@ unsigned ARMAsmBackend::adjustFixupValue(const MCAssembler &Asm,
}

void ARMAsmBackend::processFixupValue(const MCAssembler &Asm,
const MCAsmLayout &Layout,
const MCFixup &Fixup,
const MCFragment *DF,
const MCValue &Target, uint64_t &Value,
bool &IsResolved) {
const MCValue &Target, bool &IsResolved) {
const MCSymbolRefExpr *A = Target.getSymA();
const MCSymbol *Sym = A ? &A->getSymbol() : nullptr;
const unsigned FixupKind = Fixup.getKind() ;
6 changes: 2 additions & 4 deletions llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.h
Original file line number Diff line number Diff line change
@@ -40,10 +40,8 @@ class ARMAsmBackend : public MCAsmBackend {

/// processFixupValue - Target hook to process the literal value of a fixup
/// if necessary.
void processFixupValue(const MCAssembler &Asm, const MCAsmLayout &Layout,
const MCFixup &Fixup, const MCFragment *DF,
const MCValue &Target, uint64_t &Value,
bool &IsResolved) override;
void processFixupValue(const MCAssembler &Asm, const MCFixup &Fixup,
const MCValue &Target, bool &IsResolved) override;

unsigned adjustFixupValue(const MCAssembler &Asm, const MCFixup &Fixup,
const MCValue &Target, uint64_t Value, bool IsPCRel,
6 changes: 2 additions & 4 deletions llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp
Original file line number Diff line number Diff line change
@@ -202,10 +202,8 @@ class HexagonAsmBackend : public MCAsmBackend {
/// processFixupValue - Target hook to adjust the literal value of a fixup
/// if necessary. IsResolved signals whether the caller believes a relocation
/// is needed; the target can modify the value. The default does nothing.
void processFixupValue(const MCAssembler &Asm, const MCAsmLayout &Layout,
const MCFixup &Fixup, const MCFragment *DF,
const MCValue &Target, uint64_t &Value,
bool &IsResolved) override {
void processFixupValue(const MCAssembler &Asm, const MCFixup &Fixup,
const MCValue &Target, bool &IsResolved) override {
MCFixupKind Kind = Fixup.getKind();

switch((unsigned)Kind) {
6 changes: 2 additions & 4 deletions llvm/lib/Target/PowerPC/MCTargetDesc/PPCAsmBackend.cpp
Original file line number Diff line number Diff line change
@@ -131,10 +131,8 @@ class PPCAsmBackend : public MCAsmBackend {
}
}

void processFixupValue(const MCAssembler &Asm, const MCAsmLayout &Layout,
const MCFixup &Fixup, const MCFragment *DF,
const MCValue &Target, uint64_t &Value,
bool &IsResolved) override {
void processFixupValue(const MCAssembler &Asm, const MCFixup &Fixup,
const MCValue &Target, bool &IsResolved) override {
switch ((PPC::Fixups)Fixup.getKind()) {
default: break;
case PPC::fixup_ppc_br24:
6 changes: 2 additions & 4 deletions llvm/lib/Target/Sparc/MCTargetDesc/SparcAsmBackend.cpp
Original file line number Diff line number Diff line change
@@ -203,10 +203,8 @@ namespace {
return InfosBE[Kind - FirstTargetFixupKind];
}

void processFixupValue(const MCAssembler &Asm, const MCAsmLayout &Layout,
const MCFixup &Fixup, const MCFragment *DF,
const MCValue &Target, uint64_t &Value,
bool &IsResolved) override {
void processFixupValue(const MCAssembler &Asm, const MCFixup &Fixup,
const MCValue &Target, bool &IsResolved) override {
switch ((Sparc::Fixups)Fixup.getKind()) {
default: break;
case Sparc::fixup_sparc_wplt30:

0 comments on commit 6418856

Please sign in to comment.