LLVM  17.0.0git
Attributes.cpp
Go to the documentation of this file.
1 //===- Attributes.cpp - Implement AttributesList --------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // \file
10 // This file implements the Attribute, AttributeImpl, AttrBuilder,
11 // AttributeListImpl, and AttributeList classes.
12 //
13 //===----------------------------------------------------------------------===//
14 
15 #include "llvm/IR/Attributes.h"
16 #include "AttributeImpl.h"
17 #include "LLVMContextImpl.h"
18 #include "llvm/ADT/ArrayRef.h"
19 #include "llvm/ADT/FoldingSet.h"
20 #include "llvm/ADT/STLExtras.h"
21 #include "llvm/ADT/SmallVector.h"
22 #include "llvm/ADT/StringExtras.h"
23 #include "llvm/ADT/StringRef.h"
24 #include "llvm/ADT/StringSwitch.h"
25 #include "llvm/Config/llvm-config.h"
26 #include "llvm/IR/Function.h"
27 #include "llvm/IR/LLVMContext.h"
28 #include "llvm/IR/Type.h"
29 #include "llvm/Support/Compiler.h"
31 #include "llvm/Support/ModRef.h"
33 #include <algorithm>
34 #include <cassert>
35 #include <cstddef>
36 #include <cstdint>
37 #include <limits>
38 #include <optional>
39 #include <string>
40 #include <tuple>
41 #include <utility>
42 
43 using namespace llvm;
44 
45 //===----------------------------------------------------------------------===//
46 // Attribute Construction Methods
47 //===----------------------------------------------------------------------===//
48 
49 // allocsize has two integer arguments, but because they're both 32 bits, we can
50 // pack them into one 64-bit value, at the cost of making said value
51 // nonsensical.
52 //
53 // In order to do this, we need to reserve one value of the second (optional)
54 // allocsize argument to signify "not present."
55 static const unsigned AllocSizeNumElemsNotPresent = -1;
56 
57 static uint64_t packAllocSizeArgs(unsigned ElemSizeArg,
58  const std::optional<unsigned> &NumElemsArg) {
59  assert((!NumElemsArg || *NumElemsArg != AllocSizeNumElemsNotPresent) &&
60  "Attempting to pack a reserved value");
61 
62  return uint64_t(ElemSizeArg) << 32 |
63  NumElemsArg.value_or(AllocSizeNumElemsNotPresent);
64 }
65 
66 static std::pair<unsigned, std::optional<unsigned>>
68  unsigned NumElems = Num & std::numeric_limits<unsigned>::max();
69  unsigned ElemSizeArg = Num >> 32;
70 
71  std::optional<unsigned> NumElemsArg;
72  if (NumElems != AllocSizeNumElemsNotPresent)
73  NumElemsArg = NumElems;
74  return std::make_pair(ElemSizeArg, NumElemsArg);
75 }
76 
77 static uint64_t packVScaleRangeArgs(unsigned MinValue,
78  std::optional<unsigned> MaxValue) {
79  return uint64_t(MinValue) << 32 | MaxValue.value_or(0);
80 }
81 
82 static std::pair<unsigned, std::optional<unsigned>>
84  unsigned MaxValue = Value & std::numeric_limits<unsigned>::max();
85  unsigned MinValue = Value >> 32;
86 
87  return std::make_pair(MinValue,
88  MaxValue > 0 ? MaxValue : std::optional<unsigned>());
89 }
90 
92  uint64_t Val) {
93  bool IsIntAttr = Attribute::isIntAttrKind(Kind);
94  assert((IsIntAttr || Attribute::isEnumAttrKind(Kind)) &&
95  "Not an enum or int attribute");
96 
97  LLVMContextImpl *pImpl = Context.pImpl;
99  ID.AddInteger(Kind);
100  if (IsIntAttr)
101  ID.AddInteger(Val);
102  else
103  assert(Val == 0 && "Value must be zero for enum attributes");
104 
105  void *InsertPoint;
106  AttributeImpl *PA = pImpl->AttrsSet.FindNodeOrInsertPos(ID, InsertPoint);
107 
108  if (!PA) {
109  // If we didn't find any existing attributes of the same shape then create a
110  // new one and insert it.
111  if (!IsIntAttr)
112  PA = new (pImpl->Alloc) EnumAttributeImpl(Kind);
113  else
114  PA = new (pImpl->Alloc) IntAttributeImpl(Kind, Val);
115  pImpl->AttrsSet.InsertNode(PA, InsertPoint);
116  }
117 
118  // Return the Attribute that we found or created.
119  return Attribute(PA);
120 }
121 
123  LLVMContextImpl *pImpl = Context.pImpl;
125  ID.AddString(Kind);
126  if (!Val.empty()) ID.AddString(Val);
127 
128  void *InsertPoint;
129  AttributeImpl *PA = pImpl->AttrsSet.FindNodeOrInsertPos(ID, InsertPoint);
130 
131  if (!PA) {
132  // If we didn't find any existing attributes of the same shape then create a
133  // new one and insert it.
134  void *Mem =
136  alignof(StringAttributeImpl));
137  PA = new (Mem) StringAttributeImpl(Kind, Val);
138  pImpl->AttrsSet.InsertNode(PA, InsertPoint);
139  }
140 
141  // Return the Attribute that we found or created.
142  return Attribute(PA);
143 }
144 
146  Type *Ty) {
147  assert(Attribute::isTypeAttrKind(Kind) && "Not a type attribute");
148  LLVMContextImpl *pImpl = Context.pImpl;
150  ID.AddInteger(Kind);
151  ID.AddPointer(Ty);
152 
153  void *InsertPoint;
154  AttributeImpl *PA = pImpl->AttrsSet.FindNodeOrInsertPos(ID, InsertPoint);
155 
156  if (!PA) {
157  // If we didn't find any existing attributes of the same shape then create a
158  // new one and insert it.
159  PA = new (pImpl->Alloc) TypeAttributeImpl(Kind, Ty);
160  pImpl->AttrsSet.InsertNode(PA, InsertPoint);
161  }
162 
163  // Return the Attribute that we found or created.
164  return Attribute(PA);
165 }
166 
168  assert(A <= llvm::Value::MaximumAlignment && "Alignment too large.");
169  return get(Context, Alignment, A.value());
170 }
171 
173  assert(A <= 0x100 && "Alignment too large.");
174  return get(Context, StackAlignment, A.value());
175 }
176 
178  uint64_t Bytes) {
179  assert(Bytes && "Bytes must be non-zero.");
180  return get(Context, Dereferenceable, Bytes);
181 }
182 
184  uint64_t Bytes) {
185  assert(Bytes && "Bytes must be non-zero.");
186  return get(Context, DereferenceableOrNull, Bytes);
187 }
188 
190  return get(Context, ByVal, Ty);
191 }
192 
194  return get(Context, StructRet, Ty);
195 }
196 
198  return get(Context, ByRef, Ty);
199 }
200 
202  return get(Context, Preallocated, Ty);
203 }
204 
206  return get(Context, InAlloca, Ty);
207 }
208 
210  UWTableKind Kind) {
211  return get(Context, UWTable, uint64_t(Kind));
212 }
213 
215  MemoryEffects ME) {
216  return get(Context, Memory, ME.toIntValue());
217 }
218 
219 Attribute
221  const std::optional<unsigned> &NumElemsArg) {
222  assert(!(ElemSizeArg == 0 && NumElemsArg && *NumElemsArg == 0) &&
223  "Invalid allocsize arguments -- given allocsize(0, 0)");
224  return get(Context, AllocSize, packAllocSizeArgs(ElemSizeArg, NumElemsArg));
225 }
226 
228  unsigned MinValue,
229  unsigned MaxValue) {
230  return get(Context, VScaleRange, packVScaleRangeArgs(MinValue, MaxValue));
231 }
232 
234  return StringSwitch<Attribute::AttrKind>(AttrName)
235 #define GET_ATTR_NAMES
236 #define ATTRIBUTE_ENUM(ENUM_NAME, DISPLAY_NAME) \
237  .Case(#DISPLAY_NAME, Attribute::ENUM_NAME)
238 #include "llvm/IR/Attributes.inc"
240 }
241 
243  switch (AttrKind) {
244 #define GET_ATTR_NAMES
245 #define ATTRIBUTE_ENUM(ENUM_NAME, DISPLAY_NAME) \
246  case Attribute::ENUM_NAME: \
247  return #DISPLAY_NAME;
248 #include "llvm/IR/Attributes.inc"
249  case Attribute::None:
250  return "none";
251  default:
252  llvm_unreachable("invalid Kind");
253  }
254 }
255 
257  return StringSwitch<bool>(Name)
258 #define GET_ATTR_NAMES
259 #define ATTRIBUTE_ALL(ENUM_NAME, DISPLAY_NAME) .Case(#DISPLAY_NAME, true)
260 #include "llvm/IR/Attributes.inc"
261  .Default(false);
262 }
263 
264 //===----------------------------------------------------------------------===//
265 // Attribute Accessor Methods
266 //===----------------------------------------------------------------------===//
267 
269  return pImpl && pImpl->isEnumAttribute();
270 }
271 
273  return pImpl && pImpl->isIntAttribute();
274 }
275 
277  return pImpl && pImpl->isStringAttribute();
278 }
279 
281  return pImpl && pImpl->isTypeAttribute();
282 }
283 
285  if (!pImpl) return None;
287  "Invalid attribute type to get the kind as an enum!");
288  return pImpl->getKindAsEnum();
289 }
290 
292  if (!pImpl) return 0;
294  "Expected the attribute to be an integer attribute!");
295  return pImpl->getValueAsInt();
296 }
297 
299  if (!pImpl) return false;
301  "Expected the attribute to be a string attribute!");
302  return pImpl->getValueAsBool();
303 }
304 
306  if (!pImpl) return {};
308  "Invalid attribute type to get the kind as a string!");
309  return pImpl->getKindAsString();
310 }
311 
313  if (!pImpl) return {};
315  "Invalid attribute type to get the value as a string!");
316  return pImpl->getValueAsString();
317 }
318 
320  if (!pImpl) return {};
322  "Invalid attribute type to get the value as a type!");
323  return pImpl->getValueAsType();
324 }
325 
326 
328  return (pImpl && pImpl->hasAttribute(Kind)) || (!pImpl && Kind == None);
329 }
330 
332  if (!isStringAttribute()) return false;
333  return pImpl && pImpl->hasAttribute(Kind);
334 }
335 
337  assert(hasAttribute(Attribute::Alignment) &&
338  "Trying to get alignment from non-alignment attribute!");
339  return MaybeAlign(pImpl->getValueAsInt());
340 }
341 
343  assert(hasAttribute(Attribute::StackAlignment) &&
344  "Trying to get alignment from non-alignment attribute!");
345  return MaybeAlign(pImpl->getValueAsInt());
346 }
347 
349  assert(hasAttribute(Attribute::Dereferenceable) &&
350  "Trying to get dereferenceable bytes from "
351  "non-dereferenceable attribute!");
352  return pImpl->getValueAsInt();
353 }
354 
356  assert(hasAttribute(Attribute::DereferenceableOrNull) &&
357  "Trying to get dereferenceable bytes from "
358  "non-dereferenceable attribute!");
359  return pImpl->getValueAsInt();
360 }
361 
362 std::pair<unsigned, std::optional<unsigned>>
364  assert(hasAttribute(Attribute::AllocSize) &&
365  "Trying to get allocsize args from non-allocsize attribute");
366  return unpackAllocSizeArgs(pImpl->getValueAsInt());
367 }
368 
370  assert(hasAttribute(Attribute::VScaleRange) &&
371  "Trying to get vscale args from non-vscale attribute");
372  return unpackVScaleRangeArgs(pImpl->getValueAsInt()).first;
373 }
374 
375 std::optional<unsigned> Attribute::getVScaleRangeMax() const {
376  assert(hasAttribute(Attribute::VScaleRange) &&
377  "Trying to get vscale args from non-vscale attribute");
378  return unpackVScaleRangeArgs(pImpl->getValueAsInt()).second;
379 }
380 
382  assert(hasAttribute(Attribute::UWTable) &&
383  "Trying to get unwind table kind from non-uwtable attribute");
384  return UWTableKind(pImpl->getValueAsInt());
385 }
386 
388  assert(hasAttribute(Attribute::AllocKind) &&
389  "Trying to get allockind value from non-allockind attribute");
390  return AllocFnKind(pImpl->getValueAsInt());
391 }
392 
394  assert(hasAttribute(Attribute::Memory) &&
395  "Can only call getMemoryEffects() on memory attribute");
397 }
398 
399 static const char *getModRefStr(ModRefInfo MR) {
400  switch (MR) {
402  return "none";
403  case ModRefInfo::Ref:
404  return "read";
405  case ModRefInfo::Mod:
406  return "write";
407  case ModRefInfo::ModRef:
408  return "readwrite";
409  }
410  llvm_unreachable("Invalid ModRefInfo");
411 }
412 
413 std::string Attribute::getAsString(bool InAttrGrp) const {
414  if (!pImpl) return {};
415 
416  if (isEnumAttribute())
418 
419  if (isTypeAttribute()) {
420  std::string Result = getNameFromAttrKind(getKindAsEnum()).str();
421  Result += '(';
422  raw_string_ostream OS(Result);
423  getValueAsType()->print(OS, false, true);
424  OS.flush();
425  Result += ')';
426  return Result;
427  }
428 
429  // FIXME: These should be output like this:
430  //
431  // align=4
432  // alignstack=8
433  //
434  if (hasAttribute(Attribute::Alignment))
435  return (InAttrGrp ? "align=" + Twine(getValueAsInt())
436  : "align " + Twine(getValueAsInt()))
437  .str();
438 
439  auto AttrWithBytesToString = [&](const char *Name) {
440  return (InAttrGrp ? Name + ("=" + Twine(getValueAsInt()))
441  : Name + ("(" + Twine(getValueAsInt())) + ")")
442  .str();
443  };
444 
445  if (hasAttribute(Attribute::StackAlignment))
446  return AttrWithBytesToString("alignstack");
447 
448  if (hasAttribute(Attribute::Dereferenceable))
449  return AttrWithBytesToString("dereferenceable");
450 
451  if (hasAttribute(Attribute::DereferenceableOrNull))
452  return AttrWithBytesToString("dereferenceable_or_null");
453 
454  if (hasAttribute(Attribute::AllocSize)) {
455  unsigned ElemSize;
456  std::optional<unsigned> NumElems;
457  std::tie(ElemSize, NumElems) = getAllocSizeArgs();
458 
459  return (NumElems
460  ? "allocsize(" + Twine(ElemSize) + "," + Twine(*NumElems) + ")"
461  : "allocsize(" + Twine(ElemSize) + ")")
462  .str();
463  }
464 
465  if (hasAttribute(Attribute::VScaleRange)) {
466  unsigned MinValue = getVScaleRangeMin();
467  std::optional<unsigned> MaxValue = getVScaleRangeMax();
468  return ("vscale_range(" + Twine(MinValue) + "," +
469  Twine(MaxValue.value_or(0)) + ")")
470  .str();
471  }
472 
473  if (hasAttribute(Attribute::UWTable)) {
475  if (Kind != UWTableKind::None) {
476  return Kind == UWTableKind::Default
477  ? "uwtable"
478  : ("uwtable(" +
479  Twine(Kind == UWTableKind::Sync ? "sync" : "async") + ")")
480  .str();
481  }
482  }
483 
484  if (hasAttribute(Attribute::AllocKind)) {
488  parts.push_back("alloc");
490  parts.push_back("realloc");
492  parts.push_back("free");
494  parts.push_back("uninitialized");
496  parts.push_back("zeroed");
498  parts.push_back("aligned");
499  return ("allockind(\"" +
500  Twine(llvm::join(parts.begin(), parts.end(), ",")) + "\")")
501  .str();
502  }
503 
504  if (hasAttribute(Attribute::Memory)) {
505  std::string Result;
506  raw_string_ostream OS(Result);
507  bool First = true;
508  OS << "memory(";
509 
511 
512  // Print access kind for "other" as the default access kind. This way it
513  // will apply to any new location kinds that get split out of "other".
515  if (OtherMR != ModRefInfo::NoModRef || ME.getModRef() == OtherMR) {
516  First = false;
517  OS << getModRefStr(OtherMR);
518  }
519 
520  for (auto Loc : MemoryEffects::locations()) {
521  ModRefInfo MR = ME.getModRef(Loc);
522  if (MR == OtherMR)
523  continue;
524 
525  if (!First)
526  OS << ", ";
527  First = false;
528 
529  switch (Loc) {
531  OS << "argmem: ";
532  break;
534  OS << "inaccessiblemem: ";
535  break;
537  llvm_unreachable("This is represented as the default access kind");
538  }
539  OS << getModRefStr(MR);
540  }
541  OS << ")";
542  OS.flush();
543  return Result;
544  }
545 
546  // Convert target-dependent attributes to strings of the form:
547  //
548  // "kind"
549  // "kind" = "value"
550  //
551  if (isStringAttribute()) {
552  std::string Result;
553  {
554  raw_string_ostream OS(Result);
555  OS << '"' << getKindAsString() << '"';
556 
557  // Since some attribute strings contain special characters that cannot be
558  // printable, those have to be escaped to make the attribute value
559  // printable as is. e.g. "\01__gnu_mcount_nc"
560  const auto &AttrVal = pImpl->getValueAsString();
561  if (!AttrVal.empty()) {
562  OS << "=\"";
563  printEscapedString(AttrVal, OS);
564  OS << "\"";
565  }
566  }
567  return Result;
568  }
569 
570  llvm_unreachable("Unknown attribute");
571 }
572 
574  assert(isValid() && "invalid Attribute doesn't refer to any context");
576  pImpl->Profile(ID);
577  void *Unused;
578  return C.pImpl->AttrsSet.FindNodeOrInsertPos(ID, Unused) == pImpl;
579 }
580 
582  if (!pImpl && !A.pImpl) return false;
583  if (!pImpl) return true;
584  if (!A.pImpl) return false;
585  return *pImpl < *A.pImpl;
586 }
587 
589  ID.AddPointer(pImpl);
590 }
591 
593  FnAttr = (1 << 0),
594  ParamAttr = (1 << 1),
595  RetAttr = (1 << 2),
596 };
597 
598 #define GET_ATTR_PROP_TABLE
599 #include "llvm/IR/Attributes.inc"
600 
602  AttributeProperty Prop) {
603  unsigned Index = Kind - 1;
604  assert(Index < std::size(AttrPropTable) && "Invalid attribute kind");
605  return AttrPropTable[Index] & Prop;
606 }
607 
610 }
611 
614 }
615 
618 }
619 
620 //===----------------------------------------------------------------------===//
621 // AttributeImpl Definition
622 //===----------------------------------------------------------------------===//
623 
625  if (isStringAttribute()) return false;
626  return getKindAsEnum() == A;
627 }
628 
630  if (!isStringAttribute()) return false;
631  return getKindAsString() == Kind;
632 }
633 
636  return static_cast<const EnumAttributeImpl *>(this)->getEnumKind();
637 }
638 
641  return static_cast<const IntAttributeImpl *>(this)->getValue();
642 }
643 
645  assert(getValueAsString().empty() || getValueAsString() == "false" || getValueAsString() == "true");
646  return getValueAsString() == "true";
647 }
648 
651  return static_cast<const StringAttributeImpl *>(this)->getStringKind();
652 }
653 
656  return static_cast<const StringAttributeImpl *>(this)->getStringValue();
657 }
658 
661  return static_cast<const TypeAttributeImpl *>(this)->getTypeValue();
662 }
663 
665  if (this == &AI)
666  return false;
667 
668  // This sorts the attributes with Attribute::AttrKinds coming first (sorted
669  // relative to their enum value) and then strings.
670  if (!isStringAttribute()) {
671  if (AI.isStringAttribute())
672  return true;
673  if (getKindAsEnum() != AI.getKindAsEnum())
674  return getKindAsEnum() < AI.getKindAsEnum();
675  assert(!AI.isEnumAttribute() && "Non-unique attribute");
676  assert(!AI.isTypeAttribute() && "Comparison of types would be unstable");
677  // TODO: Is this actually needed?
678  assert(AI.isIntAttribute() && "Only possibility left");
679  return getValueAsInt() < AI.getValueAsInt();
680  }
681 
682  if (!AI.isStringAttribute())
683  return false;
684  if (getKindAsString() == AI.getKindAsString())
685  return getValueAsString() < AI.getValueAsString();
686  return getKindAsString() < AI.getKindAsString();
687 }
688 
689 //===----------------------------------------------------------------------===//
690 // AttributeSet Definition
691 //===----------------------------------------------------------------------===//
692 
695 }
696 
699 }
700 
702  Attribute::AttrKind Kind) const {
703  if (hasAttribute(Kind)) return *this;
704  AttrBuilder B(C);
705  B.addAttribute(Kind);
706  return addAttributes(C, AttributeSet::get(C, B));
707 }
708 
710  StringRef Value) const {
711  AttrBuilder B(C);
712  B.addAttribute(Kind, Value);
713  return addAttributes(C, AttributeSet::get(C, B));
714 }
715 
717  const AttributeSet AS) const {
718  if (!hasAttributes())
719  return AS;
720 
721  if (!AS.hasAttributes())
722  return *this;
723 
724  AttrBuilder B(C, *this);
725  B.merge(AttrBuilder(C, AS));
726  return get(C, B);
727 }
728 
730  Attribute::AttrKind Kind) const {
731  if (!hasAttribute(Kind)) return *this;
732  AttrBuilder B(C, *this);
733  B.removeAttribute(Kind);
734  return get(C, B);
735 }
736 
738  StringRef Kind) const {
739  if (!hasAttribute(Kind)) return *this;
740  AttrBuilder B(C, *this);
741  B.removeAttribute(Kind);
742  return get(C, B);
743 }
744 
746  const AttributeMask &Attrs) const {
747  AttrBuilder B(C, *this);
748  // If there is nothing to remove, directly return the original set.
749  if (!B.overlaps(Attrs))
750  return *this;
751 
752  B.remove(Attrs);
753  return get(C, B);
754 }
755 
757  return SetNode ? SetNode->getNumAttributes() : 0;
758 }
759 
761  return SetNode ? SetNode->hasAttribute(Kind) : false;
762 }
763 
765  return SetNode ? SetNode->hasAttribute(Kind) : false;
766 }
767 
769  return SetNode ? SetNode->getAttribute(Kind) : Attribute();
770 }
771 
773  return SetNode ? SetNode->getAttribute(Kind) : Attribute();
774 }
775 
777  return SetNode ? SetNode->getAlignment() : std::nullopt;
778 }
779 
781  return SetNode ? SetNode->getStackAlignment() : std::nullopt;
782 }
783 
785  return SetNode ? SetNode->getDereferenceableBytes() : 0;
786 }
787 
789  return SetNode ? SetNode->getDereferenceableOrNullBytes() : 0;
790 }
791 
793  return SetNode ? SetNode->getAttributeType(Attribute::ByRef) : nullptr;
794 }
795 
797  return SetNode ? SetNode->getAttributeType(Attribute::ByVal) : nullptr;
798 }
799 
801  return SetNode ? SetNode->getAttributeType(Attribute::StructRet) : nullptr;
802 }
803 
805  return SetNode ? SetNode->getAttributeType(Attribute::Preallocated) : nullptr;
806 }
807 
809  return SetNode ? SetNode->getAttributeType(Attribute::InAlloca) : nullptr;
810 }
811 
813  return SetNode ? SetNode->getAttributeType(Attribute::ElementType) : nullptr;
814 }
815 
816 std::optional<std::pair<unsigned, std::optional<unsigned>>>
818  if (SetNode)
819  return SetNode->getAllocSizeArgs();
820  return std::nullopt;
821 }
822 
824  return SetNode ? SetNode->getVScaleRangeMin() : 1;
825 }
826 
827 std::optional<unsigned> AttributeSet::getVScaleRangeMax() const {
828  return SetNode ? SetNode->getVScaleRangeMax() : std::nullopt;
829 }
830 
832  return SetNode ? SetNode->getUWTableKind() : UWTableKind::None;
833 }
834 
836  return SetNode ? SetNode->getAllocKind() : AllocFnKind::Unknown;
837 }
838 
840  return SetNode ? SetNode->getMemoryEffects() : MemoryEffects::unknown();
841 }
842 
843 std::string AttributeSet::getAsString(bool InAttrGrp) const {
844  return SetNode ? SetNode->getAsString(InAttrGrp) : "";
845 }
846 
848  assert(hasAttributes() && "empty AttributeSet doesn't refer to any context");
850  SetNode->Profile(ID);
851  void *Unused;
852  return C.pImpl->AttrsSetNodes.FindNodeOrInsertPos(ID, Unused) == SetNode;
853 }
854 
856  return SetNode ? SetNode->begin() : nullptr;
857 }
858 
860  return SetNode ? SetNode->end() : nullptr;
861 }
862 
863 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
865  dbgs() << "AS =\n";
866  dbgs() << " { ";
867  dbgs() << getAsString(true) << " }\n";
868 }
869 #endif
870 
871 //===----------------------------------------------------------------------===//
872 // AttributeSetNode Definition
873 //===----------------------------------------------------------------------===//
874 
875 AttributeSetNode::AttributeSetNode(ArrayRef<Attribute> Attrs)
876  : NumAttrs(Attrs.size()) {
877  // There's memory after the node where we can store the entries in.
878  llvm::copy(Attrs, getTrailingObjects<Attribute>());
879 
880  for (const auto &I : *this) {
881  if (I.isStringAttribute())
882  StringAttrs.insert({ I.getKindAsString(), I });
883  else
884  AvailableAttrs.addAttribute(I.getKindAsEnum());
885  }
886 }
887 
890  SmallVector<Attribute, 8> SortedAttrs(Attrs.begin(), Attrs.end());
891  llvm::sort(SortedAttrs);
892  return getSorted(C, SortedAttrs);
893 }
894 
895 AttributeSetNode *AttributeSetNode::getSorted(LLVMContext &C,
896  ArrayRef<Attribute> SortedAttrs) {
897  if (SortedAttrs.empty())
898  return nullptr;
899 
900  // Build a key to look up the existing attributes.
901  LLVMContextImpl *pImpl = C.pImpl;
903 
904  assert(llvm::is_sorted(SortedAttrs) && "Expected sorted attributes!");
905  for (const auto &Attr : SortedAttrs)
906  Attr.Profile(ID);
907 
908  void *InsertPoint;
909  AttributeSetNode *PA =
910  pImpl->AttrsSetNodes.FindNodeOrInsertPos(ID, InsertPoint);
911 
912  // If we didn't find any existing attributes of the same shape then create a
913  // new one and insert it.
914  if (!PA) {
915  // Coallocate entries after the AttributeSetNode itself.
916  void *Mem = ::operator new(totalSizeToAlloc<Attribute>(SortedAttrs.size()));
917  PA = new (Mem) AttributeSetNode(SortedAttrs);
918  pImpl->AttrsSetNodes.InsertNode(PA, InsertPoint);
919  }
920 
921  // Return the AttributeSetNode that we found or created.
922  return PA;
923 }
924 
926  return getSorted(C, B.attrs());
927 }
928 
930  return StringAttrs.count(Kind);
931 }
932 
933 std::optional<Attribute>
934 AttributeSetNode::findEnumAttribute(Attribute::AttrKind Kind) const {
935  // Do a quick presence check.
936  if (!hasAttribute(Kind))
937  return std::nullopt;
938 
939  // Attributes in a set are sorted by enum value, followed by string
940  // attributes. Binary search the one we want.
941  const Attribute *I =
942  std::lower_bound(begin(), end() - StringAttrs.size(), Kind,
944  return A.getKindAsEnum() < Kind;
945  });
946  assert(I != end() && I->hasAttribute(Kind) && "Presence check failed?");
947  return *I;
948 }
949 
951  if (auto A = findEnumAttribute(Kind))
952  return *A;
953  return {};
954 }
955 
957  return StringAttrs.lookup(Kind);
958 }
959 
961  if (auto A = findEnumAttribute(Attribute::Alignment))
962  return A->getAlignment();
963  return std::nullopt;
964 }
965 
967  if (auto A = findEnumAttribute(Attribute::StackAlignment))
968  return A->getStackAlignment();
969  return std::nullopt;
970 }
971 
973  if (auto A = findEnumAttribute(Kind))
974  return A->getValueAsType();
975  return nullptr;
976 }
977 
979  if (auto A = findEnumAttribute(Attribute::Dereferenceable))
980  return A->getDereferenceableBytes();
981  return 0;
982 }
983 
985  if (auto A = findEnumAttribute(Attribute::DereferenceableOrNull))
986  return A->getDereferenceableOrNullBytes();
987  return 0;
988 }
989 
990 std::optional<std::pair<unsigned, std::optional<unsigned>>>
992  if (auto A = findEnumAttribute(Attribute::AllocSize))
993  return A->getAllocSizeArgs();
994  return std::nullopt;
995 }
996 
998  if (auto A = findEnumAttribute(Attribute::VScaleRange))
999  return A->getVScaleRangeMin();
1000  return 1;
1001 }
1002 
1003 std::optional<unsigned> AttributeSetNode::getVScaleRangeMax() const {
1004  if (auto A = findEnumAttribute(Attribute::VScaleRange))
1005  return A->getVScaleRangeMax();
1006  return std::nullopt;
1007 }
1008 
1010  if (auto A = findEnumAttribute(Attribute::UWTable))
1011  return A->getUWTableKind();
1012  return UWTableKind::None;
1013 }
1014 
1016  if (auto A = findEnumAttribute(Attribute::AllocKind))
1017  return A->getAllocKind();
1018  return AllocFnKind::Unknown;
1019 }
1020 
1022  if (auto A = findEnumAttribute(Attribute::Memory))
1023  return A->getMemoryEffects();
1024  return MemoryEffects::unknown();
1025 }
1026 
1027 std::string AttributeSetNode::getAsString(bool InAttrGrp) const {
1028  std::string Str;
1029  for (iterator I = begin(), E = end(); I != E; ++I) {
1030  if (I != begin())
1031  Str += ' ';
1032  Str += I->getAsString(InAttrGrp);
1033  }
1034  return Str;
1035 }
1036 
1037 //===----------------------------------------------------------------------===//
1038 // AttributeListImpl Definition
1039 //===----------------------------------------------------------------------===//
1040 
1041 /// Map from AttributeList index to the internal array index. Adding one happens
1042 /// to work, because -1 wraps around to 0.
1043 static unsigned attrIdxToArrayIdx(unsigned Index) {
1044  return Index + 1;
1045 }
1046 
1048  : NumAttrSets(Sets.size()) {
1049  assert(!Sets.empty() && "pointless AttributeListImpl");
1050 
1051  // There's memory after the node where we can store the entries in.
1052  llvm::copy(Sets, getTrailingObjects<AttributeSet>());
1053 
1054  // Initialize AvailableFunctionAttrs and AvailableSomewhereAttrs
1055  // summary bitsets.
1056  for (const auto &I : Sets[attrIdxToArrayIdx(AttributeList::FunctionIndex)])
1057  if (!I.isStringAttribute())
1058  AvailableFunctionAttrs.addAttribute(I.getKindAsEnum());
1059 
1060  for (const auto &Set : Sets)
1061  for (const auto &I : Set)
1062  if (!I.isStringAttribute())
1063  AvailableSomewhereAttrs.addAttribute(I.getKindAsEnum());
1064 }
1065 
1067  Profile(ID, ArrayRef(begin(), end()));
1068 }
1069 
1071  ArrayRef<AttributeSet> Sets) {
1072  for (const auto &Set : Sets)
1073  ID.AddPointer(Set.SetNode);
1074 }
1075 
1077  unsigned *Index) const {
1078  if (!AvailableSomewhereAttrs.hasAttribute(Kind))
1079  return false;
1080 
1081  if (Index) {
1082  for (unsigned I = 0, E = NumAttrSets; I != E; ++I) {
1083  if (begin()[I].hasAttribute(Kind)) {
1084  *Index = I - 1;
1085  break;
1086  }
1087  }
1088  }
1089 
1090  return true;
1091 }
1092 
1093 
1094 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
1096  AttributeList(const_cast<AttributeListImpl *>(this)).dump();
1097 }
1098 #endif
1099 
1100 //===----------------------------------------------------------------------===//
1101 // AttributeList Construction and Mutation Methods
1102 //===----------------------------------------------------------------------===//
1103 
1105  ArrayRef<AttributeSet> AttrSets) {
1106  assert(!AttrSets.empty() && "pointless AttributeListImpl");
1107 
1108  LLVMContextImpl *pImpl = C.pImpl;
1110  AttributeListImpl::Profile(ID, AttrSets);
1111 
1112  void *InsertPoint;
1113  AttributeListImpl *PA =
1114  pImpl->AttrsLists.FindNodeOrInsertPos(ID, InsertPoint);
1115 
1116  // If we didn't find any existing attributes of the same shape then
1117  // create a new one and insert it.
1118  if (!PA) {
1119  // Coallocate entries after the AttributeListImpl itself.
1120  void *Mem = pImpl->Alloc.Allocate(
1121  AttributeListImpl::totalSizeToAlloc<AttributeSet>(AttrSets.size()),
1122  alignof(AttributeListImpl));
1123  PA = new (Mem) AttributeListImpl(AttrSets);
1124  pImpl->AttrsLists.InsertNode(PA, InsertPoint);
1125  }
1126 
1127  // Return the AttributesList that we found or created.
1128  return AttributeList(PA);
1129 }
1130 
1133  ArrayRef<std::pair<unsigned, Attribute>> Attrs) {
1134  // If there are no attributes then return a null AttributesList pointer.
1135  if (Attrs.empty())
1136  return {};
1137 
1139  "Misordered Attributes list!");
1141  [](const std::pair<unsigned, Attribute> &Pair) {
1142  return Pair.second.isValid();
1143  }) &&
1144  "Pointless attribute!");
1145 
1146  // Create a vector if (unsigned, AttributeSetNode*) pairs from the attributes
1147  // list.
1149  for (ArrayRef<std::pair<unsigned, Attribute>>::iterator I = Attrs.begin(),
1150  E = Attrs.end(); I != E; ) {
1151  unsigned Index = I->first;
1152  SmallVector<Attribute, 4> AttrVec;
1153  while (I != E && I->first == Index) {
1154  AttrVec.push_back(I->second);
1155  ++I;
1156  }
1157 
1158  AttrPairVec.emplace_back(Index, AttributeSet::get(C, AttrVec));
1159  }
1160 
1161  return get(C, AttrPairVec);
1162 }
1163 
1166  ArrayRef<std::pair<unsigned, AttributeSet>> Attrs) {
1167  // If there are no attributes then return a null AttributesList pointer.
1168  if (Attrs.empty())
1169  return {};
1170 
1172  "Misordered Attributes list!");
1174  [](const std::pair<unsigned, AttributeSet> &Pair) {
1175  return !Pair.second.hasAttributes();
1176  }) &&
1177  "Pointless attribute!");
1178 
1179  unsigned MaxIndex = Attrs.back().first;
1180  // If the MaxIndex is FunctionIndex and there are other indices in front
1181  // of it, we need to use the largest of those to get the right size.
1182  if (MaxIndex == FunctionIndex && Attrs.size() > 1)
1183  MaxIndex = Attrs[Attrs.size() - 2].first;
1184 
1185  SmallVector<AttributeSet, 4> AttrVec(attrIdxToArrayIdx(MaxIndex) + 1);
1186  for (const auto &Pair : Attrs)
1187  AttrVec[attrIdxToArrayIdx(Pair.first)] = Pair.second;
1188 
1189  return getImpl(C, AttrVec);
1190 }
1191 
1193  AttributeSet RetAttrs,
1194  ArrayRef<AttributeSet> ArgAttrs) {
1195  // Scan from the end to find the last argument with attributes. Most
1196  // arguments don't have attributes, so it's nice if we can have fewer unique
1197  // AttributeListImpls by dropping empty attribute sets at the end of the list.
1198  unsigned NumSets = 0;
1199  for (size_t I = ArgAttrs.size(); I != 0; --I) {
1200  if (ArgAttrs[I - 1].hasAttributes()) {
1201  NumSets = I + 2;
1202  break;
1203  }
1204  }
1205  if (NumSets == 0) {
1206  // Check function and return attributes if we didn't have argument
1207  // attributes.
1208  if (RetAttrs.hasAttributes())
1209  NumSets = 2;
1210  else if (FnAttrs.hasAttributes())
1211  NumSets = 1;
1212  }
1213 
1214  // If all attribute sets were empty, we can use the empty attribute list.
1215  if (NumSets == 0)
1216  return {};
1217 
1219  AttrSets.reserve(NumSets);
1220  // If we have any attributes, we always have function attributes.
1221  AttrSets.push_back(FnAttrs);
1222  if (NumSets > 1)
1223  AttrSets.push_back(RetAttrs);
1224  if (NumSets > 2) {
1225  // Drop the empty argument attribute sets at the end.
1226  ArgAttrs = ArgAttrs.take_front(NumSets - 2);
1227  llvm::append_range(AttrSets, ArgAttrs);
1228  }
1229 
1230  return getImpl(C, AttrSets);
1231 }
1232 
1234  AttributeSet Attrs) {
1235  if (!Attrs.hasAttributes())
1236  return {};
1238  SmallVector<AttributeSet, 8> AttrSets(Index + 1);
1239  AttrSets[Index] = Attrs;
1240  return getImpl(C, AttrSets);
1241 }
1242 
1244  const AttrBuilder &B) {
1245  return get(C, Index, AttributeSet::get(C, B));
1246 }
1247 
1251  for (const auto K : Kinds)
1252  Attrs.emplace_back(Index, Attribute::get(C, K));
1253  return get(C, Attrs);
1254 }
1255 
1258  ArrayRef<uint64_t> Values) {
1259  assert(Kinds.size() == Values.size() && "Mismatched attribute values.");
1261  auto VI = Values.begin();
1262  for (const auto K : Kinds)
1263  Attrs.emplace_back(Index, Attribute::get(C, K, *VI++));
1264  return get(C, Attrs);
1265 }
1266 
1268  ArrayRef<StringRef> Kinds) {
1270  for (const auto &K : Kinds)
1271  Attrs.emplace_back(Index, Attribute::get(C, K));
1272  return get(C, Attrs);
1273 }
1274 
1277  if (Attrs.empty())
1278  return {};
1279  if (Attrs.size() == 1)
1280  return Attrs[0];
1281 
1282  unsigned MaxSize = 0;
1283  for (const auto &List : Attrs)
1284  MaxSize = std::max(MaxSize, List.getNumAttrSets());
1285 
1286  // If every list was empty, there is no point in merging the lists.
1287  if (MaxSize == 0)
1288  return {};
1289 
1290  SmallVector<AttributeSet, 8> NewAttrSets(MaxSize);
1291  for (unsigned I = 0; I < MaxSize; ++I) {
1292  AttrBuilder CurBuilder(C);
1293  for (const auto &List : Attrs)
1294  CurBuilder.merge(AttrBuilder(C, List.getAttributes(I - 1)));
1295  NewAttrSets[I] = AttributeSet::get(C, CurBuilder);
1296  }
1297 
1298  return getImpl(C, NewAttrSets);
1299 }
1300 
1303  Attribute::AttrKind Kind) const {
1305  if (Attrs.hasAttribute(Kind))
1306  return *this;
1307  // TODO: Insert at correct position and avoid sort.
1309  NewAttrs.push_back(Attribute::get(C, Kind));
1310  return setAttributesAtIndex(C, Index, AttributeSet::get(C, NewAttrs));
1311 }
1312 
1314  StringRef Kind,
1315  StringRef Value) const {
1316  AttrBuilder B(C);
1317  B.addAttribute(Kind, Value);
1318  return addAttributesAtIndex(C, Index, B);
1319 }
1320 
1322  Attribute A) const {
1323  AttrBuilder B(C);
1324  B.addAttribute(A);
1325  return addAttributesAtIndex(C, Index, B);
1326 }
1327 
1328 AttributeList AttributeList::setAttributesAtIndex(LLVMContext &C,
1329  unsigned Index,
1330  AttributeSet Attrs) const {
1332  SmallVector<AttributeSet, 4> AttrSets(this->begin(), this->end());
1333  if (Index >= AttrSets.size())
1334  AttrSets.resize(Index + 1);
1335  AttrSets[Index] = Attrs;
1336 
1337  // Remove trailing empty attribute sets.
1338  while (!AttrSets.empty() && !AttrSets.back().hasAttributes())
1339  AttrSets.pop_back();
1340  if (AttrSets.empty())
1341  return {};
1342  return AttributeList::getImpl(C, AttrSets);
1343 }
1344 
1346  unsigned Index,
1347  const AttrBuilder &B) const {
1348  if (!B.hasAttributes())
1349  return *this;
1350 
1351  if (!pImpl)
1352  return AttributeList::get(C, {{Index, AttributeSet::get(C, B)}});
1353 
1354  AttrBuilder Merged(C, getAttributes(Index));
1355  Merged.merge(B);
1356  return setAttributesAtIndex(C, Index, AttributeSet::get(C, Merged));
1357 }
1358 
1360  ArrayRef<unsigned> ArgNos,
1361  Attribute A) const {
1362  assert(llvm::is_sorted(ArgNos));
1363 
1364  SmallVector<AttributeSet, 4> AttrSets(this->begin(), this->end());
1365  unsigned MaxIndex = attrIdxToArrayIdx(ArgNos.back() + FirstArgIndex);
1366  if (MaxIndex >= AttrSets.size())
1367  AttrSets.resize(MaxIndex + 1);
1368 
1369  for (unsigned ArgNo : ArgNos) {
1370  unsigned Index = attrIdxToArrayIdx(ArgNo + FirstArgIndex);
1371  AttrBuilder B(C, AttrSets[Index]);
1372  B.addAttribute(A);
1373  AttrSets[Index] = AttributeSet::get(C, B);
1374  }
1375 
1376  return getImpl(C, AttrSets);
1377 }
1378 
1381  Attribute::AttrKind Kind) const {
1383  AttributeSet NewAttrs = Attrs.removeAttribute(C, Kind);
1384  if (Attrs == NewAttrs)
1385  return *this;
1386  return setAttributesAtIndex(C, Index, NewAttrs);
1387 }
1388 
1390  unsigned Index,
1391  StringRef Kind) const {
1393  AttributeSet NewAttrs = Attrs.removeAttribute(C, Kind);
1394  if (Attrs == NewAttrs)
1395  return *this;
1396  return setAttributesAtIndex(C, Index, NewAttrs);
1397 }
1398 
1400  LLVMContext &C, unsigned Index, const AttributeMask &AttrsToRemove) const {
1402  AttributeSet NewAttrs = Attrs.removeAttributes(C, AttrsToRemove);
1403  // If nothing was removed, return the original list.
1404  if (Attrs == NewAttrs)
1405  return *this;
1406  return setAttributesAtIndex(C, Index, NewAttrs);
1407 }
1408 
1411  unsigned WithoutIndex) const {
1412  if (!pImpl)
1413  return {};
1414  if (attrIdxToArrayIdx(WithoutIndex) >= getNumAttrSets())
1415  return *this;
1416  return setAttributesAtIndex(C, WithoutIndex, AttributeSet());
1417 }
1418 
1420  uint64_t Bytes) const {
1421  AttrBuilder B(C);
1422  B.addDereferenceableAttr(Bytes);
1423  return addRetAttributes(C, B);
1424 }
1425 
1427  unsigned Index,
1428  uint64_t Bytes) const {
1429  AttrBuilder B(C);
1430  B.addDereferenceableAttr(Bytes);
1431  return addParamAttributes(C, Index, B);
1432 }
1433 
1436  uint64_t Bytes) const {
1437  AttrBuilder B(C);
1438  B.addDereferenceableOrNullAttr(Bytes);
1439  return addParamAttributes(C, Index, B);
1440 }
1441 
1443  LLVMContext &C, unsigned Index, unsigned ElemSizeArg,
1444  const std::optional<unsigned> &NumElemsArg) {
1445  AttrBuilder B(C);
1446  B.addAllocSizeAttr(ElemSizeArg, NumElemsArg);
1447  return addParamAttributes(C, Index, B);
1448 }
1449 
1450 //===----------------------------------------------------------------------===//
1451 // AttributeList Accessor Methods
1452 //===----------------------------------------------------------------------===//
1453 
1455  return getAttributes(ArgNo + FirstArgIndex);
1456 }
1457 
1459  return getAttributes(ReturnIndex);
1460 }
1461 
1463  return getAttributes(FunctionIndex);
1464 }
1465 
1467  Attribute::AttrKind Kind) const {
1469 }
1470 
1473 }
1474 
1476  return getAttributes(Index).hasAttributes();
1477 }
1478 
1480  return pImpl && pImpl->hasFnAttribute(Kind);
1481 }
1482 
1485 }
1486 
1488  unsigned *Index) const {
1489  return pImpl && pImpl->hasAttrSomewhere(Attr, Index);
1490 }
1491 
1493  Attribute::AttrKind Kind) const {
1495 }
1496 
1498  StringRef Kind) const {
1500 }
1501 
1504 }
1505 
1507  return getAttributes(ArgNo + FirstArgIndex).getAlignment();
1508 }
1509 
1511  return getAttributes(ArgNo + FirstArgIndex).getStackAlignment();
1512 }
1513 
1516 }
1517 
1520 }
1521 
1524 }
1525 
1528 }
1529 
1532 }
1533 
1536 }
1537 
1539  return getFnAttrs().getStackAlignment();
1540 }
1541 
1543  return getRetAttrs().getStackAlignment();
1544 }
1545 
1548 }
1549 
1552 }
1553 
1556 }
1557 
1558 uint64_t
1561 }
1562 
1564  return getFnAttrs().getUWTableKind();
1565 }
1566 
1568  return getFnAttrs().getAllocKind();
1569 }
1570 
1572  return getFnAttrs().getMemoryEffects();
1573 }
1574 
1575 std::string AttributeList::getAsString(unsigned Index, bool InAttrGrp) const {
1576  return getAttributes(Index).getAsString(InAttrGrp);
1577 }
1578 
1581  if (!pImpl || Index >= getNumAttrSets())
1582  return {};
1583  return pImpl->begin()[Index];
1584 }
1585 
1587  assert(!isEmpty() && "an empty attribute list has no parent context");
1589  pImpl->Profile(ID);
1590  void *Unused;
1591  return C.pImpl->AttrsLists.FindNodeOrInsertPos(ID, Unused) == pImpl;
1592 }
1593 
1595  return pImpl ? pImpl->begin() : nullptr;
1596 }
1597 
1599  return pImpl ? pImpl->end() : nullptr;
1600 }
1601 
1602 //===----------------------------------------------------------------------===//
1603 // AttributeList Introspection Methods
1604 //===----------------------------------------------------------------------===//
1605 
1607  return pImpl ? pImpl->NumAttrSets : 0;
1608 }
1609 
1611  O << "AttributeList[\n";
1612 
1613  for (unsigned i : indexes()) {
1614  if (!getAttributes(i).hasAttributes())
1615  continue;
1616  O << " { ";
1617  switch (i) {
1618  case AttrIndex::ReturnIndex:
1619  O << "return";
1620  break;
1621  case AttrIndex::FunctionIndex:
1622  O << "function";
1623  break;
1624  default:
1625  O << "arg(" << i - AttrIndex::FirstArgIndex << ")";
1626  }
1627  O << " => " << getAsString(i) << " }\n";
1628  }
1629 
1630  O << "]\n";
1631 }
1632 
1633 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
1635 #endif
1636 
1637 //===----------------------------------------------------------------------===//
1638 // AttrBuilder Method Implementations
1639 //===----------------------------------------------------------------------===//
1640 
1642  append_range(Attrs, AS);
1643  assert(is_sorted(Attrs) && "AttributeSet should be sorted");
1644 }
1645 
1646 void AttrBuilder::clear() { Attrs.clear(); }
1647 
1648 /// Attribute comparator that only compares attribute keys. Enum attributes are
1649 /// sorted before string attributes.
1651  bool operator()(Attribute A0, Attribute A1) const {
1652  bool A0IsString = A0.isStringAttribute();
1653  bool A1IsString = A1.isStringAttribute();
1654  if (A0IsString) {
1655  if (A1IsString)
1656  return A0.getKindAsString() < A1.getKindAsString();
1657  else
1658  return false;
1659  }
1660  if (A1IsString)
1661  return true;
1662  return A0.getKindAsEnum() < A1.getKindAsEnum();
1663  }
1665  if (A0.isStringAttribute())
1666  return false;
1667  return A0.getKindAsEnum() < Kind;
1668  }
1669  bool operator()(Attribute A0, StringRef Kind) const {
1670  if (A0.isStringAttribute())
1671  return A0.getKindAsString() < Kind;
1672  return true;
1673  }
1674 };
1675 
1676 template <typename K>
1678  Attribute Attr) {
1679  auto It = lower_bound(Attrs, Kind, AttributeComparator());
1680  if (It != Attrs.end() && It->hasAttribute(Kind))
1681  std::swap(*It, Attr);
1682  else
1683  Attrs.insert(It, Attr);
1684 }
1685 
1687  if (Attr.isStringAttribute())
1688  addAttributeImpl(Attrs, Attr.getKindAsString(), Attr);
1689  else
1690  addAttributeImpl(Attrs, Attr.getKindAsEnum(), Attr);
1691  return *this;
1692 }
1693 
1695  addAttributeImpl(Attrs, Kind, Attribute::get(Ctx, Kind));
1696  return *this;
1697 }
1698 
1700  addAttributeImpl(Attrs, A, Attribute::get(Ctx, A, V));
1701  return *this;
1702 }
1703 
1705  assert((unsigned)Val < Attribute::EndAttrKinds && "Attribute out of range!");
1706  auto It = lower_bound(Attrs, Val, AttributeComparator());
1707  if (It != Attrs.end() && It->hasAttribute(Val))
1708  Attrs.erase(It);
1709  return *this;
1710 }
1711 
1713  auto It = lower_bound(Attrs, A, AttributeComparator());
1714  if (It != Attrs.end() && It->hasAttribute(A))
1715  Attrs.erase(It);
1716  return *this;
1717 }
1718 
1719 std::optional<uint64_t>
1721  assert(Attribute::isIntAttrKind(Kind) && "Not an int attribute");
1722  Attribute A = getAttribute(Kind);
1723  if (A.isValid())
1724  return A.getValueAsInt();
1725  return std::nullopt;
1726 }
1727 
1729  uint64_t Value) {
1730  return addAttribute(Attribute::get(Ctx, Kind, Value));
1731 }
1732 
1733 std::optional<std::pair<unsigned, std::optional<unsigned>>>
1735  Attribute A = getAttribute(Attribute::AllocSize);
1736  if (A.isValid())
1737  return A.getAllocSizeArgs();
1738  return std::nullopt;
1739 }
1740 
1742  if (!Align)
1743  return *this;
1744 
1745  assert(*Align <= llvm::Value::MaximumAlignment && "Alignment too large.");
1746  return addRawIntAttr(Attribute::Alignment, Align->value());
1747 }
1748 
1750  // Default alignment, allow the target to define how to align it.
1751  if (!Align)
1752  return *this;
1753 
1754  assert(*Align <= 0x100 && "Alignment too large.");
1755  return addRawIntAttr(Attribute::StackAlignment, Align->value());
1756 }
1757 
1759  if (Bytes == 0) return *this;
1760 
1761  return addRawIntAttr(Attribute::Dereferenceable, Bytes);
1762 }
1763 
1765  if (Bytes == 0)
1766  return *this;
1767 
1768  return addRawIntAttr(Attribute::DereferenceableOrNull, Bytes);
1769 }
1770 
1771 AttrBuilder &
1773  const std::optional<unsigned> &NumElems) {
1774  return addAllocSizeAttrFromRawRepr(packAllocSizeArgs(ElemSize, NumElems));
1775 }
1776 
1778  // (0, 0) is our "not present" value, so we need to check for it here.
1779  assert(RawArgs && "Invalid allocsize arguments -- given allocsize(0, 0)");
1780  return addRawIntAttr(Attribute::AllocSize, RawArgs);
1781 }
1782 
1784  std::optional<unsigned> MaxValue) {
1785  return addVScaleRangeAttrFromRawRepr(packVScaleRangeArgs(MinValue, MaxValue));
1786 }
1787 
1789  // (0, 0) is not present hence ignore this case
1790  if (RawArgs == 0)
1791  return *this;
1792 
1793  return addRawIntAttr(Attribute::VScaleRange, RawArgs);
1794 }
1795 
1797  if (Kind == UWTableKind::None)
1798  return *this;
1799  return addRawIntAttr(Attribute::UWTable, uint64_t(Kind));
1800 }
1801 
1803  return addRawIntAttr(Attribute::Memory, ME.toIntValue());
1804 }
1805 
1807  return addRawIntAttr(Attribute::AllocKind, static_cast<uint64_t>(Kind));
1808 }
1809 
1811  assert(Attribute::isTypeAttrKind(Kind) && "Not a type attribute");
1812  Attribute A = getAttribute(Kind);
1813  return A.isValid() ? A.getValueAsType() : nullptr;
1814 }
1815 
1817  return addAttribute(Attribute::get(Ctx, Kind, Ty));
1818 }
1819 
1821  return addTypeAttr(Attribute::ByVal, Ty);
1822 }
1823 
1825  return addTypeAttr(Attribute::StructRet, Ty);
1826 }
1827 
1829  return addTypeAttr(Attribute::ByRef, Ty);
1830 }
1831 
1833  return addTypeAttr(Attribute::Preallocated, Ty);
1834 }
1835 
1837  return addTypeAttr(Attribute::InAlloca, Ty);
1838 }
1839 
1841  // TODO: Could make this O(n) as we're merging two sorted lists.
1842  for (const auto &I : B.attrs())
1843  addAttribute(I);
1844 
1845  return *this;
1846 }
1847 
1849  erase_if(Attrs, [&](Attribute A) { return AM.contains(A); });
1850  return *this;
1851 }
1852 
1853 bool AttrBuilder::overlaps(const AttributeMask &AM) const {
1854  return any_of(Attrs, [&](Attribute A) { return AM.contains(A); });
1855 }
1856 
1858  assert((unsigned)A < Attribute::EndAttrKinds && "Attribute out of range!");
1859  auto It = lower_bound(Attrs, A, AttributeComparator());
1860  if (It != Attrs.end() && It->hasAttribute(A))
1861  return *It;
1862  return {};
1863 }
1864 
1866  auto It = lower_bound(Attrs, A, AttributeComparator());
1867  if (It != Attrs.end() && It->hasAttribute(A))
1868  return *It;
1869  return {};
1870 }
1871 
1873  return getAttribute(A).isValid();
1874 }
1875 
1877  return getAttribute(A).isValid();
1878 }
1879 
1881  return Attrs == B.Attrs;
1882 }
1883 
1884 //===----------------------------------------------------------------------===//
1885 // AttributeFuncs Function Defintions
1886 //===----------------------------------------------------------------------===//
1887 
1888 /// Which attributes cannot be applied to a type.
1890  AttributeSafetyKind ASK) {
1891  AttributeMask Incompatible;
1892 
1893  if (!Ty->isIntegerTy()) {
1894  // Attributes that only apply to integers.
1895  if (ASK & ASK_SAFE_TO_DROP)
1896  Incompatible.addAttribute(Attribute::AllocAlign);
1897  if (ASK & ASK_UNSAFE_TO_DROP)
1898  Incompatible.addAttribute(Attribute::SExt).addAttribute(Attribute::ZExt);
1899  }
1900 
1901  if (!Ty->isPointerTy()) {
1902  // Attributes that only apply to pointers.
1903  if (ASK & ASK_SAFE_TO_DROP)
1904  Incompatible.addAttribute(Attribute::NoAlias)
1905  .addAttribute(Attribute::NoCapture)
1906  .addAttribute(Attribute::NonNull)
1907  .addAttribute(Attribute::ReadNone)
1908  .addAttribute(Attribute::ReadOnly)
1909  .addAttribute(Attribute::Dereferenceable)
1910  .addAttribute(Attribute::DereferenceableOrNull);
1911  if (ASK & ASK_UNSAFE_TO_DROP)
1912  Incompatible.addAttribute(Attribute::Nest)
1913  .addAttribute(Attribute::SwiftError)
1914  .addAttribute(Attribute::Preallocated)
1915  .addAttribute(Attribute::InAlloca)
1916  .addAttribute(Attribute::ByVal)
1917  .addAttribute(Attribute::StructRet)
1918  .addAttribute(Attribute::ByRef)
1919  .addAttribute(Attribute::ElementType)
1920  .addAttribute(Attribute::AllocatedPointer);
1921  }
1922 
1923  // Attributes that only apply to pointers or vectors of pointers.
1924  if (!Ty->isPtrOrPtrVectorTy()) {
1925  if (ASK & ASK_SAFE_TO_DROP)
1926  Incompatible.addAttribute(Attribute::Alignment);
1927  }
1928 
1929  // Some attributes can apply to all "values" but there are no `void` values.
1930  if (Ty->isVoidTy()) {
1931  if (ASK & ASK_SAFE_TO_DROP)
1932  Incompatible.addAttribute(Attribute::NoUndef);
1933  }
1934 
1935  return Incompatible;
1936 }
1937 
1939  AttributeMask AM;
1940  AM.addAttribute(Attribute::NoUndef);
1941  AM.addAttribute(Attribute::Dereferenceable);
1942  AM.addAttribute(Attribute::DereferenceableOrNull);
1943  return AM;
1944 }
1945 
1946 template<typename AttrClass>
1947 static bool isEqual(const Function &Caller, const Function &Callee) {
1948  return Caller.getFnAttribute(AttrClass::getKind()) ==
1949  Callee.getFnAttribute(AttrClass::getKind());
1950 }
1951 
1952 /// Compute the logical AND of the attributes of the caller and the
1953 /// callee.
1954 ///
1955 /// This function sets the caller's attribute to false if the callee's attribute
1956 /// is false.
1957 template<typename AttrClass>
1958 static void setAND(Function &Caller, const Function &Callee) {
1959  if (AttrClass::isSet(Caller, AttrClass::getKind()) &&
1960  !AttrClass::isSet(Callee, AttrClass::getKind()))
1961  AttrClass::set(Caller, AttrClass::getKind(), false);
1962 }
1963 
1964 /// Compute the logical OR of the attributes of the caller and the
1965 /// callee.
1966 ///
1967 /// This function sets the caller's attribute to true if the callee's attribute
1968 /// is true.
1969 template<typename AttrClass>
1970 static void setOR(Function &Caller, const Function &Callee) {
1971  if (!AttrClass::isSet(Caller, AttrClass::getKind()) &&
1972  AttrClass::isSet(Callee, AttrClass::getKind()))
1973  AttrClass::set(Caller, AttrClass::getKind(), true);
1974 }
1975 
1976 /// If the inlined function had a higher stack protection level than the
1977 /// calling function, then bump up the caller's stack protection level.
1978 static void adjustCallerSSPLevel(Function &Caller, const Function &Callee) {
1979  // If the calling function has *no* stack protection level (e.g. it was built
1980  // with Clang's -fno-stack-protector or no_stack_protector attribute), don't
1981  // change it as that could change the program's semantics.
1982  if (!Caller.hasStackProtectorFnAttr())
1983  return;
1984 
1985  // If upgrading the SSP attribute, clear out the old SSP Attributes first.
1986  // Having multiple SSP attributes doesn't actually hurt, but it adds useless
1987  // clutter to the IR.
1988  AttributeMask OldSSPAttr;
1989  OldSSPAttr.addAttribute(Attribute::StackProtect)
1990  .addAttribute(Attribute::StackProtectStrong)
1991  .addAttribute(Attribute::StackProtectReq);
1992 
1993  if (Callee.hasFnAttribute(Attribute::StackProtectReq)) {
1994  Caller.removeFnAttrs(OldSSPAttr);
1995  Caller.addFnAttr(Attribute::StackProtectReq);
1996  } else if (Callee.hasFnAttribute(Attribute::StackProtectStrong) &&
1997  !Caller.hasFnAttribute(Attribute::StackProtectReq)) {
1998  Caller.removeFnAttrs(OldSSPAttr);
1999  Caller.addFnAttr(Attribute::StackProtectStrong);
2000  } else if (Callee.hasFnAttribute(Attribute::StackProtect) &&
2001  !Caller.hasFnAttribute(Attribute::StackProtectReq) &&
2002  !Caller.hasFnAttribute(Attribute::StackProtectStrong))
2003  Caller.addFnAttr(Attribute::StackProtect);
2004 }
2005 
2006 /// If the inlined function required stack probes, then ensure that
2007 /// the calling function has those too.
2008 static void adjustCallerStackProbes(Function &Caller, const Function &Callee) {
2009  if (!Caller.hasFnAttribute("probe-stack") &&
2010  Callee.hasFnAttribute("probe-stack")) {
2011  Caller.addFnAttr(Callee.getFnAttribute("probe-stack"));
2012  }
2013 }
2014 
2015 /// If the inlined function defines the size of guard region
2016 /// on the stack, then ensure that the calling function defines a guard region
2017 /// that is no larger.
2018 static void
2020  Attribute CalleeAttr = Callee.getFnAttribute("stack-probe-size");
2021  if (CalleeAttr.isValid()) {
2022  Attribute CallerAttr = Caller.getFnAttribute("stack-probe-size");
2023  if (CallerAttr.isValid()) {
2024  uint64_t CallerStackProbeSize, CalleeStackProbeSize;
2025  CallerAttr.getValueAsString().getAsInteger(0, CallerStackProbeSize);
2026  CalleeAttr.getValueAsString().getAsInteger(0, CalleeStackProbeSize);
2027 
2028  if (CallerStackProbeSize > CalleeStackProbeSize) {
2029  Caller.addFnAttr(CalleeAttr);
2030  }
2031  } else {
2032  Caller.addFnAttr(CalleeAttr);
2033  }
2034  }
2035 }
2036 
2037 /// If the inlined function defines a min legal vector width, then ensure
2038 /// the calling function has the same or larger min legal vector width. If the
2039 /// caller has the attribute, but the callee doesn't, we need to remove the
2040 /// attribute from the caller since we can't make any guarantees about the
2041 /// caller's requirements.
2042 /// This function is called after the inlining decision has been made so we have
2043 /// to merge the attribute this way. Heuristics that would use
2044 /// min-legal-vector-width to determine inline compatibility would need to be
2045 /// handled as part of inline cost analysis.
2046 static void
2048  Attribute CallerAttr = Caller.getFnAttribute("min-legal-vector-width");
2049  if (CallerAttr.isValid()) {
2050  Attribute CalleeAttr = Callee.getFnAttribute("min-legal-vector-width");
2051  if (CalleeAttr.isValid()) {
2052  uint64_t CallerVectorWidth, CalleeVectorWidth;
2053  CallerAttr.getValueAsString().getAsInteger(0, CallerVectorWidth);
2054  CalleeAttr.getValueAsString().getAsInteger(0, CalleeVectorWidth);
2055  if (CallerVectorWidth < CalleeVectorWidth)
2056  Caller.addFnAttr(CalleeAttr);
2057  } else {
2058  // If the callee doesn't have the attribute then we don't know anything
2059  // and must drop the attribute from the caller.
2060  Caller.removeFnAttr("min-legal-vector-width");
2061  }
2062  }
2063 }
2064 
2065 /// If the inlined function has null_pointer_is_valid attribute,
2066 /// set this attribute in the caller post inlining.
2067 static void
2069  if (Callee.nullPointerIsDefined() && !Caller.nullPointerIsDefined()) {
2070  Caller.addFnAttr(Attribute::NullPointerIsValid);
2071  }
2072 }
2073 
2074 struct EnumAttr {
2075  static bool isSet(const Function &Fn,
2076  Attribute::AttrKind Kind) {
2077  return Fn.hasFnAttribute(Kind);
2078  }
2079 
2080  static void set(Function &Fn,
2081  Attribute::AttrKind Kind, bool Val) {
2082  if (Val)
2083  Fn.addFnAttr(Kind);
2084  else
2085  Fn.removeFnAttr(Kind);
2086  }
2087 };
2088 
2089 struct StrBoolAttr {
2090  static bool isSet(const Function &Fn,
2091  StringRef Kind) {
2092  auto A = Fn.getFnAttribute(Kind);
2093  return A.getValueAsString().equals("true");
2094  }
2095 
2096  static void set(Function &Fn,
2097  StringRef Kind, bool Val) {
2098  Fn.addFnAttr(Kind, Val ? "true" : "false");
2099  }
2100 };
2101 
2102 #define GET_ATTR_NAMES
2103 #define ATTRIBUTE_ENUM(ENUM_NAME, DISPLAY_NAME) \
2104  struct ENUM_NAME##Attr : EnumAttr { \
2105  static enum Attribute::AttrKind getKind() { \
2106  return llvm::Attribute::ENUM_NAME; \
2107  } \
2108  };
2109 #define ATTRIBUTE_STRBOOL(ENUM_NAME, DISPLAY_NAME) \
2110  struct ENUM_NAME##Attr : StrBoolAttr { \
2111  static StringRef getKind() { return #DISPLAY_NAME; } \
2112  };
2113 #include "llvm/IR/Attributes.inc"
2114 
2115 #define GET_ATTR_COMPAT_FUNC
2116 #include "llvm/IR/Attributes.inc"
2117 
2119  const Function &Callee) {
2120  return hasCompatibleFnAttrs(Caller, Callee);
2121 }
2122 
2124  const Function &B) {
2125  return hasCompatibleFnAttrs(A, B);
2126 }
2127 
2129  const Function &Callee) {
2130  mergeFnAttrs(Caller, Callee);
2131 }
2132 
2134  const Function &ToMerge) {
2135 
2136  // We merge functions so that they meet the most general case.
2137  // For example, if the NoNansFPMathAttr is set in one function, but not in
2138  // the other, in the merged function we can say that the NoNansFPMathAttr
2139  // is not set.
2140  // However if we have the SpeculativeLoadHardeningAttr set true in one
2141  // function, but not the other, we make sure that the function retains
2142  // that aspect in the merged function.
2143  mergeFnAttrs(Base, ToMerge);
2144 }
2145 
2147  uint64_t Width) {
2148  Attribute Attr = Fn.getFnAttribute("min-legal-vector-width");
2149  if (Attr.isValid()) {
2150  uint64_t OldWidth;
2151  Attr.getValueAsString().getAsInteger(0, OldWidth);
2152  if (Width > OldWidth)
2153  Fn.addFnAttr("min-legal-vector-width", llvm::utostr(Width));
2154  }
2155 }
llvm::AttributeList::removeAttributeAtIndex
AttributeList removeAttributeAtIndex(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Remove the specified attribute at the specified index from this attribute list.
Definition: Attributes.cpp:1380
llvm::Attribute::getAllocSizeArgs
std::pair< unsigned, std::optional< unsigned > > getAllocSizeArgs() const
Returns the argument numbers for the allocsize attribute.
Definition: Attributes.cpp:363
llvm::AttrBuilder::addDereferenceableOrNullAttr
AttrBuilder & addDereferenceableOrNullAttr(uint64_t Bytes)
This turns the number of dereferenceable_or_null bytes into the form used internally in Attribute.
Definition: Attributes.cpp:1764
llvm::AttributeList::getRetDereferenceableOrNullBytes
uint64_t getRetDereferenceableOrNullBytes() const
Get the number of dereferenceable_or_null bytes (or zero if unknown) of the return value.
Definition: Attributes.cpp:1554
i
i
Definition: README.txt:29
llvm::AttributeList::getParamInAllocaType
Type * getParamInAllocaType(unsigned ArgNo) const
Return the inalloca type for the specified function parameter.
Definition: Attributes.cpp:1530
llvm::AttributeList::print
void print(raw_ostream &O) const
Definition: Attributes.cpp:1610
llvm::Attribute::getWithPreallocatedType
static Attribute getWithPreallocatedType(LLVMContext &Context, Type *Ty)
Definition: Attributes.cpp:201
llvm::LLVMContextImpl::Alloc
BumpPtrAllocator Alloc
Definition: LLVMContextImpl.h:1521
llvm::AttributeList::removeAttributesAtIndex
AttributeList removeAttributesAtIndex(LLVMContext &C, unsigned Index, const AttributeMask &AttrsToRemove) const
Remove the specified attributes at the specified index from this attribute list.
Definition: Attributes.cpp:1399
llvm::Attribute::EndAttrKinds
@ EndAttrKinds
Sentinal value useful for loops.
Definition: Attributes.h:91
set
We currently generate a but we really shouldn eax ecx xorl edx divl ecx eax divl ecx movl eax ret A similar code sequence works for division We currently compile i32 v2 eax eax jo LBB1_2 atomic and others It is also currently not done for read modify write instructions It is also current not done if the OF or CF flags are needed The shift operators have the complication that when the shift count is EFLAGS is not set
Definition: README.txt:1277
llvm::ModRefInfo::NoModRef
@ NoModRef
The access neither references nor modifies the value stored in memory.
llvm::LLVMContext::pImpl
LLVMContextImpl *const pImpl
Definition: LLVMContext.h:69
llvm::AttributeImpl
Definition: AttributeImpl.h:40
llvm::AttributeSet::AttributeSet
AttributeSet()=default
AttributeSet is a trivially copyable value type.
Attrs
Function Attrs
Definition: README_ALTIVEC.txt:215
llvm::AttrBuilder::getAttribute
Attribute getAttribute(Attribute::AttrKind Kind) const
Return Attribute with the given Kind.
Definition: Attributes.cpp:1857
llvm::AttributeFuncs::mergeAttributesForOutlining
void mergeAttributesForOutlining(Function &Base, const Function &ToMerge)
Merges the functions attributes from ToMerge into function Base.
Definition: Attributes.cpp:2133
llvm::Attribute::getWithAllocSizeArgs
static Attribute getWithAllocSizeArgs(LLVMContext &Context, unsigned ElemSizeArg, const std::optional< unsigned > &NumElemsArg)
Definition: Attributes.cpp:220
LLVM_DUMP_METHOD
#define LLVM_DUMP_METHOD
Mark debug helper function definitions like dump() that should not be stripped from debug builds.
Definition: Compiler.h:492
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::Attribute::isEnumAttribute
bool isEnumAttribute() const
Return true if the attribute is an Attribute::AttrKind type.
Definition: Attributes.cpp:268
ModRef.h
llvm::Attribute::isValid
bool isValid() const
Return true if the attribute is any kind of attribute.
Definition: Attributes.h:185
llvm::AttributeList::addDereferenceableParamAttr
AttributeList addDereferenceableParamAttr(LLVMContext &C, unsigned ArgNo, uint64_t Bytes) const
Add the dereferenceable attribute to the attribute set at the given arg index.
Definition: Attributes.cpp:1426
llvm::AttrBuilder::AttrBuilder
AttrBuilder(LLVMContext &Ctx)
Definition: Attributes.h:1045
llvm::AttributeSet::hasAttributes
bool hasAttributes() const
Return true if attributes exists in this set.
Definition: Attributes.h:355
llvm::AttrBuilder::addUWTableAttr
AttrBuilder & addUWTableAttr(UWTableKind Kind)
This turns the unwind table kind into the form used internally in Attribute.
Definition: Attributes.cpp:1796
llvm::yaml::getStringValue
static StringRef getStringValue(IO &IO, const char *Key)
Definition: ELFYAML.cpp:1518
llvm::none_of
bool none_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1749
llvm::AttributeList::hasAttributesAtIndex
bool hasAttributesAtIndex(unsigned Index) const
Return true if attribute exists at the given index.
Definition: Attributes.cpp:1475
llvm::AttributeSet::getAllocKind
AllocFnKind getAllocKind() const
Definition: Attributes.cpp:835
attrIdxToArrayIdx
static unsigned attrIdxToArrayIdx(unsigned Index)
Map from AttributeList index to the internal array index.
Definition: Attributes.cpp:1043
llvm::AArch64PACKey::ID
ID
Definition: AArch64BaseInfo.h:824
llvm::Attribute::getStackAlignment
MaybeAlign getStackAlignment() const
Returns the stack alignment field of an attribute as a byte alignment value.
Definition: Attributes.cpp:342
llvm::Function::end
iterator end()
Definition: Function.h:753
llvm::AttributeList::hasAttrSomewhere
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.
Definition: Attributes.cpp:1487
llvm::Value::MaximumAlignment
static constexpr uint64_t MaximumAlignment
Definition: Value.h:790
llvm::AttributeListImpl::end
iterator end() const
Definition: AttributeImpl.h:329
llvm::AttrBuilder::addTypeAttr
AttrBuilder & addTypeAttr(Attribute::AttrKind Kind, Type *Ty)
Add a type attribute with the given type.
Definition: Attributes.cpp:1816
llvm::Type::isPointerTy
bool isPointerTy() const
True if this is an instance of PointerType.
Definition: Type.h:249
llvm::AttributeSet::getDereferenceableOrNullBytes
uint64_t getDereferenceableOrNullBytes() const
Definition: Attributes.cpp:788
llvm::Function::empty
bool empty() const
Definition: Function.h:757
llvm::Attribute::hasAttribute
bool hasAttribute(AttrKind Val) const
Return true if the attribute is present.
Definition: Attributes.cpp:327
llvm::AttributeList::AttributeList
AttributeList()=default
llvm::Function
Definition: Function.h:59
llvm::Attribute
Definition: Attributes.h:67
llvm::lower_bound
auto lower_bound(R &&Range, T &&Value)
Provide wrappers to std::lower_bound which take ranges instead of having to pass begin/end explicitly...
Definition: STLExtras.h:1923
StringRef.h
llvm::AttributeFuncs::ASK_UNSAFE_TO_DROP
@ ASK_UNSAFE_TO_DROP
Definition: Attributes.h:1249
llvm::AttributeSetNode::getNumAttributes
unsigned getNumAttributes() const
Return the number of attributes this AttributeList contains.
Definition: AttributeImpl.h:247
EnumAttr::set
static void set(Function &Fn, Attribute::AttrKind Kind, bool Val)
Definition: Attributes.cpp:2080
llvm::raw_string_ostream
A raw_ostream that writes to an std::string.
Definition: raw_ostream.h:642
llvm::AttributeList::getParamPreallocatedType
Type * getParamPreallocatedType(unsigned ArgNo) const
Return the preallocated type for the specified function parameter.
Definition: Attributes.cpp:1526
llvm::AttributeMask::contains
bool contains(Attribute::AttrKind A) const
Return true if the builder has the specified attribute.
Definition: Attributes.h:1017
llvm::Attribute::getAttrKindFromName
static Attribute::AttrKind getAttrKindFromName(StringRef AttrName)
Definition: Attributes.cpp:233
llvm::Attribute::get
static Attribute get(LLVMContext &Context, AttrKind Kind, uint64_t Val=0)
Return a uniquified Attribute object.
Definition: Attributes.cpp:91
llvm::Attribute::isTypeAttribute
bool isTypeAttribute() const
Return true if the attribute is a type attribute.
Definition: Attributes.cpp:280
llvm::Attribute::isIntAttrKind
static bool isIntAttrKind(AttrKind Kind)
Definition: Attributes.h:102
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1199
llvm::UWTableKind::None
@ None
No unwind table requested.
packAllocSizeArgs
static uint64_t packAllocSizeArgs(unsigned ElemSizeArg, const std::optional< unsigned > &NumElemsArg)
Definition: Attributes.cpp:57
getImpl
static LazyValueInfoImpl & getImpl(void *&PImpl, AssumptionCache *AC, const Module *M)
This lazily constructs the LazyValueInfoImpl.
Definition: LazyValueInfo.cpp:1542
llvm::AttributeList::getUWTableKind
UWTableKind getUWTableKind() const
Get the unwind table kind requested for the function.
Definition: Attributes.cpp:1563
getModRefStr
static const char * getModRefStr(ModRefInfo MR)
Definition: Attributes.cpp:399
adjustCallerStackProbes
static void adjustCallerStackProbes(Function &Caller, const Function &Callee)
If the inlined function required stack probes, then ensure that the calling function has those too.
Definition: Attributes.cpp:2008
ErrorHandling.h
llvm::AttributeSet::addAttributes
AttributeSet addAttributes(LLVMContext &C, AttributeSet AS) const
Add attributes to the attribute set.
Definition: Attributes.cpp:716
llvm::erase_if
void erase_if(Container &C, UnaryPredicate P)
Provide a container algorithm similar to C++ Library Fundamentals v2's erase_if which is equivalent t...
Definition: STLExtras.h:1998
llvm::AttributeFuncs::getUBImplyingAttributes
AttributeMask getUBImplyingAttributes()
Get param/return attributes which imply immediate undefined behavior if an invalid value is passed.
Definition: Attributes.cpp:1938
llvm::AttributeList::end
iterator end() const
Definition: Attributes.cpp:1598
llvm::AttributeList::get
static AttributeList get(LLVMContext &C, ArrayRef< std::pair< unsigned, Attribute >> Attrs)
Create an AttributeList with the specified parameters in it.
Definition: Attributes.cpp:1132
AllocSizeNumElemsNotPresent
static const unsigned AllocSizeNumElemsNotPresent
Definition: Attributes.cpp:55
llvm::Attribute::getWithStackAlignment
static Attribute getWithStackAlignment(LLVMContext &Context, Align Alignment)
Definition: Attributes.cpp:172
setOR
static void setOR(Function &Caller, const Function &Callee)
Compute the logical OR of the attributes of the caller and the callee.
Definition: Attributes.cpp:1970
llvm::AttributeList::getParamByValType
Type * getParamByValType(unsigned ArgNo) const
Return the byval type for the specified function parameter.
Definition: Attributes.cpp:1514
llvm::UWTableKind::Default
@ Default
llvm::AttrBuilder::getRawIntAttr
std::optional< uint64_t > getRawIntAttr(Attribute::AttrKind Kind) const
Return raw (possibly packed/encoded) value of integer attribute or std::nullopt if not set.
Definition: Attributes.cpp:1720
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::Attribute::getWithVScaleRangeArgs
static Attribute getWithVScaleRangeArgs(LLVMContext &Context, unsigned MinValue, unsigned MaxValue)
Definition: Attributes.cpp:227
llvm::AttributeList
Definition: Attributes.h:432
llvm::AttributeMask
Definition: Attributes.h:979
llvm::AttributeList::addDereferenceableRetAttr
AttributeList addDereferenceableRetAttr(LLVMContext &C, uint64_t Bytes) const
Add the dereferenceable attribute to the attribute set at the given index.
Definition: Attributes.cpp:1419
llvm::Attribute::isTypeAttrKind
static bool isTypeAttrKind(AttrKind Kind)
Definition: Attributes.h:105
llvm::AttrBuilder::addAllocKindAttr
AttrBuilder & addAllocKindAttr(AllocFnKind Kind)
Definition: Attributes.cpp:1806
llvm::copy
OutputIt copy(R &&Range, OutputIt Out)
Definition: STLExtras.h:1837
llvm::MemoryEffects::ArgMem
@ ArgMem
Access to memory via argument pointers.
Definition: ModRef.h:68
llvm::AttributeList::getFnAttrs
AttributeSet getFnAttrs() const
The function attributes are returned.
Definition: Attributes.cpp:1462
llvm::Function::insert
Function::iterator insert(Function::iterator Position, BasicBlock *BB)
Insert BB in the basic block list at Position.
Definition: Function.h:682
llvm::TypeAttributeImpl
Definition: AttributeImpl.h:189
llvm::AllocFnKind::Alloc
@ Alloc
llvm::AttributeBitSet::hasAttribute
bool hasAttribute(Attribute::AttrKind Kind) const
Definition: AttributeImpl.h:206
llvm::MemoryEffects::InaccessibleMem
@ InaccessibleMem
Memory that is inaccessible via LLVM IR.
Definition: ModRef.h:70
llvm::AttributeSet::getVScaleRangeMin
unsigned getVScaleRangeMin() const
Definition: Attributes.cpp:823
llvm::AttrBuilder::addPreallocatedAttr
AttrBuilder & addPreallocatedAttr(Type *Ty)
This turns a preallocated type into the form used internally in Attribute.
Definition: Attributes.cpp:1832
setAND
static void setAND(Function &Caller, const Function &Callee)
Compute the logical AND of the attributes of the caller and the callee.
Definition: Attributes.cpp:1958
llvm::Attribute::getAlignment
MaybeAlign getAlignment() const
Returns the alignment field of an attribute as a byte alignment value.
Definition: Attributes.cpp:336
llvm::AttributeListImpl::begin
iterator begin() const
Definition: AttributeImpl.h:328
adjustMinLegalVectorWidth
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...
Definition: Attributes.cpp:2047
llvm::max
Expected< ExpressionValue > max(const ExpressionValue &Lhs, const ExpressionValue &Rhs)
Definition: FileCheck.cpp:337
llvm::AttrBuilder::addRawIntAttr
AttrBuilder & addRawIntAttr(Attribute::AttrKind Kind, uint64_t Value)
Add integer attribute with raw value (packed/encoded if necessary).
Definition: Attributes.cpp:1728
llvm::AttributeSetNode::getDereferenceableBytes
uint64_t getDereferenceableBytes() const
Definition: Attributes.cpp:978
STLExtras.h
packVScaleRangeArgs
static uint64_t packVScaleRangeArgs(unsigned MinValue, std::optional< unsigned > MaxValue)
Definition: Attributes.cpp:77
llvm::AllocFnKind::Unknown
@ Unknown
llvm::MemoryEffects::createFromIntValue
static MemoryEffects createFromIntValue(uint32_t Data)
Create MemoryEffects from an encoded integer value (used by memory attribute).
Definition: ModRef.h:153
llvm::AttrBuilder::merge
AttrBuilder & merge(const AttrBuilder &B)
Add the attributes from the builder.
Definition: Attributes.cpp:1840
llvm::Attribute::getValueAsBool
bool getValueAsBool() const
Return the attribute's value as a boolean.
Definition: Attributes.cpp:298
adjustNullPointerValidAttr
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...
Definition: Attributes.cpp:2068
llvm::isEqual
bool isEqual(const GCNRPTracker::LiveRegSet &S1, const GCNRPTracker::LiveRegSet &S2)
Definition: GCNRegPressure.cpp:21
llvm::LLVMContextImpl::AttrsSet
FoldingSet< AttributeImpl > AttrsSet
Definition: LLVMContextImpl.h:1457
llvm::ArrayRef::empty
bool empty() const
empty - Check if the array is empty.
Definition: ArrayRef.h:158
llvm::dwarf::Attribute
Attribute
Attributes.
Definition: Dwarf.h:123
adjustCallerSSPLevel
static void adjustCallerSSPLevel(Function &Caller, const Function &Callee)
If the inlined function had a higher stack protection level than the calling function,...
Definition: Attributes.cpp:1978
llvm::AttrBuilder::removeAttribute
AttrBuilder & removeAttribute(Attribute::AttrKind Val)
Remove an attribute from the builder.
Definition: Attributes.cpp:1704
llvm::AttributeSetNode::getAlignment
MaybeAlign getAlignment() const
Definition: Attributes.cpp:960
llvm::AttributeList::getParamDereferenceableBytes
uint64_t getParamDereferenceableBytes(unsigned Index) const
Get the number of dereferenceable bytes (or zero if unknown) of an arg.
Definition: Attributes.cpp:1550
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::dbgs
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Definition: Debug.cpp:163
llvm::MemoryEffects
Summary of how a function affects memory in the program.
Definition: ModRef.h:63
llvm::AttrBuilder::remove
AttrBuilder & remove(const AttributeMask &AM)
Remove the attributes from the builder.
Definition: Attributes.cpp:1848
llvm::Attribute::getAllocKind
AllocFnKind getAllocKind() const
Definition: Attributes.cpp:387
llvm::AttributeList::getParamStackAlignment
MaybeAlign getParamStackAlignment(unsigned ArgNo) const
Return the stack alignment for the specified function parameter.
Definition: Attributes.cpp:1510
llvm::Attribute::getValueAsInt
uint64_t getValueAsInt() const
Return the attribute's value as an integer.
Definition: Attributes.cpp:291
llvm::AttributeSet::addAttribute
AttributeSet addAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Add an argument attribute.
Definition: Attributes.cpp:701
llvm::AttributeList::hasAttributeAtIndex
bool hasAttributeAtIndex(unsigned Index, Attribute::AttrKind Kind) const
Return true if the attribute exists at the given index.
Definition: Attributes.cpp:1466
llvm::all_of
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1735
llvm::UWTableKind
UWTableKind
Definition: CodeGen.h:121
llvm::ArrayRef::back
const T & back() const
back - Get the last element.
Definition: ArrayRef.h:172
llvm::Attribute::getWithInAllocaType
static Attribute getWithInAllocaType(LLVMContext &Context, Type *Ty)
Definition: Attributes.cpp:205
llvm::AttrBuilder::getTypeAttr
Type * getTypeAttr(Attribute::AttrKind Kind) const
Retrieve type for the given type attribute.
Definition: Attributes.cpp:1810
llvm::AttributeList::addParamAttributes
AttributeList addParamAttributes(LLVMContext &C, unsigned ArgNo, const AttrBuilder &B) const
Add an argument attribute to the list.
Definition: Attributes.h:591
llvm::AttributeList::hasParentContext
bool hasParentContext(LLVMContext &C) const
Return true if this attribute list belongs to the LLVMContext.
Definition: Attributes.cpp:1586
llvm::AttributeListImpl
Definition: AttributeImpl.h:291
llvm::ModRefInfo::Ref
@ Ref
The access may reference the value stored in memory.
addAttributeImpl
static void addAttributeImpl(SmallVectorImpl< Attribute > &Attrs, K Kind, Attribute Attr)
Definition: Attributes.cpp:1677
llvm::AttrBuilder::addByValAttr
AttrBuilder & addByValAttr(Type *Ty)
This turns a byval type into the form used internally in Attribute.
Definition: Attributes.cpp:1820
llvm::AttributeSet::getAsString
std::string getAsString(bool InAttrGrp=false) const
Definition: Attributes.cpp:843
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::AttributeList::begin
iterator begin() const
Definition: Attributes.cpp:1594
llvm::less_first
Function object to check whether the first component of a std::pair compares less than the first comp...
Definition: STLExtras.h:1477
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::AttributeList::getParamDereferenceableOrNullBytes
uint64_t getParamDereferenceableOrNullBytes(unsigned ArgNo) const
Get the number of dereferenceable_or_null bytes (or zero if unknown) of an arg.
Definition: Attributes.cpp:1559
llvm::LLVMContextImpl
Definition: LLVMContextImpl.h:1402
llvm::MemoryEffects::Other
@ Other
Any other memory.
Definition: ModRef.h:72
llvm::AttributeSet::hasAttribute
bool hasAttribute(Attribute::AttrKind Kind) const
Return true if the attribute exists in this set.
Definition: Attributes.cpp:760
llvm::AttributeImpl::isEnumAttribute
bool isEnumAttribute() const
Definition: AttributeImpl.h:58
llvm::AttrBuilder::operator==
bool operator==(const AttrBuilder &B) const
Definition: Attributes.cpp:1880
llvm::AttributeImpl::getKindAsString
StringRef getKindAsString() const
Definition: Attributes.cpp:649
llvm::AttributeList::addAllocSizeParamAttr
AttributeList addAllocSizeParamAttr(LLVMContext &C, unsigned ArgNo, unsigned ElemSizeArg, const std::optional< unsigned > &NumElemsArg)
Add the allocsize attribute to the attribute set at the given arg index.
Definition: Attributes.cpp:1442
llvm::Type::print
void print(raw_ostream &O, bool IsForDebug=false, bool NoDetails=false) const
Print the current type.
Definition: AsmWriter.cpp:4669
StrBoolAttr::set
static void set(Function &Fn, StringRef Kind, bool Val)
Definition: Attributes.cpp:2096
llvm::IntAttributeImpl
Definition: AttributeImpl.h:140
llvm::Attribute::getWithMemoryEffects
static Attribute getWithMemoryEffects(LLVMContext &Context, MemoryEffects ME)
Definition: Attributes.cpp:214
llvm::AttrBuilder::addVScaleRangeAttr
AttrBuilder & addVScaleRangeAttr(unsigned MinValue, std::optional< unsigned > MaxValue)
This turns two ints into the form used internally in Attribute.
Definition: Attributes.cpp:1783
llvm::AttributeImpl::hasAttribute
bool hasAttribute(Attribute::AttrKind A) const
Definition: Attributes.cpp:624
llvm::StringRef::getAsInteger
bool getAsInteger(unsigned Radix, T &Result) const
Parse the current string as an integer of the specified radix.
Definition: StringRef.h:469
llvm::AttributeImpl::getKindAsEnum
Attribute::AttrKind getKindAsEnum() const
Definition: Attributes.cpp:634
llvm::AttributeImpl::isIntAttribute
bool isIntAttribute() const
Definition: AttributeImpl.h:59
llvm::AttributeSet::getDereferenceableBytes
uint64_t getDereferenceableBytes() const
Definition: Attributes.cpp:784
llvm::AttributeFuncs::areOutlineCompatible
bool areOutlineCompatible(const Function &A, const Function &B)
Checks if there are any incompatible function attributes between A and B.
Definition: Attributes.cpp:2123
llvm::Attribute::getVScaleRangeMax
std::optional< unsigned > getVScaleRangeMax() const
Returns the maximum value for the vscale_range attribute or std::nullopt when unknown.
Definition: Attributes.cpp:375
llvm::dwarf::Index
Index
Definition: Dwarf.h:550
llvm::MaybeAlign
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition: Alignment.h:117
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
First
into llvm powi allowing the code generator to produce balanced multiplication trees First
Definition: README.txt:54
llvm::Function::getFnAttribute
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
Definition: Function.cpp:666
llvm::Attribute::getVScaleRangeMin
unsigned getVScaleRangeMin() const
Returns the minimum value for the vscale_range attribute.
Definition: Attributes.cpp:369
AttributeProperty
AttributeProperty
Definition: Attributes.cpp:592
llvm::AttributeList::getMemoryEffects
MemoryEffects getMemoryEffects() const
Returns memory effects of the function.
Definition: Attributes.cpp:1571
llvm::AttributeList::hasFnAttr
bool hasFnAttr(Attribute::AttrKind Kind) const
Return true if the attribute exists for the function.
Definition: Attributes.cpp:1479
LLVMContextImpl.h
llvm::AttributeSetNode::hasAttribute
bool hasAttribute(Attribute::AttrKind Kind) const
Definition: AttributeImpl.h:249
StrBoolAttr::isSet
static bool isSet(const Function &Fn, StringRef Kind)
Definition: Attributes.cpp:2090
llvm::AttributeList::getAttributes
AttributeSet getAttributes(unsigned Index) const
The attributes for the specified index are returned.
Definition: Attributes.cpp:1579
llvm::AttributeList::getRetAlignment
MaybeAlign getRetAlignment() const
Return the alignment of the return value.
Definition: Attributes.cpp:1502
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
llvm::SmallVectorImpl::resize
void resize(size_type N)
Definition: SmallVector.h:642
llvm::raw_ostream::flush
void flush()
Definition: raw_ostream.h:185
llvm::AttributeSet::getInAllocaType
Type * getInAllocaType() const
Definition: Attributes.cpp:808
llvm::Attribute::getKindAsString
StringRef getKindAsString() const
Return the attribute's kind as a string.
Definition: Attributes.cpp:305
llvm::Attribute::isStringAttribute
bool isStringAttribute() const
Return true if the attribute is a string (target-dependent) attribute.
Definition: Attributes.cpp:276
llvm::AttributeList::getParamElementType
Type * getParamElementType(unsigned ArgNo) const
Return the elementtype type for the specified function parameter.
Definition: Attributes.cpp:1534
llvm::AttributeList::addDereferenceableOrNullParamAttr
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.
Definition: Attributes.cpp:1435
StrBoolAttr
Definition: Attributes.cpp:2089
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition: Alignment.h:39
llvm::Attribute::getWithStructRetType
static Attribute getWithStructRetType(LLVMContext &Context, Type *Ty)
Definition: Attributes.cpp:193
llvm::AttrBuilder::getAllocSizeArgs
std::optional< std::pair< unsigned, std::optional< unsigned > > > getAllocSizeArgs() const
Retrieve the allocsize args, or std::nullopt if the attribute does not exist.
Definition: Attributes.cpp:1734
llvm::AttrBuilder::clear
void clear()
Definition: Attributes.cpp:1646
llvm::Attribute::isEnumAttrKind
static bool isEnumAttrKind(AttrKind Kind)
Definition: Attributes.h:99
hasAttributeProperty
static bool hasAttributeProperty(Attribute::AttrKind Kind, AttributeProperty Prop)
Definition: Attributes.cpp:601
llvm::Attribute::getValueAsString
StringRef getValueAsString() const
Return the attribute's value as a string.
Definition: Attributes.cpp:312
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::AttributeSet::getVScaleRangeMax
std::optional< unsigned > getVScaleRangeMax() const
Definition: Attributes.cpp:827
llvm::AttributeList::addParamAttribute
AttributeList addParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
Add an argument attribute to the list.
Definition: Attributes.h:570
llvm::CallingConv::ID
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
llvm::AttrBuilder::addAlignmentAttr
AttrBuilder & addAlignmentAttr(MaybeAlign Align)
This turns an alignment into the form used internally in Attribute.
Definition: Attributes.cpp:1741
Type.h
llvm::AttributeSetNode::begin
iterator begin() const
Definition: AttributeImpl.h:274
llvm::AttributeFuncs::AttributeSafetyKind
AttributeSafetyKind
Definition: Attributes.h:1247
llvm::AttributeSet::end
iterator end() const
Definition: Attributes.cpp:859
llvm::Type::isIntegerTy
bool isIntegerTy() const
True if this is an instance of IntegerType.
Definition: Type.h:222
llvm::sort
void sort(IteratorTy Start, IteratorTy End)
Definition: STLExtras.h:1683
llvm::AttrBuilder::addAttribute
AttrBuilder & addAttribute(Attribute::AttrKind Val)
Add an attribute to the builder.
Definition: Attributes.cpp:1694
llvm::StringRef::empty
constexpr bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:134
llvm::AttributeSet::getUWTableKind
UWTableKind getUWTableKind() const
Definition: Attributes.cpp:831
llvm::Function::hasFnAttribute
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
Definition: Function.cpp:640
llvm::AllocFnKind::Realloc
@ Realloc
llvm::AllocFnKind::Free
@ Free
llvm::AttributeList::ReturnIndex
@ ReturnIndex
Definition: Attributes.h:435
llvm::RISCVFenceField::O
@ O
Definition: RISCVBaseInfo.h:274
llvm::AttrBuilder::addAllocSizeAttr
AttrBuilder & addAllocSizeAttr(unsigned ElemSizeArg, const std::optional< unsigned > &NumElemsArg)
This turns one (or two) ints into the form used internally in Attribute.
Definition: Attributes.cpp:1772
llvm::MemoryEffects::unknown
static MemoryEffects unknown()
Create MemoryEffects that can read and write any memory.
Definition: ModRef.h:113
llvm::AttributeList::getRetAttrs
AttributeSet getRetAttrs() const
The attributes for the ret value are returned.
Definition: Attributes.cpp:1458
VI
@ VI
Definition: SIInstrInfo.cpp:7994
llvm::AttrBuilder::addStackAlignmentAttr
AttrBuilder & addStackAlignmentAttr(MaybeAlign Align)
This turns a stack alignment into the form used internally in Attribute.
Definition: Attributes.cpp:1749
llvm::Attribute::canUseAsFnAttr
static bool canUseAsFnAttr(AttrKind Kind)
Definition: Attributes.cpp:608
Index
uint32_t Index
Definition: ELFObjHandler.cpp:83
EnumAttr
Definition: Attributes.cpp:2074
llvm::AttributeSetNode::getAllocSizeArgs
std::optional< std::pair< unsigned, std::optional< unsigned > > > getAllocSizeArgs() const
Definition: Attributes.cpp:991
uint64_t
llvm::MemoryEffects::toIntValue
uint32_t toIntValue() const
Convert MemoryEffects into an encoded integer value (used by memory attribute).
Definition: ModRef.h:159
llvm::MemoryEffects::locations
static auto locations()
Returns iterator over all supported location kinds.
Definition: ModRef.h:96
llvm::AttributeSetNode::getVScaleRangeMax
std::optional< unsigned > getVScaleRangeMax() const
Definition: Attributes.cpp:1003
llvm::Attribute::None
@ None
No attributes have been set.
Definition: Attributes.h:88
llvm::AttributeList::getRetDereferenceableBytes
uint64_t getRetDereferenceableBytes() const
Get the number of dereferenceable bytes (or zero if unknown) of the return value.
Definition: Attributes.cpp:1546
ParamAttr
@ ParamAttr
Definition: Attributes.cpp:594
llvm::AttributeListImpl::AttributeList
friend class AttributeList
Definition: AttributeImpl.h:294
llvm::AttrBuilder::addVScaleRangeAttrFromRawRepr
AttrBuilder & addVScaleRangeAttrFromRawRepr(uint64_t RawVScaleRangeRepr)
Add a vscale_range attribute, using the representation returned by Attribute.getIntValue().
Definition: Attributes.cpp:1788
llvm::AttributeListImpl::dump
void dump() const
Definition: Attributes.cpp:1095
llvm::AttributeSet::get
static AttributeSet get(LLVMContext &C, const AttrBuilder &B)
Definition: Attributes.cpp:693
llvm::AttrBuilder::addInAllocaAttr
AttrBuilder & addInAllocaAttr(Type *Ty)
This turns an inalloca type into the form used internally in Attribute.
Definition: Attributes.cpp:1836
llvm::AttributeFuncs::ASK_SAFE_TO_DROP
@ ASK_SAFE_TO_DROP
Definition: Attributes.h:1248
llvm::Attribute::getWithUWTableKind
static Attribute getWithUWTableKind(LLVMContext &Context, UWTableKind Kind)
Definition: Attributes.cpp:209
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
llvm::AttributeList::getAsString
std::string getAsString(unsigned Index, bool InAttrGrp=false) const
Return the attributes at the index as a string.
Definition: Attributes.cpp:1575
llvm::AttributeList::dump
void dump() const
Definition: Attributes.cpp:1634
llvm::MemoryEffects::getModRef
ModRefInfo getModRef(Location Loc) const
Get ModRefInfo for the given Location.
Definition: ModRef.h:164
llvm::AttributeSetNode::getAttributeType
Type * getAttributeType(Attribute::AttrKind Kind) const
Definition: Attributes.cpp:972
llvm::Attribute::getKindAsEnum
Attribute::AttrKind getKindAsEnum() const
Return the attribute's kind as an enum (Attribute::AttrKind).
Definition: Attributes.cpp:284
I
#define I(x, y, z)
Definition: MD5.cpp:58
llvm::AttrBuilder
Definition: Attributes.h:1040
StringExtras.h
llvm::Attribute::AttrKind
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
Definition: Attributes.h:86
size
i< reg-> size
Definition: README.txt:166
llvm::Attribute::getWithDereferenceableBytes
static Attribute getWithDereferenceableBytes(LLVMContext &Context, uint64_t Bytes)
Definition: Attributes.cpp:177
llvm::AttributeSetNode::Profile
void Profile(FoldingSetNodeID &ID) const
Definition: AttributeImpl.h:277
llvm::AttributeList::getParamAlignment
MaybeAlign getParamAlignment(unsigned ArgNo) const
Return the alignment for the specified function parameter.
Definition: Attributes.cpp:1506
ArrayRef.h
llvm::Attribute::canUseAsParamAttr
static bool canUseAsParamAttr(AttrKind Kind)
Definition: Attributes.cpp:612
llvm::AttributeImpl::getValueAsString
StringRef getValueAsString() const
Definition: Attributes.cpp:654
llvm::AttributeSet::removeAttributes
AttributeSet removeAttributes(LLVMContext &C, const AttributeMask &AttrsToRemove) const
Remove the specified attributes from this set.
Definition: Attributes.cpp:745
llvm::AllocFnKind::Aligned
@ Aligned
llvm::ModRefInfo
ModRefInfo
Flags indicating whether a memory access modifies or references memory.
Definition: ModRef.h:27
llvm::AttributeSet::hasParentContext
bool hasParentContext(LLVMContext &C) const
Return true if this attribute set belongs to the LLVMContext.
Definition: Attributes.cpp:847
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::AttrBuilder::addByRefAttr
AttrBuilder & addByRefAttr(Type *Ty)
This turns a byref type into the form used internally in Attribute.
Definition: Attributes.cpp:1828
std::swap
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
Definition: BitVector.h:853
llvm::Attribute::getAsString
std::string getAsString(bool InAttrGrp=false) const
The Attribute is converted to a string of equivalent mnemonic.
Definition: Attributes.cpp:413
llvm::AttributeSetNode::getDereferenceableOrNullBytes
uint64_t getDereferenceableOrNullBytes() const
Definition: Attributes.cpp:984
llvm::LLVMContextImpl::AttrsLists
FoldingSet< AttributeListImpl > AttrsLists
Definition: LLVMContextImpl.h:1458
AttributeComparator
Attribute comparator that only compares attribute keys.
Definition: Attributes.cpp:1650
llvm::Type::isVoidTy
bool isVoidTy() const
Return true if this is 'void'.
Definition: Type.h:140
llvm::AttributeSet::removeAttribute
AttributeSet removeAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Remove the specified attribute from this set.
Definition: Attributes.cpp:729
llvm::AttrBuilder::contains
bool contains(Attribute::AttrKind A) const
Return true if the builder has the specified attribute.
Definition: Attributes.cpp:1872
FnAttr
@ FnAttr
Definition: Attributes.cpp:593
llvm::AttributeImpl::isTypeAttribute
bool isTypeAttribute() const
Definition: AttributeImpl.h:61
llvm::AttributeSet::getNumAttributes
unsigned getNumAttributes() const
Return the number of attributes in this set.
Definition: Attributes.cpp:756
llvm::AttributeSetNode::getStackAlignment
MaybeAlign getStackAlignment() const
Definition: Attributes.cpp:966
llvm::StringAttributeImpl
Definition: AttributeImpl.h:153
llvm::size
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.
Definition: STLExtras.h:1716
unpackVScaleRangeArgs
static std::pair< unsigned, std::optional< unsigned > > unpackVScaleRangeArgs(uint64_t Value)
Definition: Attributes.cpp:83
AttributeImpl.h
llvm::AttributeImpl::operator<
bool operator<(const AttributeImpl &AI) const
Used when sorting the attributes.
Definition: Attributes.cpp:664
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition: APInt.h:33
llvm::AttributeList::AttributeListImpl
friend class AttributeListImpl
Definition: Attributes.h:442
llvm::any_of
bool any_of(R &&range, UnaryPredicate P)
Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.
Definition: STLExtras.h:1742
llvm::sys::Memory
This class provides various memory handling functions that manipulate MemoryBlock instances.
Definition: Memory.h:52
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:143
llvm::AttributeSetNode::getAttribute
Attribute getAttribute(Attribute::AttrKind Kind) const
Definition: Attributes.cpp:950
llvm::AttributeSet::dump
void dump() const
Definition: Attributes.cpp:864
A
* A
Definition: README_ALTIVEC.txt:89
llvm::UWTableKind::Sync
@ Sync
"Synchronous" unwind tables
llvm::Attribute::getDereferenceableOrNullBytes
uint64_t getDereferenceableOrNullBytes() const
Returns the number of dereferenceable_or_null bytes from the dereferenceable_or_null attribute.
Definition: Attributes.cpp:355
Compiler.h
llvm::append_range
void append_range(Container &C, Range &&R)
Wrapper function to append a range to a container.
Definition: STLExtras.h:2014
llvm::AttributeList::getParamByRefType
Type * getParamByRefType(unsigned ArgNo) const
Return the byref type for the specified function parameter.
Definition: Attributes.cpp:1522
llvm::ModRefInfo::Mod
@ Mod
The access may modify the value stored in memory.
llvm::FoldingSetNodeID
FoldingSetNodeID - This class is used to gather all the unique data bits of a node.
Definition: FoldingSet.h:318
llvm::AttributeFuncs::updateMinLegalVectorWidthAttr
void updateMinLegalVectorWidthAttr(Function &Fn, uint64_t Width)
Update min-legal-vector-width if it is in Attribute and less than Width.
Definition: Attributes.cpp:2146
llvm::Attribute::getUWTableKind
UWTableKind getUWTableKind() const
Definition: Attributes.cpp:381
llvm::AttributeSetNode
Definition: AttributeImpl.h:219
adjustCallerStackProbeSize
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...
Definition: Attributes.cpp:2019
llvm::Type::isPtrOrPtrVectorTy
bool isPtrOrPtrVectorTy() const
Return true if this is a pointer type or a vector of pointer types.
Definition: Type.h:255
llvm::AttrBuilder::addAllocSizeAttrFromRawRepr
AttrBuilder & addAllocSizeAttrFromRawRepr(uint64_t RawAllocSizeRepr)
Add an allocsize attribute, using the representation returned by Attribute.getIntValue().
Definition: Attributes.cpp:1777
llvm::AttributeSetNode::getUWTableKind
UWTableKind getUWTableKind() const
Definition: Attributes.cpp:1009
llvm::Attribute::getWithDereferenceableOrNullBytes
static Attribute getWithDereferenceableOrNullBytes(LLVMContext &Context, uint64_t Bytes)
Definition: Attributes.cpp:183
llvm::AttributeList::getRetStackAlignment
MaybeAlign getRetStackAlignment() const
Get the stack alignment of the return value.
Definition: Attributes.cpp:1542
AttributeComparator::operator()
bool operator()(Attribute A0, StringRef Kind) const
Definition: Attributes.cpp:1669
llvm::AttributeListImpl::Profile
void Profile(FoldingSetNodeID &ID) const
Definition: Attributes.cpp:1066
llvm::StringAttributeImpl::totalSizeToAlloc
static size_t totalSizeToAlloc(StringRef Kind, StringRef Val)
Definition: AttributeImpl.h:183
llvm::Function::begin
iterator begin()
Definition: Function.h:751
FoldingSet.h
llvm::AttrBuilder::addStructRetAttr
AttrBuilder & addStructRetAttr(Type *Ty)
This turns a sret type into the form used internally in Attribute.
Definition: Attributes.cpp:1824
llvm::AttributeList::addAttributesAtIndex
AttributeList addAttributesAtIndex(LLVMContext &C, unsigned Index, const AttrBuilder &B) const
Add attributes to the attribute set at the given index.
Definition: Attributes.cpp:1345
Callee
amdgpu Simplify well known AMD library false FunctionCallee Callee
Definition: AMDGPULibCalls.cpp:187
llvm::Attribute::getWithAlignment
static Attribute getWithAlignment(LLVMContext &Context, Align Alignment)
Return a uniquified Attribute object that has the specific alignment set.
Definition: Attributes.cpp:167
Attributes.h
llvm::AttributeImpl::getValueAsBool
bool getValueAsBool() const
Definition: Attributes.cpp:644
llvm::Attribute::getDereferenceableBytes
uint64_t getDereferenceableBytes() const
Returns the number of dereferenceable bytes from the dereferenceable attribute.
Definition: Attributes.cpp:348
llvm::Attribute::hasParentContext
bool hasParentContext(LLVMContext &C) const
Return true if this attribute belongs to the LLVMContext.
Definition: Attributes.cpp:573
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
llvm::AttributeListImpl::AttributeListImpl
AttributeListImpl(ArrayRef< AttributeSet > Sets)
Definition: Attributes.cpp:1047
llvm::AttributeSet::getPreallocatedType
Type * getPreallocatedType() const
Definition: Attributes.cpp:804
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:50
llvm::AttributeSet::getByRefType
Type * getByRefType() const
Definition: Attributes.cpp:792
llvm::Attribute::isExistingAttribute
static bool isExistingAttribute(StringRef Name)
Return true if the provided string matches the IR name of an attribute.
Definition: Attributes.cpp:256
llvm::EnumAttributeImpl
Definition: AttributeImpl.h:123
llvm::Attribute::Attribute
Attribute()=default
llvm::AttributeSet::getByValType
Type * getByValType() const
Definition: Attributes.cpp:796
llvm::AttributeList::getAllocKind
AllocFnKind getAllocKind() const
Definition: Attributes.cpp:1567
llvm::ArrayRef::begin
iterator begin() const
Definition: ArrayRef.h:151
llvm::ArrayRef::take_front
ArrayRef< T > take_front(size_t N=1) const
Return a copy of *this with only the first N elements.
Definition: ArrayRef.h:226
llvm::Align::value
uint64_t value() const
This is a hole in the type system and should not be abused.
Definition: Alignment.h:85
llvm::AttributeSetNode::getMemoryEffects
MemoryEffects getMemoryEffects() const
Definition: Attributes.cpp:1021
llvm::Function::back
const BasicBlock & back() const
Definition: Function.h:760
llvm::BumpPtrAllocatorImpl::Allocate
LLVM_ATTRIBUTE_RETURNS_NONNULL void * Allocate(size_t Size, Align Alignment)
Allocate space at the specified alignment.
Definition: Allocator.h:148
llvm::AttributeList::getParamStructRetType
Type * getParamStructRetType(unsigned ArgNo) const
Return the sret type for the specified function parameter.
Definition: Attributes.cpp:1518
llvm::AllocFnKind::Uninitialized
@ Uninitialized
llvm::Attribute::getValueAsType
Type * getValueAsType() const
Return the attribute's value as a Type.
Definition: Attributes.cpp:319
llvm::AttributeSet::getMemoryEffects
MemoryEffects getMemoryEffects() const
Definition: Attributes.cpp:839
Function.h
llvm::AttrBuilder::addMemoryAttr
AttrBuilder & addMemoryAttr(MemoryEffects ME)
Add memory effect attribute.
Definition: Attributes.cpp:1802
AttributeComparator::operator()
bool operator()(Attribute A0, Attribute::AttrKind Kind) const
Definition: Attributes.cpp:1664
llvm::is_sorted
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...
Definition: STLExtras.h:1884
llvm::AttributeList::getNumAttrSets
unsigned getNumAttrSets() const
Definition: Attributes.cpp:1606
llvm::AttributeFuncs::typeIncompatible
AttributeMask typeIncompatible(Type *Ty, AttributeSafetyKind ASK=ASK_ALL)
Which attributes cannot be applied to a type.
Definition: Attributes.cpp:1889
llvm::AttributeSet::begin
iterator begin() const
Definition: Attributes.cpp:855
unpackAllocSizeArgs
static std::pair< unsigned, std::optional< unsigned > > unpackAllocSizeArgs(uint64_t Num)
Definition: Attributes.cpp:67
llvm::LLVMContextImpl::AttrsSetNodes
FoldingSet< AttributeSetNode > AttrsSetNodes
Definition: LLVMContextImpl.h:1459
llvm::AttributeList::getAttributeAtIndex
Attribute getAttributeAtIndex(unsigned Index, Attribute::AttrKind Kind) const
Return the attribute object that exists at the given index.
Definition: Attributes.cpp:1492
llvm::AttributeSet::getElementType
Type * getElementType() const
Definition: Attributes.cpp:812
StringSwitch.h
llvm::AttributeSetNode::end
iterator end() const
Definition: AttributeImpl.h:275
llvm::AMDGPU::Hwreg::Width
Width
Definition: SIDefines.h:439
AttributeComparator::operator()
bool operator()(Attribute A0, Attribute A1) const
Definition: Attributes.cpp:1651
llvm::AttrBuilder::addDereferenceableAttr
AttrBuilder & addDereferenceableAttr(uint64_t Bytes)
This turns the number of dereferenceable bytes into the form used internally in Attribute.
Definition: Attributes.cpp:1758
llvm::AttributeSet::getAllocSizeArgs
std::optional< std::pair< unsigned, std::optional< unsigned > > > getAllocSizeArgs() const
Definition: Attributes.cpp:817
llvm::Attribute::getWithByRefType
static Attribute getWithByRefType(LLVMContext &Context, Type *Ty)
Definition: Attributes.cpp:197
llvm::AttributeList::FunctionIndex
@ FunctionIndex
Definition: Attributes.h:436
llvm::Attribute::getNameFromAttrKind
static StringRef getNameFromAttrKind(Attribute::AttrKind AttrKind)
Definition: Attributes.cpp:242
llvm::AttributeFuncs::areInlineCompatible
bool areInlineCompatible(const Function &Caller, const Function &Callee)
Definition: Attributes.cpp:2118
llvm::AttributeSet
Definition: Attributes.h:295
RetAttr
@ RetAttr
Definition: Attributes.cpp:595
SmallVector.h
llvm::AttributeSet::getAttribute
Attribute getAttribute(Attribute::AttrKind Kind) const
Return the attribute object.
Definition: Attributes.cpp:768
List
const NodeList & List
Definition: RDFGraph.cpp:199
llvm::AttributeSetNode::getAsString
std::string getAsString(bool InAttrGrp) const
Definition: Attributes.cpp:1027
llvm::Function::removeFnAttr
void removeFnAttr(Attribute::AttrKind Kind)
Remove function attributes from this function.
Definition: Function.cpp:598
llvm::AttributeBitSet::addAttribute
void addAttribute(Attribute::AttrKind Kind)
Definition: AttributeImpl.h:210
llvm::AttributeList::addRetAttributes
AttributeList addRetAttributes(LLVMContext &C, const AttrBuilder &B) const
Add a return value attribute to the list.
Definition: Attributes.h:562
llvm::ArrayRef::size
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:163
llvm::AllocFnKind
AllocFnKind
Definition: Attributes.h:49
llvm::Function::addFnAttr
void addFnAttr(Attribute::AttrKind Kind)
Add function attributes to this function.
Definition: Function.cpp:550
llvm::AttributeList::indexes
index_iterator indexes() const
Use this to iterate over the valid attribute indexes.
Definition: Attributes.h:930
llvm::AttributeList::AttributeSet
friend class AttributeSet
Definition: Attributes.h:443
llvm::AttributeList::AttrBuilder
friend class AttrBuilder
Definition: Attributes.h:441
llvm::AttributeList::addAttributeAtIndex
AttributeList addAttributeAtIndex(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Add an attribute to the attribute set at the given index.
Definition: Attributes.cpp:1302
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:42
llvm::AttributeImpl::getValueAsType
Type * getValueAsType() const
Definition: Attributes.cpp:659
llvm::Attribute::Profile
void Profile(FoldingSetNodeID &ID) const
Definition: Attributes.cpp:588
llvm::AttributeSet::getStackAlignment
MaybeAlign getStackAlignment() const
Definition: Attributes.cpp:780
llvm::Attribute::isIntAttribute
bool isIntAttribute() const
Return true if the attribute is an integer attribute.
Definition: Attributes.cpp:272
llvm::AttributeSet::getStructRetType
Type * getStructRetType() const
Definition: Attributes.cpp:800
llvm::StringSwitch::Default
R Default(T Value)
Definition: StringSwitch.h:182
llvm::ArrayRef
ArrayRef(const T &OneElt) -> ArrayRef< T >
llvm::StringSwitch
A switch()-like statement whose cases are string literals.
Definition: StringSwitch.h:44
llvm::StringRef::str
std::string str() const
str - Get the contents as an std::string.
Definition: StringRef.h:222
LLVMContext.h
llvm::AttributeFuncs::mergeAttributesForInlining
void mergeAttributesForInlining(Function &Caller, const Function &Callee)
Merge caller's and callee's attributes.
Definition: Attributes.cpp:2128
llvm::AttributeMask::addAttribute
AttributeMask & addAttribute(Attribute::AttrKind Val)
Add an attribute to the mask.
Definition: Attributes.h:994
llvm::AttributeImpl::Profile
void Profile(FoldingSetNodeID &ID) const
Definition: AttributeImpl.h:78
raw_ostream.h
llvm::AttributeSet::getAlignment
MaybeAlign getAlignment() const
Definition: Attributes.cpp:776
llvm::AttributeSetNode::getAllocKind
AllocFnKind getAllocKind() const
Definition: Attributes.cpp:1015
llvm::Attribute::getWithByValType
static Attribute getWithByValType(LLVMContext &Context, Type *Ty)
Definition: Attributes.cpp:189
llvm::AttributeList::getParamAttrs
AttributeSet getParamAttrs(unsigned ArgNo) const
The attributes for the argument or parameter at the given index are returned.
Definition: Attributes.cpp:1454
llvm::SmallVectorImpl::reserve
void reserve(size_type N)
Definition: SmallVector.h:667
llvm::AttrBuilder::overlaps
bool overlaps(const AttributeMask &AM) const
Return true if the builder has any attribute that's in the specified builder.
Definition: Attributes.cpp:1853
llvm::AttributeListImpl::hasAttrSomewhere
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.
Definition: Attributes.cpp:1076
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::AttributeList::FirstArgIndex
@ FirstArgIndex
Definition: Attributes.h:437
llvm::AttributeImpl::isStringAttribute
bool isStringAttribute() const
Definition: AttributeImpl.h:60
EnumAttr::isSet
static bool isSet(const Function &Fn, Attribute::AttrKind Kind)
Definition: Attributes.cpp:2075
llvm::AllocFnKind::Zeroed
@ Zeroed
llvm::Attribute::operator<
bool operator<(Attribute A) const
Less-than operator. Useful for sorting the attributes list.
Definition: Attributes.cpp:581
llvm::AttributeList::isEmpty
bool isEmpty() const
Return true if there are no attributes.
Definition: Attributes.h:942
llvm::AttributeImpl::getValueAsInt
uint64_t getValueAsInt() const
Definition: Attributes.cpp:639
llvm::AttributeSetNode::get
static AttributeSetNode * get(LLVMContext &C, const AttrBuilder &B)
Definition: Attributes.cpp:925
llvm::ModRefInfo::ModRef
@ ModRef
The access may reference and may modify the value stored in memory.
llvm::AttributeSetNode::getVScaleRangeMin
unsigned getVScaleRangeMin() const
Definition: Attributes.cpp:997
llvm::Attribute::canUseAsRetAttr
static bool canUseAsRetAttr(AttrKind Kind)
Definition: Attributes.cpp:616
llvm::sampleprof::Base
@ Base
Definition: Discriminator.h:58
llvm::Attribute::getMemoryEffects
MemoryEffects getMemoryEffects() const
Returns memory effects.
Definition: Attributes.cpp:393
llvm::SmallVectorImpl::emplace_back
reference emplace_back(ArgTypes &&... Args)
Definition: SmallVector.h:941
llvm::Function::size
size_t size() const
Definition: Function.h:756
llvm::AttributeList::getFnStackAlignment
MaybeAlign getFnStackAlignment() const
Get the stack alignment of the function.
Definition: Attributes.cpp:1538