1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00

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

llvm-svn: 238749
This commit is contained in:
Artur Pilipenko 2015-06-01 14:53:55 +00:00
parent 027bd2baa3
commit 59c2e43924
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);
}
}