summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenTBAA.h
diff options
context:
space:
mode:
authorManman Ren <mren@apple.com>2013-04-11 23:02:56 +0000
committerManman Ren <mren@apple.com>2013-04-11 23:02:56 +0000
commite1ad74e6fd1da695e119d1a92ae10f326e6e0968 (patch)
tree3a8b70ccb00f550136e30ff3d216c2832001147f /clang/lib/CodeGen/CodeGenTBAA.h
parent65b8da0623ae3010f2508158d82d04d661138138 (diff)
downloadbcm5719-llvm-e1ad74e6fd1da695e119d1a92ae10f326e6e0968.tar.gz
bcm5719-llvm-e1ad74e6fd1da695e119d1a92ae10f326e6e0968.zip
Struct-path aware TBAA: uniformize scalar tag and path tag.
For struct-path aware TBAA, we used to use scalar type node as the scalar tag, which has an incompatible format with the struct path tag. We now use the same format: base type, access type and offset. We also uniformize the scalar type node and the struct type node: name, a list of pairs (offset + pointer to MDNode). For scalar type, we have a single pair. These are to make implementaiton of aliasing rules easier. llvm-svn: 179335
Diffstat (limited to 'clang/lib/CodeGen/CodeGenTBAA.h')
-rw-r--r--clang/lib/CodeGen/CodeGenTBAA.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenTBAA.h b/clang/lib/CodeGen/CodeGenTBAA.h
index 9ddc3aa9700..f0c9e06f02b 100644
--- a/clang/lib/CodeGen/CodeGenTBAA.h
+++ b/clang/lib/CodeGen/CodeGenTBAA.h
@@ -61,6 +61,8 @@ class CodeGenTBAA {
llvm::DenseMap<const Type *, llvm::MDNode *> StructTypeMetadataCache;
/// This maps TBAAPathTags to a tag node.
llvm::DenseMap<TBAAPathTag, llvm::MDNode *> StructTagMetadataCache;
+ /// This maps a scalar type to a scalar tag node.
+ llvm::DenseMap<const llvm::MDNode *, llvm::MDNode *> ScalarTagMetadataCache;
/// StructMetadataCache - This maps clang::Types to llvm::MDNodes describing
/// them for struct assignments.
@@ -84,6 +86,11 @@ class CodeGenTBAA {
SmallVectorImpl<llvm::MDBuilder::TBAAStructField> &Fields,
bool MayAlias);
+ /// A wrapper function to create a scalar type. For struct-path aware TBAA,
+ /// the scalar type has the same format as the struct type: name, offset,
+ /// pointer to another node in the type DAG.
+ llvm::MDNode *createTBAAScalarType(StringRef Name, llvm::MDNode *Parent);
+
public:
CodeGenTBAA(ASTContext &Ctx, llvm::LLVMContext &VMContext,
const CodeGenOptions &CGO,
@@ -105,10 +112,13 @@ public:
/// Get the MDNode in the type DAG for given struct type QType.
llvm::MDNode *getTBAAStructTypeInfo(QualType QType);
- /// Get the tag MDNode for a given base type, the actual sclar access MDNode
+ /// Get the tag MDNode for a given base type, the actual scalar access MDNode
/// and offset into the base type.
llvm::MDNode *getTBAAStructTagInfo(QualType BaseQType,
llvm::MDNode *AccessNode, uint64_t Offset);
+
+ /// Get the sclar tag MDNode for a given scalar type.
+ llvm::MDNode *getTBAAScalarTagInfo(llvm::MDNode *AccessNode);
};
} // end namespace CodeGen
OpenPOWER on IntegriCloud