summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-01-29 00:34:06 +0000
committerBill Wendling <isanbard@gmail.com>2013-01-29 00:34:06 +0000
commitc22f4aa886443507f8406d30d118fdeeac6a8c6c (patch)
tree3fb78433e481242bf2d25bb0aa8e80360893795d /include
parentc0b3d4c9c252acec01de719d4e756456d5377e6d (diff)
downloadllvm-c22f4aa886443507f8406d30d118fdeeac6a8c6c.tar.gz
llvm-c22f4aa886443507f8406d30d118fdeeac6a8c6c.tar.bz2
llvm-c22f4aa886443507f8406d30d118fdeeac6a8c6c.tar.xz
Reorder some functions and add comments. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173733 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/IR/Attributes.h101
1 files changed, 54 insertions, 47 deletions
diff --git a/include/llvm/IR/Attributes.h b/include/llvm/IR/Attributes.h
index 15b664cd3f..a95ede1760 100644
--- a/include/llvm/IR/Attributes.h
+++ b/include/llvm/IR/Attributes.h
@@ -107,6 +107,10 @@ private:
public:
Attribute() : pImpl(0) {}
+ //===--------------------------------------------------------------------===//
+ // Attribute Construction
+ //===--------------------------------------------------------------------===//
+
/// \brief Return a uniquified Attribute object.
static Attribute get(LLVMContext &Context, AttrKind Kind);
static Attribute get(LLVMContext &Context, AttrBuilder &B);
@@ -116,6 +120,10 @@ public:
static Attribute getWithAlignment(LLVMContext &Context, uint64_t Align);
static Attribute getWithStackAlignment(LLVMContext &Context, uint64_t Align);
+ //===--------------------------------------------------------------------===//
+ // Attribute Accessors
+ //===--------------------------------------------------------------------===//
+
/// \brief Return true if the attribute is present.
bool hasAttribute(AttrKind Val) const;
@@ -130,6 +138,10 @@ public:
/// alignment value.
unsigned getStackAlignment() const;
+ /// \brief The Attribute is converted to a string of equivalent mnemonic. This
+ /// is, presumably, for writing out the mnemonics for the assembly writer.
+ std::string getAsString() const;
+
/// \brief Equality and non-equality query methods.
bool operator==(AttrKind K) const;
bool operator!=(AttrKind K) const;
@@ -140,38 +152,15 @@ public:
/// \brief Less-than operator. Useful for sorting the attributes list.
bool operator<(Attribute A) const;
- /// \brief The Attribute is converted to a string of equivalent mnemonic. This
- /// is, presumably, for writing out the mnemonics for the assembly writer.
- std::string getAsString() const;
-
void Profile(FoldingSetNodeID &ID) const {
ID.AddPointer(pImpl);
}
+ // FIXME: Remove this.
uint64_t Raw() const;
};
//===----------------------------------------------------------------------===//
-/// \class
-/// \brief Provide DenseMapInfo for Attribute::AttrKinds. This is used by
-/// AttrBuilder.
-template<> struct DenseMapInfo<Attribute::AttrKind> {
- static inline Attribute::AttrKind getEmptyKey() {
- return Attribute::AttrKindEmptyKey;
- }
- static inline Attribute::AttrKind getTombstoneKey() {
- return Attribute::AttrKindTombstoneKey;
- }
- static unsigned getHashValue(const Attribute::AttrKind &Val) {
- return Val * 37U;
- }
- static bool isEqual(const Attribute::AttrKind &LHS,
- const Attribute::AttrKind &RHS) {
- return LHS == RHS;
- }
-};
-
-//===----------------------------------------------------------------------===//
// AttributeSet Smart Pointer
//===----------------------------------------------------------------------===//
@@ -223,7 +212,7 @@ public:
}
//===--------------------------------------------------------------------===//
- // Attribute List Construction and Mutation
+ // AttributeSet Construction and Mutation
//===--------------------------------------------------------------------===//
/// \brief Return an AttributeSet with the specified parameters in it.
@@ -267,7 +256,7 @@ public:
AttributeSet Attrs) const;
//===--------------------------------------------------------------------===//
- // Attribute Set Accessors
+ // AttributeSet Accessors
//===--------------------------------------------------------------------===//
/// \brief The attributes for the specified index are returned.
@@ -285,6 +274,10 @@ public:
/// \brief Return true if attribute exists at the given index.
bool hasAttributes(unsigned Index) const;
+ /// \brief Return true if the specified attribute is set for at least one
+ /// parameter or for the return value.
+ bool hasAttrSomewhere(Attribute::AttrKind Attr) const;
+
/// \brief Return the alignment for the specified function parameter.
unsigned getParamAlignment(unsigned Idx) const;
@@ -294,12 +287,6 @@ public:
/// \brief Return the attributes at the index as a string.
std::string getAsString(unsigned Index) const;
- uint64_t Raw(unsigned Index) const;
-
- /// \brief Return true if the specified attribute is set for at least one
- /// parameter or for the return value.
- bool hasAttrSomewhere(Attribute::AttrKind Attr) const;
-
/// operator==/!= - Provide equality predicates.
bool operator==(const AttributeSet &RHS) const {
return pImpl == RHS.pImpl;
@@ -309,18 +296,17 @@ public:
}
//===--------------------------------------------------------------------===//
- // Attribute List Introspection
+ // AttributeSet Introspection
//===--------------------------------------------------------------------===//
+ // FIXME: Remove this.
+ uint64_t Raw(unsigned Index) const;
+
/// \brief Return a raw pointer that uniquely identifies this attribute list.
void *getRawPointer() const {
return pImpl;
}
- // Attributes are stored as a dense set of slots, where there is one slot for
- // each argument that has an attribute. This allows walking over the dense
- // set instead of walking the sparse list of attributes.
-
/// \brief Return true if there are no attributes.
bool isEmpty() const {
return pImpl == 0;
@@ -342,6 +328,26 @@ public:
//===----------------------------------------------------------------------===//
/// \class
+/// \brief Provide DenseMapInfo for Attribute::AttrKinds. This is used by
+/// AttrBuilder.
+template<> struct DenseMapInfo<Attribute::AttrKind> {
+ static inline Attribute::AttrKind getEmptyKey() {
+ return Attribute::AttrKindEmptyKey;
+ }
+ static inline Attribute::AttrKind getTombstoneKey() {
+ return Attribute::AttrKindTombstoneKey;
+ }
+ static unsigned getHashValue(const Attribute::AttrKind &Val) {
+ return Val * 37U;
+ }
+ static bool isEqual(const Attribute::AttrKind &LHS,
+ const Attribute::AttrKind &RHS) {
+ return LHS == RHS;
+ }
+};
+
+//===----------------------------------------------------------------------===//
+/// \class
/// \brief This class is used in conjunction with the Attribute::get method to
/// create an Attribute object. The object itself is uniquified. The Builder's
/// value, however, is not. So this can be used as a quick way to test for
@@ -407,17 +413,11 @@ public:
typedef DenseSet<Attribute::AttrKind>::iterator iterator;
typedef DenseSet<Attribute::AttrKind>::const_iterator const_iterator;
- iterator begin() { return Attrs.begin(); }
- iterator end() { return Attrs.end(); }
-
+ iterator begin() { return Attrs.begin(); }
+ iterator end() { return Attrs.end(); }
const_iterator begin() const { return Attrs.begin(); }
const_iterator end() const { return Attrs.end(); }
- /// \brief Add the raw value to the internal representation.
- ///
- /// N.B. This should be used ONLY for decoding LLVM bitcode!
- AttrBuilder &addRawValue(uint64_t Val);
-
/// \brief Remove attributes that are used on functions only.
void removeFunctionOnlyAttrs() {
removeAttribute(Attribute::NoReturn)
@@ -443,12 +443,19 @@ public:
.removeAttribute(Attribute::NoDuplicate);
}
- uint64_t Raw() const;
-
bool operator==(const AttrBuilder &B);
bool operator!=(const AttrBuilder &B) {
return !(*this == B);
}
+
+ // FIXME: Remove these.
+
+ /// \brief Add the raw value to the internal representation.
+ ///
+ /// N.B. This should be used ONLY for decoding LLVM bitcode!
+ AttrBuilder &addRawValue(uint64_t Val);
+
+ uint64_t Raw() const;
};
namespace AttributeFuncs {