summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/AttributeImpl.h
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-01-24 00:06:56 +0000
committerBill Wendling <isanbard@gmail.com>2013-01-24 00:06:56 +0000
commitd2e493bb6596619d47476820a0864e933a7c53b0 (patch)
tree6404723ae7255a5672b6b05f1de35b6d6e9127ce /llvm/lib/IR/AttributeImpl.h
parentbe8229c8c0d3711942be72d38a2f59d0ee985520 (diff)
downloadbcm5719-llvm-d2e493bb6596619d47476820a0864e933a7c53b0.tar.gz
bcm5719-llvm-d2e493bb6596619d47476820a0864e933a7c53b0.zip
Create a new class: AttributeSetNode.
This is a helper class for the AttributeSetImpl class. It holds a set of attributes that apply to a single element: function, return type, or parameter. These are uniqued. llvm-svn: 173310
Diffstat (limited to 'llvm/lib/IR/AttributeImpl.h')
-rw-r--r--llvm/lib/IR/AttributeImpl.h35
1 files changed, 34 insertions, 1 deletions
diff --git a/llvm/lib/IR/AttributeImpl.h b/llvm/lib/IR/AttributeImpl.h
index 0843fd8ac88..b02cc8bdefe 100644
--- a/llvm/lib/IR/AttributeImpl.h
+++ b/llvm/lib/IR/AttributeImpl.h
@@ -56,6 +56,8 @@ public:
bool operator==(StringRef Kind) const;
bool operator!=(StringRef Kind) const;
+ bool operator<(const AttributeImpl &AI) const;
+
uint64_t Raw() const; // FIXME: Remove.
static uint64_t getAttrMask(Attribute::AttrKind Val);
@@ -69,7 +71,38 @@ public:
//===----------------------------------------------------------------------===//
/// \class
-/// \brief This class represents a set of attributes.
+/// \brief This class represents a group of attributes that apply to one
+/// element: function, return type, or parameter.
+class AttributeSetNode : public FoldingSetNode {
+ SmallVector<Attribute, 4> AttrList;
+
+ AttributeSetNode(ArrayRef<Attribute> Attrs)
+ : AttrList(Attrs.begin(), Attrs.end()) {}
+public:
+ static AttributeSetNode *get(LLVMContext &C, ArrayRef<Attribute> Attrs);
+
+ typedef SmallVectorImpl<Attribute>::iterator iterator;
+ typedef SmallVectorImpl<Attribute>::const_iterator const_iterator;
+
+ iterator begin() { return AttrList.begin(); }
+ iterator end() { return AttrList.end(); }
+
+ const_iterator begin() const { return AttrList.begin(); }
+ const_iterator end() const { return AttrList.end(); }
+
+ void Profile(FoldingSetNodeID &ID) const {
+ Profile(ID, AttrList);
+ }
+ static void Profile(FoldingSetNodeID &ID, ArrayRef<Attribute> AttrList) {
+ for (unsigned I = 0, E = AttrList.size(); I != E; ++I)
+ AttrList[I].Profile(ID);
+ }
+};
+
+//===----------------------------------------------------------------------===//
+/// \class
+/// \brief This class represents a set of attributes that apply to the function,
+/// return type, and parameters.
class AttributeSetImpl : public FoldingSetNode {
LLVMContext &Context;
SmallVector<AttributeWithIndex, 4> AttrList;
OpenPOWER on IntegriCloud