25#include "llvm/Config/llvm-config.h"
62 const std::optional<unsigned> &NumElemsArg) {
64 "Attempting to pack a reserved value");
70static std::pair<unsigned, std::optional<unsigned>>
72 unsigned NumElems = Num & std::numeric_limits<unsigned>::max();
73 unsigned ElemSizeArg = Num >> 32;
75 std::optional<unsigned> NumElemsArg;
77 NumElemsArg = NumElems;
78 return std::make_pair(ElemSizeArg, NumElemsArg);
82 std::optional<unsigned> MaxValue) {
83 return uint64_t(MinValue) << 32 | MaxValue.value_or(0);
86static std::pair<unsigned, std::optional<unsigned>>
88 unsigned MaxValue =
Value & std::numeric_limits<unsigned>::max();
89 unsigned MinValue =
Value >> 32;
91 return std::make_pair(MinValue,
92 MaxValue > 0 ? MaxValue : std::optional<unsigned>());
99 "Not an enum or int attribute");
107 assert(Val == 0 &&
"Value must be zero for enum attributes");
119 pImpl->
AttrsSet.InsertNode(PA, InsertPoint);
130 if (!Val.
empty())
ID.AddString(Val);
142 pImpl->
AttrsSet.InsertNode(PA, InsertPoint);
164 pImpl->
AttrsSet.InsertNode(PA, InsertPoint);
174 "Not a ConstantRange attribute");
190 pImpl->
AttrsSet.InsertNode(PA, InsertPoint);
200 "Not a ConstantRangeList attribute");
204 ID.AddInteger(Val.
size());
205 for (
auto &CR : Val) {
206 CR.getLower().Profile(
ID);
207 CR.getUpper().Profile(
ID);
225 pImpl->
AttrsSet.InsertNode(PA, InsertPoint);
236 return get(Context, Alignment,
A.value());
240 assert(
A <= 0x100 &&
"Alignment too large.");
241 return get(Context, StackAlignment,
A.value());
246 assert(Bytes &&
"Bytes must be non-zero.");
247 return get(Context, Dereferenceable, Bytes);
252 assert(Bytes &&
"Bytes must be non-zero.");
253 return get(Context, DereferenceableOrNull, Bytes);
257 return get(Context, ByVal, Ty);
261 return get(Context, StructRet, Ty);
265 return get(Context, ByRef, Ty);
269 return get(Context, Preallocated, Ty);
273 return get(Context, InAlloca, Ty);
288 return get(Context, NoFPClass, ClassMask);
293 const std::optional<unsigned> &NumElemsArg) {
294 assert(!(ElemSizeArg == 0 && NumElemsArg && *NumElemsArg == 0) &&
295 "Invalid allocsize arguments -- given allocsize(0, 0)");
307#define GET_ATTR_NAMES
308#define ATTRIBUTE_ENUM(ENUM_NAME, DISPLAY_NAME) \
309 .Case(#DISPLAY_NAME, Attribute::ENUM_NAME)
310#include "llvm/IR/Attributes.inc"
316#define GET_ATTR_NAMES
317#define ATTRIBUTE_ENUM(ENUM_NAME, DISPLAY_NAME) \
318 case Attribute::ENUM_NAME: \
319 return #DISPLAY_NAME;
320#include "llvm/IR/Attributes.inc"
330#define GET_ATTR_NAMES
331#define ATTRIBUTE_ALL(ENUM_NAME, DISPLAY_NAME) .Case(#DISPLAY_NAME, true)
332#include "llvm/IR/Attributes.inc"
365 if (!pImpl)
return None;
367 "Invalid attribute type to get the kind as an enum!");
372 if (!pImpl)
return 0;
374 "Expected the attribute to be an integer attribute!");
379 if (!pImpl)
return false;
381 "Expected the attribute to be a string attribute!");
386 if (!pImpl)
return {};
388 "Invalid attribute type to get the kind as a string!");
393 if (!pImpl)
return {};
395 "Invalid attribute type to get the value as a string!");
400 if (!pImpl)
return {};
402 "Invalid attribute type to get the value as a type!");
408 "Invalid attribute type to get the value as a ConstantRange!");
414 "Invalid attribute type to get the value as a ConstantRangeList!");
429 "Trying to get alignment from non-alignment attribute!");
435 "Trying to get alignment from non-alignment attribute!");
441 "Trying to get dereferenceable bytes from "
442 "non-dereferenceable attribute!");
448 "Trying to get dereferenceable bytes from "
449 "non-dereferenceable attribute!");
453std::pair<unsigned, std::optional<unsigned>>
456 "Trying to get allocsize args from non-allocsize attribute");
462 "Trying to get vscale args from non-vscale attribute");
468 "Trying to get vscale args from non-vscale attribute");
474 "Trying to get unwind table kind from non-uwtable attribute");
480 "Trying to get allockind value from non-allockind attribute");
486 "Can only call getMemoryEffects() on memory attribute");
492 "Can only call getNoFPClass() on nofpclass attribute");
498 "Trying to get range args from non-range attribute");
504 "Trying to get initializes attr from non-ConstantRangeList attribute");
523 if (!pImpl)
return {};
548 auto AttrWithBytesToString = [&](
const char *
Name) {
555 return AttrWithBytesToString(
"alignstack");
558 return AttrWithBytesToString(
"dereferenceable");
561 return AttrWithBytesToString(
"dereferenceable_or_null");
565 std::optional<unsigned> NumElems;
569 ?
"allocsize(" +
Twine(ElemSize) +
"," +
Twine(*NumElems) +
")"
570 :
"allocsize(" +
Twine(ElemSize) +
")")
577 return (
"vscale_range(" +
Twine(MinValue) +
"," +
578 Twine(MaxValue.value_or(0)) +
")")
603 return (
"allockind(\"" +
638 OS <<
"inaccessiblemem: ";
651 std::string Result =
"nofpclass";
673 OS <<
"initializes(";
695 if (!AttrVal.empty()) {
697 printEscapedString(AttrVal,
OS);
708 assert(
isValid() &&
"invalid Attribute doesn't refer to any context");
712 return C.pImpl->AttrsSet.FindNodeOrInsertPos(
ID, Unused) == pImpl;
716 if (!pImpl && !
A.pImpl)
722 return pImpl->
cmp(*
A.pImpl,
true);
726 if (!pImpl && !
A.pImpl)
return false;
727 if (!pImpl)
return true;
728 if (!
A.pImpl)
return false;
729 return *pImpl < *
A.pImpl;
733 ID.AddPointer(pImpl);
747#define GET_ATTR_PROP_TABLE
748#include "llvm/IR/Attributes.inc"
751 unsigned Index = Kind - 1;
752 assert(Index < std::size(AttrPropTable) &&
"Invalid attribute kind");
753 return AttrPropTable[Index];
775 assert((Prop == AttributeProperty::IntersectPreserve ||
776 Prop == AttributeProperty::IntersectAnd ||
777 Prop == AttributeProperty::IntersectMin ||
778 Prop == AttributeProperty::IntersectCustom) &&
779 "Unknown intersect property");
781 AttributeProperty::IntersectPropertyMask) == Prop;
845 ->getConstantRangeValue();
851 ->getConstantRangeListValue();
873 "Unclear how to compare range list");
890 return cmp(AI,
false) < 0;
909 B.addAttribute(Kind);
916 B.addAttribute(Kind,
Value);
937 B.removeAttribute(Kind);
945 B.removeAttribute(Kind);
953 if (!
B.overlaps(Attrs))
960std::optional<AttributeSet>
967 auto ItBegin0 =
begin();
969 auto ItBegin1 =
Other.begin();
970 auto ItEnd1 =
Other.end();
972 while (ItBegin0 != ItEnd0 || ItBegin1 != ItEnd1) {
977 if (ItBegin1 == ItEnd1)
979 else if (ItBegin0 == ItEnd0)
982 int Cmp = ItBegin0->cmpKind(*ItBegin1);
991 assert(Attr0.
isValid() &&
"Iteration should always yield a valid attr");
993 auto IntersectEq = [&]() {
1006 return std::nullopt;
1015 return std::nullopt;
1021 "Iterator picked up two different attributes in the same iteration");
1026 "Invalid attr type of intersectAnd");
1034 "Invalid attr type of intersectMin");
1042 case Attribute::Alignment:
1049 case Attribute::Memory:
1053 case Attribute::NoFPClass:
1057 case Attribute::Range: {
1073 return std::nullopt;
1077 if (Kind == Attribute::ByVal &&
1079 Other.getAttribute(Attribute::Alignment))
1080 return std::nullopt;
1083 return get(
C, Intersected);
1107 return SetNode ? SetNode->
getAlignment() : std::nullopt;
1131 return SetNode ? SetNode->
getAttributeType(Attribute::StructRet) :
nullptr;
1135 return SetNode ? SetNode->
getAttributeType(Attribute::Preallocated) :
nullptr;
1143 return SetNode ? SetNode->
getAttributeType(Attribute::ElementType) :
nullptr;
1146std::optional<std::pair<unsigned, std::optional<unsigned>>>
1150 return std::nullopt;
1178 return SetNode ? SetNode->
getAsString(InAttrGrp) :
"";
1186 return C.pImpl->AttrsSetNodes.FindNodeOrInsertPos(
ID, Unused) == SetNode;
1190 return SetNode ? SetNode->
begin() :
nullptr;
1194 return SetNode ? SetNode->
end() :
nullptr;
1197#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
1210 : NumAttrs(Attrs.
size()) {
1212 llvm::copy(Attrs, getTrailingObjects<Attribute>());
1214 for (
const auto &
I : *
this) {
1215 if (
I.isStringAttribute())
1216 StringAttrs.insert({
I.getKindAsString(),
I });
1218 AvailableAttrs.addAttribute(
I.getKindAsEnum());
1226 return getSorted(
C, SortedAttrs);
1231 if (SortedAttrs.
empty())
1239 for (
const auto &Attr : SortedAttrs)
1250 void *Mem = ::operator
new(totalSizeToAlloc<Attribute>(SortedAttrs.size()));
1260 return getSorted(
C,
B.attrs());
1264 return StringAttrs.count(Kind);
1267std::optional<Attribute>
1271 return std::nullopt;
1276 std::lower_bound(
begin(),
end() - StringAttrs.size(), Kind,
1278 return A.getKindAsEnum() < Kind;
1280 assert(
I !=
end() &&
I->hasAttribute(Kind) &&
"Presence check failed?");
1285 if (
auto A = findEnumAttribute(Kind))
1291 return StringAttrs.lookup(Kind);
1295 if (
auto A = findEnumAttribute(Attribute::Alignment))
1296 return A->getAlignment();
1297 return std::nullopt;
1301 if (
auto A = findEnumAttribute(Attribute::StackAlignment))
1302 return A->getStackAlignment();
1303 return std::nullopt;
1307 if (
auto A = findEnumAttribute(Kind))
1308 return A->getValueAsType();
1313 if (
auto A = findEnumAttribute(Attribute::Dereferenceable))
1314 return A->getDereferenceableBytes();
1319 if (
auto A = findEnumAttribute(Attribute::DereferenceableOrNull))
1320 return A->getDereferenceableOrNullBytes();
1324std::optional<std::pair<unsigned, std::optional<unsigned>>>
1326 if (
auto A = findEnumAttribute(Attribute::AllocSize))
1327 return A->getAllocSizeArgs();
1328 return std::nullopt;
1332 if (
auto A = findEnumAttribute(Attribute::VScaleRange))
1333 return A->getVScaleRangeMin();
1338 if (
auto A = findEnumAttribute(Attribute::VScaleRange))
1339 return A->getVScaleRangeMax();
1340 return std::nullopt;
1344 if (
auto A = findEnumAttribute(Attribute::UWTable))
1345 return A->getUWTableKind();
1350 if (
auto A = findEnumAttribute(Attribute::AllocKind))
1351 return A->getAllocKind();
1356 if (
auto A = findEnumAttribute(Attribute::Memory))
1357 return A->getMemoryEffects();
1362 if (
auto A = findEnumAttribute(Attribute::NoFPClass))
1363 return A->getNoFPClass();
1372 Str +=
I->getAsString(InAttrGrp);
1388 : NumAttrSets(Sets.
size()) {
1389 assert(!Sets.
empty() &&
"pointless AttributeListImpl");
1392 llvm::copy(Sets, getTrailingObjects<AttributeSet>());
1397 if (!
I.isStringAttribute())
1400 for (
const auto &Set : Sets)
1401 for (
const auto &
I : Set)
1402 if (!
I.isStringAttribute())
1412 for (
const auto &Set : Sets)
1413 ID.AddPointer(Set.SetNode);
1417 unsigned *Index)
const {
1422 for (
unsigned I = 0, E = NumAttrSets;
I != E; ++
I) {
1423 if (
begin()[
I].hasAttribute(Kind)) {
1434#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
1446 assert(!AttrSets.
empty() &&
"pointless AttributeListImpl");
1454 pImpl->
AttrsLists.FindNodeOrInsertPos(
ID, InsertPoint);
1461 AttributeListImpl::totalSizeToAlloc<AttributeSet>(AttrSets.
size()),
1464 pImpl->
AttrsLists.InsertNode(PA, InsertPoint);
1473 ArrayRef<std::pair<unsigned, Attribute>> Attrs) {
1479 "Misordered Attributes list!");
1481 [](
const std::pair<unsigned, Attribute> &Pair) {
1482 return Pair.second.isValid();
1484 "Pointless attribute!");
1490 E = Attrs.end();
I != E; ) {
1491 unsigned Index =
I->first;
1493 while (
I != E &&
I->first == Index) {
1501 return get(
C, AttrPairVec);
1506 ArrayRef<std::pair<unsigned, AttributeSet>> Attrs) {
1512 "Misordered Attributes list!");
1514 [](
const std::pair<unsigned, AttributeSet> &Pair) {
1515 return !Pair.second.hasAttributes();
1517 "Pointless attribute!");
1519 unsigned MaxIndex = Attrs.back().first;
1523 MaxIndex = Attrs[Attrs.size() - 2].first;
1526 for (
const auto &Pair : Attrs)
1529 return getImpl(
C, AttrVec);
1538 unsigned NumSets = 0;
1539 for (
size_t I = ArgAttrs.
size();
I != 0; --
I) {
1540 if (ArgAttrs[
I - 1].hasAttributes()) {
1570 return getImpl(
C, AttrSets);
1575 if (!Attrs.hasAttributes())
1579 AttrSets[Index] = Attrs;
1580 return getImpl(
C, AttrSets);
1591 for (
const auto K : Kinds)
1593 return get(
C, Attrs);
1599 assert(Kinds.
size() == Values.
size() &&
"Mismatched attribute values.");
1601 auto VI = Values.
begin();
1602 for (
const auto K : Kinds)
1604 return get(
C, Attrs);
1610 for (
const auto &K : Kinds)
1612 return get(
C, Attrs);
1619 if (Attrs.size() == 1)
1622 unsigned MaxSize = 0;
1623 for (
const auto &
List : Attrs)
1624 MaxSize = std::max(MaxSize,
List.getNumAttrSets());
1631 for (
unsigned I = 0;
I < MaxSize; ++
I) {
1633 for (
const auto &
List : Attrs)
1638 return getImpl(
C, NewAttrSets);
1645 if (Attrs.hasAttribute(Kind))
1657 B.addAttribute(Kind,
Value);
1673 if (Index >= AttrSets.
size())
1674 AttrSets.resize(Index + 1);
1675 AttrSets[Index] = Attrs;
1678 while (!AttrSets.
empty() && !AttrSets.
back().hasAttributes())
1679 AttrSets.pop_back();
1680 if (AttrSets.
empty())
1682 return AttributeList::getImpl(
C, AttrSets);
1688 if (!
B.hasAttributes())
1706 if (MaxIndex >= AttrSets.
size())
1707 AttrSets.
resize(MaxIndex + 1);
1709 for (
unsigned ArgNo : ArgNos) {
1716 return getImpl(
C, AttrSets);
1724 if (Attrs == NewAttrs)
1726 return setAttributesAtIndex(
C, Index, NewAttrs);
1734 if (Attrs == NewAttrs)
1736 return setAttributesAtIndex(
C, Index, NewAttrs);
1742 AttributeSet NewAttrs = Attrs.removeAttributes(
C, AttrsToRemove);
1744 if (Attrs == NewAttrs)
1746 return setAttributesAtIndex(
C, Index, NewAttrs);
1751 unsigned WithoutIndex)
const {
1756 return setAttributesAtIndex(
C, WithoutIndex,
AttributeSet());
1762 B.addDereferenceableAttr(Bytes);
1770 B.addDereferenceableAttr(Bytes);
1778 B.addDereferenceableOrNullAttr(Bytes);
1791 const std::optional<unsigned> &NumElemsArg)
const {
1793 B.addAllocSizeAttr(ElemSizeArg, NumElemsArg);
1797std::optional<AttributeList>
1806 for (
unsigned Idx : IndexIt) {
1807 auto IntersectedAS =
1811 return std::nullopt;
1812 if (!IntersectedAS->hasAttributes())
1814 IntersectedAttrs.
push_back(std::make_pair(
Idx, *IntersectedAS));
1851 return pImpl && pImpl->hasFnAttribute(Kind);
1859 unsigned *Index)
const {
1860 return pImpl && pImpl->hasAttrSomewhere(Attr, Index);
1934std::optional<ConstantRange>
1937 if (RangeAttr.isValid())
1939 return std::nullopt;
1970 return pImpl->begin()[Index];
1974 assert(!
isEmpty() &&
"an empty attribute list has no parent context");
1978 return C.pImpl->AttrsLists.FindNodeOrInsertPos(
ID, Unused) == pImpl;
1982 return pImpl ? pImpl->begin() :
nullptr;
1986 return pImpl ? pImpl->end() :
nullptr;
1994 return pImpl ? pImpl->NumAttrSets : 0;
1998 O <<
"AttributeList[\n";
2000 for (
unsigned i :
indexes()) {
2020#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
2063template <
typename K>
2067 if (It != Attrs.end() && It->hasAttribute(Kind))
2070 Attrs.insert(It, Attr);
2094 if (It != Attrs.end() && It->hasAttribute(Val))
2101 if (It != Attrs.end() && It->hasAttribute(
A))
2106std::optional<uint64_t>
2111 return A.getValueAsInt();
2112 return std::nullopt;
2120std::optional<std::pair<unsigned, std::optional<unsigned>>>
2124 return A.getAllocSizeArgs();
2125 return std::nullopt;
2141 assert(*
Align <= 0x100 &&
"Alignment too large.");
2146 if (Bytes == 0)
return *
this;
2155 return addRawIntAttr(Attribute::DereferenceableOrNull, Bytes);
2160 const std::optional<unsigned> &NumElems) {
2166 assert(RawArgs &&
"Invalid allocsize arguments -- given allocsize(0, 0)");
2171 std::optional<unsigned> MaxValue) {
2207 return A.isValid() ?
A.getValueAsType() :
nullptr;
2258 for (
const auto &
I :
B.attrs())
2276 if (It != Attrs.end() && It->hasAttribute(
A))
2283 if (It != Attrs.end() && It->hasAttribute(
A))
2292 return std::nullopt;
2304 return Attrs ==
B.Attrs;
2383 return Incompatible;
2417 DenormalMode CallerModeF32 = Caller.getDenormalModeF32Raw();
2418 DenormalMode CalleeModeF32 = Callee.getDenormalModeF32Raw();
2420 CallerModeF32 = CallerMode;
2422 CalleeModeF32 = CalleeMode;
2432 return !Callee.getAttributes().hasFnAttr(Attribute::StrictFP) ||
2433 Caller.getAttributes().hasFnAttr(Attribute::StrictFP);
2436template<
typename AttrClass>
2438 return Caller.getFnAttribute(AttrClass::getKind()) ==
2439 Callee.getFnAttribute(AttrClass::getKind());
2444 return Caller.getFnAttribute(AttrName) == Callee.getFnAttribute(AttrName);
2452template<
typename AttrClass>
2454 if (AttrClass::isSet(Caller, AttrClass::getKind()) &&
2455 !AttrClass::isSet(Callee, AttrClass::getKind()))
2456 AttrClass::set(Caller, AttrClass::getKind(),
false);
2464template<
typename AttrClass>
2466 if (!AttrClass::isSet(Caller, AttrClass::getKind()) &&
2467 AttrClass::isSet(Callee, AttrClass::getKind()))
2468 AttrClass::set(Caller, AttrClass::getKind(),
true);
2477 if (!Caller.hasStackProtectorFnAttr())
2488 if (Callee.hasFnAttribute(Attribute::StackProtectReq)) {
2489 Caller.removeFnAttrs(OldSSPAttr);
2490 Caller.addFnAttr(Attribute::StackProtectReq);
2491 }
else if (Callee.hasFnAttribute(Attribute::StackProtectStrong) &&
2492 !Caller.hasFnAttribute(Attribute::StackProtectReq)) {
2493 Caller.removeFnAttrs(OldSSPAttr);
2494 Caller.addFnAttr(Attribute::StackProtectStrong);
2495 }
else if (Callee.hasFnAttribute(Attribute::StackProtect) &&
2496 !Caller.hasFnAttribute(Attribute::StackProtectReq) &&
2497 !Caller.hasFnAttribute(Attribute::StackProtectStrong))
2498 Caller.addFnAttr(Attribute::StackProtect);
2504 if (!Caller.hasFnAttribute(
"probe-stack") &&
2505 Callee.hasFnAttribute(
"probe-stack")) {
2506 Caller.addFnAttr(Callee.getFnAttribute(
"probe-stack"));
2515 Attribute CalleeAttr = Callee.getFnAttribute(
"stack-probe-size");
2517 Attribute CallerAttr = Caller.getFnAttribute(
"stack-probe-size");
2519 uint64_t CallerStackProbeSize, CalleeStackProbeSize;
2523 if (CallerStackProbeSize > CalleeStackProbeSize) {
2524 Caller.addFnAttr(CalleeAttr);
2527 Caller.addFnAttr(CalleeAttr);
2543 Attribute CallerAttr = Caller.getFnAttribute(
"min-legal-vector-width");
2545 Attribute CalleeAttr = Callee.getFnAttribute(
"min-legal-vector-width");
2547 uint64_t CallerVectorWidth, CalleeVectorWidth;
2550 if (CallerVectorWidth < CalleeVectorWidth)
2551 Caller.addFnAttr(CalleeAttr);
2555 Caller.removeFnAttr(
"min-legal-vector-width");
2564 if (Callee.nullPointerIsDefined() && !Caller.nullPointerIsDefined()) {
2565 Caller.addFnAttr(Attribute::NullPointerIsValid);
2588 return A.getValueAsString() ==
"true";
2593 Fn.
addFnAttr(Kind, Val ?
"true" :
"false");
2597#define GET_ATTR_NAMES
2598#define ATTRIBUTE_ENUM(ENUM_NAME, DISPLAY_NAME) \
2599 struct ENUM_NAME##Attr : EnumAttr { \
2600 static enum Attribute::AttrKind getKind() { \
2601 return llvm::Attribute::ENUM_NAME; \
2604#define ATTRIBUTE_STRBOOL(ENUM_NAME, DISPLAY_NAME) \
2605 struct ENUM_NAME##Attr : StrBoolAttr { \
2606 static StringRef getKind() { return #DISPLAY_NAME; } \
2608#include "llvm/IR/Attributes.inc"
2610#define GET_ATTR_COMPAT_FUNC
2611#include "llvm/IR/Attributes.inc"
2615 return hasCompatibleFnAttrs(Caller, Callee);
2620 return hasCompatibleFnAttrs(
A,
B);
2625 mergeFnAttrs(Caller, Callee);
2638 mergeFnAttrs(
Base, ToMerge);
2647 if (Width > OldWidth)
2648 Fn.
addFnAttr(
"min-legal-vector-width", llvm::utostr(Width));
This file defines various helper methods and classes used by LLVMContextImpl for creating and managin...
static void addAttributeImpl(SmallVectorImpl< Attribute > &Attrs, K Kind, Attribute Attr)
static void setAND(Function &Caller, const Function &Callee)
Compute the logical AND of the attributes of the caller and the callee.
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 std::pair< unsigned, std::optional< unsigned > > unpackVScaleRangeArgs(uint64_t Value)
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 sa...
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 f...
static void adjustCallerSSPLevel(Function &Caller, const Function &Callee)
If the inlined function had a higher stack protection level than the calling function,...
static bool checkStrictFP(const Function &Caller, const Function &Callee)
static uint64_t packAllocSizeArgs(unsigned ElemSizeArg, const std::optional< unsigned > &NumElemsArg)
static uint64_t packVScaleRangeArgs(unsigned MinValue, std::optional< unsigned > MaxValue)
static bool hasIntersectProperty(Attribute::AttrKind Kind, AttributeProperty Prop)
static unsigned attrIdxToArrayIdx(unsigned Index)
Map from AttributeList index to the internal array index.
static bool denormModeCompatible(DenormalMode CallerMode, DenormalMode CalleeMode)
Callees with dynamic denormal modes are compatible with any caller mode.
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 in...
static const unsigned AllocSizeNumElemsNotPresent
static std::pair< unsigned, std::optional< unsigned > > unpackAllocSizeArgs(uint64_t Num)
static bool checkDenormMode(const Function &Caller, const Function &Callee)
static unsigned getAttributeProperties(Attribute::AttrKind Kind)
static void setOR(Function &Caller, const Function &Callee)
Compute the logical OR of the attributes of the caller and the callee.
static bool hasAttributeProperty(Attribute::AttrKind Kind, AttributeProperty Prop)
static const char * getModRefStr(ModRefInfo MR)
This file contains the simple types necessary to represent the attributes associated with functions a...
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
This file defines a hash set that can be used to remove duplication of nodes in a graph.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file defines the SmallVector class.
This file implements the StringSwitch template, which mimics a switch() statement whose cases are str...
void Profile(FoldingSetNodeID &id) const
Used to insert APInt objects, or objects that contain APInt objects, into FoldingSets.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
const T & back() const
back - Get the last element.
ArrayRef< T > take_front(size_t N=1) const
Return a copy of *this with only the first N elements.
size_t size() const
size - Get the array size.
bool empty() const
empty - Check if the array is empty.
AttrBuilder & addStructRetAttr(Type *Ty)
This turns a sret type into the form used internally in Attribute.
AttrBuilder & addAlignmentAttr(MaybeAlign Align)
This turns an alignment into the form used internally in Attribute.
AttrBuilder & addVScaleRangeAttrFromRawRepr(uint64_t RawVScaleRangeRepr)
Add a vscale_range attribute, using the representation returned by Attribute.getIntValue().
std::optional< uint64_t > getRawIntAttr(Attribute::AttrKind Kind) const
Return raw (possibly packed/encoded) value of integer attribute or std::nullopt if not set.
AttrBuilder & addAllocKindAttr(AllocFnKind Kind)
Attribute getAttribute(Attribute::AttrKind Kind) const
Return Attribute with the given Kind.
AttrBuilder & addByRefAttr(Type *Ty)
This turns a byref type into the form used internally in Attribute.
AttrBuilder & addNoFPClassAttr(FPClassTest NoFPClassMask)
bool overlaps(const AttributeMask &AM) const
Return true if the builder has any attribute that's in the specified builder.
AttrBuilder & merge(const AttrBuilder &B)
Add the attributes from the builder.
AttrBuilder & addVScaleRangeAttr(unsigned MinValue, std::optional< unsigned > MaxValue)
This turns two ints into the form used internally in Attribute.
AttrBuilder(LLVMContext &Ctx)
AttrBuilder & addRawIntAttr(Attribute::AttrKind Kind, uint64_t Value)
Add integer attribute with raw value (packed/encoded if necessary).
AttrBuilder & addAttribute(Attribute::AttrKind Val)
Add an attribute to the builder.
AttrBuilder & addByValAttr(Type *Ty)
This turns a byval type into the form used internally in Attribute.
AttrBuilder & addDereferenceableAttr(uint64_t Bytes)
This turns the number of dereferenceable bytes into the form used internally in Attribute.
AttrBuilder & addInitializesAttr(const ConstantRangeList &CRL)
Add initializes attribute.
bool contains(Attribute::AttrKind A) const
Return true if the builder has the specified attribute.
AttrBuilder & addMemoryAttr(MemoryEffects ME)
Add memory effect attribute.
AttrBuilder & addConstantRangeListAttr(Attribute::AttrKind Kind, ArrayRef< ConstantRange > Val)
Add a ConstantRangeList attribute with the given ranges.
AttrBuilder & addConstantRangeAttr(Attribute::AttrKind Kind, const ConstantRange &CR)
Add a ConstantRange attribute with the given range.
AttrBuilder & addAllocSizeAttrFromRawRepr(uint64_t RawAllocSizeRepr)
Add an allocsize attribute, using the representation returned by Attribute.getIntValue().
AttrBuilder & addPreallocatedAttr(Type *Ty)
This turns a preallocated type into the form used internally in Attribute.
AttrBuilder & addStackAlignmentAttr(MaybeAlign Align)
This turns a stack alignment into the form used internally in Attribute.
AttrBuilder & addInAllocaAttr(Type *Ty)
This turns an inalloca type into the form used internally in Attribute.
AttrBuilder & removeAttribute(Attribute::AttrKind Val)
Remove an attribute from the builder.
bool operator==(const AttrBuilder &B) const
Type * getTypeAttr(Attribute::AttrKind Kind) const
Retrieve type for the given type attribute.
AttrBuilder & remove(const AttributeMask &AM)
Remove the attributes from the builder.
std::optional< ConstantRange > getRange() const
Retrieve the range if the attribute exists (std::nullopt is returned otherwise).
AttrBuilder & addDereferenceableOrNullAttr(uint64_t Bytes)
This turns the number of dereferenceable_or_null bytes into the form used internally in Attribute.
AttrBuilder & addTypeAttr(Attribute::AttrKind Kind, Type *Ty)
Add a type attribute with the given type.
std::optional< std::pair< unsigned, std::optional< unsigned > > > getAllocSizeArgs() const
Retrieve the allocsize args, or std::nullopt if the attribute does not exist.
AttrBuilder & addAllocSizeAttr(unsigned ElemSizeArg, const std::optional< unsigned > &NumElemsArg)
This turns one (or two) ints into the form used internally in Attribute.
AttrBuilder & addRangeAttr(const ConstantRange &CR)
Add range attribute.
AttrBuilder & addUWTableAttr(UWTableKind Kind)
This turns the unwind table kind into the form used internally in Attribute.
void addAttribute(Attribute::AttrKind Kind)
bool hasAttribute(Attribute::AttrKind Kind) const
int cmp(const AttributeImpl &AI, bool KindOnly) const
Used to sort attributes.
bool isConstantRangeAttribute() const
bool hasAttribute(Attribute::AttrKind A) const
void Profile(FoldingSetNodeID &ID) const
Type * getValueAsType() const
Attribute::AttrKind getKindAsEnum() const
bool operator<(const AttributeImpl &AI) const
Used when sorting the attributes.
uint64_t getValueAsInt() const
bool isIntAttribute() const
bool isTypeAttribute() const
bool getValueAsBool() const
StringRef getKindAsString() const
StringRef getValueAsString() const
bool isEnumAttribute() const
ArrayRef< ConstantRange > getValueAsConstantRangeList() const
bool isConstantRangeListAttribute() const
bool isStringAttribute() const
const ConstantRange & getValueAsConstantRange() const
bool hasAttrSomewhere(Attribute::AttrKind Kind, unsigned *Index=nullptr) const
Return true if the specified attribute is set for at least one parameter or for the return value.
void Profile(FoldingSetNodeID &ID) const
AttributeListImpl(ArrayRef< AttributeSet > Sets)
friend class AttributeList
bool hasAttributeAtIndex(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
Type * getParamStructRetType(unsigned ArgNo) const
Return the sret type for the specified function parameter.
AttributeList addDereferenceableParamAttr(LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const
Add the dereferenceable attribute to the attribute set at the given arg index.
AttributeList removeAttributeAtIndex(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Remove the specified attribute at the specified index from this attribute list.
AttributeList addRangeRetAttr(LLVMContext &C, const ConstantRange &CR) const
Add the range attribute to the attribute set at the return value index.
bool hasAttributesAtIndex(unsigned Index) const
Return true if attribute exists at the given index.
friend class AttributeListImpl
AttributeSet getFnAttrs() const
The function attributes are returned.
index_iterator indexes() const
Use this to iterate over the valid attribute indexes.
AttributeList removeAttributesAtIndex(LLVMContext &C, unsigned Index, const AttributeMask &AttrsToRemove) const
Remove the specified attributes at the specified index from this attribute list.
friend class AttributeSet
MaybeAlign getRetStackAlignment() const
Get the stack alignment of the return value.
AttributeList addRetAttributes(LLVMContext &C, const AttrBuilder &B) const
Add a return value attribute to the list.
void print(raw_ostream &O) const
AttributeList addDereferenceableRetAttr(LLVMContext &C, uint64_t Bytes) const
Add the dereferenceable attribute to the attribute set at the given index.
static AttributeList get(LLVMContext &C, ArrayRef< std::pair< unsigned, Attribute > > Attrs)
Create an AttributeList with the specified parameters in it.
AllocFnKind getAllocKind() const
bool isEmpty() const
Return true if there are no attributes.
AttributeSet getRetAttrs() const
The attributes for the ret value are returned.
bool hasFnAttr(Attribute::AttrKind Kind) const
Return true if the attribute exists for the function.
uint64_t getParamDereferenceableBytes(unsigned Index) const
Get the number of dereferenceable bytes (or zero if unknown) of an arg.
MaybeAlign getParamAlignment(unsigned ArgNo) const
Return the alignment for the specified function parameter.
bool hasAttrSomewhere(Attribute::AttrKind Kind, unsigned *Index=nullptr) const
Return true if the specified attribute is set for at least one parameter or for the return value.
Type * getParamInAllocaType(unsigned ArgNo) const
Return the inalloca type for the specified function parameter.
unsigned getNumAttrSets() const
FPClassTest getRetNoFPClass() const
Get the disallowed floating-point classes of the return value.
std::string getAsString(unsigned Index, bool InAttrGrp=false) const
Return the attributes at the index as a string.
UWTableKind getUWTableKind() const
Get the unwind table kind requested for the function.
MaybeAlign getRetAlignment() const
Return the alignment of the return value.
Type * getParamElementType(unsigned ArgNo) const
Return the elementtype type for the specified function parameter.
Attribute getAttributeAtIndex(unsigned Index, Attribute::AttrKind Kind) const
Return the attribute object that exists at the given index.
Type * getParamPreallocatedType(unsigned ArgNo) const
Return the preallocated type for the specified function parameter.
bool hasParentContext(LLVMContext &C) const
Return true if this attribute list belongs to the LLVMContext.
const AttributeSet * iterator
MaybeAlign getFnStackAlignment() const
Get the stack alignment of the function.
AttributeList addAttributesAtIndex(LLVMContext &C, unsigned Index, const AttrBuilder &B) const
Add attributes to the attribute set at the given index.
Type * getParamByValType(unsigned ArgNo) const
Return the byval type for the specified function parameter.
MaybeAlign getParamStackAlignment(unsigned ArgNo) const
Return the stack alignment for the specified function parameter.
uint64_t getRetDereferenceableBytes() const
Get the number of dereferenceable bytes (or zero if unknown) of the return value.
AttributeList addAllocSizeParamAttr(LLVMContext &C, unsigned ArgNo, unsigned ElemSizeArg, const std::optional< unsigned > &NumElemsArg) const
Add the allocsize attribute to the attribute set at the given arg index.
uint64_t getParamDereferenceableOrNullBytes(unsigned ArgNo) const
Get the number of dereferenceable_or_null bytes (or zero if unknown) of an arg.
AttributeList addDereferenceableOrNullParamAttr(LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const
Add the dereferenceable_or_null attribute to the attribute set at the given arg index.
AttributeSet getAttributes(unsigned Index) const
The attributes for the specified index are returned.
FPClassTest getParamNoFPClass(unsigned ArgNo) const
Get the disallowed floating-point classes of the argument value.
std::optional< AttributeList > intersectWith(LLVMContext &C, AttributeList Other) const
Try to intersect this AttributeList with Other.
Type * getParamByRefType(unsigned ArgNo) const
Return the byref type for the specified function parameter.
AttributeList addAttributeAtIndex(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Add an attribute to the attribute set at the given index.
AttributeSet getParamAttrs(unsigned ArgNo) const
The attributes for the argument or parameter at the given index are returned.
AttributeList addParamAttributes(LLVMContext &C, unsigned ArgNo, const AttrBuilder &B) const
Add an argument attribute to the list.
std::optional< ConstantRange > getParamRange(unsigned ArgNo) const
Get range (or std::nullopt if unknown) of an arg.
uint64_t getRetDereferenceableOrNullBytes() const
Get the number of dereferenceable_or_null bytes (or zero if unknown) of the return value.
AttributeList addParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
Add an argument attribute to the list.
MemoryEffects getMemoryEffects() const
Returns memory effects of the function.
AttributeMask & addAttribute(Attribute::AttrKind Val)
Add an attribute to the mask.
bool contains(Attribute::AttrKind A) const
Return true if the builder has the specified attribute.
MaybeAlign getStackAlignment() const
uint64_t getDereferenceableOrNullBytes() const
std::optional< unsigned > getVScaleRangeMax() const
bool hasAttribute(Attribute::AttrKind Kind) const
Type * getAttributeType(Attribute::AttrKind Kind) const
AllocFnKind getAllocKind() const
unsigned getVScaleRangeMin() const
MaybeAlign getAlignment() const
MemoryEffects getMemoryEffects() const
UWTableKind getUWTableKind() const
std::optional< std::pair< unsigned, std::optional< unsigned > > > getAllocSizeArgs() const
uint64_t getDereferenceableBytes() const
unsigned getNumAttributes() const
Return the number of attributes this AttributeList contains.
void Profile(FoldingSetNodeID &ID) const
std::string getAsString(bool InAttrGrp) const
static AttributeSetNode * get(LLVMContext &C, const AttrBuilder &B)
FPClassTest getNoFPClass() const
Attribute getAttribute(Attribute::AttrKind Kind) const
AllocFnKind getAllocKind() const
bool hasAttributes() const
Return true if attributes exists in this set.
AttributeSet removeAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Remove the specified attribute from this set.
Type * getInAllocaType() const
Type * getByValType() const
AttributeSet addAttributes(LLVMContext &C, AttributeSet AS) const
Add attributes to the attribute set.
MemoryEffects getMemoryEffects() const
bool hasAttribute(Attribute::AttrKind Kind) const
Return true if the attribute exists in this set.
std::optional< AttributeSet > intersectWith(LLVMContext &C, AttributeSet Other) const
Try to intersect this AttributeSet with Other.
Type * getStructRetType() const
std::string getAsString(bool InAttrGrp=false) const
unsigned getVScaleRangeMin() const
std::optional< std::pair< unsigned, std::optional< unsigned > > > getAllocSizeArgs() const
UWTableKind getUWTableKind() const
bool hasParentContext(LLVMContext &C) const
Return true if this attribute set belongs to the LLVMContext.
AttributeSet removeAttributes(LLVMContext &C, const AttributeMask &AttrsToRemove) const
Remove the specified attributes from this set.
std::optional< unsigned > getVScaleRangeMax() const
MaybeAlign getStackAlignment() const
Attribute getAttribute(Attribute::AttrKind Kind) const
Return the attribute object.
Type * getPreallocatedType() const
uint64_t getDereferenceableBytes() const
MaybeAlign getAlignment() const
FPClassTest getNoFPClass() const
Type * getElementType() const
Type * getByRefType() const
AttributeSet()=default
AttributeSet is a trivially copyable value type.
static AttributeSet get(LLVMContext &C, const AttrBuilder &B)
uint64_t getDereferenceableOrNullBytes() const
unsigned getNumAttributes() const
Return the number of attributes in this set.
AttributeSet addAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Add an argument attribute.
bool isStringAttribute() const
Return true if the attribute is a string (target-dependent) attribute.
static Attribute getWithStructRetType(LLVMContext &Context, Type *Ty)
static Attribute::AttrKind getAttrKindFromName(StringRef AttrName)
bool isEnumAttribute() const
Return true if the attribute is an Attribute::AttrKind type.
static Attribute getWithStackAlignment(LLVMContext &Context, Align Alignment)
const ConstantRange & getRange() const
Returns the value of the range attribute.
static bool intersectWithCustom(AttrKind Kind)
bool isIntAttribute() const
Return true if the attribute is an integer attribute.
static Attribute getWithByRefType(LLVMContext &Context, Type *Ty)
std::optional< unsigned > getVScaleRangeMax() const
Returns the maximum value for the vscale_range attribute or std::nullopt when unknown.
uint64_t getValueAsInt() const
Return the attribute's value as an integer.
unsigned getVScaleRangeMin() const
Returns the minimum value for the vscale_range attribute.
AllocFnKind getAllocKind() const
bool isConstantRangeAttribute() const
Return true if the attribute is a ConstantRange attribute.
StringRef getKindAsString() const
Return the attribute's kind as a string.
static Attribute getWithPreallocatedType(LLVMContext &Context, Type *Ty)
static bool intersectWithMin(AttrKind Kind)
static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val=0)
Return a uniquified Attribute object.
static bool canUseAsRetAttr(AttrKind Kind)
static bool isTypeAttrKind(AttrKind Kind)
std::string getAsString(bool InAttrGrp=false) const
The Attribute is converted to a string of equivalent mnemonic.
uint64_t getDereferenceableOrNullBytes() const
Returns the number of dereferenceable_or_null bytes from the dereferenceable_or_null attribute.
static Attribute getWithDereferenceableBytes(LLVMContext &Context, uint64_t Bytes)
std::pair< unsigned, std::optional< unsigned > > getAllocSizeArgs() const
Returns the argument numbers for the allocsize attribute.
static Attribute getWithUWTableKind(LLVMContext &Context, UWTableKind Kind)
FPClassTest getNoFPClass() const
Return the FPClassTest for nofpclass.
static Attribute getWithAllocSizeArgs(LLVMContext &Context, unsigned ElemSizeArg, const std::optional< unsigned > &NumElemsArg)
Attribute::AttrKind getKindAsEnum() const
Return the attribute's kind as an enum (Attribute::AttrKind).
bool getValueAsBool() const
Return the attribute's value as a boolean.
ArrayRef< ConstantRange > getInitializes() const
Returns the value of the initializes attribute.
const ConstantRange & getValueAsConstantRange() const
Return the attribute's value as a ConstantRange.
uint64_t getDereferenceableBytes() const
Returns the number of dereferenceable bytes from the dereferenceable attribute.
static Attribute getWithVScaleRangeArgs(LLVMContext &Context, unsigned MinValue, unsigned MaxValue)
MemoryEffects getMemoryEffects() const
Returns memory effects.
void Profile(FoldingSetNodeID &ID) const
UWTableKind getUWTableKind() const
static Attribute getWithDereferenceableOrNullBytes(LLVMContext &Context, uint64_t Bytes)
ArrayRef< ConstantRange > getValueAsConstantRangeList() const
Return the attribute's value as a ConstantRange array.
StringRef getValueAsString() const
Return the attribute's value as a string.
static bool isExistingAttribute(StringRef Name)
Return true if the provided string matches the IR name of an attribute.
bool hasKindAsEnum() const
Returns true if the attribute's kind can be represented as an enum (Enum, Integer,...
static StringRef getNameFromAttrKind(Attribute::AttrKind AttrKind)
static bool canUseAsFnAttr(AttrKind Kind)
static bool intersectWithAnd(AttrKind Kind)
static Attribute getWithNoFPClass(LLVMContext &Context, FPClassTest Mask)
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
@ None
No attributes have been set.
@ EndAttrKinds
Sentinel value useful for loops.
static bool isConstantRangeAttrKind(AttrKind Kind)
bool hasParentContext(LLVMContext &C) const
Return true if this attribute belongs to the LLVMContext.
bool isTypeAttribute() const
Return true if the attribute is a type attribute.
static Attribute getWithInAllocaType(LLVMContext &Context, Type *Ty)
static bool isIntAttrKind(AttrKind Kind)
static bool isConstantRangeListAttrKind(AttrKind Kind)
bool isConstantRangeListAttribute() const
Return true if the attribute is a ConstantRangeList attribute.
static Attribute getWithByValType(LLVMContext &Context, Type *Ty)
bool hasAttribute(AttrKind Val) const
Return true if the attribute is present.
static bool isEnumAttrKind(AttrKind Kind)
static Attribute getWithMemoryEffects(LLVMContext &Context, MemoryEffects ME)
static bool canUseAsParamAttr(AttrKind Kind)
bool isValid() const
Return true if the attribute is any kind of attribute.
MaybeAlign getStackAlignment() const
Returns the stack alignment field of an attribute as a byte alignment value.
MaybeAlign getAlignment() const
Returns the alignment field of an attribute as a byte alignment value.
static bool intersectMustPreserve(AttrKind Kind)
int cmpKind(Attribute A) const
Used to sort attribute by kind.
bool operator<(Attribute A) const
Less-than operator. Useful for sorting the attributes list.
static Attribute getWithAlignment(LLVMContext &Context, Align Alignment)
Return a uniquified Attribute object that has the specific alignment set.
Type * getValueAsType() const
Return the attribute's value as a Type.
LLVM_ATTRIBUTE_RETURNS_NONNULL void * Allocate(size_t Size, Align Alignment)
Allocate space at the specified alignment.
static size_t totalSizeToAlloc(ArrayRef< ConstantRange > Val)
This class represents a list of constant ranges.
ArrayRef< ConstantRange > rangesRef() const
void print(raw_ostream &OS) const
Print out the ranges to a stream.
This class represents a range of values.
const APInt & getLower() const
Return the lower value for this range.
bool isFullSet() const
Return true if this set contains all of the elements possible for this data-type.
const APInt & getUpper() const
Return the upper value for this range.
ConstantRange unionWith(const ConstantRange &CR, PreferredRangeType Type=Smallest) const
Return the range that results from the union of this range with another range.
uint32_t getBitWidth() const
Get the bit width of this ConstantRange.
static bool isSupportedFloatingPointType(Type *Ty)
Returns true if Ty is a supported floating-point type for phi, select, or call FPMathOperators.
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
void addFnAttr(Attribute::AttrKind Kind)
Add function attributes to this function.
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
void removeFnAttr(Attribute::AttrKind Kind)
Remove function attributes from this function.
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
FoldingSet< AttributeImpl > AttrsSet
FoldingSet< AttributeSetNode > AttrsSetNodes
FoldingSet< AttributeListImpl > AttrsLists
SpecificBumpPtrAllocator< ConstantRangeAttributeImpl > ConstantRangeAttributeAlloc
std::vector< ConstantRangeListAttributeImpl * > ConstantRangeListAttributes
This is an important class for using LLVM in a threaded context.
LLVMContextImpl *const pImpl
ModRefInfo getModRef(Location Loc) const
Get ModRefInfo for the given Location.
static MemoryEffectsBase createFromIntValue(uint32_t Data)
Create MemoryEffectsBase from an encoded integer value (used by memory attribute).
static auto locations()
Returns iterator over all supported location kinds.
uint32_t toIntValue() const
Convert MemoryEffectsBase into an encoded integer value (used by memory attribute).
static MemoryEffectsBase unknown()
Create MemoryEffectsBase that can read and write any memory.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
reference emplace_back(ArgTypes &&... Args)
void reserve(size_type N)
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
static size_t totalSizeToAlloc(StringRef Kind, StringRef Val)
StringRef - Represent a constant reference to a string, i.e.
bool getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
std::string str() const
str - Get the contents as an std::string.
constexpr bool empty() const
empty - Check if the string is empty.
int compare(StringRef RHS) const
compare - Compare two strings; the result is negative, zero, or positive if this string is lexicograp...
A switch()-like statement whose cases are string literals.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
The instances of the Type class are immutable: once they are created, they are never changed.
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
bool isPointerTy() const
True if this is an instance of PointerType.
void print(raw_ostream &O, bool IsForDebug=false, bool NoDetails=false) const
Print the current type.
unsigned getScalarSizeInBits() const LLVM_READONLY
If this is a vector type, return the getPrimitiveSizeInBits value for the element type.
bool isPtrOrPtrVectorTy() const
Return true if this is a pointer type or a vector of pointer types.
bool isIntegerTy() const
True if this is an instance of IntegerType.
bool isVoidTy() const
Return true if this is 'void'.
LLVM Value Representation.
static constexpr uint64_t MaximumAlignment
This class implements an extremely fast bulk output stream that can only output to a stream.
A raw_ostream that writes to an std::string.
This class provides various memory handling functions that manipulate MemoryBlock instances.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
bool areInlineCompatible(const Function &Caller, const Function &Callee)
AttributeMask getUBImplyingAttributes()
Get param/return attributes which imply immediate undefined behavior if an invalid value is passed.
bool isNoFPClassCompatibleType(Type *Ty)
Returns true if this is a type legal for the 'nofpclass' attribute.
bool areOutlineCompatible(const Function &A, const Function &B)
Checks if there are any incompatible function attributes between A and B.
void updateMinLegalVectorWidthAttr(Function &Fn, uint64_t Width)
Update min-legal-vector-width if it is in Attribute and less than Width.
void mergeAttributesForOutlining(Function &Base, const Function &ToMerge)
Merges the functions attributes from ToMerge into function Base.
AttributeMask typeIncompatible(Type *Ty, AttributeSet AS, AttributeSafetyKind ASK=ASK_ALL)
Which attributes cannot be applied to a type.
void mergeAttributesForInlining(Function &Caller, const Function &Callee)
Merge caller's and callee's attributes.
@ C
The default llvm calling convention, compatible with C.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
bool isEqual(const GCNRPTracker::LiveRegSet &S1, const GCNRPTracker::LiveRegSet &S2)
auto size(R &&Range, std::enable_if_t< std::is_base_of< std::random_access_iterator_tag, typename std::iterator_traits< decltype(Range.begin())>::iterator_category >::value, void > *=nullptr)
Get the size of a range.
void append_range(Container &C, Range &&R)
Wrapper function to append range R to container C.
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
@ None
No unwind table requested.
void sort(IteratorTy Start, IteratorTy End)
FPClassTest
Floating-point class tests, supported by 'is_fpclass' intrinsic.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
bool none_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly.
bool is_sorted(R &&Range, Compare C)
Wrapper function around std::is_sorted to check if elements in a range R are sorted with respect to a...
ModRefInfo
Flags indicating whether a memory access modifies or references memory.
@ Ref
The access may reference the value stored in memory.
@ ModRef
The access may reference and may modify the value stored in memory.
@ Mod
The access may modify the value stored in memory.
@ NoModRef
The access neither references nor modifies the value stored in memory.
@ ArgMem
Access to memory via argument pointers.
@ First
Helpers to iterate all locations in the MemoryEffectsBase class.
@ InaccessibleMem
Memory that is inaccessible via LLVM IR.
auto lower_bound(R &&Range, T &&Value)
Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly...
OutputIt copy(R &&Range, OutputIt Out)
void erase_if(Container &C, UnaryPredicate P)
Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent t...
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Attribute comparator that only compares attribute keys.
bool operator()(Attribute A0, StringRef Kind) const
bool operator()(Attribute A0, Attribute A1) const
bool operator()(Attribute A0, Attribute::AttrKind Kind) const
static void set(Function &Fn, Attribute::AttrKind Kind, bool Val)
static bool isSet(const Function &Fn, Attribute::AttrKind Kind)
static bool isSet(const Function &Fn, StringRef Kind)
static void set(Function &Fn, StringRef Kind, bool Val)
This struct is a compact representation of a valid (non-zero power of two) alignment.
uint64_t value() const
This is a hole in the type system and should not be abused.
Represent subnormal handling kind for floating point instruction inputs and outputs.
DenormalModeKind Input
Denormal treatment kind for floating point instruction inputs in the default floating-point environme...
@ Dynamic
Denormals have unknown treatment.
static constexpr DenormalMode getInvalid()
DenormalModeKind Output
Denormal flushing mode for floating point instruction results in the default floating point environme...
static constexpr DenormalMode getDynamic()
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Align valueOrOne() const
For convenience, returns a valid alignment or 1 if undefined.
Function object to check whether the first component of a container supported by std::get (like std::...