Lines Matching defs:GD
667 for (const GlobalDecl &GD : Aliases) {
668 const auto *D = cast<ValueDecl>(GD.getDecl());
678 StringRef MangledName = getMangledName(GD);
737 for (const GlobalDecl &GD : Aliases) {
738 StringRef MangledName = getMangledName(GD);
948 GlobalDecl GD;
950 GD = GlobalDecl(FD, KernelReferenceKind::Kernel);
952 GD = GlobalDecl(D);
954 GetAddrOfGlobal(GD), Int8PtrTy));
1767 GlobalDecl GD) const {
1768 const auto *D = dyn_cast<NamedDecl>(GD.getDecl());
1771 getCXXABI().setCXXDestructorDLLStorage(GV, Dtor, GD.getDtorType());
1790 GlobalDecl GD) const {
1791 setDLLImportDLLExport(GV, GD);
1792 setGVPropertiesAux(GV, dyn_cast<NamedDecl>(GD.getDecl()));
1863 // Returns true if GD is a function decl with internal linkage and
1865 static bool isUniqueInternalLinkageDecl(GlobalDecl GD,
1867 const Decl *D = GD.getDecl();
1869 (CGM.getFunctionLinkage(GD) == llvm::GlobalValue::InternalLinkage);
1872 static std::string getMangledNameImpl(CodeGenModule &CGM, GlobalDecl GD,
1882 MC.mangleName(GD.getWithDecl(ND), Out);
1895 GD.getKernelReferenceKind() == KernelReferenceKind::Stub) {
1910 if (ShouldMangle && isUniqueInternalLinkageDecl(GD, CGM)) {
1923 GD.getMultiVersionIndex(), Out);
1945 unsigned Index = GD.getMultiVersionIndex();
1964 void CodeGenModule::UpdateMultiVersionNames(GlobalDecl GD,
1974 getMangledNameImpl(*this, GD, FD, /*OmitMultiVersionMangling=*/true);
1981 "Other GD should now be a multiversioned function");
2001 if (GD.getCanonicalDecl() == OtherGD.getCanonicalDecl())
2009 StringRef CodeGenModule::getMangledName(GlobalDecl GD) {
2010 GlobalDecl CanonicalGD = GD.getCanonicalDecl();
2016 CXXCtorType OrigCtorType = GD.getCtorType();
2027 if (!LangOpts.CUDAIsDevice || !getContext().mayExternalize(GD.getDecl())) {
2034 const auto *ND = cast<NamedDecl>(GD.getDecl());
2035 std::string MangledName = getMangledNameImpl(*this, GD, ND);
2054 GD.getWithKernelReferenceKind(KernelReferenceKind::Kernel),
2062 // !GD->hasAttr<AsmLabelAttr>() &&
2066 auto Result = Manglings.insert(std::make_pair(MangledName, GD));
2070 StringRef CodeGenModule::getBlockMangledName(GlobalDecl GD,
2073 const Decl *D = GD.getDecl();
2081 MangleCtx.mangleCtorBlock(CD, GD.getCtorType(), BD, Out);
2083 MangleCtx.mangleDtorBlock(DD, GD.getDtorType(), BD, Out);
2183 CodeGenModule::getFunctionLinkage(GlobalDecl GD) {
2184 const auto *D = cast<FunctionDecl>(GD.getDecl());
2189 return getCXXABI().getCXXDestructorLinkage(Linkage, Dtor, GD.getDtorType());
2219 void CodeGenModule::SetLLVMFunctionAttributes(GlobalDecl GD,
2224 ConstructAttributeList(F->getName(), Info, GD, PAL, CallingConv,
2229 if (const Decl *D = GD.getDecl())
2665 void CodeGenModule::SetCommonAttributes(GlobalDecl GD, llvm::GlobalValue *GV) {
2666 const Decl *D = GD.getDecl();
2668 setGVProperties(GV, GD);
2685 bool CodeGenModule::GetCPUAndFeaturesAttributes(GlobalDecl GD,
2694 const auto *FD = dyn_cast_or_null<FunctionDecl>(GD.getDecl());
2704 getContext().getFunctionFeatureMap(FeatureMap, GD);
2730 TuneCPU = SD->getCPUName(GD.getMultiVersionIndex())->getName();
2762 IsDefault = TC->isDefaultVersion(GD.getMultiVersionIndex());
2763 TC->getFeatures(Feats, GD.getMultiVersionIndex());
2781 void CodeGenModule::setNonAliasAttributes(GlobalDecl GD,
2783 const Decl *D = GD.getDecl();
2784 SetCommonAttributes(GD, GO);
2808 if (GetCPUAndFeaturesAttributes(GD, Attrs)) {
2831 void CodeGenModule::SetInternalFunctionAttributes(GlobalDecl GD,
2834 const Decl *D = GD.getDecl();
2835 SetLLVMFunctionAttributes(GD, FI, F, /*IsThunk=*/false);
2840 setNonAliasAttributes(GD, F);
2923 void CodeGenModule::SetFunctionAttributes(GlobalDecl GD, llvm::Function *F,
2934 const auto *FD = cast<FunctionDecl>(GD.getDecl());
2937 SetLLVMFunctionAttributes(GD, getTypes().arrangeGlobalDeclaration(GD), F,
2943 if (!IsThunk && getCXXABI().HasThisReturn(GD) &&
3657 ConstantAddress CodeGenModule::GetAddrOfMSGuidDecl(const MSGuidDecl *GD) {
3658 StringRef Name = getMangledName(GD);
3670 APValue &V = GD->getAsAPValue();
3675 GD->getAsAPValue(), GD->getType().getAddressSpace(), GD->getType());
3681 MSGuidDecl::Parts Parts = GD->getParts();
3704 llvm::Type *Ty = getTypes().ConvertTypeForMem(GD->getType());
3819 void CodeGenModule::EmitGlobal(GlobalDecl GD) {
3820 const auto *Global = cast<ValueDecl>(GD.getDecl());
3829 return EmitAliasDefinition(GD);
3833 return emitIFuncDefinition(GD);
3837 return emitCPUDispatchDefinition(GD);
3868 if (OpenMPRuntime && OpenMPRuntime->emitTargetGlobal(GD))
3887 StringRef MangledName = getMangledName(GD);
3898 StringRef MangledName = getMangledName(GD);
3901 const CGFunctionInfo &FI = getTypes().arrangeGlobalDeclaration(GD);
3904 GetOrCreateLLVMFunction(MangledName, Ty, GD, /*ForVTable=*/false,
3956 EmitGlobalDefinition(GD);
3957 addEmittedDeferredDecl(GD);
3969 StringRef MangledName = getMangledName(GD);
3972 addDeferredDeclToEmit(GD);
3976 addDeferredDeclToEmit(GD);
3981 DeferredDecls[MangledName] = GD;
4114 bool CodeGenModule::shouldEmitFunction(GlobalDecl GD) {
4115 if (getFunctionLinkage(GD) != llvm::Function::AvailableExternallyLinkage)
4118 const auto *F = cast<FunctionDecl>(GD.getDecl());
4181 void CodeGenModule::EmitMultiVersionFunctionDefinition(GlobalDecl GD,
4183 const auto *FD = cast<FunctionDecl>(GD.getDecl());
4188 EmitGlobalFunctionDefinition(GD.getWithMultiVersionIndex(I), nullptr);
4194 EmitGlobalFunctionDefinition(GD.getWithMultiVersionIndex(I), nullptr);
4196 GetOrCreateMultiVersionResolver(GD);
4198 EmitGlobalFunctionDefinition(GD, GV);
4203 AddDeferredMultiVersionResolverToEmit(GD);
4206 void CodeGenModule::EmitGlobalDefinition(GlobalDecl GD, llvm::GlobalValue *GV) {
4207 const auto *D = cast<ValueDecl>(GD.getDecl());
4216 if (!shouldEmitFunction(GD))
4231 ABI->emitCXXStructor(GD);
4233 EmitMultiVersionFunctionDefinition(GD, GV);
4235 EmitGlobalFunctionDefinition(GD, GV);
4238 getVTables().EmitThunks(GD);
4244 return EmitMultiVersionFunctionDefinition(GD, GV);
4245 return EmitGlobalFunctionDefinition(GD, GV);
4271 getMultiversionLinkage(CodeGenModule &CGM, GlobalDecl GD) {
4272 const FunctionDecl *FD = cast<FunctionDecl>(GD.getDecl());
4281 for (GlobalDecl GD : MVFuncsToEmit) {
4282 const auto *FD = cast<FunctionDecl>(GD.getDecl());
4352 llvm::Constant *ResolverConstant = GetOrCreateMultiVersionResolver(GD);
4358 *this, GD, FD, /*OmitMultiVersionMangling=*/true);
4360 const CGFunctionInfo &FI = getTypes().arrangeGlobalDeclaration(GD);
4366 DeclTy, 0, getMultiversionLinkage(*this, GD),
4374 ResolverFunc->setLinkage(getMultiversionLinkage(*this, GD));
4410 void CodeGenModule::emitCPUDispatchDefinition(GlobalDecl GD) {
4411 const auto *FD = cast<FunctionDecl>(GD.getDecl());
4417 const CGFunctionInfo &FI = getTypes().arrangeGlobalDeclaration(GD);
4420 StringRef ResolverName = getMangledName(GD);
4421 UpdateMultiVersionNames(GD, FD, ResolverName);
4433 ResolverGD = GD;
4438 ResolverFunc->setLinkage(getMultiversionLinkage(*this, GD));
4448 std::string MangledName = getMangledNameImpl(*this, GD, FD, true) +
4461 ExistingDecl = GD.getWithMultiVersionIndex(Index);
4506 llvm::GlobalValue::LinkageTypes Linkage = getMultiversionLinkage(*this, GD);
4507 auto *IFunc = cast<llvm::GlobalValue>(GetOrCreateMultiVersionResolver(GD));
4520 *this, GD, FD, /*OmitMultiVersionMangling=*/true);
4525 SetCommonAttributes(GD, GA);
4531 void CodeGenModule::AddDeferredMultiVersionResolverToEmit(GlobalDecl GD) {
4532 const auto *FD = cast<FunctionDecl>(GD.getDecl());
4537 getMangledNameImpl(*this, GD, FD, /*OmitMultiVersionMangling=*/true);
4541 MultiVersionFuncs.push_back(GD);
4547 llvm::Constant *CodeGenModule::GetOrCreateMultiVersionResolver(GlobalDecl GD) {
4548 const auto *FD = cast<FunctionDecl>(GD.getDecl());
4552 getMangledNameImpl(*this, GD, FD, /*OmitMultiVersionMangling=*/true);
4587 const CGFunctionInfo &FI = getTypes().arrangeGlobalDeclaration(GD);
4593 AddDeferredMultiVersionResolverToEmit(GD);
4605 llvm::GlobalIFunc::create(DeclTy, AS, getMultiversionLinkage(*this, GD),
4643 StringRef MangledName, llvm::Type *Ty, GlobalDecl GD, bool ForVTable,
4646 const Decl *D = GD.getDecl();
4654 !OpenMPRuntime->markAsGlobalTarget(GD) && FD->isDefined() &&
4659 GDDef = GlobalDecl(CD, GD.getCtorType());
4661 GDDef = GlobalDecl(DD, GD.getDtorType());
4669 UpdateMultiVersionNames(GD, FD, MangledName);
4676 AddDeferredMultiVersionResolverToEmit(GD);
4678 *this, GD, FD, /*OmitMultiVersionMangling=*/true);
4680 return GetOrCreateMultiVersionResolver(GD);
4707 // Check that GD is not yet in DiagnosedConflictingDefinitions is required
4710 (GD.getCanonicalDecl().getDecl() !=
4712 DiagnosedConflictingDefinitions.insert(GD).second) {
4779 SetFunctionAttributes(GD, F, IsIncompleteFunction, IsThunk);
4791 GD.getDtorType()))
4792 addDeferredDeclToEmit(GD);
4822 addDeferredDeclToEmit(GD.getWithDecl(FD));
4843 CodeGenModule::GetAddrOfFunction(GlobalDecl GD, llvm::Type *Ty, bool ForVTable,
4848 const auto *FD = cast<FunctionDecl>(GD.getDecl());
4855 if (const auto *DD = dyn_cast<CXXDestructorDecl>(GD.getDecl())) {
4857 GD.getDtorType() == Dtor_Complete &&
4859 GD = GlobalDecl(DD, Dtor_Base);
4862 StringRef MangledName = getMangledName(GD);
4863 auto *F = GetOrCreateLLVMFunction(MangledName, Ty, GD, ForVTable, DontDefer,
4868 cast<FunctionDecl>(GD.getDecl())->hasAttr<CUDAGlobalAttr>()) {
4870 cast<llvm::Function>(F->stripPointerCasts()), GD);
5211 CodeGenModule::GetAddrOfGlobal(GlobalDecl GD, ForDefinition_t IsForDefinition) {
5212 const Decl *D = GD.getDecl();
5215 return getAddrOfCXXStructor(GD, /*FnInfo=*/nullptr, /*FnType=*/nullptr,
5222 return GetAddrOfFunction(GD, Ty, /*ForVTable=*/false, /*DontDefer=*/false,
5227 const CGFunctionInfo &FI = getTypes().arrangeGlobalDeclaration(GD);
5229 return GetAddrOfFunction(GD, Ty, /*ForVTable=*/false, /*DontDefer=*/false,
6085 void CodeGenModule::EmitGlobalFunctionDefinition(GlobalDecl GD,
6087 const auto *D = cast<FunctionDecl>(GD.getDecl());
6090 const CGFunctionInfo &FI = getTypes().arrangeGlobalDeclaration(GD);
6095 GV = cast<llvm::GlobalValue>(GetAddrOfFunction(GD, Ty, /*ForVTable=*/false,
6108 setFunctionLinkage(GD, Fn);
6111 setGVProperties(Fn, GD);
6117 CodeGenFunction(*this).GenerateCode(GD, Fn, FI);
6119 setNonAliasAttributes(GD, Fn);
6130 void CodeGenModule::EmitAliasDefinition(GlobalDecl GD) {
6131 const auto *D = cast<ValueDecl>(GD.getDecl());
6135 StringRef MangledName = getMangledName(GD);
6148 Aliases.push_back(GD);
6157 Aliasee = GetOrCreateLLVMFunction(AA->getAliasee(), DeclTy, GD,
6159 LT = getFunctionLinkage(GD);
6163 if (const auto *VD = dyn_cast<VarDecl>(GD.getDecl()))
6166 LT = getFunctionLinkage(GD);
6209 SetCommonAttributes(GD, GA);
6214 DI->EmitGlobalAlias(cast<llvm::GlobalValue>(GA->getAliasee()->stripPointerCasts()), GD);
6217 void CodeGenModule::emitIFuncDefinition(GlobalDecl GD) {
6218 const auto *D = cast<ValueDecl>(GD.getDecl());
6222 StringRef MangledName = getMangledName(GD);
6234 DiagnosedConflictingDefinitions.insert(GD).second) {
6243 Aliases.push_back(GD);
6276 SetCommonAttributes(GD, GIF);
7345 GlobalDecl GD(cast<FunctionDecl>(D));
7346 PGO.emitEmptyCounterMapping(D, getMangledName(GD),
7347 getFunctionLinkage(GD));
7352 GlobalDecl GD(cast<CXXConstructorDecl>(D), Ctor_Base);
7353 PGO.emitEmptyCounterMapping(D, getMangledName(GD),
7354 getFunctionLinkage(GD));
7359 GlobalDecl GD(cast<CXXDestructorDecl>(D), Dtor_Base);
7360 PGO.emitEmptyCounterMapping(D, getMangledName(GD),
7361 getFunctionLinkage(GD));
7549 GlobalDecl GD = GlobalDecl(cast<VarDecl>(D));
7550 EmitGlobalDeclMetadata(CGM, GlobalMetadata, GD, GV);