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);
171 llvm::MDNode *getValidBaseTypeInfo(
QualType QTy);
223template<>
struct DenseMapInfo<
clang::CodeGen::TBAAAccessInfo> {
225 unsigned UnsignedKey = DenseMapInfo<unsigned>::getEmptyKey();
228 DenseMapInfo<MDNode *>::getEmptyKey(),
229 DenseMapInfo<MDNode *>::getEmptyKey(),
230 DenseMapInfo<uint64_t>::getEmptyKey(),
231 DenseMapInfo<uint64_t>::getEmptyKey());
235 unsigned UnsignedKey = DenseMapInfo<unsigned>::getTombstoneKey();
238 DenseMapInfo<MDNode *>::getTombstoneKey(),
239 DenseMapInfo<MDNode *>::getTombstoneKey(),
240 DenseMapInfo<uint64_t>::getTombstoneKey(),
241 DenseMapInfo<uint64_t>::getTombstoneKey());
245 auto KindValue =
static_cast<unsigned>(Val.
Kind);
246 return DenseMapInfo<unsigned>::getHashValue(KindValue) ^
247 DenseMapInfo<MDNode *>::getHashValue(Val.
BaseType) ^
248 DenseMapInfo<MDNode *>::getHashValue(Val.
AccessType) ^
249 DenseMapInfo<uint64_t>::getHashValue(Val.
Offset) ^
250 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...
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)