Add isConstant argument to MDBuilder::createTBAAStructTagNode

According to the TBAA description struct-path tag node can have an optional IsConstant field. Add corresponding argument to MDBuilder::createTBAAStructTagNode.

Reviewed By: hfinkel

Differential Revision: http://reviews.llvm.org/D10160


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238749 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Artur Pilipenko 2015-06-01 14:53:55 +00:00
parent 8a6a249f6b
commit d997435840
2 changed files with 12 additions and 5 deletions

View File

@ -153,7 +153,7 @@ public:
/// \brief Return metadata for a TBAA tag node with the given
/// base type, access type and offset relative to the base type.
MDNode *createTBAAStructTagNode(MDNode *BaseType, MDNode *AccessType,
uint64_t Offset);
uint64_t Offset, bool IsConstant = false);
};
} // end namespace llvm

View File

@ -168,9 +168,16 @@ MDNode *MDBuilder::createTBAAScalarTypeNode(StringRef Name, MDNode *Parent,
/// \brief Return metadata for a TBAA tag node with the given
/// base type, access type and offset relative to the base type.
MDNode *MDBuilder::createTBAAStructTagNode(MDNode *BaseType, MDNode *AccessType,
uint64_t Offset) {
uint64_t Offset, bool IsConstant) {
Type *Int64 = Type::getInt64Ty(Context);
Metadata *Ops[3] = {BaseType, AccessType,
createConstant(ConstantInt::get(Int64, Offset))};
return MDNode::get(Context, Ops);
if (IsConstant) {
Metadata *Ops[4] = {BaseType, AccessType,
createConstant(ConstantInt::get(Int64, Offset)),
createConstant(ConstantInt::get(Int64, 1))};
return MDNode::get(Context, Ops);
} else {
Metadata *Ops[3] = {BaseType, AccessType,
createConstant(ConstantInt::get(Int64, Offset))};
return MDNode::get(Context, Ops);
}
}