diff options
author | Ivan A. Kosarev <ikosarev@accesssoftek.com> | 2017-10-05 11:08:17 +0000 |
---|---|---|
committer | Ivan A. Kosarev <ikosarev@accesssoftek.com> | 2017-10-05 11:08:17 +0000 |
commit | 3d68ce90f21a38e8204d0a66ad2f634cfcdb7599 (patch) | |
tree | 6d5c3a26fc22d043e822650ea989b14b80936ed1 /clang/lib/CodeGen/CodeGenTBAA.h | |
parent | afc074cc4149d8e16230fc0870458ed455c5e3ba (diff) | |
download | bcm5719-llvm-3d68ce90f21a38e8204d0a66ad2f634cfcdb7599.tar.gz bcm5719-llvm-3d68ce90f21a38e8204d0a66ad2f634cfcdb7599.zip |
[CodeGen] Unify generation of scalar and struct-path TBAA tags
This patch makes it possible to produce access tags in a uniform
manner regardless whether the resulting tag will be a scalar or a
struct-path one. getAccessTagInfo() now takes care of the actual
translation of access descriptors to tags and can handle all
kinds of accesses. Facilities that specific to scalar accesses
are eliminated.
Some more details:
* DecorateInstructionWithTBAA() is not responsible for conversion
of types to access tags anymore. Instead, it takes an access
descriptor (TBAAAccessInfo) and generates corresponding access
tag from it.
* getTBAAInfoForVTablePtr() reworked to
getTBAAVTablePtrAccessInfo() that now returns the
virtual-pointer access descriptor and not the virtual-point
type metadata.
* Added function getTBAAMayAliasAccessInfo() that returns the
descriptor for may-alias accesses.
* getTBAAStructTagInfo() renamed to getTBAAAccessTagInfo() as now
it is the only way to generate access tag by a given access
descriptor. It is capable of producing both scalar and
struct-path tags, depending on options and availability of the
base access type. getTBAAScalarTagInfo() and its cache
ScalarTagMetadataCache are eliminated.
* Now that we do not need to care about whether the resulting
access tag should be a scalar or struct-path one,
getTBAAStructTypeInfo() is renamed to getBaseTypeInfo().
* Added function getTBAAAccessInfo() that constructs access
descriptor by a given QualType access type.
This is part of D37826 reworked to be a separate patch to
simplify review.
Differential Revision: https://reviews.llvm.org/D38503
llvm-svn: 314979
Diffstat (limited to 'clang/lib/CodeGen/CodeGenTBAA.h')
-rw-r--r-- | clang/lib/CodeGen/CodeGenTBAA.h | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/clang/lib/CodeGen/CodeGenTBAA.h b/clang/lib/CodeGen/CodeGenTBAA.h index 2b2c2d4b098..198c2005db9 100644 --- a/clang/lib/CodeGen/CodeGenTBAA.h +++ b/clang/lib/CodeGen/CodeGenTBAA.h @@ -86,8 +86,6 @@ 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. @@ -127,26 +125,23 @@ public: /// given type. llvm::MDNode *getTypeInfo(QualType QTy); - /// getTBAAInfoForVTablePtr - Get the TBAA MDNode to be used for a - /// dereference of a vtable pointer. - llvm::MDNode *getTBAAInfoForVTablePtr(); + /// getVTablePtrAccessInfo - Get the TBAA information that describes an + /// access to a virtual table pointer. + TBAAAccessInfo getVTablePtrAccessInfo(); /// getTBAAStructInfo - Get the TBAAStruct MDNode to be used for a memcpy of /// the given type. llvm::MDNode *getTBAAStructInfo(QualType QTy); - /// Get the MDNode in the type DAG for given struct type QType. - llvm::MDNode *getTBAAStructTypeInfo(QualType QType); + /// getBaseTypeInfo - Get metadata node for a given base access type. + llvm::MDNode *getBaseTypeInfo(QualType QType); - /// Get path-aware TBAA tag for a given memory access. - llvm::MDNode *getTBAAStructTagInfo(TBAAAccessInfo Info); + /// getAccessTagInfo - Get TBAA tag for a given memory access. + llvm::MDNode *getAccessTagInfo(TBAAAccessInfo Info); - /// Get the scalar tag MDNode for a given scalar type. - llvm::MDNode *getTBAAScalarTagInfo(llvm::MDNode *AccessNode); - - /// getMayAliasTypeInfo - Get TBAA information that represents may-alias + /// getMayAliasAccessInfo - Get TBAA information that represents may-alias /// accesses. - llvm::MDNode *getMayAliasTypeInfo(); + TBAAAccessInfo getMayAliasAccessInfo(); }; } // end namespace CodeGen |