|
LLVM 24.0.0git
|
#include "llvm/IR/Attributes.h"#include "AttributeImpl.h"#include "LLVMContextImpl.h"#include "llvm/ADT/ArrayRef.h"#include "llvm/ADT/FoldingSet.h"#include "llvm/ADT/STLExtras.h"#include "llvm/ADT/SmallVector.h"#include "llvm/ADT/StringExtras.h"#include "llvm/ADT/StringRef.h"#include "llvm/ADT/StringSwitch.h"#include "llvm/Config/llvm-config.h"#include "llvm/IR/AttributeMask.h"#include "llvm/IR/ConstantRange.h"#include "llvm/IR/ConstantRangeList.h"#include "llvm/IR/Function.h"#include "llvm/IR/LLVMContext.h"#include "llvm/IR/Operator.h"#include "llvm/IR/Type.h"#include "llvm/Support/Compiler.h"#include "llvm/Support/ErrorHandling.h"#include "llvm/Support/ModRef.h"#include "llvm/Support/raw_ostream.h"#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) |
| #define | GET_ATTR_NAMES |
| #define | ATTRIBUTE_ENUM(ENUM_NAME, DISPLAY_NAME) |
| #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 |
Enumerations | |
| enum | AttributeProperty { FnAttr = (1 << 0) , ParamAttr = (1 << 1) , RetAttr = (1 << 2) , IntersectPreserve = (0 << 3) , IntersectAnd = (1 << 3) , IntersectMin = (2 << 3) , IntersectCustom = (3 << 3) , IntersectPropertyMask = (3 << 3) , ABIAttr = (1 << 5) } |
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 bool | isSortedAndUnique (ArrayRef< Attribute > Attrs) |
Return true if Attrs is known sorted with no duplicate entries. | |
| static unsigned | attrIdxToArrayIdx (unsigned Index) |
| Map from AttributeList index to the internal array index. | |
| template<typename K> | |
| static void | addAttributeImpl (SmallVectorImpl< Attribute > &Attrs, K Kind, Attribute Attr) |
| static void | mergeSortedAttrs (ArrayRef< Attribute > A, ArrayRef< Attribute > B, SmallVectorImpl< Attribute > &Merged) |
Merge B into A, both sorted by kind, into Merged. | |
| 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<typename AttrClass> | |
| static bool | isEqual (const Function &Caller, const Function &Callee) |
| static bool | isEqual (const Function &Caller, const Function &Callee, const StringRef &AttrName) |
| template<typename AttrClass> | |
| static void | setAND (Function &Caller, const Function &Callee) |
| Compute the logical AND of the attributes of the caller and the callee. | |
| template<typename AttrClass> | |
| 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. | |
Variables | |
| static const unsigned | AllocSizeNumElemsNotPresent = -1 |
| #define ATTRIBUTE_ENUM | ( | ENUM_NAME, | |
| DISPLAY_NAME ) |
Definition at line 2801 of file Attributes.cpp.
| #define ATTRIBUTE_ENUM | ( | ENUM_NAME, | |
| DISPLAY_NAME ) |
Definition at line 2801 of file Attributes.cpp.
| #define ATTRIBUTE_ENUM | ( | ENUM_NAME, | |
| DISPLAY_NAME ) |
Definition at line 2801 of file Attributes.cpp.
| #define ATTRIBUTE_STRBOOL | ( | ENUM_NAME, | |
| DISPLAY_NAME ) |
Definition at line 2807 of file Attributes.cpp.
| #define GET_ATTR_COMPAT_FUNC |
Definition at line 2813 of file Attributes.cpp.
| #define GET_ATTR_NAMES |
Definition at line 2800 of file Attributes.cpp.
| #define GET_ATTR_NAMES |
Definition at line 2800 of file Attributes.cpp.
| #define GET_ATTR_NAMES |
Definition at line 2800 of file Attributes.cpp.
| #define GET_ATTR_PROP_TABLE |
Definition at line 809 of file Attributes.cpp.
| enum AttributeProperty |
| Enumerator | |
|---|---|
| FnAttr | |
| ParamAttr | |
| RetAttr | |
| IntersectPreserve | |
| IntersectAnd | |
| IntersectMin | |
| IntersectCustom | |
| IntersectPropertyMask | |
| ABIAttr | |
Definition at line 797 of file Attributes.cpp.
|
static |
Definition at line 2165 of file Attributes.cpp.
References llvm::lower_bound(), and std::swap().
If the inlined function had a higher stack protection level than the calling function, then bump up the caller's stack protection level.
Definition at line 2676 of file Attributes.cpp.
References llvm::AttributeMask::addAttribute().
If the inlined function required stack probes, then ensure that the calling function has those too.
Definition at line 2706 of file Attributes.cpp.
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.
Definition at line 2717 of file Attributes.cpp.
References llvm::StringRef::getAsInteger(), llvm::Attribute::getValueAsString(), llvm::Attribute::isValid(), and uint64_t.
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 2745 of file Attributes.cpp.
References llvm::StringRef::getAsInteger(), llvm::Attribute::getValueAsString(), llvm::Attribute::isValid(), and uint64_t.
If the inlined function has null_pointer_is_valid attribute, set this attribute in the caller post inlining.
Definition at line 2766 of file Attributes.cpp.
Map from AttributeList index to the internal array index.
Adding one happens to work, because -1 wraps around to 0.
Definition at line 1515 of file Attributes.cpp.
Referenced by llvm::AttributeListImpl::AttributeListImpl().
Definition at line 2615 of file Attributes.cpp.
References llvm::DenormalFPEnv::DefaultMode, denormModeCompatible(), llvm::DenormalFPEnv::F32Mode, and llvm::DenormalMode::getInvalid().
Definition at line 2632 of file Attributes.cpp.
Referenced by llvm::isStrictFPInlineCompatible().
|
static |
Callees with dynamic denormal modes are compatible with any caller mode.
Definition at line 2598 of file Attributes.cpp.
References llvm::DenormalMode::Dynamic, llvm::DenormalMode::getDynamic(), llvm::DenormalMode::Input, and llvm::DenormalMode::Output.
Referenced by checkDenormMode().
|
static |
Definition at line 812 of file Attributes.cpp.
References assert().
Referenced by hasAttributeProperty(), and hasIntersectProperty().
|
static |
Definition at line 517 of file Attributes.cpp.
References llvm_unreachable, llvm::Mod, llvm::ModRef, llvm::NoModRef, and llvm::Ref.
Referenced by llvm::Attribute::getAsString().
|
static |
Definition at line 818 of file Attributes.cpp.
References getAttributeProperties().
Referenced by llvm::Attribute::canUseAsFnAttr(), llvm::Attribute::canUseAsParamAttr(), llvm::Attribute::canUseAsRetAttr(), and llvm::Attribute::isABIAttr().
|
static |
Definition at line 839 of file Attributes.cpp.
References assert(), getAttributeProperties(), IntersectAnd, IntersectCustom, IntersectMin, IntersectPreserve, and IntersectPropertyMask.
Referenced by llvm::Attribute::intersectMustPreserve(), llvm::Attribute::intersectWithAnd(), llvm::Attribute::intersectWithCustom(), and llvm::Attribute::intersectWithMin().
|
static |
Definition at line 2640 of file Attributes.cpp.
Referenced by EliminateDuplicatePHINodesSetBasedImpl(), hasHazard(), and markAliveBlocks().
|
static |
Definition at line 2645 of file Attributes.cpp.
Return true if Attrs is known sorted with no duplicate entries.
Definition at line 1348 of file Attributes.cpp.
References llvm::adjacent_find().
Referenced by llvm::AttributeSet::addSortedAttributes(), and llvm::AttributeSetNode::getSorted().
|
static |
Merge B into A, both sorted by kind, into Merged.
An attribute in B replaces the attribute of the same kind in A.
Definition at line 2411 of file Attributes.cpp.
References A(), llvm::SmallVectorImpl< T >::append(), B(), E(), I, llvm::Less, llvm::SmallVectorTemplateBase< T, bool >::push_back(), and llvm::SmallVectorImpl< T >::reserve().
Referenced by llvm::AttributeSet::addSortedAttributes().
|
static |
Definition at line 61 of file Attributes.cpp.
References AllocSizeNumElemsNotPresent, assert(), and uint64_t.
Referenced by llvm::Attribute::getWithAllocSizeArgs().
Definition at line 81 of file Attributes.cpp.
References uint64_t.
Referenced by llvm::Attribute::getWithVScaleRangeArgs().
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 2656 of file Attributes.cpp.
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 2668 of file Attributes.cpp.
Definition at line 71 of file Attributes.cpp.
References AllocSizeNumElemsNotPresent, and uint64_t.
Referenced by llvm::Attribute::getAllocSizeArgs().
Definition at line 87 of file Attributes.cpp.
References uint64_t.
Referenced by llvm::Attribute::getVScaleRangeMax(), and llvm::Attribute::getVScaleRangeMin().
Definition at line 59 of file Attributes.cpp.
Referenced by packAllocSizeArgs(), and unpackAllocSizeArgs().