X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=include%2Fllvm%2FIR%2FMDBuilder.h;h=ce81b5498f5295377beb80998e97d34d8cbe86b6;hb=b0dcfa5c1f78305b125f4b710f467c16c9948354;hp=a1e3fb1966ed3dc4de2846812697f7cb3cd2a22f;hpb=082bb7cf57e3a7089b8302a7d676fddf0bce276e;p=oota-llvm.git diff --git a/include/llvm/IR/MDBuilder.h b/include/llvm/IR/MDBuilder.h index a1e3fb1966e..ce81b5498f5 100644 --- a/include/llvm/IR/MDBuilder.h +++ b/include/llvm/IR/MDBuilder.h @@ -157,19 +157,31 @@ 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) { + ArrayRef > Fields) { SmallVector Ops(Fields.size() * 2 + 1); Type *Int64 = IntegerType::get(Context, 64); Ops[0] = createString(Name); for (unsigned i = 0, e = Fields.size(); i != e; ++i) { - Ops[i * 2 + 1] = ConstantInt::get(Int64, Fields[i].first); - Ops[i * 2 + 2] = Fields[i].second; + Ops[i * 2 + 1] = Fields[i].first; + Ops[i * 2 + 2] = ConstantInt::get(Int64, Fields[i].second); } 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, MDNode *Parent, + uint64_t Offset = 0) { + SmallVector Ops(3); + Type *Int64 = IntegerType::get(Context, 64); + Ops[0] = createString(Name); + Ops[1] = Parent; + Ops[2] = ConstantInt::get(Int64, Offset); + 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,