diff options
author | Dan Gohman <gohman@apple.com> | 2012-09-28 21:58:29 +0000 |
---|---|---|
committer | Dan Gohman <gohman@apple.com> | 2012-09-28 21:58:29 +0000 |
commit | b22c7dc707cf3770ff3b5e5f11f11fd0aaa06d9b (patch) | |
tree | 229206e36c039731daa063a9a194205dc31f904b /lib/CodeGen/CodeGenTBAA.h | |
parent | 72ab27732ea7a42d756a1e79727f86fbe391b42b (diff) |
Add basic support for adding !tbaa.struct metadata on llvm.memcpy calls for
struct assignment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@164853 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenTBAA.h')
-rw-r--r-- | lib/CodeGen/CodeGenTBAA.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/CodeGen/CodeGenTBAA.h b/lib/CodeGen/CodeGenTBAA.h index c17a5cf03c..eedb996f3e 100644 --- a/lib/CodeGen/CodeGenTBAA.h +++ b/lib/CodeGen/CodeGenTBAA.h @@ -49,6 +49,10 @@ class CodeGenTBAA { /// MetadataCache - This maps clang::Types to llvm::MDNodes describing them. llvm::DenseMap<const Type *, llvm::MDNode *> MetadataCache; + /// StructMetadataCache - This maps clang::Types to llvm::MDNodes describing + /// them for struct assignments. + llvm::DenseMap<const Type *, llvm::MDNode *> StructMetadataCache; + llvm::MDNode *Root; llvm::MDNode *Char; @@ -60,6 +64,13 @@ class CodeGenTBAA { /// considered to be equivalent to it. llvm::MDNode *getChar(); + /// CollectFields - Collect information about the fields of a type for + /// !tbaa.struct metadata formation. Return false for an unsupported type. + bool CollectFields(uint64_t BaseOffset, + QualType Ty, + SmallVectorImpl<llvm::MDBuilder::TBAAStructField> &Fields, + bool MayAlias); + public: CodeGenTBAA(ASTContext &Ctx, llvm::LLVMContext &VMContext, const CodeGenOptions &CGO, @@ -74,6 +85,10 @@ public: /// getTBAAInfoForVTablePtr - Get the TBAA MDNode to be used for a /// dereference of a vtable pointer. llvm::MDNode *getTBAAInfoForVTablePtr(); + + /// getTBAAStructInfo - Get the TBAAStruct MDNode to be used for a memcpy of + /// the given type. + llvm::MDNode *getTBAAStructInfo(QualType QTy); }; } // end namespace CodeGen |