summaryrefslogtreecommitdiff
path: root/include/llvm/IR/Attributes.h
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2013-02-05 22:37:24 +0000
committerBill Wendling <isanbard@gmail.com>2013-02-05 22:37:24 +0000
commit8c74ecfbddabe89e150abff4fdff0a27108874b9 (patch)
tree7365c1c933ddb77cd29d0a5422fb7ce5dd39fb4e /include/llvm/IR/Attributes.h
parent2a1b60d791522d73be91d4281c90d25bd5e3d117 (diff)
downloadllvm-8c74ecfbddabe89e150abff4fdff0a27108874b9.tar.gz
llvm-8c74ecfbddabe89e150abff4fdff0a27108874b9.tar.bz2
llvm-8c74ecfbddabe89e150abff4fdff0a27108874b9.tar.xz
Convert to storing the attribute's internals as enums, integers, and strings.
The stuff we're handing are all enums (Attribute::AttrKind), integers and strings. Don't convert them to Constants, which is an unnecessary step here. The rest of the changes are mostly mechanical. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174456 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/IR/Attributes.h')
-rw-r--r--include/llvm/IR/Attributes.h40
1 files changed, 28 insertions, 12 deletions
diff --git a/include/llvm/IR/Attributes.h b/include/llvm/IR/Attributes.h
index 61202eebef..46d279c157 100644
--- a/include/llvm/IR/Attributes.h
+++ b/include/llvm/IR/Attributes.h
@@ -114,8 +114,9 @@ public:
//===--------------------------------------------------------------------===//
/// \brief Return a uniquified Attribute object.
- static Attribute get(LLVMContext &Context, AttrKind Kind, Constant *Val = 0);
- static Attribute get(LLVMContext &Context, Constant *Kind, Constant *Val = 0);
+ static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val = 0);
+ static Attribute get(LLVMContext &Context, StringRef Kind,
+ StringRef Val = StringRef());
/// \brief Return a uniquified Attribute object that has the specific
/// alignment set.
@@ -126,16 +127,34 @@ public:
// Attribute Accessors
//===--------------------------------------------------------------------===//
+ /// \brief Return true if the attribute is an Attribute::AttrKind type.
+ bool isEnumAttribute() const;
+
+ /// \brief Return true if the attribute is an alignment attribute.
+ bool isAlignAttribute() const;
+
+ /// \brief Return true if the attribute is a string (target-dependent)
+ /// attribute.
+ bool isStringAttribute() const;
+
/// \brief Return true if the attribute is present.
bool hasAttribute(AttrKind Val) const;
- /// \brief Return the kind of this attribute: enum or string.
- Constant *getAttributeKind() const;
+ /// \brief Return the attribute's kind as an enum (Attribute::AttrKind). This
+ /// requires the attribute to be an enum or alignment attribute.
+ Attribute::AttrKind getKindAsEnum() const;
- /// \brief Return the values (if present) of the attribute. This may be a
- /// ConstantVector to represent a list of values associated with the
- /// attribute.
- Constant *getAttributeValues() const;
+ /// \brief Return the attribute's value as an integer. This requires that the
+ /// attribute be an alignment attribute.
+ uint64_t getValueAsInt() const;
+
+ /// \brief Return the attribute's kind as a string. This requires the
+ /// attribute to be a string attribute.
+ StringRef getKindAsString() const;
+
+ /// \brief Return the attribute's value as a string. This requires the
+ /// attribute to be a string attribute.
+ StringRef getValueAsString() const;
/// \brief Returns the alignment field of an attribute as a byte alignment
/// value.
@@ -149,10 +168,7 @@ public:
/// 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;
-
+ /// \brief Equality and non-equality operators.
bool operator==(Attribute A) const { return pImpl == A.pImpl; }
bool operator!=(Attribute A) const { return pImpl != A.pImpl; }