Go to the documentation of this file.
14 #ifndef LLVM_CLANG_LIB_CODEGEN_CODEGENTBAA_H
15 #define LLVM_CLANG_LIB_CODEGEN_CODEGENTBAA_H
19 #include "llvm/ADT/DenseMap.h"
20 #include "llvm/IR/MDBuilder.h"
21 #include "llvm/IR/Metadata.h"
87 return !(*
this == Other);
90 explicit operator bool()
const {
124 llvm::MDBuilder MDHelper;
128 llvm::DenseMap<const Type *, llvm::MDNode *> MetadataCache;
130 llvm::DenseMap<const Type *, llvm::MDNode *> BaseTypeMetadataCache;
132 llvm::DenseMap<TBAAAccessInfo, llvm::MDNode *> AccessTagMetadataCache;
136 llvm::DenseMap<const Type *, llvm::MDNode *> StructMetadataCache;
143 llvm::MDNode *getRoot();
147 llvm::MDNode *getChar();
151 bool CollectFields(
uint64_t BaseOffset,
158 llvm::MDNode *createScalarTypeNode(StringRef Name, llvm::MDNode *
Parent,
163 llvm::MDNode *getTypeInfoHelper(
const Type *Ty);
167 llvm::MDNode *getBaseTypeInfoHelper(
const Type *Ty);
218 template<>
struct DenseMapInfo<
clang::CodeGen::TBAAAccessInfo> {
220 unsigned UnsignedKey = DenseMapInfo<unsigned>::getEmptyKey();
223 DenseMapInfo<MDNode *>::getEmptyKey(),
224 DenseMapInfo<MDNode *>::getEmptyKey(),
225 DenseMapInfo<uint64_t>::getEmptyKey(),
226 DenseMapInfo<uint64_t>::getEmptyKey());
230 unsigned UnsignedKey = DenseMapInfo<unsigned>::getTombstoneKey();
233 DenseMapInfo<MDNode *>::getTombstoneKey(),
234 DenseMapInfo<MDNode *>::getTombstoneKey(),
235 DenseMapInfo<uint64_t>::getTombstoneKey(),
236 DenseMapInfo<uint64_t>::getTombstoneKey());
240 auto KindValue =
static_cast<unsigned>(Val.
Kind);
241 return DenseMapInfo<unsigned>::getHashValue(KindValue) ^
242 DenseMapInfo<MDNode *>::getHashValue(Val.
BaseType) ^
243 DenseMapInfo<MDNode *>::getHashValue(Val.
AccessType) ^
244 DenseMapInfo<uint64_t>::getHashValue(Val.
Offset) ^
245 DenseMapInfo<uint64_t>::getHashValue(Val.
Size);
TBAAAccessInfo mergeTBAAInfoForConditionalOperator(TBAAAccessInfo InfoA, TBAAAccessInfo InfoB)
mergeTBAAInfoForConditionalOperator - Get merged TBAA information for the purpose of conditional oper...
YAML serialization mapping.
TBAAAccessKind Kind
Kind - The kind of the access descriptor.
TBAAAccessInfo(llvm::MDNode *BaseType, llvm::MDNode *AccessType, uint64_t Offset, uint64_t Size)
TBAAAccessInfo(TBAAAccessKind Kind, llvm::MDNode *BaseType, llvm::MDNode *AccessType, uint64_t Offset, uint64_t Size)
llvm::MDNode * getTypeInfo(QualType QTy)
getTypeInfo - Get metadata used to describe accesses to objects of the given type.
A (possibly-)qualified type.
Exposes information about the current target.
TBAAAccessInfo getVTablePtrAccessInfo(llvm::Type *VTablePtrType)
getVTablePtrAccessInfo - Get the TBAA information that describes an access to a virtual table pointer...
TBAAAccessInfo(llvm::MDNode *AccessType, uint64_t Size)
@ Ordinary
An ordinary type.
static clang::CodeGen::TBAAAccessInfo getTombstoneKey()
The base class of the type hierarchy.
MangleContext - Context for tracking state which persists across multiple calls to the C++ name mangl...
Describes a module or submodule.
static bool isEqual(const clang::CodeGen::TBAAAccessInfo &LHS, const clang::CodeGen::TBAAAccessInfo &RHS)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
bool isIncomplete() const
llvm::MDNode * BaseType
BaseType - The base/leading access type.
CodeGenTBAA(ASTContext &Ctx, llvm::Module &M, const CodeGenOptions &CGO, const LangOptions &Features, MangleContext &MContext)
llvm::MDNode * getBaseTypeInfo(QualType QTy)
getBaseTypeInfo - Get metadata that describes the given base access type.
llvm::MDNode * getAccessTagInfo(TBAAAccessInfo Info)
getAccessTagInfo - Get TBAA tag for a given memory access.
static TBAAAccessInfo getIncompleteInfo()
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
llvm::MDNode * getTBAAStructInfo(QualType QTy)
getTBAAStructInfo - Get the TBAAStruct MDNode to be used for a memcpy of the given type.
static clang::CodeGen::TBAAAccessInfo getEmptyKey()
uint64_t Size
Size - The size of access, in bytes.
bool operator!=(const TBAAAccessInfo &Other) const
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
static unsigned getHashValue(const clang::CodeGen::TBAAAccessInfo &Val)
bool operator==(const TBAAAccessInfo &Other) const
TBAAAccessInfo mergeTBAAInfoForCast(TBAAAccessInfo SourceInfo, TBAAAccessInfo TargetInfo)
mergeTBAAInfoForCast - Get merged TBAA information for the purpose of type casts.
uint64_t Offset
Offset - The byte offset of the final access within the base one.
static TBAAAccessInfo getMayAliasInfo()
TBAAAccessInfo getAccessInfo(QualType AccessType)
getAccessInfo - Get TBAA information that describes an access to an object of the given type.
llvm::MDNode * AccessType
AccessType - The final access type.
CodeGenTBAA - This class organizes the cross-module state that is used while lowering AST types to LL...
TBAAAccessInfo mergeTBAAInfoForMemoryTransfer(TBAAAccessInfo DestInfo, TBAAAccessInfo SrcInfo)
mergeTBAAInfoForMemoryTransfer - Get merged TBAA information for the purpose of memory transfer calls...