clang
8.0.0
|
#include "CodeGenModule.h"
#include "CGBlocks.h"
#include "CGCUDARuntime.h"
#include "CGCXXABI.h"
#include "CGCall.h"
#include "CGDebugInfo.h"
#include "CGObjCRuntime.h"
#include "CGOpenCLRuntime.h"
#include "CGOpenMPRuntime.h"
#include "CGOpenMPRuntimeNVPTX.h"
#include "CodeGenFunction.h"
#include "CodeGenPGO.h"
#include "ConstantEmitter.h"
#include "CoverageMappingGen.h"
#include "TargetInfo.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/CharUnits.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
#include "clang/AST/Mangle.h"
#include "clang/AST/RecordLayout.h"
#include "clang/AST/RecursiveASTVisitor.h"
#include "clang/Basic/Builtins.h"
#include "clang/Basic/CharInfo.h"
#include "clang/Basic/CodeGenOptions.h"
#include "clang/Basic/Diagnostic.h"
#include "clang/Basic/Module.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/TargetInfo.h"
#include "clang/Basic/Version.h"
#include "clang/CodeGen/ConstantInitBuilder.h"
#include "clang/Frontend/FrontendDiagnostic.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/ADT/Triple.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/IR/CallSite.h"
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/ProfileData/InstrProfReader.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/ConvertUTF.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MD5.h"
Go to the source code of this file.
Functions | |
static llvm::cl::opt< bool > | LimitedCoverage ("limited-coverage-experimental", llvm::cl::ZeroOrMore, llvm::cl::Hidden, llvm::cl::desc("Emit limited coverage mapping information (experimental)"), llvm::cl::init(false)) |
static CGCXXABI * | createCXXABI (CodeGenModule &CGM) |
static const llvm::GlobalObject * | getAliasedGlobal (const llvm::GlobalIndirectSymbol &GIS) |
static bool | shouldAssumeDSOLocal (const CodeGenModule &CGM, llvm::GlobalValue *GV) |
static llvm::GlobalVariable::ThreadLocalMode | GetLLVMTLSModel (StringRef S) |
static llvm::GlobalVariable::ThreadLocalMode | GetLLVMTLSModel (CodeGenOptions::TLSModel M) |
static std::string | getCPUSpecificMangling (const CodeGenModule &CGM, StringRef Name) |
static void | AppendCPUSpecificCPUDispatchMangling (const CodeGenModule &CGM, const CPUSpecificAttr *Attr, unsigned CPUIndex, raw_ostream &Out) |
static void | AppendTargetMangling (const CodeGenModule &CGM, const TargetAttr *Attr, raw_ostream &Out) |
static std::string | getMangledNameImpl (const CodeGenModule &CGM, GlobalDecl GD, const NamedDecl *ND, bool OmitMultiVersionMangling=false) |
static bool | hasUnwindExceptions (const LangOptions &LangOpts) |
Determines whether the language options require us to model unwind exceptions. More... | |
static bool | requiresMemberFunctionPointerTypeMetadata (CodeGenModule &CGM, const CXXMethodDecl *MD) |
static void | setLinkageForGV (llvm::GlobalValue *GV, const NamedDecl *ND) |
static void | emitUsed (CodeGenModule &CGM, StringRef Name, std::vector< llvm::WeakTrackingVH > &List) |
static void | addLinkOptionsPostorder (CodeGenModule &CGM, Module *Mod, SmallVectorImpl< llvm::MDNode *> &Metadata, llvm::SmallPtrSet< Module *, 16 > &Visited) |
Add link options implied by the given module, including modules it depends on, using a postorder walk. More... | |
static bool | HasNonDllImportDtor (QualType T) |
static void | ReplaceUsesOfNonProtoTypeWithRealFunction (llvm::GlobalValue *Old, llvm::Function *NewFn) |
ReplaceUsesOfNonProtoTypeWithRealFunction - This function is called when we implement a function with no prototype, e.g. More... | |
static unsigned | TargetMVPriority (const TargetInfo &TI, const CodeGenFunction::MultiVersionResolverOption &RO) |
static const FunctionDecl * | GetRuntimeFunctionDecl (ASTContext &C, StringRef Name) |
static llvm::Constant * | castStringLiteralToDefaultAddressSpace (CodeGenModule &CGM, llvm::GlobalVariable *GV) |
static bool | shouldBeInCOMDAT (CodeGenModule &CGM, const Decl &D) |
static bool | isVarDeclStrongDefinition (const ASTContext &Context, CodeGenModule &CGM, const VarDecl *D, bool NoCommon) |
static void | replaceUsesOfNonProtoConstant (llvm::Constant *old, llvm::Function *newFn) |
Replace the uses of a function that was declared with a non-proto type. More... | |
static llvm::StringMapEntry< llvm::GlobalVariable * > & | GetConstantCFStringEntry (llvm::StringMap< llvm::GlobalVariable *> &Map, const StringLiteral *Literal, bool TargetIsLSB, bool &IsUTF16, unsigned &StringLength) |
static llvm::GlobalVariable * | GenerateStringLiteral (llvm::Constant *C, llvm::GlobalValue::LinkageTypes LT, CodeGenModule &CGM, StringRef GlobalName, CharUnits Alignment) |
static bool | needsDestructMethod (ObjCImplementationDecl *impl) |
static bool | AllTrivialInitializers (CodeGenModule &CGM, ObjCImplementationDecl *D) |
static llvm::Constant * | GetPointerConstant (llvm::LLVMContext &Context, const void *Ptr) |
Turns the given pointer into a constant. More... | |
static void | EmitGlobalDeclMetadata (CodeGenModule &CGM, llvm::NamedMDNode *&GlobalMetadata, GlobalDecl D, llvm::GlobalValue *Addr) |
static QualType | GeneralizeType (ASTContext &Ctx, QualType Ty) |
static QualType | GeneralizeFunctionType (ASTContext &Ctx, QualType Ty) |
Variables | |
static const char | AnnotationSection [] = "llvm.metadata" |
|
static |
Add link options implied by the given module, including modules it depends on, using a postorder walk.
Definition at line 1678 of file CodeGenModule.cpp.
References clang::CodeGen::TargetCodeGenInfo::getDependentLibraryOption(), clang::CodeGen::CodeGenModule::getLLVMContext(), clang::CodeGen::CodeGenModule::getTarget(), clang::CodeGen::CodeGenModule::getTargetCodeGenInfo(), clang::TargetInfo::getTriple(), clang::Module::Imports, clang::Module::LinkLibraries, clang::Module::Parent, and clang::Module::UseExportAsModuleLinkName.
|
static |
Definition at line 4720 of file CodeGenModule.cpp.
References clang::ObjCImplDecl::addInstanceMethod(), clang::ObjCMethodDecl::Create(), clang::DeclContext::decls(), clang::CodeGen::CodeGenModule::EmitTopLevelDecl(), clang::CodeGen::CodeGenModule::ErrorUnsupported(), clang::CodeGen::CodeGenFunction::GenerateObjCCtorDtorMethod(), clang::IdentifierTable::get(), clang::CodeGen::CodeGenModule::getContext(), clang::CXXCtorInitializer::getInit(), clang::LinkageSpecDecl::getLanguage(), clang::Decl::getLocation(), clang::ObjCImplementationDecl::getNumIvarInitializers(), clang::ASTContext::getObjCIdType(), clang::SelectorTable::getSelector(), clang::ASTContext::Idents, clang::ObjCImplementationDecl::init_begin(), clang::ObjCImplementationDecl::init_end(), clang::CodeGen::CodeGenFunction::isTrivialInitializer(), clang::LinkageSpecDecl::lang_c, clang::LinkageSpecDecl::lang_cxx, needsDestructMethod(), clang::ObjCMethodDecl::Required, clang::ASTContext::Selectors, clang::ObjCImplementationDecl::setHasDestructors(), clang::ObjCImplementationDecl::setHasNonZeroConstructors(), and clang::ASTContext::VoidTy.
|
static |
Definition at line 898 of file CodeGenModule.cpp.
References getCPUSpecificMangling(), clang::CodeGen::CodeGenModule::getTarget(), and clang::TargetInfo::supportsIFunc().
Referenced by getMangledNameImpl().
|
static |
Definition at line 910 of file CodeGenModule.cpp.
References clang::CodeGen::CodeGenModule::getTarget(), and clang::TargetInfo::multiVersionSortPriority().
Referenced by getMangledNameImpl().
|
static |
Definition at line 3383 of file CodeGenModule.cpp.
References clang::Default, clang::TargetInfo::getConstantAddressSpace(), clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getTarget(), clang::ASTContext::getTargetAddressSpace(), clang::CodeGen::CodeGenModule::getTargetCodeGenInfo(), and clang::CodeGen::TargetCodeGenInfo::performAddrSpaceCast().
Referenced by clang::CodeGen::CodeGenModule::GetAddrOfConstantCString().
|
static |
Definition at line 72 of file CodeGenModule.cpp.
References clang::CodeGen::CreateItaniumCXXABI(), clang::CodeGen::CreateMicrosoftCXXABI(), clang::TargetCXXABI::GenericAArch64, clang::TargetCXXABI::GenericARM, clang::TargetCXXABI::GenericItanium, clang::TargetCXXABI::GenericMIPS, clang::TargetInfo::getCXXABI(), clang::TargetCXXABI::getKind(), clang::CodeGen::CodeGenModule::getTarget(), clang::TargetCXXABI::iOS, clang::TargetCXXABI::iOS64, clang::TargetCXXABI::Microsoft, clang::TargetCXXABI::WatchOS, and clang::TargetCXXABI::WebAssembly.
Referenced by clang::ASTContext::InitBuiltinTypes().
|
static |
Definition at line 5139 of file CodeGenModule.cpp.
References clang::GlobalDecl::getDecl(), clang::CodeGen::CodeGenModule::getLLVMContext(), clang::CodeGen::CodeGenModule::getModule(), GetPointerConstant(), and clang::CodeGen::CodeGenModule::getTargetCodeGenInfo().
Referenced by clang::CodeGen::CodeGenModule::lookupRepresentativeDecl().
|
static |
Definition at line 1620 of file CodeGenModule.cpp.
|
static |
Definition at line 5387 of file CodeGenModule.cpp.
References GeneralizeType(), clang::Type::getAs(), clang::ASTContext::getFunctionNoProtoType(), and clang::ASTContext::getFunctionType().
Referenced by clang::CodeGen::CodeGenModule::CreateMetadataIdentifierGeneralized().
|
static |
Definition at line 5377 of file CodeGenModule.cpp.
References clang::QualType::getCVRQualifiers(), clang::Type::getPointeeType(), clang::ASTContext::getPointerType(), clang::Type::isPointerType(), clang::ASTContext::VoidTy, and clang::QualType::withCVRQualifiers().
Referenced by GeneralizeFunctionType().
|
static |
Definition at line 4471 of file CodeGenModule.cpp.
References clang::CodeGen::CodeGenModule::getContext(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getModule(), clang::CharUnits::getQuantity(), clang::CodeGen::CodeGenModule::getStringLiteralAddressSpace(), clang::ASTContext::getTargetAddressSpace(), LT, clang::CodeGen::CodeGenModule::setDSOLocal(), and clang::CodeGen::CodeGenModule::supportsCOMDAT().
Referenced by clang::CodeGen::CodeGenModule::GetAddrOfConstantCString().
|
static |
|
static |
Definition at line 4174 of file CodeGenModule.cpp.
References clang::StringLiteral::containsNonAsciiOrNull(), and clang::StringLiteral::getString().
Referenced by clang::CodeGen::CodeGenModule::GetAddrOfConstantCFString().
|
static |
Definition at line 892 of file CodeGenModule.cpp.
Referenced by AppendCPUSpecificCPUDispatchMangling().
|
static |
Definition at line 855 of file CodeGenModule.cpp.
Referenced by clang::CodeGen::CodeGenModule::setTLSMode().
|
static |
Definition at line 863 of file CodeGenModule.cpp.
References clang::CodeGenOptions::GeneralDynamicTLSModel, clang::CodeGenOptions::InitialExecTLSModel, clang::CodeGenOptions::LocalDynamicTLSModel, and clang::CodeGenOptions::LocalExecTLSModel.
|
static |
Definition at line 942 of file CodeGenModule.cpp.
References AppendCPUSpecificCPUDispatchMangling(), AppendTargetMangling(), clang::CC_X86RegCall, clang::CPUDispatch, clang::CPUSpecific, clang::Decl::getAsFunction(), clang::GlobalDecl::getCanonicalDecl(), clang::GlobalDecl::getCtorType(), clang::CodeGen::CodeGenModule::getCXXABI(), clang::GlobalDecl::getDecl(), clang::GlobalDecl::getDtorType(), clang::CodeGen::CodeGenModule::GetGlobalValue(), clang::NamedDecl::getIdentifier(), clang::CodeGen::CGCXXABI::getMangleContext(), clang::Redeclarable< decl_type >::getMostRecentDecl(), clang::GlobalDecl::getMultiVersionIndex(), clang::IdentifierInfo::getName(), clang::FunctionDecl::isMultiVersion(), clang::CodeGen::CodeGenModule::lookupRepresentativeDecl(), clang::MangleContext::mangleCXXCtor(), clang::MangleContext::mangleCXXDtor(), clang::MangleContext::mangleName(), clang::None, clang::MangleContext::shouldMangleDeclName(), and clang::Target.
Referenced by clang::CodeGen::CodeGenModule::getMangledName().
|
static |
Turns the given pointer into a constant.
Definition at line 5132 of file CodeGenModule.cpp.
References clang::CodeGen::Type.
Referenced by EmitGlobalDeclMetadata(), and clang::CodeGen::CodeGenModule::lookupRepresentativeDecl().
|
static |
Definition at line 2917 of file CodeGenModule.cpp.
Definition at line 2258 of file CodeGenModule.cpp.
References clang::Type::getAs(), and clang::Type::getBaseElementTypeUnsafe().
|
static |
Determines whether the language options require us to model unwind exceptions.
We treat -fexceptions as mandating this except under the fragile ObjC ABI with only ObjC exceptions enabled. This means, for example, that C with -fexceptions enables this.
Definition at line 1181 of file CodeGenModule.cpp.
References clang::ObjCRuntime::hasUnwindExceptions(), and clang::LangOptions::ObjCRuntime.
Referenced by clang::CodeGen::CodeGenModule::SetLLVMFunctionAttributesForDefinition().
|
static |
Definition at line 3704 of file CodeGenModule.cpp.
References clang::RecordDecl::fields(), clang::Type::getAs(), clang::TargetInfo::getCXXABI(), clang::VarDecl::getInit(), clang::ASTContext::getTargetInfo(), clang::VarDecl::getTLSKind(), clang::TargetInfo::getTriple(), clang::ValueDecl::getType(), clang::ASTContext::getTypeAlignIfKnown(), clang::Decl::hasAttr(), clang::VarDecl::hasExternalStorage(), clang::ASTContext::isAlignmentRequired(), clang::TargetCXXABI::isMicrosoft(), and shouldBeInCOMDAT().
Referenced by clang::CodeGen::CodeGenModule::getLLVMLinkageForDeclarator().
|
static |
Definition at line 4710 of file CodeGenModule.cpp.
References clang::ObjCInterfaceDecl::all_declared_ivar_begin(), clang::ObjCImplDecl::getClassInterface(), and clang::ObjCIvarDecl::getNextIvar().
Referenced by AllTrivialInitializers().
|
static |
Replace the uses of a function that was declared with a non-proto type.
We want to silently drop extra arguments from call sites
Definition at line 3857 of file CodeGenModule.cpp.
References clang::Create(), and clang::CodeGen::Type.
Referenced by ReplaceUsesOfNonProtoTypeWithRealFunction().
|
static |
ReplaceUsesOfNonProtoTypeWithRealFunction - This function is called when we implement a function with no prototype, e.g.
"int foo() {}". If there are existing call uses of the old function in the module, this adjusts them to call the new function directly.
This is not just a cleanup: the always_inline pass requires direct calls to functions to be able to inline them. If there is a bitcast in the way, it won't inline them. Instcombine normally deletes these calls, but it isn't run at -O0.
Definition at line 3963 of file CodeGenModule.cpp.
References replaceUsesOfNonProtoConstant().
|
static |
Definition at line 1196 of file CodeGenModule.cpp.
References clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CXXMethodDecl::getParent(), clang::CodeGen::CodeGenModule::HasHiddenLTOVisibility(), clang::CXXMethodDecl::isStatic(), and clang::CXXMethodDecl::isVirtual().
Referenced by clang::CodeGen::CodeGenModule::SetLLVMFunctionAttributesForDefinition().
|
static |
Definition at line 1494 of file CodeGenModule.cpp.
References clang::LinkageInfo::getLinkage(), clang::NamedDecl::getLinkageAndVisibility(), clang::Decl::hasAttr(), clang::isExternallyVisible(), clang::Decl::isWeakImported(), and clang::LinkageInfo::setLinkage().
Referenced by clang::CodeGen::CodeGenModule::CreateFunctionTypeMetadataForIcall(), and clang::CodeGen::CodeGenModule::isTypeConstant().
|
static |
Definition at line 740 of file CodeGenModule.cpp.
References clang::CodeGen::CodeGenModule::getCodeGenOpts(), clang::CodeGen::CodeGenModule::getLangOpts(), clang::CodeGen::CodeGenModule::getTriple(), and clang::CodeGenOptions::RelocationModel.
Referenced by clang::CodeGen::CodeGenModule::setDSOLocal().
|
static |
Definition at line 3431 of file CodeGenModule.cpp.
References clang::CodeGen::CodeGenModule::getContext(), clang::ASTContext::GetGVALinkageForFunction(), clang::ASTContext::GetGVALinkageForVariable(), clang::GVA_AvailableExternally, clang::GVA_DiscardableODR, clang::GVA_Internal, clang::GVA_StrongExternal, clang::GVA_StrongODR, clang::Decl::hasAttr(), and clang::CodeGen::CodeGenModule::supportsCOMDAT().
Referenced by isVarDeclStrongDefinition(), and clang::CodeGen::CodeGenModule::maybeSetTrivialComdat().
|
static |
Definition at line 2483 of file CodeGenModule.cpp.
References clang::CodeGen::CodeGenFunction::MultiVersionResolverOption::Conds::Architecture, clang::CodeGen::CodeGenFunction::MultiVersionResolverOption::Conditions, clang::CodeGen::CodeGenFunction::MultiVersionResolverOption::Conds::Features, max(), and clang::TargetInfo::multiVersionSortPriority().
|
static |
Definition at line 70 of file CodeGenModule.cpp.