[NFC] Remove unused parameter from shouldAssumeDSOLocal()

This commit is contained in:
Arthur Eubanks committed 2024-03-11 19:48:17 +00:00
1 parent 5feaef63c0
commit 94c988bcfd
18 files changed
+33 -43

No files matched your search

+1 -1
View File
@@ -241,7 +241,7 @@ public:
bool isPositionIndependent() const;
bool shouldAssumeDSOLocal(const Module &M, const GlobalValue *GV) const;
bool shouldAssumeDSOLocal(const GlobalValue *GV) const;
/// Returns true if this target uses emulated TLS.
bool useEmulatedTLS() const;
+1 -1
View File
@@ -641,7 +641,7 @@ bool GlobalMergeImpl::run(Module &M) {
continue;
// It's not safe to merge globals that may be preempted
if (TM && !TM->shouldAssumeDSOLocal(M, &GV))
if (TM && !TM->shouldAssumeDSOLocal(&GV))
continue;
if (!(Opt.MergeExternal && GV.hasExternalLinkage()) &&
@@ -491,7 +491,7 @@ TargetLowering::isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const {
// If the address is not even local to this DSO we will have to load it from
// a got and then add the offset.
if (!TM.shouldAssumeDSOLocal(*GV->getParent(), GV))
if (!TM.shouldAssumeDSOLocal(GV))
return false;
// If the code is position independent we will have to add a base register.
+2 -3
View File
@@ -398,7 +398,7 @@ AArch64Subtarget::ClassifyGlobalReference(const GlobalValue *GV,
if (GV->isTagged())
return AArch64II::MO_GOT;
if (!TM.shouldAssumeDSOLocal(*GV->getParent(), GV)) {
if (!TM.shouldAssumeDSOLocal(GV)) {
if (GV->hasDLLImportStorageClass()) {
return AArch64II::MO_GOT | AArch64II::MO_DLLIMPORT;
}
@@ -435,8 +435,7 @@ unsigned AArch64Subtarget::classifyGlobalFunctionReference(
// NonLazyBind goes via GOT unless we know it's available locally.
auto *F = dyn_cast<Function>(GV);
if ((!isTargetMachO() || MachOUseNonLazyBind) && F &&
F->hasFnAttribute(Attribute::NonLazyBind) &&
!TM.shouldAssumeDSOLocal(*GV->getParent(), GV))
F->hasFnAttribute(Attribute::NonLazyBind) && !TM.shouldAssumeDSOLocal(GV))
return AArch64II::MO_GOT;
if (getTargetTriple().isOSWindows()) {
+1 -2
View File
@@ -6219,8 +6219,7 @@ bool SITargetLowering::shouldEmitGOTReloc(const GlobalValue *GV) const {
// address space for functions to avoid the explicit check.
return (GV->getValueType()->isFunctionTy() ||
!isNonGlobalAddrSpace(GV->getAddressSpace())) &&
!shouldEmitFixup(GV) &&
!getTargetMachine().shouldAssumeDSOLocal(*GV->getParent(), GV);
!shouldEmitFixup(GV) && !getTargetMachine().shouldAssumeDSOLocal(GV);
}
bool SITargetLowering::shouldEmitPCReloc(const GlobalValue *GV) const {
+3 -5
View File
@@ -2655,12 +2655,10 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
bool isDirect = false;
const TargetMachine &TM = getTargetMachine();
const Module *Mod = MF.getFunction().getParent();
const GlobalValue *GVal = nullptr;
if (GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee))
GVal = G->getGlobal();
bool isStub =
!TM.shouldAssumeDSOLocal(*Mod, GVal) && Subtarget->isTargetMachO();
bool isStub = !TM.shouldAssumeDSOLocal(GVal) && Subtarget->isTargetMachO();
bool isARMFunc = !Subtarget->isThumb() || (isStub && !Subtarget->isMClass());
bool isLocalARMFunc = false;
@@ -2737,7 +2735,7 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
unsigned TargetFlags = ARMII::MO_NO_FLAG;
if (GVal->hasDLLImportStorageClass())
TargetFlags = ARMII::MO_DLLIMPORT;
else if (!TM.shouldAssumeDSOLocal(*GVal->getParent(), GVal))
else if (!TM.shouldAssumeDSOLocal(GVal))
TargetFlags = ARMII::MO_COFFSTUB;
Callee = DAG.getTargetGlobalAddress(GVal, dl, PtrVt, /*offset=*/0,
TargetFlags);
@@ -4021,7 +4019,7 @@ SDValue ARMTargetLowering::LowerGlobalAddressWindows(SDValue Op,
ARMII::TOF TargetFlags = ARMII::MO_NO_FLAG;
if (GV->hasDLLImportStorageClass())
TargetFlags = ARMII::MO_DLLIMPORT;
else if (!TM.shouldAssumeDSOLocal(*GV->getParent(), GV))
else if (!TM.shouldAssumeDSOLocal(GV))
TargetFlags = ARMII::MO_COFFSTUB;
EVT PtrVT = getPointerTy(DAG.getDataLayout());
SDValue Result;
+1 -1
View File
@@ -353,7 +353,7 @@ bool ARMSubtarget::isRWPI() const {
}
bool ARMSubtarget::isGVIndirectSymbol(const GlobalValue *GV) const {
if (!TM.shouldAssumeDSOLocal(*GV->getParent(), GV))
if (!TM.shouldAssumeDSOLocal(GV))
return true;
// 32 bit macho has no relocation for a-b if a is undefined, even if b is in
+3 -5
View File
@@ -649,8 +649,7 @@ SDValue CSKYTargetLowering::LowerCall(CallLoweringInfo &CLI,
if (GlobalAddressSDNode *S = dyn_cast<GlobalAddressSDNode>(Callee)) {
const GlobalValue *GV = S->getGlobal();
bool IsLocal =
getTargetMachine().shouldAssumeDSOLocal(*GV->getParent(), GV);
bool IsLocal = getTargetMachine().shouldAssumeDSOLocal(GV);
if (isPositionIndependent() || !Subtarget.has2E3()) {
IsRegCall = true;
@@ -662,8 +661,7 @@ SDValue CSKYTargetLowering::LowerCall(CallLoweringInfo &CLI,
cast<GlobalAddressSDNode>(Callee), Ty, DAG, CSKYII::MO_None));
}
} else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(Callee)) {
bool IsLocal = getTargetMachine().shouldAssumeDSOLocal(
*MF.getFunction().getParent(), nullptr);
bool IsLocal = getTargetMachine().shouldAssumeDSOLocal(nullptr);
if (isPositionIndependent() || !Subtarget.has2E3()) {
IsRegCall = true;
@@ -1153,7 +1151,7 @@ SDValue CSKYTargetLowering::LowerGlobalAddress(SDValue Op,
int64_t Offset = N->getOffset();
const GlobalValue *GV = N->getGlobal();
bool IsLocal = getTargetMachine().shouldAssumeDSOLocal(*GV->getParent(), GV);
bool IsLocal = getTargetMachine().shouldAssumeDSOLocal(GV);
SDValue Addr = getAddr<GlobalAddressSDNode, false>(N, DAG, IsLocal);
// In order to maximise the opportunity for common subexpression elimination,
@@ -1238,7 +1238,7 @@ HexagonTargetLowering::LowerGLOBALADDRESS(SDValue Op, SelectionDAG &DAG) const {
return DAG.getNode(HexagonISD::CONST32, dl, PtrVT, GA);
}
bool UsePCRel = getTargetMachine().shouldAssumeDSOLocal(*GV->getParent(), GV);
bool UsePCRel = getTargetMachine().shouldAssumeDSOLocal(GV);
if (UsePCRel) {
SDValue GA = DAG.getTargetGlobalAddress(GV, dl, PtrVT, Offset,
HexagonII::MO_PCREL);
@@ -4251,14 +4251,12 @@ LoongArchTargetLowering::LowerCall(CallLoweringInfo &CLI,
// split it and then direct call can be matched by PseudoCALL.
if (GlobalAddressSDNode *S = dyn_cast<GlobalAddressSDNode>(Callee)) {
const GlobalValue *GV = S->getGlobal();
unsigned OpFlags =
getTargetMachine().shouldAssumeDSOLocal(*GV->getParent(), GV)
? LoongArchII::MO_CALL
: LoongArchII::MO_CALL_PLT;
unsigned OpFlags = getTargetMachine().shouldAssumeDSOLocal(GV)
? LoongArchII::MO_CALL
: LoongArchII::MO_CALL_PLT;
Callee = DAG.getTargetGlobalAddress(S->getGlobal(), DL, PtrVT, 0, OpFlags);
} else if (ExternalSymbolSDNode *S = dyn_cast<ExternalSymbolSDNode>(Callee)) {
unsigned OpFlags = getTargetMachine().shouldAssumeDSOLocal(
*MF.getFunction().getParent(), nullptr)
unsigned OpFlags = getTargetMachine().shouldAssumeDSOLocal(nullptr)
? LoongArchII::MO_CALL
: LoongArchII::MO_CALL_PLT;
Callee = DAG.getTargetExternalSymbol(S->getSymbol(), PtrVT, OpFlags);
+3 -3
View File
@@ -175,7 +175,7 @@ M68kSubtarget::classifyLocalReference(const GlobalValue *GV) const {
}
unsigned char M68kSubtarget::classifyExternalReference(const Module &M) const {
if (TM.shouldAssumeDSOLocal(M, nullptr))
if (TM.shouldAssumeDSOLocal(nullptr))
return classifyLocalReference(nullptr);
if (isPositionIndependent())
@@ -191,7 +191,7 @@ M68kSubtarget::classifyGlobalReference(const GlobalValue *GV) const {
unsigned char M68kSubtarget::classifyGlobalReference(const GlobalValue *GV,
const Module &M) const {
if (TM.shouldAssumeDSOLocal(M, GV))
if (TM.shouldAssumeDSOLocal(GV))
return classifyLocalReference(GV);
switch (TM.getCodeModel()) {
@@ -240,7 +240,7 @@ unsigned char
M68kSubtarget::classifyGlobalFunctionReference(const GlobalValue *GV,
const Module &M) const {
// local always use pc-rel referencing
if (TM.shouldAssumeDSOLocal(M, GV))
if (TM.shouldAssumeDSOLocal(GV))
return M68kII::MO_NO_FLAG;
// If the function is marked as non-lazy, generate an indirect call
+3 -4
View File
@@ -4818,7 +4818,7 @@ static bool callsShareTOCBase(const Function *Caller,
// If the callee is preemptable, then the static linker will use a plt-stub
// which saves the toc to the stack, and needs a nop after the call
// instruction to convert to a toc-restore.
if (!TM.shouldAssumeDSOLocal(*Caller->getParent(), CalleeGV))
if (!TM.shouldAssumeDSOLocal(CalleeGV))
return false;
// Functions with PC Relative enabled may clobber the TOC in the same DSO.
@@ -5420,10 +5420,9 @@ static SDValue transformCallee(const SDValue &Callee, SelectionDAG &DAG,
// Returns true if the callee is local, and false otherwise.
auto isLocalCallee = [&]() {
const GlobalAddressSDNode *G = dyn_cast<GlobalAddressSDNode>(Callee);
const Module *Mod = DAG.getMachineFunction().getFunction().getParent();
const GlobalValue *GV = G ? G->getGlobal() : nullptr;
return DAG.getTarget().shouldAssumeDSOLocal(*Mod, GV) &&
return DAG.getTarget().shouldAssumeDSOLocal(GV) &&
!isa_and_nonnull<GlobalIFunc>(GV);
};
@@ -18045,7 +18044,7 @@ bool PPCTargetLowering::mayBeEmittedAsTailCall(const CallInst *CI) const {
return false;
// If the function is local then we have a good chance at tail-calling it
return getTargetMachine().shouldAssumeDSOLocal(*Caller->getParent(), Callee);
return getTargetMachine().shouldAssumeDSOLocal(Callee);
}
bool PPCTargetLowering::
+1 -1
View File
@@ -189,7 +189,7 @@ bool PPCSubtarget::isGVIndirectSymbol(const GlobalValue *GV) const {
// Large code model always uses the TOC even for local symbols.
if (TM.getCodeModel() == CodeModel::Large)
return true;
if (TM.shouldAssumeDSOLocal(*GV->getParent(), GV))
if (TM.shouldAssumeDSOLocal(GV))
return false;
return true;
}
+1 -1
View File
@@ -122,7 +122,7 @@ bool SystemZSubtarget::isPC32DBLSymbol(const GlobalValue *GV,
// For the small model, all locally-binding symbols are in range.
if (CM == CodeModel::Small)
return TLInfo.getTargetMachine().shouldAssumeDSOLocal(*GV->getParent(), GV);
return TLInfo.getTargetMachine().shouldAssumeDSOLocal(GV);
// For Medium and above, assume that the symbol is not within the 4GB range.
// Taking the address of locally-defined text would be OK, but that
+2 -3
View File
@@ -160,8 +160,7 @@ static TLSModel::Model getSelectedTLSModel(const GlobalValue *GV) {
llvm_unreachable("invalid TLS model");
}
bool TargetMachine::shouldAssumeDSOLocal(const Module &M,
const GlobalValue *GV) const {
bool TargetMachine::shouldAssumeDSOLocal(const GlobalValue *GV) const {
const Triple &TT = getTargetTriple();
Reloc::Model RM = getRelocationModel();
@@ -225,7 +224,7 @@ TLSModel::Model TargetMachine::getTLSModel(const GlobalValue *GV) const {
bool IsPIE = GV->getParent()->getPIELevel() != PIELevel::Default;
Reloc::Model RM = getRelocationModel();
bool IsSharedLibrary = RM == Reloc::PIC_ && !IsPIE;
bool IsLocal = shouldAssumeDSOLocal(*GV->getParent(), GV);
bool IsLocal = shouldAssumeDSOLocal(GV);
TLSModel::Model Model;
if (IsSharedLibrary) {
+1 -1
View File
@@ -653,7 +653,7 @@ SDValue VETargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
auto *CalleeG = dyn_cast<GlobalAddressSDNode>(Callee);
if (CalleeG)
GV = CalleeG->getGlobal();
bool Local = TM.shouldAssumeDSOLocal(*Mod, GV);
bool Local = TM.shouldAssumeDSOLocal(GV);
bool UsePlt = !Local;
MachineFunction &MF = DAG.getMachineFunction();
@@ -1683,7 +1683,7 @@ WebAssemblyTargetLowering::LowerGlobalTLSAddress(SDValue Op,
if (model == GlobalValue::LocalExecTLSModel ||
model == GlobalValue::LocalDynamicTLSModel ||
(model == GlobalValue::GeneralDynamicTLSModel &&
getTargetMachine().shouldAssumeDSOLocal(*GV->getParent(), GV))) {
getTargetMachine().shouldAssumeDSOLocal(GV))) {
// For DSO-local TLS variables we use offset from __tls_base
MVT PtrVT = getPointerTy(DAG.getDataLayout());
@@ -1729,7 +1729,7 @@ SDValue WebAssemblyTargetLowering::LowerGlobalAddress(SDValue Op,
// need special treatment for tables in PIC mode.
if (isPositionIndependent() &&
!WebAssembly::isWebAssemblyTableType(GV->getValueType())) {
if (getTargetMachine().shouldAssumeDSOLocal(*GV->getParent(), GV)) {
if (getTargetMachine().shouldAssumeDSOLocal(GV)) {
MachineFunction &MF = DAG.getMachineFunction();
MVT PtrVT = getPointerTy(MF.getDataLayout());
const char *BaseName;
+2 -2
View File
@@ -140,7 +140,7 @@ unsigned char X86Subtarget::classifyGlobalReference(const GlobalValue *GV,
}
}
if (TM.shouldAssumeDSOLocal(M, GV))
if (TM.shouldAssumeDSOLocal(GV))
return classifyLocalReference(GV);
if (isTargetCOFF()) {
@@ -190,7 +190,7 @@ X86Subtarget::classifyGlobalFunctionReference(const GlobalValue *GV) const {
unsigned char
X86Subtarget::classifyGlobalFunctionReference(const GlobalValue *GV,
const Module &M) const {
if (TM.shouldAssumeDSOLocal(M, GV))
if (TM.shouldAssumeDSOLocal(GV))
return X86II::MO_NO_FLAG;
// Functions on COFF can be non-DSO local for three reasons: