#include #include #include #include #include #include #include #include #include "llvm/IR/Attributes.inc"">

LLVM: lib/IR/Attributes.cpp File Reference (original) (raw)

#include "[llvm/IR/Attributes.h](Attributes%5F8h%5Fsource.html)"
#include "[AttributeImpl.h](AttributeImpl%5F8h%5Fsource.html)"
#include "[LLVMContextImpl.h](LLVMContextImpl%5F8h%5Fsource.html)"
#include "[llvm/ADT/ArrayRef.h](ArrayRef%5F8h%5Fsource.html)"
#include "[llvm/ADT/FoldingSet.h](FoldingSet%5F8h%5Fsource.html)"
#include "[llvm/ADT/STLExtras.h](STLExtras%5F8h%5Fsource.html)"
#include "[llvm/ADT/SmallVector.h](SmallVector%5F8h%5Fsource.html)"
#include "[llvm/ADT/StringExtras.h](StringExtras%5F8h%5Fsource.html)"
#include "[llvm/ADT/StringRef.h](StringRef%5F8h%5Fsource.html)"
#include "[llvm/ADT/StringSwitch.h](StringSwitch%5F8h%5Fsource.html)"
#include "llvm/Config/llvm-config.h"
#include "[llvm/IR/AttributeMask.h](AttributeMask%5F8h%5Fsource.html)"
#include "[llvm/IR/ConstantRange.h](ConstantRange%5F8h%5Fsource.html)"
#include "[llvm/IR/ConstantRangeList.h](ConstantRangeList%5F8h%5Fsource.html)"
#include "[llvm/IR/Function.h](IR%5F2Function%5F8h%5Fsource.html)"
#include "[llvm/IR/LLVMContext.h](LLVMContext%5F8h%5Fsource.html)"
#include "[llvm/IR/Operator.h](IR%5F2Operator%5F8h%5Fsource.html)"
#include "[llvm/IR/Type.h](IR%5F2Type%5F8h%5Fsource.html)"
#include "[llvm/Support/Compiler.h](Compiler%5F8h%5Fsource.html)"
#include "[llvm/Support/ErrorHandling.h](llvm%5F2Support%5F2ErrorHandling%5F8h%5Fsource.html)"
#include "[llvm/Support/ModRef.h](ModRef%5F8h%5Fsource.html)"
#include "[llvm/Support/raw_ostream.h](raw%5F%5Fostream%5F8h%5Fsource.html)"
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <cstdint>
#include <limits>
#include <optional>
#include <string>
#include <tuple>
#include <utility>
#include "llvm/IR/Attributes.inc"

Go to the source code of this file.

Classes
struct AttributeComparator
Attribute comparator that only compares attribute keys. More...
struct EnumAttr
struct StrBoolAttr
Macros
#define GET_ATTR_NAMES
#define ATTRIBUTE_ENUM(ENUM_NAME, DISPLAY_NAME) .Case(#DISPLAY_NAME, Attribute::ENUM_NAME)
#define GET_ATTR_NAMES
#define ATTRIBUTE_ENUM(ENUM_NAME, DISPLAY_NAME)
#define GET_ATTR_NAMES
#define ATTRIBUTE_ALL(ENUM_NAME, DISPLAY_NAME) .Case(#DISPLAY_NAME, true)
#define GET_ATTR_PROP_TABLE
#define GET_ATTR_NAMES
#define ATTRIBUTE_ENUM(ENUM_NAME, DISPLAY_NAME)
#define ATTRIBUTE_STRBOOL(ENUM_NAME, DISPLAY_NAME)
#define GET_ATTR_COMPAT_FUNC
Functions
static uint64_t packAllocSizeArgs (unsigned ElemSizeArg, const std::optional< unsigned > &NumElemsArg)
static std::pair< unsigned, std::optional< unsigned > > unpackAllocSizeArgs (uint64_t Num)
static uint64_t packVScaleRangeArgs (unsigned MinValue, std::optional< unsigned > MaxValue)
static std::pair< unsigned, std::optional< unsigned > > unpackVScaleRangeArgs (uint64_t Value)
static const char * getModRefStr (ModRefInfo MR)
static unsigned getAttributeProperties (Attribute::AttrKind Kind)
static bool hasAttributeProperty (Attribute::AttrKind Kind, AttributeProperty Prop)
static bool hasIntersectProperty (Attribute::AttrKind Kind, AttributeProperty Prop)
static unsigned attrIdxToArrayIdx (unsigned Index)
Map from AttributeList index to the internal array index.
template
static void addAttributeImpl (SmallVectorImpl< Attribute > &Attrs, K Kind, Attribute Attr)
static bool denormModeCompatible (DenormalMode CallerMode, DenormalMode CalleeMode)
Callees with dynamic denormal modes are compatible with any caller mode.
static bool checkDenormMode (const Function &Caller, const Function &Callee)
static bool checkStrictFP (const Function &Caller, const Function &Callee)
template
static bool isEqual (const Function &Caller, const Function &Callee)
static bool isEqual (const Function &Caller, const Function &Callee, const StringRef &AttrName)
template
static void setAND (Function &Caller, const Function &Callee)
Compute the logical AND of the attributes of the caller and the callee.
template
static void setOR (Function &Caller, const Function &Callee)
Compute the logical OR of the attributes of the caller and the callee.
static void adjustCallerSSPLevel (Function &Caller, const Function &Callee)
If the inlined function had a higher stack protection level than the calling function, then bump up the caller's stack protection level.
static void adjustCallerStackProbes (Function &Caller, const Function &Callee)
If the inlined function required stack probes, then ensure that the calling function has those too.
static void adjustCallerStackProbeSize (Function &Caller, const Function &Callee)
If the inlined function defines the size of guard region on the stack, then ensure that the calling function defines a guard region that is no larger.
static void adjustMinLegalVectorWidth (Function &Caller, const Function &Callee)
If the inlined function defines a min legal vector width, then ensure the calling function has the same or larger min legal vector width.
static void adjustNullPointerValidAttr (Function &Caller, const Function &Callee)
If the inlined function has null_pointer_is_valid attribute, set this attribute in the caller post inlining.

ATTRIBUTE_ALL

| #define ATTRIBUTE_ALL | ( | | ENUM_NAME, | | ---------------------- | ----------------------------------------------------------------------------------------------- | | ----------- | | | DISPLAY_NAME | | | | | ) | .Case(#DISPLAY_NAME, true) | | |

ATTRIBUTE_ENUM [1/3]

| #define ATTRIBUTE_ENUM | ( | | ENUM_NAME, | | ----------------------- | -------------------------------------------- | | ----------- | | | DISPLAY_NAME | | | | | ) | .Case(#DISPLAY_NAME, Attribute::ENUM_NAME) | | |

ATTRIBUTE_ENUM [2/3]

| #define ATTRIBUTE_ENUM | ( | | ENUM_NAME, | | ----------------------- | - | | ----------- | | | DISPLAY_NAME | | | | | ) | | | |

Value:

case Attribute::ENUM_NAME: \

return #DISPLAY_NAME;

Definition at line 2630 of file Attributes.cpp.

ATTRIBUTE_ENUM [3/3]

| #define ATTRIBUTE_ENUM | ( | | ENUM_NAME, | | ----------------------- | - | | ----------- | | | DISPLAY_NAME | | | | | ) | | | |

Value:

struct ENUM_NAME##Attr : EnumAttr { \

return llvm::Attribute::ENUM_NAME; \

} \

};

AttrKind

This enumeration lists the attributes that can be associated with parameters, function results,...

Definition at line 2630 of file Attributes.cpp.

ATTRIBUTE_STRBOOL

| #define ATTRIBUTE_STRBOOL | ( | | ENUM_NAME, | | -------------------------- | - | | ----------- | | | DISPLAY_NAME | | | | | ) | | | |

Value:

static StringRef getKind() { return #DISPLAY_NAME; } \

};

StringRef - Represent a constant reference to a string, i.e.

Definition at line 2636 of file Attributes.cpp.

GET_ATTR_COMPAT_FUNC

#define GET_ATTR_COMPAT_FUNC

GET_ATTR_NAMES [1/4]

GET_ATTR_NAMES [2/4]

GET_ATTR_NAMES [3/4]

GET_ATTR_NAMES [4/4]

GET_ATTR_PROP_TABLE

#define GET_ATTR_PROP_TABLE

AttributeProperty

Enumerator
FnAttr
ParamAttr
RetAttr
IntersectPreserve
IntersectAnd
IntersectMin
IntersectCustom
IntersectPropertyMask

Definition at line 749 of file Attributes.cpp.

addAttributeImpl()

adjustCallerSSPLevel()

adjustCallerStackProbes()

If the inlined function required stack probes, then ensure that the calling function has those too.

Definition at line 2535 of file Attributes.cpp.

adjustCallerStackProbeSize()

adjustMinLegalVectorWidth()

If the inlined function defines a min legal vector width, then ensure the calling function has the same or larger min legal vector width.

If the caller has the attribute, but the callee doesn't, we need to remove the attribute from the caller since we can't make any guarantees about the caller's requirements. This function is called after the inlining decision has been made so we have to merge the attribute this way. Heuristics that would use min-legal-vector-width to determine inline compatibility would need to be handled as part of inline cost analysis.

Definition at line 2574 of file Attributes.cpp.

References llvm::StringRef::getAsInteger(), llvm::Attribute::getValueAsString(), and llvm::Attribute::isValid().

adjustNullPointerValidAttr()

If the inlined function has null_pointer_is_valid attribute, set this attribute in the caller post inlining.

Definition at line 2595 of file Attributes.cpp.

attrIdxToArrayIdx()

checkDenormMode()

checkStrictFP()

denormModeCompatible()

getAttributeProperties()

getModRefStr()

hasAttributeProperty()

hasIntersectProperty()

isEqual() [1/2]

template

isEqual() [2/2]

packAllocSizeArgs()

packVScaleRangeArgs()

setAND()

template

Compute the logical AND of the attributes of the caller and the callee.

This function sets the caller's attribute to false if the callee's attribute is false.

Definition at line 2485 of file Attributes.cpp.

setOR()

template

Compute the logical OR of the attributes of the caller and the callee.

This function sets the caller's attribute to true if the callee's attribute is true.

Definition at line 2497 of file Attributes.cpp.

unpackAllocSizeArgs()

unpackVScaleRangeArgs()

AllocSizeNumElemsNotPresent