diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2023-07-26 19:03:47 +0000 |
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2023-07-26 19:04:23 +0000 |
| commit | 7fa27ce4a07f19b07799a767fc29416f3b625afb (patch) | |
| tree | 27825c83636c4de341eb09a74f49f5d38a15d165 /clang/lib/CodeGen/CodeGenModule.h | |
| parent | e3b557809604d036af6e00c60f012c2025b59a5e (diff) | |
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.h')
| -rw-r--r-- | clang/lib/CodeGen/CodeGenModule.h | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.h b/clang/lib/CodeGen/CodeGenModule.h index b3354657b237..05cb217e2bee 100644 --- a/clang/lib/CodeGen/CodeGenModule.h +++ b/clang/lib/CodeGen/CodeGenModule.h @@ -30,6 +30,7 @@ #include "clang/Basic/XRayLists.h" #include "clang/Lex/PreprocessorOptions.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/MapVector.h" #include "llvm/ADT/SetVector.h" #include "llvm/ADT/SmallPtrSet.h" #include "llvm/ADT/StringMap.h" @@ -378,8 +379,7 @@ private: /// multiversion function resolvers and ifuncs are defined and emitted. std::vector<GlobalDecl> MultiVersionFuncs; - typedef llvm::StringMap<llvm::TrackingVH<llvm::Constant> > ReplacementsTy; - ReplacementsTy Replacements; + llvm::MapVector<StringRef, llvm::TrackingVH<llvm::Constant>> Replacements; /// List of global values to be replaced with something else. Used when we /// want to replace a GlobalValue but can't identify it by its mangled name @@ -590,8 +590,6 @@ private: MetadataTypeMap VirtualMetadataIdMap; MetadataTypeMap GeneralizedMetadataIdMap; - llvm::DenseMap<const llvm::Constant *, llvm::GlobalVariable *> RTTIProxyMap; - // Helps squashing blocks of TopLevelStmtDecl into a single llvm::Function // when used with -fincremental-extensions. std::pair<std::unique_ptr<CodeGenFunction>, const TopLevelStmtDecl *> @@ -816,7 +814,7 @@ public: return getTBAAAccessInfo(AccessType); } - bool isTypeConstant(QualType QTy, bool ExcludeCtorDtor); + bool isTypeConstant(QualType QTy, bool ExcludeCtor, bool ExcludeDtor); bool isPaddedAtomicType(QualType type); bool isPaddedAtomicType(const AtomicType *type); @@ -928,6 +926,13 @@ public: // Return the function body address of the given function. llvm::Constant *GetFunctionStart(const ValueDecl *Decl); + // Return whether RTTI information should be emitted for this target. + bool shouldEmitRTTI(bool ForEH = false) { + return (ForEH || getLangOpts().RTTI) && !getLangOpts().CUDAIsDevice && + !(getLangOpts().OpenMP && getLangOpts().OpenMPIsTargetDevice && + getTriple().isNVPTX()); + } + /// Get the address of the RTTI descriptor for the given type. llvm::Constant *GetAddrOfRTTIDescriptor(QualType Ty, bool ForEH = false); @@ -1272,6 +1277,8 @@ public: /// function which relies on particular fast-math attributes for correctness. /// It's up to you to ensure that this is safe. void addDefaultFunctionDefinitionAttributes(llvm::Function &F); + void mergeDefaultFunctionDefinitionAttributes(llvm::Function &F, + bool WillInternalize); /// Like the overload taking a `Function &`, but intended specifically /// for frontends that want to build on Clang's target-configuration logic. @@ -1501,9 +1508,6 @@ public: std::vector<const CXXRecordDecl *> getMostBaseClasses(const CXXRecordDecl *RD); - llvm::GlobalVariable * - GetOrCreateRTTIProxyGlobalVariable(llvm::Constant *Addr); - /// Get the declaration of std::terminate for the platform. llvm::FunctionCallee getTerminateFn(); @@ -1581,7 +1585,8 @@ private: ForDefinition_t IsForDefinition = NotForDefinition); bool GetCPUAndFeaturesAttributes(GlobalDecl GD, - llvm::AttrBuilder &AttrBuilder); + llvm::AttrBuilder &AttrBuilder, + bool SetTargetFeatures = true); void setNonAliasAttributes(GlobalDecl GD, llvm::GlobalObject *GO); /// Set function attributes for a function declaration. @@ -1711,7 +1716,7 @@ private: /// Emit the module flag metadata used to pass options controlling the /// the backend to LLVM. - void EmitBackendOptionsMetadata(const CodeGenOptions CodeGenOpts); + void EmitBackendOptionsMetadata(const CodeGenOptions &CodeGenOpts); /// Emits OpenCL specific Metadata e.g. OpenCL version. void EmitOpenCLMetadata(); @@ -1734,6 +1739,12 @@ private: /// function. void SimplifyPersonality(); + /// Helper function for getDefaultFunctionAttributes. Builds a set of function + /// attributes which can be simply added to a function. + void getTrivialDefaultFunctionAttributes(StringRef Name, bool HasOptnone, + bool AttrOnCallSite, + llvm::AttrBuilder &FuncAttrs); + /// Helper function for ConstructAttributeList and /// addDefaultFunctionDefinitionAttributes. Builds a set of function /// attributes to add to a function with the given properties. |
