diff options
author | Ivan A. Kosarev <ikosarev@accesssoftek.com> | 2017-10-05 10:47:51 +0000 |
---|---|---|
committer | Ivan A. Kosarev <ikosarev@accesssoftek.com> | 2017-10-05 10:47:51 +0000 |
commit | c64aa1bff66eaa08d18f0704502ac0b45610f218 (patch) | |
tree | 2456766cc28890126c8490922909291508602ab1 /lib/CodeGen/CodeGenModule.h | |
parent | 7728f3542e45915878ff7f98d7dd14bca4fe933e (diff) | |
download | clang-c64aa1bff66eaa08d18f0704502ac0b45610f218.tar.gz |
[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
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@314977 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.h')
-rw-r--r-- | lib/CodeGen/CodeGenModule.h | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h index 33b622972d..8b2fc8d2a8 100644 --- a/lib/CodeGen/CodeGenModule.h +++ b/lib/CodeGen/CodeGenModule.h @@ -656,28 +656,36 @@ public: /// the given type. llvm::MDNode *getTBAATypeInfo(QualType QTy); - llvm::MDNode *getTBAAInfoForVTablePtr(); + /// getTBAAAccessInfo - Get TBAA information that describes an access to + /// an object of the given type. + TBAAAccessInfo getTBAAAccessInfo(QualType AccessType); + + /// getTBAAVTablePtrAccessInfo - Get the TBAA information that describes an + /// access to a virtual table pointer. + TBAAAccessInfo getTBAAVTablePtrAccessInfo(); + llvm::MDNode *getTBAAStructInfo(QualType QTy); - /// Get path-aware TBAA tag for a given memory access. - llvm::MDNode *getTBAAStructTagInfo(TBAAAccessInfo Info); + /// getTBAABaseTypeMetadata - Get metadata that describes the given base + /// access type. Return null if the type is not suitable for use in TBAA + /// access tags. + llvm::MDNode *getTBAABaseTypeInfo(QualType QTy); + + /// getTBAAAccessTagInfo - Get TBAA tag for a given memory access. + llvm::MDNode *getTBAAAccessTagInfo(TBAAAccessInfo Info); - /// getTBAAMayAliasTypeInfo - Get TBAA information that represents + /// getTBAAMayAliasAccessInfo - Get TBAA information that represents /// may-alias accesses. - llvm::MDNode *getTBAAMayAliasTypeInfo(); + TBAAAccessInfo getTBAAMayAliasAccessInfo(); bool isTypeConstant(QualType QTy, bool ExcludeCtorDtor); bool isPaddedAtomicType(QualType type); bool isPaddedAtomicType(const AtomicType *type); - /// Decorate the instruction with a TBAA tag. For scalar TBAA, the tag - /// is the same as the type. For struct-path aware TBAA, the tag - /// is different from the type: base type, access type and offset. - /// When ConvertTypeToTag is true, we create a tag based on the scalar type. + /// DecorateInstructionWithTBAA - Decorate the instruction with a TBAA tag. void DecorateInstructionWithTBAA(llvm::Instruction *Inst, - llvm::MDNode *TBAAInfo, - bool ConvertTypeToTag = true); + TBAAAccessInfo TBAAInfo); /// Adds !invariant.barrier !tag to instruction void DecorateInstructionWithInvariantGroup(llvm::Instruction *I, |