16 #ifndef LLVM_IR_ATTRIBUTES_H
17 #define LLVM_IR_ATTRIBUTES_H
32 class AttributeSetImpl;
33 class AttributeSetNode;
35 template<
typename T>
struct DenseMapInfo;
201 std::string
getAsString(
bool InAttrGrp =
false)
const;
305 uint64_t Bytes)
const;
311 uint64_t Bytes)
const;
362 std::string
getAsString(
unsigned Index,
bool InAttrGrp =
false)
const;
371 return pImpl == RHS.pImpl;
374 return pImpl != RHS.pImpl;
382 uint64_t
Raw(
unsigned Index)
const;
413 uintptr_t Val =
static_cast<uintptr_t
>(-1);
414 Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable;
415 return AttributeSet(reinterpret_cast<AttributeSetImpl*>(Val));
418 uintptr_t Val =
static_cast<uintptr_t
>(-2);
419 Val <<= PointerLikeTypeTraits<void*>::NumLowBitsAvailable;
420 return AttributeSet(reinterpret_cast<AttributeSetImpl*>(Val));
423 return (
unsigned((uintptr_t)AS.pImpl) >> 4) ^
424 (
unsigned((uintptr_t)AS.pImpl) >> 9);
436 std::bitset<Attribute::EndAttrKinds> Attrs;
437 std::map<std::string, std::string> TargetDepAttrs;
439 uint64_t StackAlignment;
441 uint64_t DerefOrNullBytes;
444 : Attrs(0), Alignment(0), StackAlignment(0), DerefBytes(0),
445 DerefOrNullBytes(0) {}
447 : Attrs(0), Alignment(0), StackAlignment(0), DerefBytes(0),
448 DerefOrNullBytes(0) {
452 : Attrs(0), Alignment(0), StackAlignment(0), DerefBytes(0),
453 DerefOrNullBytes(0) {
540 bool empty()
const {
return Attrs.none(); }
543 typedef std::pair<std::string, std::string>
td_type;
560 bool td_empty()
const {
return TargetDepAttrs.empty(); }
564 return !(*
this == B);
573 namespace AttributeFuncs {
void AddPointer(const void *Ptr)
Add* - Add various data types to Bit data.
void * getRawPointer() const
Return a raw pointer that uniquely identifies this attribute list.
static AttributeSet getEmptyKey()
Alignment of stack for function (3 bits) stored as log2 of alignment with +1 bias 0 means unaligned (...
AttributeSet getParamAttributes(unsigned Index) const
The attributes for the specified index are returned.
unsigned getStackAlignment(unsigned Index) const
Get the stack alignment.
Sign extended before/after call.
std::string getAsString(unsigned Index, bool InAttrGrp=false) const
Return the attributes at the index as a string.
static Attribute getWithAlignment(LLVMContext &Context, uint64_t Align)
Return a uniquified Attribute object that has the specific alignment set.
Force argument to be passed in register.
Function is called early and/or often, so lazy binding isn't worthwhile.
static Attribute getWithDereferenceableBytes(LLVMContext &Context, uint64_t Bytes)
Nested function static chain.
static unsigned getHashValue(AttributeSet AS)
uint64_t getAlignment() const
Retrieve the alignment attribute, if it exists.
uint64_t getDereferenceableOrNullBytes() const
Retrieve the number of dereferenceable_or_null bytes, if the dereferenceable_or_null attribute exists...
uint64_t getValueAsInt() const
Return the attribute's value as an integer.
Source said inlining was desirable.
iterator begin(unsigned Slot) const
AttrBuilder & addDereferenceableAttr(uint64_t Bytes)
This turns the number of dereferenceable bytes into the form used internally in Attribute.
unsigned getParamAlignment(unsigned Index) const
Return the alignment for the specified function parameter.
unsigned getAlignment() const
Returns the alignment field of an attribute as a byte alignment value.
AttrBuilder & addAttribute(Attribute::AttrKind Val)
Add an attribute to the builder.
bool hasAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
bool hasAlignmentAttr() const
Return true if the builder has an alignment attribute.
bool contains(Attribute::AttrKind A) const
Return true if the builder has the specified attribute.
bool hasAttribute(AttrKind Val) const
Return true if the attribute is present.
AttrBuilder & addRawValue(uint64_t Val)
Add the raw value to the internal representation.
AttributeSet getRetAttributes() const
The attributes for the ret value are returned.
StringRef getKindAsString() const
Return the attribute's kind as a string.
AttributeSet removeAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Attr) const
Remove the specified attribute at the specified index from this attribute list.
uint64_t getDereferenceableBytes(unsigned Index) const
Get the number of dereferenceable bytes (or zero if unknown).
std::string getAsString(bool InAttrGrp=false) const
The Attribute is converted to a string of equivalent mnemonic.
AttrBuilder & addDereferenceableOrNullAttr(uint64_t Bytes)
This turns the number of dereferenceable_or_null bytes into the form used internally in Attribute...
static Attribute getWithDereferenceableOrNullBytes(LLVMContext &Context, uint64_t Bytes)
No attributes have been set.
AttributeSet addDereferenceableAttr(LLVMContext &C, unsigned Index, uint64_t Bytes) const
Add the dereferenceable attribute to the attribute set at the given index.
Function must be in a unwind table.
td_const_range td_attrs() const
Function does not access memory.
Hidden pointer to structure to return.
Function creates no aliases of pointer.
td_const_iterator td_begin() const
std::map< std::string, std::string >::iterator td_iterator
uint64_t getDereferenceableBytes() const
Retrieve the number of dereferenceable bytes, if the dereferenceable attribute exists (zero is return...
static AttributeSet getTombstoneKey()
llvm::iterator_range< td_const_iterator > td_const_range
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
unsigned getStackAlignment() const
Returns the stack alignment field of an attribute as a byte alignment value.
Considered to not alias after call.
static Attribute getWithStackAlignment(LLVMContext &Context, uint64_t Align)
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
std::pair< std::string, std::string > td_type
uint64_t getDereferenceableBytes() const
Returns the number of dereferenceable bytes from the dereferenceable attribute (or zero if unknown)...
unsigned getNumSlots() const
Return the number of slots used in this attribute list.
bool operator==(const AttrBuilder &B)
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
AttributeSet getSlotAttributes(unsigned Slot) const
Return the attributes at the given slot.
bool operator!=(const AttrBuilder &B)
Return value is always equal to this argument.
Pass structure in an alloca.
uint64_t getDereferenceableOrNullBytes(unsigned Index) const
Get the number of dereferenceable_or_null bytes (or zero if unknown).
Zero extended before/after call.
bool overlaps(const AttrBuilder &B) const
Return true if the builder has any attribute that's in the specified builder.
Function doesn't unwind stack.
bool isEnumAttribute() const
Return true if the attribute is an Attribute::AttrKind type.
bool operator==(Attribute A) const
Equality and non-equality operators.
Marks function as being in a cold path.
Sentinal value useful for loops.
Mark the function as not returning.
uint64_t getDereferenceableOrNullBytes() const
Returns the number of dereferenceable_or_null bytes from the dereferenceable_or_null attribute (or ze...
Call cannot be duplicated.
Pointer is known to be not null.
LLVMContext & getContext() const
Retrieve the LLVM context.
AttrBuilder & removeAttribute(Attribute::AttrKind Val)
Remove an attribute from the builder.
Callee is recognized as a builtin, despite nobuiltin attribute on its declaration.
Attribute::AttrKind getKindAsEnum() const
Return the attribute's kind as an enum (Attribute::AttrKind).
iterator end(unsigned Slot) const
void Profile(FoldingSetNodeID &ID) const
bool isIntAttribute() const
Return true if the attribute is an integer attribute.
bool empty() const
Return true if the builder contains no target-independent attributes.
AttrBuilder(const Attribute &A)
llvm::iterator_range< td_iterator > td_range
static cl::opt< AlignMode > Align(cl::desc("Load/store alignment support"), cl::Hidden, cl::init(NoStrictAlign), cl::values(clEnumValN(StrictAlign,"aarch64-strict-align","Disallow all unaligned memory accesses"), clEnumValN(NoStrictAlign,"aarch64-no-strict-align","Allow unaligned memory accesses"), clEnumValEnd))
Alignment of parameter (5 bits) stored as log2 of alignment with +1 bias 0 means unaligned (different...
AttributeSet removeAttributes(LLVMContext &C, unsigned Index, AttributeSet Attrs) const
Remove the specified attributes at the specified index from this attribute list.
A range adaptor for a pair of iterators.
Function must not be optimized.
Function only reads from memory.
std::map< std::string, std::string >::const_iterator td_const_iterator
bool operator<(Attribute A) const
Less-than operator. Useful for sorting the attributes list.
bool operator==(const AttributeSet &RHS) const
operator==/!= - Provide equality predicates.
AttributeSet addAttribute(LLVMContext &C, unsigned Index, Attribute::AttrKind Attr) const
Add an attribute to the attribute set at the given index.
unsigned getSlotIndex(unsigned Slot) const
Return the index for the given slot.
bool hasAttrSomewhere(Attribute::AttrKind Attr) const
Return true if the specified attribute is set for at least one parameter or for the return value...
AttributeSet addDereferenceableOrNullAttr(LLVMContext &C, unsigned Index, uint64_t Bytes) const
Add the dereferenceable_or_null attribute to the attribute set at the given index.
bool hasAttributes(unsigned Index) const
Return true if attribute exists at the given index.
AttrBuilder typeIncompatible(const Type *Ty)
Which attributes cannot be applied to a type.
Callee isn't recognized as a builtin.
AttrBuilder(uint64_t Val)
ArrayRef< Attribute >::iterator iterator
bool isStringAttribute() const
Return true if the attribute is a string (target-dependent) attribute.
AttributeSet getAttributes(LLVMContext &C, ID id)
Return the attributes for an intrinsic.
Funciton can access memory only using pointers based on its arguments.
AttrBuilder & removeAttributes(AttributeSet A, uint64_t Index)
Remove the attributes from the builder.
Attribute getAttribute(unsigned Index, Attribute::AttrKind Kind) const
Return the attribute object that exists at the given index.
AttrBuilder & merge(const AttrBuilder &B)
Add the attributes from the builder.
StringRef getValueAsString() const
Return the attribute's value as a string.
Function can return twice.
const ARM::ArchExtKind Kind
Pointer is known to be dereferenceable.
LLVM Value Representation.
uint64_t Raw(unsigned Index) const
bool hasAttributes() const
Return true if the builder has IR-level attributes.
Disable implicit floating point insts.
AttrBuilder & addStackAlignmentAttr(unsigned Align)
This turns an int stack alignment (which must be a power of 2) into the form used internally in Attri...
StringRef - Represent a constant reference to a string, i.e.
AttrBuilder & addAlignmentAttr(unsigned Align)
This turns an int alignment (which must be a power of 2) into the form used internally in Attribute...
bool operator!=(Attribute A) const
static bool isEqual(AttributeSet LHS, AttributeSet RHS)
AttributeSet addAttributes(LLVMContext &C, unsigned Index, AttributeSet Attrs) const
Add attributes to the attribute set at the given index.
Can only be moved to control-equivalent blocks.
Stack protection required.
td_const_iterator td_end() const
bool isEmpty() const
Return true if there are no attributes.
Build jump-instruction tables and replace refs.
Pointer is either null or dereferenceable.
uint64_t getStackAlignment() const
Retrieve the stack alignment attribute, if it exists.
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results...
AttributeSet getFnAttributes() const
The function attributes are returned.
bool operator!=(const AttributeSet &RHS) const
Function must be optimized for size first.