///
//===----------------------------------------------------------------------===//
-#ifndef LLVM_ATTRIBUTESIMPL_H
-#define LLVM_ATTRIBUTESIMPL_H
+#ifndef LLVM_LIB_IR_ATTRIBUTEIMPL_H
+#define LLVM_LIB_IR_ATTRIBUTEIMPL_H
#include "llvm/ADT/FoldingSet.h"
#include "llvm/IR/Attributes.h"
/// \class
/// \brief This class represents a single, uniqued attribute. That attribute
/// could be a single enum, a tuple, or a string.
-class LLVM_LIBRARY_VISIBILITY AttributeImpl : public FoldingSetNode {
+class AttributeImpl : public FoldingSetNode {
unsigned char KindID; ///< Holds the AttrEntryKind of the attribute
// AttributesImpl is uniqued, these should not be publicly available.
protected:
enum AttrEntryKind {
EnumAttrEntry,
- AlignAttrEntry,
+ IntAttrEntry,
StringAttrEntry
};
virtual ~AttributeImpl();
bool isEnumAttribute() const { return KindID == EnumAttrEntry; }
- bool isAlignAttribute() const { return KindID == AlignAttrEntry; }
+ bool isIntAttribute() const { return KindID == IntAttrEntry; }
bool isStringAttribute() const { return KindID == StringAttrEntry; }
bool hasAttribute(Attribute::AttrKind A) const;
void Profile(FoldingSetNodeID &ID) const {
if (isEnumAttribute())
Profile(ID, getKindAsEnum(), 0);
- else if (isAlignAttribute())
+ else if (isIntAttribute())
Profile(ID, getKindAsEnum(), getValueAsInt());
else
Profile(ID, getKindAsString(), getValueAsString());
/// represented by Attribute::AttrKind; alignment attribute entries; and string
/// attribute enties, which are for target-dependent attributes.
-class LLVM_LIBRARY_VISIBILITY EnumAttributeImpl : public AttributeImpl {
+class EnumAttributeImpl : public AttributeImpl {
+ virtual void anchor();
Attribute::AttrKind Kind;
protected:
Attribute::AttrKind getEnumKind() const { return Kind; }
};
-class LLVM_LIBRARY_VISIBILITY AlignAttributeImpl : public EnumAttributeImpl {
- unsigned Align;
+class IntAttributeImpl : public EnumAttributeImpl {
+ void anchor() override;
+ uint64_t Val;
public:
- AlignAttributeImpl(Attribute::AttrKind Kind, unsigned Align)
- : EnumAttributeImpl(AlignAttrEntry, Kind), Align(Align) {
+ IntAttributeImpl(Attribute::AttrKind Kind, uint64_t Val)
+ : EnumAttributeImpl(IntAttrEntry, Kind), Val(Val) {
assert(
- (Kind == Attribute::Alignment || Kind == Attribute::StackAlignment) &&
- "Wrong kind for alignment attribute!");
+ (Kind == Attribute::Alignment || Kind == Attribute::StackAlignment ||
+ Kind == Attribute::Dereferenceable) &&
+ "Wrong kind for int attribute!");
}
- unsigned getAlignment() const { return Align; }
+ uint64_t getValue() const { return Val; }
};
-class LLVM_LIBRARY_VISIBILITY StringAttributeImpl : public AttributeImpl {
+class StringAttributeImpl : public AttributeImpl {
+ virtual void anchor();
std::string Kind;
std::string Val;
/// \class
/// \brief This class represents a group of attributes that apply to one
/// element: function, return type, or parameter.
-class LLVM_LIBRARY_VISIBILITY AttributeSetNode : public FoldingSetNode {
+class AttributeSetNode : public FoldingSetNode {
unsigned NumAttrs; ///< Number of attributes in this node.
AttributeSetNode(ArrayRef<Attribute> Attrs) : NumAttrs(Attrs.size()) {
unsigned getAlignment() const;
unsigned getStackAlignment() const;
+ uint64_t getDereferenceableBytes() const;
std::string getAsString(bool InAttrGrp) const;
typedef const Attribute *iterator;
/// \class
/// \brief This class represents a set of attributes that apply to the function,
/// return type, and parameters.
-class LLVM_LIBRARY_VISIBILITY AttributeSetImpl : public FoldingSetNode {
+class AttributeSetImpl : public FoldingSetNode {
friend class AttributeSet;
LLVMContext &Context;