Skip to content

Commit 2e5c839

Browse files
committed
Remove requiresDiffExpressionRelocations target hook
Turns out this isn't needed, each fragment records whether it's relaxable
1 parent e39cb12 commit 2e5c839

File tree

3 files changed

+6
-26
lines changed

3 files changed

+6
-26
lines changed

llvm/include/llvm/MC/MCAsmBackend.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,10 +135,6 @@ class MCAsmBackend {
135135
uint64_t Value, bool IsResolved,
136136
const MCSubtargetInfo *STI) const = 0;
137137

138-
/// Check whether the given target requires emitting differences of two
139-
/// symbols as a set of relocations.
140-
virtual bool requiresDiffExpressionRelocations() const { return false; }
141-
142138
/// @}
143139

144140
/// \name Target Relaxation Interfaces

llvm/lib/MC/MCObjectStreamer.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -469,14 +469,12 @@ void MCObjectStreamer::emitDwarfAdvanceLineAddr(int64_t LineDelta,
469469
// fragment, then the address-offset is already a fixed constant and is not
470470
// relaxable. Emit the advance-line-addr data immediately to save time and
471471
// memory.
472-
if (!Assembler->getBackend().requiresDiffExpressionRelocations()) {
473-
if (auto OptAddrDelta = absoluteSymbolDiff(Label, LastLabel)) {
474-
SmallString<16> Tmp;
475-
MCDwarfLineAddr::encode(getContext(), Assembler->getDWARFLinetableParams(),
476-
LineDelta, *OptAddrDelta, Tmp);
477-
emitBytes(Tmp);
478-
return;
479-
}
472+
if (auto OptAddrDelta = absoluteSymbolDiff(Label, LastLabel)) {
473+
SmallString<16> Tmp;
474+
MCDwarfLineAddr::encode(getContext(), Assembler->getDWARFLinetableParams(),
475+
LineDelta, *OptAddrDelta, Tmp);
476+
emitBytes(Tmp);
477+
return;
480478
}
481479

482480
const MCExpr *AddrDelta = buildSymbolDiff(*this, Label, LastLabel, SMLoc());

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

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,6 @@ class RISCVAsmBackend : public MCAsmBackend {
3535

3636
void setForceRelocs() { ForceRelocs = true; }
3737

38-
// Returns true if relocations will be forced for shouldForceRelocation by
39-
// default. This will be true if relaxation is enabled or had previously
40-
// been enabled.
41-
bool willForceRelocations() const {
42-
return ForceRelocs || STI.getFeatureBits()[RISCV::FeatureRelax];
43-
}
44-
45-
// Generate diff expression relocations if the relax feature is enabled or had
46-
// previously been enabled, otherwise it is safe for the assembler to
47-
// calculate these internally.
48-
bool requiresDiffExpressionRelocations() const override {
49-
return willForceRelocations();
50-
}
51-
5238
// Return Size with extra Nop Bytes for alignment directive in code section.
5339
bool shouldInsertExtraNopBytesForCodeAlign(const MCAlignFragment &AF,
5440
unsigned &Size) override;

0 commit comments

Comments
 (0)