[llvm] r179331 - TBAA: add utility to create a TBAA scalar type node

Manman Ren mren at apple.com
Thu Apr 11 15:51:31 PDT 2013


Author: mren
Date: Thu Apr 11 17:51:30 2013
New Revision: 179331

URL: http://llvm.org/viewvc/llvm-project?rev=179331&view=rev
Log:
TBAA: add utility to create a TBAA scalar type node

Modified:
    llvm/trunk/include/llvm/IR/MDBuilder.h

Modified: llvm/trunk/include/llvm/IR/MDBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/IR/MDBuilder.h?rev=179331&r1=179330&r2=179331&view=diff
==============================================================================
--- llvm/trunk/include/llvm/IR/MDBuilder.h (original)
+++ llvm/trunk/include/llvm/IR/MDBuilder.h Thu Apr 11 17:51:30 2013
@@ -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,





More information about the llvm-commits mailing list