Skip to content

Commit b478c38

Browse files
committed
MCAsmBackend: Replace FKF_IsPCRel with isPCRel()
1 parent 4acdb8e commit b478c38

File tree

8 files changed

+10
-21
lines changed

8 files changed

+10
-21
lines changed

llvm/include/llvm/MC/MCMachObjectWriter.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,6 @@ class LLVM_ABI MachObjectWriter final : public MCObjectWriter {
191191
/// \name Utility Methods
192192
/// @{
193193

194-
bool isFixupKindPCRel(const MCAssembler &Asm, unsigned Kind);
195-
196194
std::vector<IndirectSymbolData> &getIndirectSymbols() {
197195
return IndirectSymbols;
198196
}

llvm/lib/MC/MachObjectWriter.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,6 @@ MachSymbolData::operator<(const MachSymbolData &RHS) const {
8585
return Symbol->getName() < RHS.Symbol->getName();
8686
}
8787

88-
bool MachObjectWriter::isFixupKindPCRel(const MCAssembler &Asm, unsigned Kind) {
89-
MCFixupKindInfo FKI = Asm.getBackend().getFixupKindInfo((MCFixupKind)Kind);
90-
91-
return FKI.Flags & MCFixupKindInfo::FKF_IsPCRel;
92-
}
93-
9488
uint64_t
9589
MachObjectWriter::getFragmentAddress(const MCAssembler &Asm,
9690
const MCFragment *Fragment) const {

llvm/lib/MC/WasmObjectWriter.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,7 @@ void WasmObjectWriter::recordRelocation(const MCFragment &F,
479479
const MCFixup &Fixup, MCValue Target,
480480
uint64_t &FixedValue) {
481481
// The WebAssembly backend should never generate FKF_IsPCRel fixups
482-
assert(!(Asm->getBackend().getFixupKindInfo(Fixup.getKind()).Flags &
483-
MCFixupKindInfo::FKF_IsPCRel));
482+
assert(!Fixup.isPCRel());
484483

485484
const auto &FixupSection = cast<MCSectionWasm>(*F.getParent());
486485
uint64_t C = Target.getConstant();

llvm/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ static bool canUseLocalRelocation(const MCSectionMachO &Section,
147147
void AArch64MachObjectWriter::recordRelocation(
148148
MachObjectWriter *Writer, MCAssembler &Asm, const MCFragment *Fragment,
149149
const MCFixup &Fixup, MCValue Target, uint64_t &FixedValue) {
150-
unsigned IsPCRel = Writer->isFixupKindPCRel(Asm, Fixup.getKind());
150+
unsigned IsPCRel = Fixup.isPCRel();
151151

152152
// See <reloc.h>.
153153
uint32_t FixupOffset = Asm.getFragmentOffset(*Fragment);

llvm/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ void ARMMachObjectWriter::recordARMScatteredHalfRelocation(
144144
return;
145145
}
146146

147-
unsigned IsPCRel = Writer->isFixupKindPCRel(Asm, Fixup.getKind());
147+
unsigned IsPCRel = Fixup.isPCRel();
148148
unsigned Type = MachO::ARM_RELOC_HALF;
149149

150150
// See <reloc.h>.
@@ -251,7 +251,7 @@ void ARMMachObjectWriter::recordARMScatteredRelocation(
251251
return;
252252
}
253253

254-
unsigned IsPCRel = Writer->isFixupKindPCRel(Asm, Fixup.getKind());
254+
unsigned IsPCRel = Fixup.isPCRel();
255255

256256
// See <reloc.h>.
257257
const MCSymbol *A = Target.getAddSym();
@@ -358,7 +358,7 @@ void ARMMachObjectWriter::recordRelocation(MachObjectWriter *Writer,
358358
const MCFragment *Fragment,
359359
const MCFixup &Fixup, MCValue Target,
360360
uint64_t &FixedValue) {
361-
unsigned IsPCRel = Writer->isFixupKindPCRel(Asm, Fixup.getKind());
361+
unsigned IsPCRel = Fixup.isPCRel();
362362
unsigned Log2Size;
363363
unsigned RelocType = MachO::ARM_RELOC_VANILLA;
364364
if (!getARMFixupKindMachOInfo(Fixup.getKind(), RelocType, Log2Size)) {

llvm/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -794,8 +794,7 @@ bool RISCVAsmBackend::addReloc(const MCFragment &F, const MCFixup &Fixup,
794794
// generate a relocation and then append a RELAX.
795795
if (Fixup.isLinkerRelaxable())
796796
IsResolved = false;
797-
if (IsResolved &&
798-
(getFixupKindInfo(Fixup.getKind()).Flags & MCFixupKindInfo::FKF_IsPCRel))
797+
if (IsResolved && Fixup.isPCRel())
799798
IsResolved = isPCRelFixupResolved(Target.getAddSym(), F);
800799

801800
if (!IsResolved) {

llvm/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -705,8 +705,7 @@ void X86AsmBackend::applyFixup(const MCFragment &F, const MCFixup &Fixup,
705705
assert(Fixup.getOffset() + Size <= Data.size() && "Invalid fixup offset!");
706706

707707
int64_t SignedValue = static_cast<int64_t>(Value);
708-
if (IsResolved &&
709-
getFixupKindInfo(Fixup.getKind()).Flags & MCFixupKindInfo::FKF_IsPCRel) {
708+
if (IsResolved && Fixup.isPCRel()) {
710709
// check that PC relative fixup fits into the fixup size.
711710
if (Size > 0 && !isIntN(Size * 8, SignedValue))
712711
getContext().reportError(Fixup.getLoc(),

llvm/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ static unsigned getFixupKindLog2Size(unsigned Kind) {
102102
void X86MachObjectWriter::RecordX86_64Relocation(
103103
MachObjectWriter *Writer, MCAssembler &Asm, const MCFragment *Fragment,
104104
const MCFixup &Fixup, MCValue Target, uint64_t &FixedValue) {
105-
unsigned IsPCRel = Writer->isFixupKindPCRel(Asm, Fixup.getKind());
105+
unsigned IsPCRel = Fixup.isPCRel();
106106
unsigned IsRIPRel = isFixupKindRIPRel(Fixup.getKind());
107107
unsigned Log2Size = getFixupKindLog2Size(Fixup.getKind());
108108

@@ -353,7 +353,7 @@ bool X86MachObjectWriter::recordScatteredRelocation(MachObjectWriter *Writer,
353353
uint64_t &FixedValue) {
354354
uint64_t OriginalFixedValue = FixedValue;
355355
uint32_t FixupOffset = Asm.getFragmentOffset(*Fragment) + Fixup.getOffset();
356-
unsigned IsPCRel = Writer->isFixupKindPCRel(Asm, Fixup.getKind());
356+
unsigned IsPCRel = Fixup.isPCRel();
357357
unsigned Type = MachO::GENERIC_RELOC_VANILLA;
358358

359359
// See <reloc.h>.
@@ -483,7 +483,7 @@ void X86MachObjectWriter::RecordX86Relocation(MachObjectWriter *Writer,
483483
const MCFixup &Fixup,
484484
MCValue Target,
485485
uint64_t &FixedValue) {
486-
unsigned IsPCRel = Writer->isFixupKindPCRel(Asm, Fixup.getKind());
486+
unsigned IsPCRel = Fixup.isPCRel();
487487
unsigned Log2Size = getFixupKindLog2Size(Fixup.getKind());
488488
const MCSymbol *A = Target.getAddSym();
489489

0 commit comments

Comments
 (0)