From 327f0100d1c1aa738d13b45d70eab08d0d2030fb Mon Sep 17 00:00:00 2001 From: Manman Ren Date: Thu, 11 Apr 2013 22:51:30 +0000 Subject: 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 --- include/llvm/IR/MDBuilder.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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 > Fields) { SmallVector 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 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, -- cgit v1.2.3