Skip to content

Commit 88c0a82

Browse files
committed
[MC] Make MCAsmBackend::fixupNeedsRelaxation not pure virtual
This hook only needs to be implemented if mayNeedRelaxation may return true.
1 parent deda50f commit 88c0a82

File tree

10 files changed

+3
-68
lines changed

10 files changed

+3
-68
lines changed

llvm/include/llvm/MC/MCAsmBackend.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,9 @@ class MCAsmBackend {
167167
/// Simple predicate for targets where !Resolved implies requiring relaxation
168168
virtual bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
169169
const MCRelaxableFragment *DF,
170-
const MCAsmLayout &Layout) const = 0;
170+
const MCAsmLayout &Layout) const {
171+
llvm_unreachable("Needed if mayNeedRelaxation may return true");
172+
}
171173

172174
/// Relax the instruction in the given fragment to the next wider instruction.
173175
///

llvm/lib/Target/AVR/MCTargetDesc/AVRAsmBackend.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ class AVRAsmBackend : public MCAsmBackend {
4949
return AVR::NumTargetFixupKinds;
5050
}
5151

52-
bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
53-
const MCRelaxableFragment *DF,
54-
const MCAsmLayout &Layout) const override {
55-
llvm_unreachable("RelaxInstruction() unimplemented");
56-
return false;
57-
}
58-
5952
bool writeNopData(raw_ostream &OS, uint64_t Count,
6053
const MCSubtargetInfo *STI) const override;
6154

llvm/lib/Target/BPF/MCTargetDesc/BPFAsmBackend.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,6 @@ class BPFAsmBackend : public MCAsmBackend {
3636
std::unique_ptr<MCObjectTargetWriter>
3737
createObjectTargetWriter() const override;
3838

39-
// No instruction requires relaxation
40-
bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
41-
const MCRelaxableFragment *DF,
42-
const MCAsmLayout &Layout) const override {
43-
return false;
44-
}
45-
4639
unsigned getNumFixupKinds() const override {
4740
return BPF::NumTargetFixupKinds;
4841
}

llvm/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -644,13 +644,6 @@ class HexagonAsmBackend : public MCAsmBackend {
644644
return false;
645645
}
646646

647-
/// Simple predicate for targets where !Resolved implies requiring relaxation
648-
bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
649-
const MCRelaxableFragment *DF,
650-
const MCAsmLayout &Layout) const override {
651-
llvm_unreachable("Handled by fixupNeedsRelaxationAdvanced");
652-
}
653-
654647
void relaxInstruction(MCInst &Inst,
655648
const MCSubtargetInfo &STI) const override {
656649
assert(HexagonMCInstrInfo::isBundle(Inst) &&

llvm/lib/Target/LoongArch/MCTargetDesc/LoongArchAsmBackend.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,6 @@ class LoongArchAsmBackend : public MCAsmBackend {
6060
const MCValue &Target,
6161
const MCSubtargetInfo *STI) override;
6262

63-
bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
64-
const MCRelaxableFragment *DF,
65-
const MCAsmLayout &Layout) const override {
66-
return false;
67-
}
68-
6963
unsigned getNumFixupKinds() const override {
7064
return LoongArch::NumTargetFixupKinds;
7165
}

llvm/lib/Target/MSP430/MCTargetDesc/MSP430AsmBackend.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,6 @@ class MSP430AsmBackend : public MCAsmBackend {
4747
return createMSP430ELFObjectWriter(OSABI);
4848
}
4949

50-
bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
51-
const MCRelaxableFragment *DF,
52-
const MCAsmLayout &Layout) const override {
53-
return false;
54-
}
55-
5650
bool fixupNeedsRelaxationAdvanced(const MCAssembler &Asm,
5751
const MCFixup &Fixup, bool Resolved,
5852
uint64_t Value,

llvm/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,6 @@ class MipsAsmBackend : public MCAsmBackend {
5151
return Mips::NumTargetFixupKinds;
5252
}
5353

54-
/// @name Target Relaxation Interfaces
55-
/// @{
56-
57-
/// fixupNeedsRelaxation - Target specific predicate for whether a given
58-
/// fixup requires the associated instruction to be relaxed.
59-
bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
60-
const MCRelaxableFragment *DF,
61-
const MCAsmLayout &Layout) const override {
62-
// FIXME.
63-
llvm_unreachable("RelaxInstruction() unimplemented");
64-
return false;
65-
}
66-
6754
bool writeNopData(raw_ostream &OS, uint64_t Count,
6855
const MCSubtargetInfo *STI) const override;
6956

llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmBackend.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -122,11 +122,6 @@ class SystemZMCAsmBackend : public MCAsmBackend {
122122
const MCValue &Target, MutableArrayRef<char> Data,
123123
uint64_t Value, bool IsResolved,
124124
const MCSubtargetInfo *STI) const override;
125-
bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
126-
const MCRelaxableFragment *Fragment,
127-
const MCAsmLayout &Layout) const override {
128-
return false;
129-
}
130125
bool writeNopData(raw_ostream &OS, uint64_t Count,
131126
const MCSubtargetInfo *STI) const override;
132127
};

llvm/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyAsmBackend.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,13 +52,6 @@ class WebAssemblyAsmBackend final : public MCAsmBackend {
5252
std::unique_ptr<MCObjectTargetWriter>
5353
createObjectTargetWriter() const override;
5454

55-
// No instruction requires relaxation
56-
bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
57-
const MCRelaxableFragment *DF,
58-
const MCAsmLayout &Layout) const override {
59-
return false;
60-
}
61-
6255
bool writeNopData(raw_ostream &OS, uint64_t Count,
6356
const MCSubtargetInfo *STI) const override;
6457
};

llvm/lib/Target/Xtensa/MCTargetDesc/XtensaAsmBackend.cpp

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,6 @@ class XtensaMCAsmBackend : public MCAsmBackend {
4343
const MCSubtargetInfo *STI) const override;
4444
bool mayNeedRelaxation(const MCInst &Inst,
4545
const MCSubtargetInfo &STI) const override;
46-
bool fixupNeedsRelaxation(const MCFixup &Fixup, uint64_t Value,
47-
const MCRelaxableFragment *Fragment,
48-
const MCAsmLayout &Layout) const override;
4946
void relaxInstruction(MCInst &Inst,
5047
const MCSubtargetInfo &STI) const override;
5148
bool writeNopData(raw_ostream &OS, uint64_t Count,
@@ -172,12 +169,6 @@ bool XtensaMCAsmBackend::mayNeedRelaxation(const MCInst &Inst,
172169
return false;
173170
}
174171

175-
bool XtensaMCAsmBackend::fixupNeedsRelaxation(
176-
const MCFixup &Fixup, uint64_t Value, const MCRelaxableFragment *Fragment,
177-
const MCAsmLayout &Layout) const {
178-
return false;
179-
}
180-
181172
void XtensaMCAsmBackend::relaxInstruction(MCInst &Inst,
182173
const MCSubtargetInfo &STI) const {}
183174

0 commit comments

Comments
 (0)