Skip to content

Commit 7e6d008

Browse files
committed
AsmPrinter: Remove unneeded lowerRelativeReference overrides
The function is only called by AsmPrinter, where there is a fallback when lowerRelativeReference returns nullptr. wasm and XCOFF could use the fallback code. (lowerRelativeReference was introduced in 2016 (https://reviews.llvm.org/D17938) for C++ relative vtables, but C++ relative vtables ended up using dso_local_equivalent. llvm/test/MC/COFF/cross-section-relative.ll also uses this.)
1 parent ddc6279 commit 7e6d008

File tree

2 files changed

+0
-34
lines changed

2 files changed

+0
-34
lines changed

llvm/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -240,10 +240,6 @@ class TargetLoweringObjectFileWasm : public TargetLoweringObjectFile {
240240
const MCSymbol *KeySym) const override;
241241
MCSection *getStaticDtorSection(unsigned Priority,
242242
const MCSymbol *KeySym) const override;
243-
244-
const MCExpr *lowerRelativeReference(const GlobalValue *LHS,
245-
const GlobalValue *RHS,
246-
const TargetMachine &TM) const override;
247243
};
248244

249245
class TargetLoweringObjectFileXCOFF : public TargetLoweringObjectFile {
@@ -269,10 +265,6 @@ class TargetLoweringObjectFileXCOFF : public TargetLoweringObjectFile {
269265
MCSection *getStaticDtorSection(unsigned Priority,
270266
const MCSymbol *KeySym) const override;
271267

272-
const MCExpr *lowerRelativeReference(const GlobalValue *LHS,
273-
const GlobalValue *RHS,
274-
const TargetMachine &TM) const override;
275-
276268
MCSection *SelectSectionForGlobal(const GlobalObject *GO, SectionKind Kind,
277269
const TargetMachine &TM) const override;
278270

llvm/lib/CodeGen/TargetLoweringObjectFileImpl.cpp

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2289,25 +2289,6 @@ bool TargetLoweringObjectFileWasm::shouldPutJumpTableInFunctionSection(
22892289
return false;
22902290
}
22912291

2292-
const MCExpr *TargetLoweringObjectFileWasm::lowerRelativeReference(
2293-
const GlobalValue *LHS, const GlobalValue *RHS,
2294-
const TargetMachine &TM) const {
2295-
// We may only use a PLT-relative relocation to refer to unnamed_addr
2296-
// functions.
2297-
if (!LHS->hasGlobalUnnamedAddr() || !LHS->getValueType()->isFunctionTy())
2298-
return nullptr;
2299-
2300-
// Basic correctness checks.
2301-
if (LHS->getType()->getPointerAddressSpace() != 0 ||
2302-
RHS->getType()->getPointerAddressSpace() != 0 || LHS->isThreadLocal() ||
2303-
RHS->isThreadLocal())
2304-
return nullptr;
2305-
2306-
return MCBinaryExpr::createSub(
2307-
MCSymbolRefExpr::create(TM.getSymbol(LHS), getContext()),
2308-
MCSymbolRefExpr::create(TM.getSymbol(RHS), getContext()), getContext());
2309-
}
2310-
23112292
void TargetLoweringObjectFileWasm::InitializeWasm() {
23122293
StaticCtorSection =
23132294
getContext().getWasmSection(".init_array", SectionKind::getData());
@@ -2635,13 +2616,6 @@ MCSection *TargetLoweringObjectFileXCOFF::getStaticDtorSection(
26352616
report_fatal_error("no static destructor section on AIX");
26362617
}
26372618

2638-
const MCExpr *TargetLoweringObjectFileXCOFF::lowerRelativeReference(
2639-
const GlobalValue *LHS, const GlobalValue *RHS,
2640-
const TargetMachine &TM) const {
2641-
/* Not implemented yet, but don't crash, return nullptr. */
2642-
return nullptr;
2643-
}
2644-
26452619
XCOFF::StorageClass
26462620
TargetLoweringObjectFileXCOFF::getStorageClassForGlobal(const GlobalValue *GV) {
26472621
assert(!isa<GlobalIFunc>(GV) && "GlobalIFunc is not supported on AIX.");

0 commit comments

Comments
 (0)