[llvm-branch-commits] [llvm-branch] r164505 - /llvm/branches/R600/include/llvm/MDBuilder.h
Tom Stellard
thomas.stellard at amd.com
Mon Sep 24 08:53:25 PDT 2012
Author: tstellar
Date: Mon Sep 24 10:51:47 2012
New Revision: 164505
URL: http://llvm.org/viewvc/llvm-project?rev=164505&view=rev
Log:
Add an MDBuilder utility for creating !tbaa.struct nodes.
Modified:
llvm/branches/R600/include/llvm/MDBuilder.h
Modified: llvm/branches/R600/include/llvm/MDBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/R600/include/llvm/MDBuilder.h?rev=164505&r1=164504&r2=164505&view=diff
==============================================================================
--- llvm/branches/R600/include/llvm/MDBuilder.h (original)
+++ llvm/branches/R600/include/llvm/MDBuilder.h Mon Sep 24 10:51:47 2012
@@ -134,6 +134,27 @@
}
}
+ struct TBAAStructField {
+ uint64_t Offset;
+ uint64_t Size;
+ MDNode *TBAA;
+ TBAAStructField(uint64_t Offset, uint64_t Size, MDNode *TBAA) :
+ Offset(Offset), Size(Size), TBAA(TBAA) {}
+ };
+
+ /// \brief Return metadata for a tbaa.struct node with the given
+ /// struct field descriptions.
+ MDNode *createTBAAStructNode(ArrayRef<TBAAStructField> Fields) {
+ SmallVector<Value *, 4> Vals(Fields.size() * 3);
+ Type *Int64 = IntegerType::get(Context, 64);
+ for (unsigned i = 0, e = Fields.size(); i != e; ++i) {
+ Vals[i * 3 + 0] = ConstantInt::get(Int64, Fields[i].Offset);
+ Vals[i * 3 + 1] = ConstantInt::get(Int64, Fields[i].Size);
+ Vals[i * 3 + 2] = Fields[i].TBAA;
+ }
+ return MDNode::get(Context, Vals);
+ }
+
};
} // end namespace llvm
More information about the llvm-branch-commits
mailing list