aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorManman Ren <mren@apple.com>2013-04-11 22:51:30 +0000
committerManman Ren <mren@apple.com>2013-04-11 22:51:30 +0000
commit327f0100d1c1aa738d13b45d70eab08d0d2030fb (patch)
tree492a7af42e0ab12cec6f9f0932dbf39a25efb0b9
parentf16b08de8a57b921ef10f96d5e233027530db448 (diff)
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
-rw-r--r--include/llvm/IR/MDBuilder.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/include/llvm/IR/MDBuilder.h b/include/llvm/IR/MDBuilder.h
index a1e3fb1966..074db78a76 100644
--- a/include/llvm/IR/MDBuilder.h
+++ b/include/llvm/IR/MDBuilder.h
@@ -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,