Skip to content

Commit 7c83b7e

Browse files
committed
[MC] Remove two unused parameters from MCAsmBackend::fixupNeedsRelaxation
fixupNeedsRelaxation is a simple implementation for fixupNeedsRelaxationAdvanced. Its users do not utilize MCAsmLayout or MCRelaxableFragment. Follow-up to 22c7317 ("[MC] Remove the MCAsmLayout parameter from relocation related functions").
1 parent 3eb795c commit 7c83b7e

File tree

10 files changed

+24
-40
lines changed

10 files changed

+24
-40
lines changed

llvm/include/llvm/MC/MCAsmBackend.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,8 @@ class MCAsmBackend {
165165
const bool WasForced) const;
166166

167167
/// Simple predicate for targets where !Resolved implies requiring relaxation
168-
virtual bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
169-
const MCRelaxableFragment *DF,
170-
const MCAsmLayout &Layout) const {
168+
virtual bool fixupNeedsRelaxation(const MCFixup &Fixup,
169+
uint64_t Value) const {
171170
llvm_unreachable("Needed if mayNeedRelaxation may return true");
172171
}
173172

llvm/lib/MC/MCAsmBackend.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ bool MCAsmBackend::fixupNeedsRelaxationAdvanced(const MCAssembler &Asm,
123123
const bool WasForced) const {
124124
if (!Resolved)
125125
return true;
126-
return fixupNeedsRelaxation(Fixup, Value, DF, *Asm.getLayout());
126+
return fixupNeedsRelaxation(Fixup, Value);
127127
}
128128

129129
bool MCAsmBackend::isDarwinCanonicalPersonality(const MCSymbol *Sym) const {

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,8 @@ class AArch64AsmBackend : public MCAsmBackend {
9090
uint64_t Value, bool IsResolved,
9191
const MCSubtargetInfo *STI) const override;
9292

93-
bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
94-
const MCRelaxableFragment *DF,
95-
const MCAsmLayout &Layout) const override;
93+
bool fixupNeedsRelaxation(const MCFixup &Fixup,
94+
uint64_t Value) const override;
9695
void relaxInstruction(MCInst &Inst,
9796
const MCSubtargetInfo &STI) const override;
9897
bool writeNopData(raw_ostream &OS, uint64_t Count,
@@ -483,9 +482,7 @@ void AArch64AsmBackend::applyFixup(const MCAssembler &Asm, const MCFixup &Fixup,
483482
}
484483

485484
bool AArch64AsmBackend::fixupNeedsRelaxation(const MCFixup &Fixup,
486-
uint64_t Value,
487-
const MCRelaxableFragment *DF,
488-
const MCAsmLayout &Layout) const {
485+
uint64_t Value) const {
489486
// FIXME: This isn't correct for AArch64. Just moving the "generic" logic
490487
// into the targets for now.
491488
//

llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,8 @@ class AMDGPUAsmBackend : public MCAsmBackend {
3636
const MCValue &Target, MutableArrayRef<char> Data,
3737
uint64_t Value, bool IsResolved,
3838
const MCSubtargetInfo *STI) const override;
39-
bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
40-
const MCRelaxableFragment *DF,
41-
const MCAsmLayout &Layout) const override;
39+
bool fixupNeedsRelaxation(const MCFixup &Fixup,
40+
uint64_t Value) const override;
4241

4342
void relaxInstruction(MCInst &Inst,
4443
const MCSubtargetInfo &STI) const override;
@@ -69,9 +68,7 @@ void AMDGPUAsmBackend::relaxInstruction(MCInst &Inst,
6968
}
7069

7170
bool AMDGPUAsmBackend::fixupNeedsRelaxation(const MCFixup &Fixup,
72-
uint64_t Value,
73-
const MCRelaxableFragment *DF,
74-
const MCAsmLayout &Layout) const {
71+
uint64_t Value) const {
7572
// if the branch target has an offset of x3f this needs to be relaxed to
7673
// add a s_nop 0 immediately after branch to effectively increment offset
7774
// for hardware workaround in gfx1010

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,8 @@ const char *ARMAsmBackend::reasonForFixupRelaxation(const MCFixup &Fixup,
337337
return nullptr;
338338
}
339339

340-
bool ARMAsmBackend::fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
341-
const MCRelaxableFragment *DF,
342-
const MCAsmLayout &Layout) const {
340+
bool ARMAsmBackend::fixupNeedsRelaxation(const MCFixup &Fixup,
341+
uint64_t Value) const {
343342
return reasonForFixupRelaxation(Fixup, Value);
344343
}
345344

llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,8 @@ class ARMAsmBackend : public MCAsmBackend {
5757
const char *reasonForFixupRelaxation(const MCFixup &Fixup,
5858
uint64_t Value) const;
5959

60-
bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
61-
const MCRelaxableFragment *DF,
62-
const MCAsmLayout &Layout) const override;
60+
bool fixupNeedsRelaxation(const MCFixup &Fixup,
61+
uint64_t Value) const override;
6362

6463
void relaxInstruction(MCInst &Inst,
6564
const MCSubtargetInfo &STI) const override;

llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -284,9 +284,8 @@ bool CSKYAsmBackend::shouldForceRelocation(const MCAssembler &Asm,
284284
return false;
285285
}
286286

287-
bool CSKYAsmBackend::fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
288-
const MCRelaxableFragment *DF,
289-
const MCAsmLayout &Layout) const {
287+
bool CSKYAsmBackend::fixupNeedsRelaxation(const MCFixup &Fixup,
288+
uint64_t Value) const {
290289
return false;
291290
}
292291

llvm/lib/Target/CSKY/MCTargetDesc/CSKYAsmBackend.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@ class CSKYAsmBackend : public MCAsmBackend {
3333

3434
const MCFixupKindInfo &getFixupKindInfo(MCFixupKind Kind) const override;
3535

36-
bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
37-
const MCRelaxableFragment *DF,
38-
const MCAsmLayout &Layout) const override;
36+
bool fixupNeedsRelaxation(const MCFixup &Fixup,
37+
uint64_t Value) const override;
3938

4039
void relaxInstruction(MCInst &Inst,
4140
const MCSubtargetInfo &STI) const override;

llvm/lib/Target/M68k/MCTargetDesc/M68kAsmBackend.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,8 @@ class M68kAsmBackend : public MCAsmBackend {
6868
bool mayNeedRelaxation(const MCInst &Inst,
6969
const MCSubtargetInfo &STI) const override;
7070

71-
bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
72-
const MCRelaxableFragment *DF,
73-
const MCAsmLayout &Layout) const override;
71+
bool fixupNeedsRelaxation(const MCFixup &Fixup,
72+
uint64_t Value) const override;
7473

7574
void relaxInstruction(MCInst &Inst,
7675
const MCSubtargetInfo &STI) const override;
@@ -166,9 +165,8 @@ bool M68kAsmBackend::mayNeedRelaxation(const MCInst &Inst,
166165
return false;
167166
}
168167

169-
bool M68kAsmBackend::fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
170-
const MCRelaxableFragment *DF,
171-
const MCAsmLayout &Layout) const {
168+
bool M68kAsmBackend::fixupNeedsRelaxation(const MCFixup &Fixup,
169+
uint64_t Value) const {
172170
// TODO Newer CPU can use 32 bit offsets, so check for this when ready
173171
if (!isInt<16>(Value)) {
174172
llvm_unreachable("Cannot relax the instruction, value does not fit");

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,9 +186,8 @@ class X86AsmBackend : public MCAsmBackend {
186186
bool mayNeedRelaxation(const MCInst &Inst,
187187
const MCSubtargetInfo &STI) const override;
188188

189-
bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
190-
const MCRelaxableFragment *DF,
191-
const MCAsmLayout &Layout) const override;
189+
bool fixupNeedsRelaxation(const MCFixup &Fixup,
190+
uint64_t Value) const override;
192191

193192
void relaxInstruction(MCInst &Inst,
194193
const MCSubtargetInfo &STI) const override;
@@ -743,9 +742,7 @@ bool X86AsmBackend::mayNeedRelaxation(const MCInst &MI,
743742
}
744743

745744
bool X86AsmBackend::fixupNeedsRelaxation(const MCFixup &Fixup,
746-
uint64_t Value,
747-
const MCRelaxableFragment *DF,
748-
const MCAsmLayout &Layout) const {
745+
uint64_t Value) const {
749746
// Relax if the value is too big for a (signed) i8.
750747
return !isInt<8>(Value);
751748
}

0 commit comments

Comments
 (0)