TBAA: add utility to create a TBAA scalar type node

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@179331 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Manman Ren 2013-04-11 22:51:30 +00:00
parent f16b08de8a
commit 327f0100d1

View File

@ -157,7 +157,7 @@ public:
}
/// \brief Return metadata for a TBAA struct node in the type DAG
/// with the given name, parents in the TBAA DAG.
/// with the given name, a list of pairs (offset, field type in the type DAG).
MDNode *createTBAAStructTypeNode(StringRef Name,
ArrayRef<std::pair<uint64_t, MDNode*> > Fields) {
SmallVector<Value *, 4> Ops(Fields.size() * 2 + 1);
@ -170,6 +170,18 @@ public:
return MDNode::get(Context, Ops);
}
/// \brief Return metadata for a TBAA scalar type node with the
/// given name, an offset and a parent in the TBAA type DAG.
MDNode *createTBAAScalarTypeNode(StringRef Name, uint64_t Offset,
MDNode *Parent) {
SmallVector<Value *, 4> Ops(3);
Type *Int64 = IntegerType::get(Context, 64);
Ops[0] = createString(Name);
Ops[1] = ConstantInt::get(Int64, Offset);
Ops[2] = Parent;
return MDNode::get(Context, Ops);
}
/// \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,