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"
88 return !(*
this ==
Other);
91 explicit operator bool()
const {
126 llvm::MDBuilder MDHelper;
130 llvm::DenseMap<const Type *, llvm::MDNode *> MetadataCache;
132 llvm::DenseMap<const Type *, llvm::MDNode *> BaseTypeMetadataCache;
134 llvm::DenseMap<TBAAAccessInfo, llvm::MDNode *> AccessTagMetadataCache;
138 llvm::DenseMap<const Type *, llvm::MDNode *> StructMetadataCache;
145 llvm::MDNode *getRoot();
149 llvm::MDNode *getChar();
153 bool CollectFields(uint64_t BaseOffset,
160 llvm::MDNode *createScalarTypeNode(StringRef Name, llvm::MDNode *
Parent,
165 llvm::MDNode *getTypeInfoHelper(
const Type *Ty);
169 llvm::MDNode *getBaseTypeInfoHelper(
const Type *Ty);
173 llvm::MDNode *getValidBaseTypeInfo(
QualType QTy);
226template<>
struct DenseMapInfo<
clang::CodeGen::TBAAAccessInfo> {
228 unsigned UnsignedKey = DenseMapInfo<unsigned>::getEmptyKey();
231 DenseMapInfo<MDNode *>::getEmptyKey(),
232 DenseMapInfo<MDNode *>::getEmptyKey(),
233 DenseMapInfo<uint64_t>::getEmptyKey(),
234 DenseMapInfo<uint64_t>::getEmptyKey());
238 unsigned UnsignedKey = DenseMapInfo<unsigned>::getTombstoneKey();
241 DenseMapInfo<MDNode *>::getTombstoneKey(),
242 DenseMapInfo<MDNode *>::getTombstoneKey(),
243 DenseMapInfo<uint64_t>::getTombstoneKey(),
244 DenseMapInfo<uint64_t>::getTombstoneKey());
248 auto KindValue =
static_cast<unsigned>(Val.
Kind);
249 return DenseMapInfo<unsigned>::getHashValue(KindValue) ^
250 DenseMapInfo<MDNode *>::getHashValue(Val.
BaseType) ^
251 DenseMapInfo<MDNode *>::getHashValue(Val.
AccessType) ^
252 DenseMapInfo<uint64_t>::getHashValue(Val.
Offset) ^
253 DenseMapInfo<uint64_t>::getHashValue(Val.
Size);
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
C Language Family Type Representation.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
CodeGenOptions - Track various options which control how the code is optimized and passed to the back...
CodeGenTBAA - This class organizes the cross-module state that is used while lowering AST types to LL...
llvm::MDNode * getBaseTypeInfo(QualType QTy)
getBaseTypeInfo - Get metadata that describes the given base access type.
llvm::MDNode * getTypeInfo(QualType QTy)
getTypeInfo - Get metadata used to describe accesses to objects of the given type.
TBAAAccessInfo getVTablePtrAccessInfo(llvm::Type *VTablePtrType)
getVTablePtrAccessInfo - Get the TBAA information that describes an access to a virtual table pointer...
TBAAAccessInfo mergeTBAAInfoForMemoryTransfer(TBAAAccessInfo DestInfo, TBAAAccessInfo SrcInfo)
mergeTBAAInfoForMemoryTransfer - Get merged TBAA information for the purpose of memory transfer calls...
TBAAAccessInfo mergeTBAAInfoForCast(TBAAAccessInfo SourceInfo, TBAAAccessInfo TargetInfo)
mergeTBAAInfoForCast - Get merged TBAA information for the purpose of type casts.
TBAAAccessInfo mergeTBAAInfoForConditionalOperator(TBAAAccessInfo InfoA, TBAAAccessInfo InfoB)
mergeTBAAInfoForConditionalOperator - Get merged TBAA information for the purpose of conditional oper...
llvm::MDNode * getAccessTagInfo(TBAAAccessInfo Info)
getAccessTagInfo - Get TBAA tag for a given memory access.
llvm::MDNode * getTBAAStructInfo(QualType QTy)
getTBAAStructInfo - Get the TBAAStruct MDNode to be used for a memcpy of the given type.
TBAAAccessInfo getAccessInfo(QualType AccessType)
getAccessInfo - Get TBAA information that describes an access to an object of the given type.
This class organizes the cross-module state that is used while lowering AST types to LLVM types.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
MangleContext - Context for tracking state which persists across multiple calls to the C++ name mangl...
Describes a module or submodule.
A (possibly-)qualified type.
Exposes information about the current target.
The base class of the type hierarchy.
The JSON file list parser is used to communicate input to InstallAPI.
@ Other
Other implicit parameter.
Diagnostic wrappers for TextAPI types for error reporting.
TBAAAccessKind Kind
Kind - The kind of the access descriptor.
llvm::MDNode * AccessType
AccessType - The final access type.
uint64_t Offset
Offset - The byte offset of the final access within the base one.
TBAAAccessInfo(TBAAAccessKind Kind, llvm::MDNode *BaseType, llvm::MDNode *AccessType, uint64_t Offset, uint64_t Size)
static TBAAAccessInfo getMayAliasInfo()
TBAAAccessInfo(llvm::MDNode *AccessType, uint64_t Size)
uint64_t Size
Size - The size of access, in bytes.
bool operator==(const TBAAAccessInfo &Other) const
static TBAAAccessInfo getIncompleteInfo()
bool operator!=(const TBAAAccessInfo &Other) const
llvm::MDNode * BaseType
BaseType - The base/leading access type.
bool isIncomplete() const
TBAAAccessInfo(llvm::MDNode *BaseType, llvm::MDNode *AccessType, uint64_t Offset, uint64_t Size)
static clang::CodeGen::TBAAAccessInfo getTombstoneKey()
static clang::CodeGen::TBAAAccessInfo getEmptyKey()
static unsigned getHashValue(const clang::CodeGen::TBAAAccessInfo &Val)
static bool isEqual(const clang::CodeGen::TBAAAccessInfo &LHS, const clang::CodeGen::TBAAAccessInfo &RHS)