summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/AttributeImpl.h
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-01-24 01:01:34 +0000
committerBill Wendling <isanbard@gmail.com>2013-01-24 01:01:34 +0000
commit39a4c8057016c24d405b2f47d0f29364fa72e2dc (patch)
treedc19c312502e88b93c4ebaf58c53fb3da6e939f1 /llvm/lib/IR/AttributeImpl.h
parent164a4fbb5b99aadf060d9c96d74e5d60d369ee04 (diff)
downloadbcm5719-llvm-39a4c8057016c24d405b2f47d0f29364fa72e2dc.tar.gz
bcm5719-llvm-39a4c8057016c24d405b2f47d0f29364fa72e2dc.zip
Add a profile for uniquifying the AttributeSet with the AttributeSetNodes.
llvm-svn: 173313
Diffstat (limited to 'llvm/lib/IR/AttributeImpl.h')
-rw-r--r--llvm/lib/IR/AttributeImpl.h15
1 files changed, 14 insertions, 1 deletions
diff --git a/llvm/lib/IR/AttributeImpl.h b/llvm/lib/IR/AttributeImpl.h
index b02cc8bdefe..b35e5e0f0b3 100644
--- a/llvm/lib/IR/AttributeImpl.h
+++ b/llvm/lib/IR/AttributeImpl.h
@@ -107,12 +107,17 @@ class AttributeSetImpl : public FoldingSetNode {
LLVMContext &Context;
SmallVector<AttributeWithIndex, 4> AttrList;
+ SmallVector<std::pair<uint64_t, AttributeSetNode*>, 4> AttrNodes;
+
// AttributesSet is uniqued, these should not be publicly available.
void operator=(const AttributeSetImpl &) LLVM_DELETED_FUNCTION;
AttributeSetImpl(const AttributeSetImpl &) LLVM_DELETED_FUNCTION;
public:
AttributeSetImpl(LLVMContext &C, ArrayRef<AttributeWithIndex> attrs)
: Context(C), AttrList(attrs.begin(), attrs.end()) {}
+ AttributeSetImpl(LLVMContext &C,
+ ArrayRef<std::pair<uint64_t, AttributeSetNode*> > attrs)
+ : Context(C), AttrNodes(attrs.begin(), attrs.end()) {}
LLVMContext &getContext() { return Context; }
ArrayRef<AttributeWithIndex> getAttributes() const { return AttrList; }
@@ -122,12 +127,20 @@ public:
Profile(ID, AttrList);
}
static void Profile(FoldingSetNodeID &ID,
- ArrayRef<AttributeWithIndex> AttrList){
+ ArrayRef<AttributeWithIndex> AttrList) {
for (unsigned i = 0, e = AttrList.size(); i != e; ++i) {
ID.AddInteger(AttrList[i].Index);
ID.AddInteger(AttrList[i].Attrs.Raw());
}
}
+
+ static void Profile(FoldingSetNodeID &ID,
+ ArrayRef<std::pair<uint64_t, AttributeSetNode*> > Nodes) {
+ for (unsigned i = 0, e = Nodes.size(); i != e; ++i) {
+ ID.AddInteger(Nodes[i].first);
+ ID.AddPointer(Nodes[i].second);
+ }
+ }
};
} // end llvm namespace
OpenPOWER on IntegriCloud