LLVM  17.0.0git
Function.cpp
Go to the documentation of this file.
1 //===- Function.cpp - Implement the Global object classes -----------------===//
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 // This file implements the Function class for the IR library.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "llvm/IR/Function.h"
15 #include "llvm/ADT/ArrayRef.h"
16 #include "llvm/ADT/DenseSet.h"
17 #include "llvm/ADT/STLExtras.h"
18 #include "llvm/ADT/SmallString.h"
19 #include "llvm/ADT/SmallVector.h"
20 #include "llvm/ADT/StringExtras.h"
21 #include "llvm/ADT/StringRef.h"
23 #include "llvm/IR/Argument.h"
24 #include "llvm/IR/Attributes.h"
25 #include "llvm/IR/BasicBlock.h"
26 #include "llvm/IR/Constant.h"
27 #include "llvm/IR/Constants.h"
28 #include "llvm/IR/DerivedTypes.h"
29 #include "llvm/IR/GlobalValue.h"
30 #include "llvm/IR/InstIterator.h"
31 #include "llvm/IR/Instruction.h"
32 #include "llvm/IR/IntrinsicInst.h"
33 #include "llvm/IR/Intrinsics.h"
34 #include "llvm/IR/IntrinsicsAArch64.h"
35 #include "llvm/IR/IntrinsicsAMDGPU.h"
36 #include "llvm/IR/IntrinsicsARM.h"
37 #include "llvm/IR/IntrinsicsBPF.h"
38 #include "llvm/IR/IntrinsicsDirectX.h"
39 #include "llvm/IR/IntrinsicsHexagon.h"
40 #include "llvm/IR/IntrinsicsMips.h"
41 #include "llvm/IR/IntrinsicsNVPTX.h"
42 #include "llvm/IR/IntrinsicsPowerPC.h"
43 #include "llvm/IR/IntrinsicsR600.h"
44 #include "llvm/IR/IntrinsicsRISCV.h"
45 #include "llvm/IR/IntrinsicsS390.h"
46 #include "llvm/IR/IntrinsicsVE.h"
47 #include "llvm/IR/IntrinsicsWebAssembly.h"
48 #include "llvm/IR/IntrinsicsX86.h"
49 #include "llvm/IR/IntrinsicsXCore.h"
50 #include "llvm/IR/LLVMContext.h"
51 #include "llvm/IR/MDBuilder.h"
52 #include "llvm/IR/Metadata.h"
53 #include "llvm/IR/Module.h"
54 #include "llvm/IR/Operator.h"
56 #include "llvm/IR/Type.h"
57 #include "llvm/IR/Use.h"
58 #include "llvm/IR/User.h"
59 #include "llvm/IR/Value.h"
61 #include "llvm/Support/Casting.h"
63 #include "llvm/Support/Compiler.h"
65 #include "llvm/Support/ModRef.h"
66 #include <cassert>
67 #include <cstddef>
68 #include <cstdint>
69 #include <cstring>
70 #include <string>
71 
72 using namespace llvm;
74 
75 // Explicit instantiations of SymbolTableListTraits since some of the methods
76 // are not in the public header file...
78 
80  "non-global-value-max-name-size", cl::Hidden, cl::init(1024),
81  cl::desc("Maximum size for the name of non-global values."));
82 
83 //===----------------------------------------------------------------------===//
84 // Argument Implementation
85 //===----------------------------------------------------------------------===//
86 
87 Argument::Argument(Type *Ty, const Twine &Name, Function *Par, unsigned ArgNo)
88  : Value(Ty, Value::ArgumentVal), Parent(Par), ArgNo(ArgNo) {
89  setName(Name);
90 }
91 
92 void Argument::setParent(Function *parent) {
93  Parent = parent;
94 }
95 
96 bool Argument::hasNonNullAttr(bool AllowUndefOrPoison) const {
97  if (!getType()->isPointerTy()) return false;
98  if (getParent()->hasParamAttribute(getArgNo(), Attribute::NonNull) &&
99  (AllowUndefOrPoison ||
100  getParent()->hasParamAttribute(getArgNo(), Attribute::NoUndef)))
101  return true;
102  else if (getDereferenceableBytes() > 0 &&
104  getType()->getPointerAddressSpace()))
105  return true;
106  return false;
107 }
108 
110  if (!getType()->isPointerTy()) return false;
111  return hasAttribute(Attribute::ByVal);
112 }
113 
115  if (!getType()->isPointerTy())
116  return false;
117  return hasAttribute(Attribute::ByRef);
118 }
119 
121  return getParent()->hasParamAttribute(getArgNo(), Attribute::SwiftSelf);
122 }
123 
125  return getParent()->hasParamAttribute(getArgNo(), Attribute::SwiftError);
126 }
127 
129  if (!getType()->isPointerTy()) return false;
130  return hasAttribute(Attribute::InAlloca);
131 }
132 
134  if (!getType()->isPointerTy())
135  return false;
136  return hasAttribute(Attribute::Preallocated);
137 }
138 
140  if (!getType()->isPointerTy()) return false;
142  return Attrs.hasParamAttr(getArgNo(), Attribute::ByVal) ||
143  Attrs.hasParamAttr(getArgNo(), Attribute::InAlloca) ||
144  Attrs.hasParamAttr(getArgNo(), Attribute::Preallocated);
145 }
146 
148  if (!getType()->isPointerTy())
149  return false;
151  return Attrs.hasParamAttr(getArgNo(), Attribute::ByVal) ||
152  Attrs.hasParamAttr(getArgNo(), Attribute::StructRet) ||
153  Attrs.hasParamAttr(getArgNo(), Attribute::InAlloca) ||
154  Attrs.hasParamAttr(getArgNo(), Attribute::Preallocated) ||
155  Attrs.hasParamAttr(getArgNo(), Attribute::ByRef);
156 }
157 
158 /// For a byval, sret, inalloca, or preallocated parameter, get the in-memory
159 /// parameter type.
161  // FIXME: All the type carrying attributes are mutually exclusive, so there
162  // should be a single query to get the stored type that handles any of them.
163  if (Type *ByValTy = ParamAttrs.getByValType())
164  return ByValTy;
165  if (Type *ByRefTy = ParamAttrs.getByRefType())
166  return ByRefTy;
167  if (Type *PreAllocTy = ParamAttrs.getPreallocatedType())
168  return PreAllocTy;
169  if (Type *InAllocaTy = ParamAttrs.getInAllocaType())
170  return InAllocaTy;
171  if (Type *SRetTy = ParamAttrs.getStructRetType())
172  return SRetTy;
173 
174  return nullptr;
175 }
176 
178  AttributeSet ParamAttrs =
180  if (Type *MemTy = getMemoryParamAllocType(ParamAttrs))
181  return DL.getTypeAllocSize(MemTy);
182  return 0;
183 }
184 
186  AttributeSet ParamAttrs =
188  return getMemoryParamAllocType(ParamAttrs);
189 }
190 
192  assert(getType()->isPointerTy() && "Only pointers have alignments");
193  return getParent()->getParamAlign(getArgNo());
194 }
195 
198 }
199 
201  assert(getType()->isPointerTy() && "Only pointers have byval types");
202  return getParent()->getParamByValType(getArgNo());
203 }
204 
206  assert(getType()->isPointerTy() && "Only pointers have sret types");
208 }
209 
211  assert(getType()->isPointerTy() && "Only pointers have byref types");
212  return getParent()->getParamByRefType(getArgNo());
213 }
214 
216  assert(getType()->isPointerTy() && "Only pointers have inalloca types");
218 }
219 
221  assert(getType()->isPointerTy() &&
222  "Only pointers have dereferenceable bytes");
224 }
225 
227  assert(getType()->isPointerTy() &&
228  "Only pointers have dereferenceable bytes");
230 }
231 
232 bool Argument::hasNestAttr() const {
233  if (!getType()->isPointerTy()) return false;
234  return hasAttribute(Attribute::Nest);
235 }
236 
238  if (!getType()->isPointerTy()) return false;
239  return hasAttribute(Attribute::NoAlias);
240 }
241 
243  if (!getType()->isPointerTy()) return false;
244  return hasAttribute(Attribute::NoCapture);
245 }
246 
248  if (!getType()->isPointerTy()) return false;
249  return hasAttribute(Attribute::NoFree);
250 }
251 
253  if (!getType()->isPointerTy()) return false;
254  return hasAttribute(Attribute::StructRet);
255 }
256 
258  return hasAttribute(Attribute::InReg);
259 }
260 
262  return hasAttribute(Attribute::Returned);
263 }
264 
265 bool Argument::hasZExtAttr() const {
266  return hasAttribute(Attribute::ZExt);
267 }
268 
269 bool Argument::hasSExtAttr() const {
270  return hasAttribute(Attribute::SExt);
271 }
272 
275  return Attrs.hasParamAttr(getArgNo(), Attribute::ReadOnly) ||
276  Attrs.hasParamAttr(getArgNo(), Attribute::ReadNone);
277 }
278 
281  AL = AL.addParamAttributes(Parent->getContext(), getArgNo(), B);
283 }
284 
286  getParent()->addParamAttr(getArgNo(), Kind);
287 }
288 
290  getParent()->addParamAttr(getArgNo(), Attr);
291 }
292 
294  getParent()->removeParamAttr(getArgNo(), Kind);
295 }
296 
299  AL = AL.removeParamAttributes(Parent->getContext(), getArgNo(), AM);
301 }
302 
304  return getParent()->hasParamAttribute(getArgNo(), Kind);
305 }
306 
308  return getParent()->getParamAttribute(getArgNo(), Kind);
309 }
310 
311 //===----------------------------------------------------------------------===//
312 // Helper Methods in Function
313 //===----------------------------------------------------------------------===//
314 
316  return getType()->getContext();
317 }
318 
320  unsigned NumInstrs = 0;
321  for (const BasicBlock &BB : BasicBlocks)
322  NumInstrs += std::distance(BB.instructionsWithoutDebug().begin(),
323  BB.instructionsWithoutDebug().end());
324  return NumInstrs;
325 }
326 
328  const Twine &N, Module &M) {
329  return Create(Ty, Linkage, M.getDataLayout().getProgramAddressSpace(), N, &M);
330 }
331 
333  LinkageTypes Linkage,
334  unsigned AddrSpace, const Twine &N,
335  Module *M) {
336  auto *F = new Function(Ty, Linkage, AddrSpace, N, M);
337  AttrBuilder B(F->getContext());
338  UWTableKind UWTable = M->getUwtable();
339  if (UWTable != UWTableKind::None)
340  B.addUWTableAttr(UWTable);
341  switch (M->getFramePointer()) {
343  // 0 ("none") is the default.
344  break;
346  B.addAttribute("frame-pointer", "non-leaf");
347  break;
349  B.addAttribute("frame-pointer", "all");
350  break;
351  }
352  if (M->getModuleFlag("function_return_thunk_extern"))
353  B.addAttribute(Attribute::FnRetThunkExtern);
354  F->addFnAttrs(B);
355  return F;
356 }
357 
359  getParent()->getFunctionList().remove(getIterator());
360 }
361 
363  getParent()->getFunctionList().erase(getIterator());
364 }
365 
367  Function::iterator FromBeginIt,
368  Function::iterator FromEndIt) {
369 #ifdef EXPENSIVE_CHECKS
370  // Check that FromBeginIt is before FromEndIt.
371  auto FromFEnd = FromF->end();
372  for (auto It = FromBeginIt; It != FromEndIt; ++It)
373  assert(It != FromFEnd && "FromBeginIt not before FromEndIt!");
374 #endif // EXPENSIVE_CHECKS
375  BasicBlocks.splice(ToIt, FromF->BasicBlocks, FromBeginIt, FromEndIt);
376 }
377 
379  Function::iterator ToIt) {
380  return BasicBlocks.erase(FromIt, ToIt);
381 }
382 
383 //===----------------------------------------------------------------------===//
384 // Function Implementation
385 //===----------------------------------------------------------------------===//
386 
387 static unsigned computeAddrSpace(unsigned AddrSpace, Module *M) {
388  // If AS == -1 and we are passed a valid module pointer we place the function
389  // in the program address space. Otherwise we default to AS0.
390  if (AddrSpace == static_cast<unsigned>(-1))
391  return M ? M->getDataLayout().getProgramAddressSpace() : 0;
392  return AddrSpace;
393 }
394 
395 Function::Function(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace,
396  const Twine &name, Module *ParentModule)
397  : GlobalObject(Ty, Value::FunctionVal,
398  OperandTraits<Function>::op_begin(this), 0, Linkage, name,
399  computeAddrSpace(AddrSpace, ParentModule)),
400  NumArgs(Ty->getNumParams()) {
401  assert(FunctionType::isValidReturnType(getReturnType()) &&
402  "invalid return type");
403  setGlobalObjectSubClassData(0);
404 
405  // We only need a symbol table for a function if the context keeps value names
406  if (!getContext().shouldDiscardValueNames())
407  SymTab = std::make_unique<ValueSymbolTable>(NonGlobalValueMaxNameSize);
408 
409  // If the function has arguments, mark them as lazily built.
410  if (Ty->getNumParams())
411  setValueSubclassData(1); // Set the "has lazy arguments" bit.
412 
413  if (ParentModule)
414  ParentModule->getFunctionList().push_back(this);
415 
416  HasLLVMReservedName = getName().startswith("llvm.");
417  // Ensure intrinsics have the right parameter attributes.
418  // Note, the IntID field will have been set in Value::setName if this function
419  // name is a valid intrinsic ID.
420  if (IntID)
421  setAttributes(Intrinsic::getAttributes(getContext(), IntID));
422 }
423 
424 Function::~Function() {
425  dropAllReferences(); // After this it is safe to delete instructions.
426 
427  // Delete all of the method arguments and unlink from symbol table...
428  if (Arguments)
429  clearArguments();
430 
431  // Remove the function from the on-the-side GC table.
432  clearGC();
433 }
434 
435 void Function::BuildLazyArguments() const {
436  // Create the arguments vector, all arguments start out unnamed.
437  auto *FT = getFunctionType();
438  if (NumArgs > 0) {
439  Arguments = std::allocator<Argument>().allocate(NumArgs);
440  for (unsigned i = 0, e = NumArgs; i != e; ++i) {
441  Type *ArgTy = FT->getParamType(i);
442  assert(!ArgTy->isVoidTy() && "Cannot have void typed arguments!");
443  new (Arguments + i) Argument(ArgTy, "", const_cast<Function *>(this), i);
444  }
445  }
446 
447  // Clear the lazy arguments bit.
448  unsigned SDC = getSubclassDataFromValue();
449  SDC &= ~(1 << 0);
450  const_cast<Function*>(this)->setValueSubclassData(SDC);
452 }
453 
455  return MutableArrayRef<Argument>(Args, Count);
456 }
457 
459  switch (getIntrinsicID()) {
460 #define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC) \
461  case Intrinsic::INTRINSIC:
462 #include "llvm/IR/ConstrainedOps.def"
463  return true;
464 #undef INSTRUCTION
465  default:
466  return false;
467  }
468 }
469 
470 void Function::clearArguments() {
471  for (Argument &A : makeArgArray(Arguments, NumArgs)) {
472  A.setName("");
473  A.~Argument();
474  }
475  std::allocator<Argument>().deallocate(Arguments, NumArgs);
476  Arguments = nullptr;
477 }
478 
480  assert(isDeclaration() && "Expected no references to current arguments");
481 
482  // Drop the current arguments, if any, and set the lazy argument bit.
483  if (!hasLazyArguments()) {
484  assert(llvm::all_of(makeArgArray(Arguments, NumArgs),
485  [](const Argument &A) { return A.use_empty(); }) &&
486  "Expected arguments to be unused in declaration");
487  clearArguments();
488  setValueSubclassData(getSubclassDataFromValue() | (1 << 0));
489  }
490 
491  // Nothing to steal if Src has lazy arguments.
492  if (Src.hasLazyArguments())
493  return;
494 
495  // Steal arguments from Src, and fix the lazy argument bits.
496  assert(arg_size() == Src.arg_size());
497  Arguments = Src.Arguments;
498  Src.Arguments = nullptr;
499  for (Argument &A : makeArgArray(Arguments, NumArgs)) {
500  // FIXME: This does the work of transferNodesFromList inefficiently.
501  SmallString<128> Name;
502  if (A.hasName())
503  Name = A.getName();
504  if (!Name.empty())
505  A.setName("");
506  A.setParent(this);
507  if (!Name.empty())
508  A.setName(Name);
509  }
510 
511  setValueSubclassData(getSubclassDataFromValue() & ~(1 << 0));
513  Src.setValueSubclassData(Src.getSubclassDataFromValue() | (1 << 0));
514 }
515 
516 // dropAllReferences() - This function causes all the subinstructions to "let
517 // go" of all references that they are maintaining. This allows one to
518 // 'delete' a whole class at a time, even though there may be circular
519 // references... first all references are dropped, and all use counts go to
520 // zero. Then everything is deleted for real. Note that no operations are
521 // valid on an object that has "dropped all references", except operator
522 // delete.
523 //
525  setIsMaterializable(false);
526 
527  for (BasicBlock &BB : *this)
528  BB.dropAllReferences();
529 
530  // Delete all basic blocks. They are now unused, except possibly by
531  // blockaddresses, but BasicBlock's destructor takes care of those.
532  while (!BasicBlocks.empty())
533  BasicBlocks.begin()->eraseFromParent();
534 
535  // Drop uses of any optional data (real or placeholder).
536  if (getNumOperands()) {
539  setValueSubclassData(getSubclassDataFromValue() & ~0xe);
540  }
541 
542  // Metadata is stored in a side-table.
543  clearMetadata();
544 }
545 
547  AttributeSets = AttributeSets.addAttributeAtIndex(getContext(), i, Attr);
548 }
549 
551  AttributeSets = AttributeSets.addFnAttribute(getContext(), Kind);
552 }
553 
555  AttributeSets = AttributeSets.addFnAttribute(getContext(), Kind, Val);
556 }
557 
559  AttributeSets = AttributeSets.addFnAttribute(getContext(), Attr);
560 }
561 
563  AttributeSets = AttributeSets.addFnAttributes(getContext(), Attrs);
564 }
565 
567  AttributeSets = AttributeSets.addRetAttribute(getContext(), Kind);
568 }
569 
571  AttributeSets = AttributeSets.addRetAttribute(getContext(), Attr);
572 }
573 
575  AttributeSets = AttributeSets.addRetAttributes(getContext(), Attrs);
576 }
577 
578 void Function::addParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) {
579  AttributeSets = AttributeSets.addParamAttribute(getContext(), ArgNo, Kind);
580 }
581 
582 void Function::addParamAttr(unsigned ArgNo, Attribute Attr) {
583  AttributeSets = AttributeSets.addParamAttribute(getContext(), ArgNo, Attr);
584 }
585 
586 void Function::addParamAttrs(unsigned ArgNo, const AttrBuilder &Attrs) {
587  AttributeSets = AttributeSets.addParamAttributes(getContext(), ArgNo, Attrs);
588 }
589 
591  AttributeSets = AttributeSets.removeAttributeAtIndex(getContext(), i, Kind);
592 }
593 
595  AttributeSets = AttributeSets.removeAttributeAtIndex(getContext(), i, Kind);
596 }
597 
599  AttributeSets = AttributeSets.removeFnAttribute(getContext(), Kind);
600 }
601 
603  AttributeSets = AttributeSets.removeFnAttribute(getContext(), Kind);
604 }
605 
607  AttributeSets = AttributeSets.removeFnAttributes(getContext(), AM);
608 }
609 
611  AttributeSets = AttributeSets.removeRetAttribute(getContext(), Kind);
612 }
613 
615  AttributeSets = AttributeSets.removeRetAttribute(getContext(), Kind);
616 }
617 
619  AttributeSets = AttributeSets.removeRetAttributes(getContext(), Attrs);
620 }
621 
622 void Function::removeParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) {
623  AttributeSets = AttributeSets.removeParamAttribute(getContext(), ArgNo, Kind);
624 }
625 
626 void Function::removeParamAttr(unsigned ArgNo, StringRef Kind) {
627  AttributeSets = AttributeSets.removeParamAttribute(getContext(), ArgNo, Kind);
628 }
629 
630 void Function::removeParamAttrs(unsigned ArgNo, const AttributeMask &Attrs) {
631  AttributeSets =
632  AttributeSets.removeParamAttributes(getContext(), ArgNo, Attrs);
633 }
634 
635 void Function::addDereferenceableParamAttr(unsigned ArgNo, uint64_t Bytes) {
636  AttributeSets =
637  AttributeSets.addDereferenceableParamAttr(getContext(), ArgNo, Bytes);
638 }
639 
641  return AttributeSets.hasFnAttr(Kind);
642 }
643 
645  return AttributeSets.hasFnAttr(Kind);
646 }
647 
649  return AttributeSets.hasRetAttr(Kind);
650 }
651 
652 bool Function::hasParamAttribute(unsigned ArgNo,
653  Attribute::AttrKind Kind) const {
654  return AttributeSets.hasParamAttr(ArgNo, Kind);
655 }
656 
658  Attribute::AttrKind Kind) const {
659  return AttributeSets.getAttributeAtIndex(i, Kind);
660 }
661 
663  return AttributeSets.getAttributeAtIndex(i, Kind);
664 }
665 
667  return AttributeSets.getFnAttr(Kind);
668 }
669 
671  return AttributeSets.getFnAttr(Kind);
672 }
673 
675  uint64_t Default) const {
676  Attribute A = getFnAttribute(Name);
677  uint64_t Result = Default;
678  if (A.isStringAttribute()) {
679  StringRef Str = A.getValueAsString();
680  if (Str.getAsInteger(0, Result))
681  getContext().emitError("cannot parse integer attribute " + Name);
682  }
683 
684  return Result;
685 }
686 
687 /// gets the specified attribute from the list of attributes.
689  Attribute::AttrKind Kind) const {
690  return AttributeSets.getParamAttr(ArgNo, Kind);
691 }
692 
694  uint64_t Bytes) {
695  AttributeSets = AttributeSets.addDereferenceableOrNullParamAttr(getContext(),
696  ArgNo, Bytes);
697 }
698 
700  if (&FPType == &APFloat::IEEEsingle()) {
701  Attribute Attr = getFnAttribute("denormal-fp-math-f32");
702  StringRef Val = Attr.getValueAsString();
703  if (!Val.empty())
704  return parseDenormalFPAttribute(Val);
705 
706  // If the f32 variant of the attribute isn't specified, try to use the
707  // generic one.
708  }
709 
710  Attribute Attr = getFnAttribute("denormal-fp-math");
712 }
713 
714 const std::string &Function::getGC() const {
715  assert(hasGC() && "Function has no collector");
716  return getContext().getGC(*this);
717 }
718 
719 void Function::setGC(std::string Str) {
720  setValueSubclassDataBit(14, !Str.empty());
721  getContext().setGC(*this, std::move(Str));
722 }
723 
725  if (!hasGC())
726  return;
727  getContext().deleteGC(*this);
728  setValueSubclassDataBit(14, false);
729 }
730 
732  return hasFnAttribute(Attribute::StackProtect) ||
733  hasFnAttribute(Attribute::StackProtectStrong) ||
734  hasFnAttribute(Attribute::StackProtectReq);
735 }
736 
737 /// Copy all additional attributes (those not needed to create a Function) from
738 /// the Function Src to this one.
741  setCallingConv(Src->getCallingConv());
742  setAttributes(Src->getAttributes());
743  if (Src->hasGC())
744  setGC(Src->getGC());
745  else
746  clearGC();
747  if (Src->hasPersonalityFn())
748  setPersonalityFn(Src->getPersonalityFn());
749  if (Src->hasPrefixData())
750  setPrefixData(Src->getPrefixData());
751  if (Src->hasPrologueData())
752  setPrologueData(Src->getPrologueData());
753 }
754 
756  return getAttributes().getMemoryEffects();
757 }
760 }
761 
762 /// Determine if the function does not access memory.
765 }
768 }
769 
770 /// Determine if the function does not access or only reads memory.
773 }
776 }
777 
778 /// Determine if the function does not access or only writes memory.
781 }
784 }
785 
786 /// Determine if the call can access memmory only using pointers based
787 /// on its arguments.
790 }
793 }
794 
795 /// Determine if the function may only access memory that is
796 /// inaccessible from the IR.
799 }
802 }
803 
804 /// Determine if the function may only access memory that is
805 /// either inaccessible from the IR or pointed to by its arguments.
808 }
812 }
813 
814 /// Table of string intrinsic names indexed by enum value.
815 static const char * const IntrinsicNameTable[] = {
816  "not_intrinsic",
817 #define GET_INTRINSIC_NAME_TABLE
818 #include "llvm/IR/IntrinsicImpl.inc"
819 #undef GET_INTRINSIC_NAME_TABLE
820 };
821 
822 /// Table of per-target intrinsic name tables.
823 #define GET_INTRINSIC_TARGET_DATA
824 #include "llvm/IR/IntrinsicImpl.inc"
825 #undef GET_INTRINSIC_TARGET_DATA
826 
828  return IID > TargetInfos[0].Count;
829 }
830 
832  return isTargetIntrinsic(IntID);
833 }
834 
835 /// Find the segment of \c IntrinsicNameTable for intrinsics with the same
836 /// target as \c Name, or the generic table if \c Name is not target specific.
837 ///
838 /// Returns the relevant slice of \c IntrinsicNameTable
840  assert(Name.startswith("llvm."));
841 
842  ArrayRef<IntrinsicTargetInfo> Targets(TargetInfos);
843  // Drop "llvm." and take the first dotted component. That will be the target
844  // if this is target specific.
845  StringRef Target = Name.drop_front(5).split('.').first;
846  auto It = partition_point(
847  Targets, [=](const IntrinsicTargetInfo &TI) { return TI.Name < Target; });
848  // We've either found the target or just fall back to the generic set, which
849  // is always first.
850  const auto &TI = It != Targets.end() && It->Name == Target ? *It : Targets[0];
851  return ArrayRef(&IntrinsicNameTable[1] + TI.Offset, TI.Count);
852 }
853 
854 /// This does the actual lookup of an intrinsic ID which
855 /// matches the given function name.
857  ArrayRef<const char *> NameTable = findTargetSubtable(Name);
858  int Idx = Intrinsic::lookupLLVMIntrinsicByName(NameTable, Name);
859  if (Idx == -1)
861 
862  // Intrinsic IDs correspond to the location in IntrinsicNameTable, but we have
863  // an index into a sub-table.
864  int Adjust = NameTable.data() - IntrinsicNameTable;
865  Intrinsic::ID ID = static_cast<Intrinsic::ID>(Idx + Adjust);
866 
867  // If the intrinsic is not overloaded, require an exact match. If it is
868  // overloaded, require either exact or prefix match.
869  const auto MatchSize = strlen(NameTable[Idx]);
870  assert(Name.size() >= MatchSize && "Expected either exact or prefix match");
871  bool IsExactMatch = Name.size() == MatchSize;
872  return IsExactMatch || Intrinsic::isOverloaded(ID) ? ID
874 }
875 
877  StringRef Name = getName();
878  if (!Name.startswith("llvm.")) {
879  HasLLVMReservedName = false;
881  return;
882  }
883  HasLLVMReservedName = true;
884  IntID = lookupIntrinsicID(Name);
885 }
886 
887 /// Returns a stable mangling for the type specified for use in the name
888 /// mangling scheme used by 'any' types in intrinsic signatures. The mangling
889 /// of named types is simply their name. Manglings for unnamed types consist
890 /// of a prefix ('p' for pointers, 'a' for arrays, 'f_' for functions)
891 /// combined with the mangling of their component types. A vararg function
892 /// type will have a suffix of 'vararg'. Since function types can contain
893 /// other function types, we close a function type mangling with suffix 'f'
894 /// which can't be confused with it's prefix. This ensures we don't have
895 /// collisions between two unrelated function types. Otherwise, you might
896 /// parse ffXX as f(fXX) or f(fX)X. (X is a placeholder for any other type.)
897 /// The HasUnnamedType boolean is set if an unnamed type was encountered,
898 /// indicating that extra care must be taken to ensure a unique name.
899 static std::string getMangledTypeStr(Type *Ty, bool &HasUnnamedType) {
900  std::string Result;
901  if (PointerType *PTyp = dyn_cast<PointerType>(Ty)) {
902  Result += "p" + utostr(PTyp->getAddressSpace());
903  // Opaque pointer doesn't have pointee type information, so we just mangle
904  // address space for opaque pointer.
905  if (!PTyp->isOpaque())
906  Result += getMangledTypeStr(PTyp->getNonOpaquePointerElementType(),
907  HasUnnamedType);
908  } else if (ArrayType *ATyp = dyn_cast<ArrayType>(Ty)) {
909  Result += "a" + utostr(ATyp->getNumElements()) +
910  getMangledTypeStr(ATyp->getElementType(), HasUnnamedType);
911  } else if (StructType *STyp = dyn_cast<StructType>(Ty)) {
912  if (!STyp->isLiteral()) {
913  Result += "s_";
914  if (STyp->hasName())
915  Result += STyp->getName();
916  else
917  HasUnnamedType = true;
918  } else {
919  Result += "sl_";
920  for (auto *Elem : STyp->elements())
921  Result += getMangledTypeStr(Elem, HasUnnamedType);
922  }
923  // Ensure nested structs are distinguishable.
924  Result += "s";
925  } else if (FunctionType *FT = dyn_cast<FunctionType>(Ty)) {
926  Result += "f_" + getMangledTypeStr(FT->getReturnType(), HasUnnamedType);
927  for (size_t i = 0; i < FT->getNumParams(); i++)
928  Result += getMangledTypeStr(FT->getParamType(i), HasUnnamedType);
929  if (FT->isVarArg())
930  Result += "vararg";
931  // Ensure nested function types are distinguishable.
932  Result += "f";
933  } else if (VectorType *VTy = dyn_cast<VectorType>(Ty)) {
934  ElementCount EC = VTy->getElementCount();
935  if (EC.isScalable())
936  Result += "nx";
937  Result += "v" + utostr(EC.getKnownMinValue()) +
938  getMangledTypeStr(VTy->getElementType(), HasUnnamedType);
939  } else if (TargetExtType *TETy = dyn_cast<TargetExtType>(Ty)) {
940  Result += "t";
941  Result += TETy->getName();
942  for (Type *ParamTy : TETy->type_params())
943  Result += "_" + getMangledTypeStr(ParamTy, HasUnnamedType);
944  for (unsigned IntParam : TETy->int_params())
945  Result += "_" + utostr(IntParam);
946  // Ensure nested target extension types are distinguishable.
947  Result += "t";
948  } else if (Ty) {
949  switch (Ty->getTypeID()) {
950  default: llvm_unreachable("Unhandled type");
951  case Type::VoidTyID: Result += "isVoid"; break;
952  case Type::MetadataTyID: Result += "Metadata"; break;
953  case Type::HalfTyID: Result += "f16"; break;
954  case Type::BFloatTyID: Result += "bf16"; break;
955  case Type::FloatTyID: Result += "f32"; break;
956  case Type::DoubleTyID: Result += "f64"; break;
957  case Type::X86_FP80TyID: Result += "f80"; break;
958  case Type::FP128TyID: Result += "f128"; break;
959  case Type::PPC_FP128TyID: Result += "ppcf128"; break;
960  case Type::X86_MMXTyID: Result += "x86mmx"; break;
961  case Type::X86_AMXTyID: Result += "x86amx"; break;
962  case Type::IntegerTyID:
963  Result += "i" + utostr(cast<IntegerType>(Ty)->getBitWidth());
964  break;
965  }
966  }
967  return Result;
968 }
969 
971  assert(id < num_intrinsics && "Invalid intrinsic ID!");
972  return IntrinsicNameTable[id];
973 }
974 
976  assert(id < num_intrinsics && "Invalid intrinsic ID!");
978  "This version of getName does not support overloading");
979  return getBaseName(id);
980 }
981 
983  Module *M, FunctionType *FT,
984  bool EarlyModuleCheck) {
985 
986  assert(Id < Intrinsic::num_intrinsics && "Invalid intrinsic ID!");
987  assert((Tys.empty() || Intrinsic::isOverloaded(Id)) &&
988  "This version of getName is for overloaded intrinsics only");
989  (void)EarlyModuleCheck;
990  assert((!EarlyModuleCheck || M ||
991  !any_of(Tys, [](Type *T) { return isa<PointerType>(T); })) &&
992  "Intrinsic overloading on pointer types need to provide a Module");
993  bool HasUnnamedType = false;
994  std::string Result(Intrinsic::getBaseName(Id));
995  for (Type *Ty : Tys)
996  Result += "." + getMangledTypeStr(Ty, HasUnnamedType);
997  if (HasUnnamedType) {
998  assert(M && "unnamed types need a module");
999  if (!FT)
1000  FT = Intrinsic::getType(M->getContext(), Id, Tys);
1001  else
1002  assert((FT == Intrinsic::getType(M->getContext(), Id, Tys)) &&
1003  "Provided FunctionType must match arguments");
1004  return M->getUniqueIntrinsicName(Result, Id, FT);
1005  }
1006  return Result;
1007 }
1008 
1010  FunctionType *FT) {
1011  assert(M && "We need to have a Module");
1012  return getIntrinsicNameImpl(Id, Tys, M, FT, true);
1013 }
1014 
1016  return getIntrinsicNameImpl(Id, Tys, nullptr, nullptr, false);
1017 }
1018 
1019 /// IIT_Info - These are enumerators that describe the entries returned by the
1020 /// getIntrinsicInfoTableEntries function.
1021 ///
1022 /// NOTE: This must be kept in synch with the copy in TblGen/IntrinsicEmitter!
1023 enum IIT_Info {
1024  // Common values should be encoded with 0-15.
1026  IIT_I1 = 1,
1027  IIT_I8 = 2,
1028  IIT_I16 = 3,
1029  IIT_I32 = 4,
1030  IIT_I64 = 5,
1031  IIT_F16 = 6,
1032  IIT_F32 = 7,
1033  IIT_F64 = 8,
1034  IIT_V2 = 9,
1035  IIT_V4 = 10,
1036  IIT_V8 = 11,
1037  IIT_V16 = 12,
1038  IIT_V32 = 13,
1039  IIT_PTR = 14,
1040  IIT_ARG = 15,
1041 
1042  // Values from 16+ are only encodable with the inefficient encoding.
1043  IIT_V64 = 16,
1044  IIT_MMX = 17,
1055  IIT_V1 = 28,
1062  IIT_I128 = 35,
1063  IIT_V512 = 36,
1068  IIT_F128 = 41,
1074  IIT_V128 = 47,
1075  IIT_BF16 = 48,
1077  IIT_V256 = 50,
1078  IIT_AMX = 51,
1080  IIT_V3 = 53,
1084  IIT_I2 = 57,
1085  IIT_I4 = 58,
1086 };
1087 
1088 static void DecodeIITType(unsigned &NextElt, ArrayRef<unsigned char> Infos,
1089  IIT_Info LastInfo,
1091  using namespace Intrinsic;
1092 
1093  bool IsScalableVector = (LastInfo == IIT_SCALABLE_VEC);
1094 
1095  IIT_Info Info = IIT_Info(Infos[NextElt++]);
1096  unsigned StructElts = 2;
1097 
1098  switch (Info) {
1099  case IIT_Done:
1100  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Void, 0));
1101  return;
1102  case IIT_VARARG:
1103  OutputTable.push_back(IITDescriptor::get(IITDescriptor::VarArg, 0));
1104  return;
1105  case IIT_MMX:
1106  OutputTable.push_back(IITDescriptor::get(IITDescriptor::MMX, 0));
1107  return;
1108  case IIT_AMX:
1109  OutputTable.push_back(IITDescriptor::get(IITDescriptor::AMX, 0));
1110  return;
1111  case IIT_TOKEN:
1112  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Token, 0));
1113  return;
1114  case IIT_METADATA:
1115  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Metadata, 0));
1116  return;
1117  case IIT_F16:
1118  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Half, 0));
1119  return;
1120  case IIT_BF16:
1121  OutputTable.push_back(IITDescriptor::get(IITDescriptor::BFloat, 0));
1122  return;
1123  case IIT_F32:
1124  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Float, 0));
1125  return;
1126  case IIT_F64:
1127  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Double, 0));
1128  return;
1129  case IIT_F128:
1130  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Quad, 0));
1131  return;
1132  case IIT_PPCF128:
1133  OutputTable.push_back(IITDescriptor::get(IITDescriptor::PPCQuad, 0));
1134  return;
1135  case IIT_I1:
1136  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Integer, 1));
1137  return;
1138  case IIT_I2:
1139  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Integer, 2));
1140  return;
1141  case IIT_I4:
1142  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Integer, 4));
1143  return;
1144  case IIT_I8:
1145  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Integer, 8));
1146  return;
1147  case IIT_I16:
1148  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Integer,16));
1149  return;
1150  case IIT_I32:
1151  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Integer, 32));
1152  return;
1153  case IIT_I64:
1154  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Integer, 64));
1155  return;
1156  case IIT_I128:
1157  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Integer, 128));
1158  return;
1159  case IIT_V1:
1160  OutputTable.push_back(IITDescriptor::getVector(1, IsScalableVector));
1161  DecodeIITType(NextElt, Infos, Info, OutputTable);
1162  return;
1163  case IIT_V2:
1164  OutputTable.push_back(IITDescriptor::getVector(2, IsScalableVector));
1165  DecodeIITType(NextElt, Infos, Info, OutputTable);
1166  return;
1167  case IIT_V3:
1168  OutputTable.push_back(IITDescriptor::getVector(3, IsScalableVector));
1169  DecodeIITType(NextElt, Infos, Info, OutputTable);
1170  return;
1171  case IIT_V4:
1172  OutputTable.push_back(IITDescriptor::getVector(4, IsScalableVector));
1173  DecodeIITType(NextElt, Infos, Info, OutputTable);
1174  return;
1175  case IIT_V8:
1176  OutputTable.push_back(IITDescriptor::getVector(8, IsScalableVector));
1177  DecodeIITType(NextElt, Infos, Info, OutputTable);
1178  return;
1179  case IIT_V16:
1180  OutputTable.push_back(IITDescriptor::getVector(16, IsScalableVector));
1181  DecodeIITType(NextElt, Infos, Info, OutputTable);
1182  return;
1183  case IIT_V32:
1184  OutputTable.push_back(IITDescriptor::getVector(32, IsScalableVector));
1185  DecodeIITType(NextElt, Infos, Info, OutputTable);
1186  return;
1187  case IIT_V64:
1188  OutputTable.push_back(IITDescriptor::getVector(64, IsScalableVector));
1189  DecodeIITType(NextElt, Infos, Info, OutputTable);
1190  return;
1191  case IIT_V128:
1192  OutputTable.push_back(IITDescriptor::getVector(128, IsScalableVector));
1193  DecodeIITType(NextElt, Infos, Info, OutputTable);
1194  return;
1195  case IIT_V256:
1196  OutputTable.push_back(IITDescriptor::getVector(256, IsScalableVector));
1197  DecodeIITType(NextElt, Infos, Info, OutputTable);
1198  return;
1199  case IIT_V512:
1200  OutputTable.push_back(IITDescriptor::getVector(512, IsScalableVector));
1201  DecodeIITType(NextElt, Infos, Info, OutputTable);
1202  return;
1203  case IIT_V1024:
1204  OutputTable.push_back(IITDescriptor::getVector(1024, IsScalableVector));
1205  DecodeIITType(NextElt, Infos, Info, OutputTable);
1206  return;
1207  case IIT_EXTERNREF:
1208  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Pointer, 10));
1209  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Struct, 0));
1210  return;
1211  case IIT_FUNCREF:
1212  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Pointer, 20));
1213  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Integer, 8));
1214  return;
1215  case IIT_PTR:
1216  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Pointer, 0));
1217  DecodeIITType(NextElt, Infos, Info, OutputTable);
1218  return;
1219  case IIT_ANYPTR: { // [ANYPTR addrspace, subtype]
1220  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Pointer,
1221  Infos[NextElt++]));
1222  DecodeIITType(NextElt, Infos, Info, OutputTable);
1223  return;
1224  }
1225  case IIT_ARG: {
1226  unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1227  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Argument, ArgInfo));
1228  return;
1229  }
1230  case IIT_EXTEND_ARG: {
1231  unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1232  OutputTable.push_back(IITDescriptor::get(IITDescriptor::ExtendArgument,
1233  ArgInfo));
1234  return;
1235  }
1236  case IIT_TRUNC_ARG: {
1237  unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1238  OutputTable.push_back(IITDescriptor::get(IITDescriptor::TruncArgument,
1239  ArgInfo));
1240  return;
1241  }
1242  case IIT_HALF_VEC_ARG: {
1243  unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1244  OutputTable.push_back(IITDescriptor::get(IITDescriptor::HalfVecArgument,
1245  ArgInfo));
1246  return;
1247  }
1248  case IIT_SAME_VEC_WIDTH_ARG: {
1249  unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1251  ArgInfo));
1252  return;
1253  }
1254  case IIT_PTR_TO_ARG: {
1255  unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1256  OutputTable.push_back(IITDescriptor::get(IITDescriptor::PtrToArgument,
1257  ArgInfo));
1258  return;
1259  }
1260  case IIT_PTR_TO_ELT: {
1261  unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1262  OutputTable.push_back(IITDescriptor::get(IITDescriptor::PtrToElt, ArgInfo));
1263  return;
1264  }
1265  case IIT_ANYPTR_TO_ELT: {
1266  unsigned short ArgNo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1267  unsigned short RefNo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1268  OutputTable.push_back(
1270  return;
1271  }
1273  unsigned short ArgNo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1274  unsigned short RefNo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1275  OutputTable.push_back(
1277  return;
1278  }
1279  case IIT_EMPTYSTRUCT:
1280  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Struct, 0));
1281  return;
1282  case IIT_STRUCT9: ++StructElts; [[fallthrough]];
1283  case IIT_STRUCT8: ++StructElts; [[fallthrough]];
1284  case IIT_STRUCT7: ++StructElts; [[fallthrough]];
1285  case IIT_STRUCT6: ++StructElts; [[fallthrough]];
1286  case IIT_STRUCT5: ++StructElts; [[fallthrough]];
1287  case IIT_STRUCT4: ++StructElts; [[fallthrough]];
1288  case IIT_STRUCT3: ++StructElts; [[fallthrough]];
1289  case IIT_STRUCT2: {
1290  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Struct,StructElts));
1291 
1292  for (unsigned i = 0; i != StructElts; ++i)
1293  DecodeIITType(NextElt, Infos, Info, OutputTable);
1294  return;
1295  }
1296  case IIT_SUBDIVIDE2_ARG: {
1297  unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1299  ArgInfo));
1300  return;
1301  }
1302  case IIT_SUBDIVIDE4_ARG: {
1303  unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1305  ArgInfo));
1306  return;
1307  }
1308  case IIT_VEC_ELEMENT: {
1309  unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1311  ArgInfo));
1312  return;
1313  }
1314  case IIT_SCALABLE_VEC: {
1315  DecodeIITType(NextElt, Infos, Info, OutputTable);
1316  return;
1317  }
1319  unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1321  ArgInfo));
1322  return;
1323  }
1324  }
1325  llvm_unreachable("unhandled");
1326 }
1327 
1328 #define GET_INTRINSIC_GENERATOR_GLOBAL
1329 #include "llvm/IR/IntrinsicImpl.inc"
1330 #undef GET_INTRINSIC_GENERATOR_GLOBAL
1331 
1334  // Check to see if the intrinsic's type was expressible by the table.
1335  unsigned TableVal = IIT_Table[id-1];
1336 
1337  // Decode the TableVal into an array of IITValues.
1339  ArrayRef<unsigned char> IITEntries;
1340  unsigned NextElt = 0;
1341  if ((TableVal >> 31) != 0) {
1342  // This is an offset into the IIT_LongEncodingTable.
1343  IITEntries = IIT_LongEncodingTable;
1344 
1345  // Strip sentinel bit.
1346  NextElt = (TableVal << 1) >> 1;
1347  } else {
1348  // Decode the TableVal into an array of IITValues. If the entry was encoded
1349  // into a single word in the table itself, decode it now.
1350  do {
1351  IITValues.push_back(TableVal & 0xF);
1352  TableVal >>= 4;
1353  } while (TableVal);
1354 
1355  IITEntries = IITValues;
1356  NextElt = 0;
1357  }
1358 
1359  // Okay, decode the table into the output vector of IITDescriptors.
1360  DecodeIITType(NextElt, IITEntries, IIT_Done, T);
1361  while (NextElt != IITEntries.size() && IITEntries[NextElt] != 0)
1362  DecodeIITType(NextElt, IITEntries, IIT_Done, T);
1363 }
1364 
1367  using namespace Intrinsic;
1368 
1369  IITDescriptor D = Infos.front();
1370  Infos = Infos.slice(1);
1371 
1372  switch (D.Kind) {
1385 
1387  return IntegerType::get(Context, D.Integer_Width);
1388  case IITDescriptor::Vector:
1389  return VectorType::get(DecodeFixedType(Infos, Tys, Context),
1390  D.Vector_Width);
1392  return PointerType::get(DecodeFixedType(Infos, Tys, Context),
1393  D.Pointer_AddressSpace);
1394  case IITDescriptor::Struct: {
1396  for (unsigned i = 0, e = D.Struct_NumElements; i != e; ++i)
1397  Elts.push_back(DecodeFixedType(Infos, Tys, Context));
1398  return StructType::get(Context, Elts);
1399  }
1401  return Tys[D.getArgumentNumber()];
1403  Type *Ty = Tys[D.getArgumentNumber()];
1404  if (VectorType *VTy = dyn_cast<VectorType>(Ty))
1406 
1407  return IntegerType::get(Context, 2 * cast<IntegerType>(Ty)->getBitWidth());
1408  }
1410  Type *Ty = Tys[D.getArgumentNumber()];
1411  if (VectorType *VTy = dyn_cast<VectorType>(Ty))
1413 
1414  IntegerType *ITy = cast<IntegerType>(Ty);
1415  assert(ITy->getBitWidth() % 2 == 0);
1416  return IntegerType::get(Context, ITy->getBitWidth() / 2);
1417  }
1420  Type *Ty = Tys[D.getArgumentNumber()];
1421  VectorType *VTy = dyn_cast<VectorType>(Ty);
1422  assert(VTy && "Expected an argument of Vector Type");
1423  int SubDivs = D.Kind == IITDescriptor::Subdivide2Argument ? 1 : 2;
1424  return VectorType::getSubdividedVectorType(VTy, SubDivs);
1425  }
1427  return VectorType::getHalfElementsVectorType(cast<VectorType>(
1428  Tys[D.getArgumentNumber()]));
1430  Type *EltTy = DecodeFixedType(Infos, Tys, Context);
1431  Type *Ty = Tys[D.getArgumentNumber()];
1432  if (auto *VTy = dyn_cast<VectorType>(Ty))
1433  return VectorType::get(EltTy, VTy->getElementCount());
1434  return EltTy;
1435  }
1437  Type *Ty = Tys[D.getArgumentNumber()];
1438  return PointerType::getUnqual(Ty);
1439  }
1440  case IITDescriptor::PtrToElt: {
1441  Type *Ty = Tys[D.getArgumentNumber()];
1442  VectorType *VTy = dyn_cast<VectorType>(Ty);
1443  if (!VTy)
1444  llvm_unreachable("Expected an argument of Vector Type");
1445  Type *EltTy = VTy->getElementType();
1446  return PointerType::getUnqual(EltTy);
1447  }
1449  Type *Ty = Tys[D.getArgumentNumber()];
1450  if (VectorType *VTy = dyn_cast<VectorType>(Ty))
1451  return VTy->getElementType();
1452  llvm_unreachable("Expected an argument of Vector Type");
1453  }
1455  Type *Ty = Tys[D.getArgumentNumber()];
1456  VectorType *VTy = dyn_cast<VectorType>(Ty);
1457  assert(VTy && "Expected an argument of Vector Type");
1458  return VectorType::getInteger(VTy);
1459  }
1461  // Return the overloaded type (which determines the pointers address space)
1462  return Tys[D.getOverloadArgNumber()];
1464  // Return the overloaded type (which determines the pointers address space)
1465  return Tys[D.getOverloadArgNumber()];
1466  }
1467  llvm_unreachable("unhandled");
1468 }
1469 
1471  ID id, ArrayRef<Type*> Tys) {
1473  getIntrinsicInfoTableEntries(id, Table);
1474 
1476  Type *ResultTy = DecodeFixedType(TableRef, Tys, Context);
1477 
1478  SmallVector<Type*, 8> ArgTys;
1479  while (!TableRef.empty())
1480  ArgTys.push_back(DecodeFixedType(TableRef, Tys, Context));
1481 
1482  // DecodeFixedType returns Void for IITDescriptor::Void and IITDescriptor::VarArg
1483  // If we see void type as the type of the last argument, it is vararg intrinsic
1484  if (!ArgTys.empty() && ArgTys.back()->isVoidTy()) {
1485  ArgTys.pop_back();
1486  return FunctionType::get(ResultTy, ArgTys, true);
1487  }
1488  return FunctionType::get(ResultTy, ArgTys, false);
1489 }
1490 
1492 #define GET_INTRINSIC_OVERLOAD_TABLE
1493 #include "llvm/IR/IntrinsicImpl.inc"
1494 #undef GET_INTRINSIC_OVERLOAD_TABLE
1495 }
1496 
1497 /// This defines the "Intrinsic::getAttributes(ID id)" method.
1498 #define GET_INTRINSIC_ATTRIBUTES
1499 #include "llvm/IR/IntrinsicImpl.inc"
1500 #undef GET_INTRINSIC_ATTRIBUTES
1501 
1503  // There can never be multiple globals with the same name of different types,
1504  // because intrinsics must be a specific type.
1505  auto *FT = getType(M->getContext(), id, Tys);
1506  return cast<Function>(
1507  M->getOrInsertFunction(
1508  Tys.empty() ? getName(id) : getName(id, Tys, M, FT), FT)
1509  .getCallee());
1510 }
1511 
1512 // This defines the "Intrinsic::getIntrinsicForClangBuiltin()" method.
1513 #define GET_LLVM_INTRINSIC_FOR_CLANG_BUILTIN
1514 #include "llvm/IR/IntrinsicImpl.inc"
1515 #undef GET_LLVM_INTRINSIC_FOR_CLANG_BUILTIN
1516 
1517 // This defines the "Intrinsic::getIntrinsicForMSBuiltin()" method.
1518 #define GET_LLVM_INTRINSIC_FOR_MS_BUILTIN
1519 #include "llvm/IR/IntrinsicImpl.inc"
1520 #undef GET_LLVM_INTRINSIC_FOR_MS_BUILTIN
1521 
1523  std::pair<Type *, ArrayRef<Intrinsic::IITDescriptor>>;
1524 
1527  SmallVectorImpl<Type *> &ArgTys,
1529  bool IsDeferredCheck) {
1530  using namespace Intrinsic;
1531 
1532  // If we ran out of descriptors, there are too many arguments.
1533  if (Infos.empty()) return true;
1534 
1535  // Do this before slicing off the 'front' part
1536  auto InfosRef = Infos;
1537  auto DeferCheck = [&DeferredChecks, &InfosRef](Type *T) {
1538  DeferredChecks.emplace_back(T, InfosRef);
1539  return false;
1540  };
1541 
1542  IITDescriptor D = Infos.front();
1543  Infos = Infos.slice(1);
1544 
1545  switch (D.Kind) {
1546  case IITDescriptor::Void: return !Ty->isVoidTy();
1547  case IITDescriptor::VarArg: return true;
1548  case IITDescriptor::MMX: return !Ty->isX86_MMXTy();
1549  case IITDescriptor::AMX: return !Ty->isX86_AMXTy();
1550  case IITDescriptor::Token: return !Ty->isTokenTy();
1551  case IITDescriptor::Metadata: return !Ty->isMetadataTy();
1552  case IITDescriptor::Half: return !Ty->isHalfTy();
1553  case IITDescriptor::BFloat: return !Ty->isBFloatTy();
1554  case IITDescriptor::Float: return !Ty->isFloatTy();
1555  case IITDescriptor::Double: return !Ty->isDoubleTy();
1556  case IITDescriptor::Quad: return !Ty->isFP128Ty();
1557  case IITDescriptor::PPCQuad: return !Ty->isPPC_FP128Ty();
1558  case IITDescriptor::Integer: return !Ty->isIntegerTy(D.Integer_Width);
1559  case IITDescriptor::Vector: {
1560  VectorType *VT = dyn_cast<VectorType>(Ty);
1561  return !VT || VT->getElementCount() != D.Vector_Width ||
1562  matchIntrinsicType(VT->getElementType(), Infos, ArgTys,
1563  DeferredChecks, IsDeferredCheck);
1564  }
1565  case IITDescriptor::Pointer: {
1566  PointerType *PT = dyn_cast<PointerType>(Ty);
1567  if (!PT || PT->getAddressSpace() != D.Pointer_AddressSpace)
1568  return true;
1569  if (!PT->isOpaque()) {
1570  /* Manually consume a pointer to empty struct descriptor, which is
1571  * used for externref. We don't want to enforce that the struct is
1572  * anonymous in this case. (This renders externref intrinsics
1573  * non-unique, but this will go away with opaque pointers anyway.) */
1574  if (Infos.front().Kind == IITDescriptor::Struct &&
1575  Infos.front().Struct_NumElements == 0) {
1576  Infos = Infos.slice(1);
1577  return false;
1578  }
1580  ArgTys, DeferredChecks, IsDeferredCheck);
1581  }
1582  // Consume IIT descriptors relating to the pointer element type.
1583  // FIXME: Intrinsic type matching of nested single value types or even
1584  // aggregates doesn't work properly with opaque pointers but hopefully
1585  // doesn't happen in practice.
1586  while (Infos.front().Kind == IITDescriptor::Pointer ||
1587  Infos.front().Kind == IITDescriptor::Vector)
1588  Infos = Infos.slice(1);
1589  assert((Infos.front().Kind != IITDescriptor::Argument ||
1591  "Unsupported polymorphic pointer type with opaque pointer");
1592  Infos = Infos.slice(1);
1593  return false;
1594  }
1595 
1596  case IITDescriptor::Struct: {
1597  StructType *ST = dyn_cast<StructType>(Ty);
1598  if (!ST || !ST->isLiteral() || ST->isPacked() ||
1599  ST->getNumElements() != D.Struct_NumElements)
1600  return true;
1601 
1602  for (unsigned i = 0, e = D.Struct_NumElements; i != e; ++i)
1603  if (matchIntrinsicType(ST->getElementType(i), Infos, ArgTys,
1604  DeferredChecks, IsDeferredCheck))
1605  return true;
1606  return false;
1607  }
1608 
1610  // If this is the second occurrence of an argument,
1611  // verify that the later instance matches the previous instance.
1612  if (D.getArgumentNumber() < ArgTys.size())
1613  return Ty != ArgTys[D.getArgumentNumber()];
1614 
1615  if (D.getArgumentNumber() > ArgTys.size() ||
1616  D.getArgumentKind() == IITDescriptor::AK_MatchType)
1617  return IsDeferredCheck || DeferCheck(Ty);
1618 
1619  assert(D.getArgumentNumber() == ArgTys.size() && !IsDeferredCheck &&
1620  "Table consistency error");
1621  ArgTys.push_back(Ty);
1622 
1623  switch (D.getArgumentKind()) {
1624  case IITDescriptor::AK_Any: return false; // Success
1626  case IITDescriptor::AK_AnyFloat: return !Ty->isFPOrFPVectorTy();
1627  case IITDescriptor::AK_AnyVector: return !isa<VectorType>(Ty);
1628  case IITDescriptor::AK_AnyPointer: return !isa<PointerType>(Ty);
1629  default: break;
1630  }
1631  llvm_unreachable("all argument kinds not covered");
1632 
1634  // If this is a forward reference, defer the check for later.
1635  if (D.getArgumentNumber() >= ArgTys.size())
1636  return IsDeferredCheck || DeferCheck(Ty);
1637 
1638  Type *NewTy = ArgTys[D.getArgumentNumber()];
1639  if (VectorType *VTy = dyn_cast<VectorType>(NewTy))
1641  else if (IntegerType *ITy = dyn_cast<IntegerType>(NewTy))
1642  NewTy = IntegerType::get(ITy->getContext(), 2 * ITy->getBitWidth());
1643  else
1644  return true;
1645 
1646  return Ty != NewTy;
1647  }
1649  // If this is a forward reference, defer the check for later.
1650  if (D.getArgumentNumber() >= ArgTys.size())
1651  return IsDeferredCheck || DeferCheck(Ty);
1652 
1653  Type *NewTy = ArgTys[D.getArgumentNumber()];
1654  if (VectorType *VTy = dyn_cast<VectorType>(NewTy))
1656  else if (IntegerType *ITy = dyn_cast<IntegerType>(NewTy))
1657  NewTy = IntegerType::get(ITy->getContext(), ITy->getBitWidth() / 2);
1658  else
1659  return true;
1660 
1661  return Ty != NewTy;
1662  }
1664  // If this is a forward reference, defer the check for later.
1665  if (D.getArgumentNumber() >= ArgTys.size())
1666  return IsDeferredCheck || DeferCheck(Ty);
1667  return !isa<VectorType>(ArgTys[D.getArgumentNumber()]) ||
1669  cast<VectorType>(ArgTys[D.getArgumentNumber()])) != Ty;
1671  if (D.getArgumentNumber() >= ArgTys.size()) {
1672  // Defer check and subsequent check for the vector element type.
1673  Infos = Infos.slice(1);
1674  return IsDeferredCheck || DeferCheck(Ty);
1675  }
1676  auto *ReferenceType = dyn_cast<VectorType>(ArgTys[D.getArgumentNumber()]);
1677  auto *ThisArgType = dyn_cast<VectorType>(Ty);
1678  // Both must be vectors of the same number of elements or neither.
1679  if ((ReferenceType != nullptr) != (ThisArgType != nullptr))
1680  return true;
1681  Type *EltTy = Ty;
1682  if (ThisArgType) {
1683  if (ReferenceType->getElementCount() !=
1684  ThisArgType->getElementCount())
1685  return true;
1686  EltTy = ThisArgType->getElementType();
1687  }
1688  return matchIntrinsicType(EltTy, Infos, ArgTys, DeferredChecks,
1689  IsDeferredCheck);
1690  }
1692  if (D.getArgumentNumber() >= ArgTys.size())
1693  return IsDeferredCheck || DeferCheck(Ty);
1694  Type * ReferenceType = ArgTys[D.getArgumentNumber()];
1695  PointerType *ThisArgType = dyn_cast<PointerType>(Ty);
1696  return (!ThisArgType ||
1698  }
1699  case IITDescriptor::PtrToElt: {
1700  if (D.getArgumentNumber() >= ArgTys.size())
1701  return IsDeferredCheck || DeferCheck(Ty);
1703  dyn_cast<VectorType> (ArgTys[D.getArgumentNumber()]);
1704  PointerType *ThisArgType = dyn_cast<PointerType>(Ty);
1705 
1706  if (!ThisArgType || !ReferenceType)
1707  return true;
1708  return !ThisArgType->isOpaqueOrPointeeTypeMatches(
1709  ReferenceType->getElementType());
1710  }
1712  unsigned RefArgNumber = D.getRefArgNumber();
1713  if (RefArgNumber >= ArgTys.size()) {
1714  if (IsDeferredCheck)
1715  return true;
1716  // If forward referencing, already add the pointer type and
1717  // defer the checks for later.
1718  ArgTys.push_back(Ty);
1719  return DeferCheck(Ty);
1720  }
1721 
1722  if (!IsDeferredCheck) {
1723  assert(D.getOverloadArgNumber() == ArgTys.size() &&
1724  "Table consistency error");
1725  ArgTys.push_back(Ty);
1726  }
1727 
1728  auto *ReferenceType = dyn_cast<VectorType>(ArgTys[RefArgNumber]);
1729  auto *ThisArgType = dyn_cast<PointerType>(Ty);
1730  if (!ThisArgType || !ReferenceType)
1731  return true;
1732  return !ThisArgType->isOpaqueOrPointeeTypeMatches(
1733  ReferenceType->getElementType());
1734  }
1736  unsigned RefArgNumber = D.getRefArgNumber();
1737  if (RefArgNumber >= ArgTys.size()) {
1738  if (IsDeferredCheck)
1739  return true;
1740  // If forward referencing, already add the pointer-vector type and
1741  // defer the checks for later.
1742  ArgTys.push_back(Ty);
1743  return DeferCheck(Ty);
1744  }
1745 
1746  if (!IsDeferredCheck){
1747  assert(D.getOverloadArgNumber() == ArgTys.size() &&
1748  "Table consistency error");
1749  ArgTys.push_back(Ty);
1750  }
1751 
1752  // Verify the overloaded type "matches" the Ref type.
1753  // i.e. Ty is a vector with the same width as Ref.
1754  // Composed of pointers to the same element type as Ref.
1755  auto *ReferenceType = dyn_cast<VectorType>(ArgTys[RefArgNumber]);
1756  auto *ThisArgVecTy = dyn_cast<VectorType>(Ty);
1757  if (!ThisArgVecTy || !ReferenceType ||
1758  (ReferenceType->getElementCount() != ThisArgVecTy->getElementCount()))
1759  return true;
1760  PointerType *ThisArgEltTy =
1761  dyn_cast<PointerType>(ThisArgVecTy->getElementType());
1762  if (!ThisArgEltTy)
1763  return true;
1764  return !ThisArgEltTy->isOpaqueOrPointeeTypeMatches(
1765  ReferenceType->getElementType());
1766  }
1768  if (D.getArgumentNumber() >= ArgTys.size())
1769  return IsDeferredCheck ? true : DeferCheck(Ty);
1770  auto *ReferenceType = dyn_cast<VectorType>(ArgTys[D.getArgumentNumber()]);
1771  return !ReferenceType || Ty != ReferenceType->getElementType();
1772  }
1775  // If this is a forward reference, defer the check for later.
1776  if (D.getArgumentNumber() >= ArgTys.size())
1777  return IsDeferredCheck || DeferCheck(Ty);
1778 
1779  Type *NewTy = ArgTys[D.getArgumentNumber()];
1780  if (auto *VTy = dyn_cast<VectorType>(NewTy)) {
1781  int SubDivs = D.Kind == IITDescriptor::Subdivide2Argument ? 1 : 2;
1782  NewTy = VectorType::getSubdividedVectorType(VTy, SubDivs);
1783  return Ty != NewTy;
1784  }
1785  return true;
1786  }
1788  if (D.getArgumentNumber() >= ArgTys.size())
1789  return IsDeferredCheck || DeferCheck(Ty);
1790  auto *ReferenceType = dyn_cast<VectorType>(ArgTys[D.getArgumentNumber()]);
1791  auto *ThisArgVecTy = dyn_cast<VectorType>(Ty);
1792  if (!ThisArgVecTy || !ReferenceType)
1793  return true;
1794  return ThisArgVecTy != VectorType::getInteger(ReferenceType);
1795  }
1796  }
1797  llvm_unreachable("unhandled");
1798 }
1799 
1803  SmallVectorImpl<Type *> &ArgTys) {
1805  if (matchIntrinsicType(FTy->getReturnType(), Infos, ArgTys, DeferredChecks,
1806  false))
1808 
1809  unsigned NumDeferredReturnChecks = DeferredChecks.size();
1810 
1811  for (auto *Ty : FTy->params())
1812  if (matchIntrinsicType(Ty, Infos, ArgTys, DeferredChecks, false))
1814 
1815  for (unsigned I = 0, E = DeferredChecks.size(); I != E; ++I) {
1816  DeferredIntrinsicMatchPair &Check = DeferredChecks[I];
1817  if (matchIntrinsicType(Check.first, Check.second, ArgTys, DeferredChecks,
1818  true))
1819  return I < NumDeferredReturnChecks ? MatchIntrinsicTypes_NoMatchRet
1821  }
1822 
1824 }
1825 
1826 bool
1829  // If there are no descriptors left, then it can't be a vararg.
1830  if (Infos.empty())
1831  return isVarArg;
1832 
1833  // There should be only one descriptor remaining at this point.
1834  if (Infos.size() != 1)
1835  return true;
1836 
1837  // Check and verify the descriptor.
1838  IITDescriptor D = Infos.front();
1839  Infos = Infos.slice(1);
1840  if (D.Kind == IITDescriptor::VarArg)
1841  return !isVarArg;
1842 
1843  return true;
1844 }
1845 
1847  SmallVectorImpl<Type *> &ArgTys) {
1848  Intrinsic::ID ID = F->getIntrinsicID();
1849  if (!ID)
1850  return false;
1851 
1855 
1856  if (Intrinsic::matchIntrinsicSignature(F->getFunctionType(), TableRef,
1857  ArgTys) !=
1859  return false;
1860  }
1861  if (Intrinsic::matchIntrinsicVarArg(F->getFunctionType()->isVarArg(),
1862  TableRef))
1863  return false;
1864  return true;
1865 }
1866 
1867 std::optional<Function *> Intrinsic::remangleIntrinsicFunction(Function *F) {
1868  SmallVector<Type *, 4> ArgTys;
1869  if (!getIntrinsicSignature(F, ArgTys))
1870  return std::nullopt;
1871 
1872  Intrinsic::ID ID = F->getIntrinsicID();
1873  StringRef Name = F->getName();
1874  std::string WantedName =
1875  Intrinsic::getName(ID, ArgTys, F->getParent(), F->getFunctionType());
1876  if (Name == WantedName)
1877  return std::nullopt;
1878 
1879  Function *NewDecl = [&] {
1880  if (auto *ExistingGV = F->getParent()->getNamedValue(WantedName)) {
1881  if (auto *ExistingF = dyn_cast<Function>(ExistingGV))
1882  if (ExistingF->getFunctionType() == F->getFunctionType())
1883  return ExistingF;
1884 
1885  // The name already exists, but is not a function or has the wrong
1886  // prototype. Make place for the new one by renaming the old version.
1887  // Either this old version will be removed later on or the module is
1888  // invalid and we'll get an error.
1889  ExistingGV->setName(WantedName + ".renamed");
1890  }
1891  return Intrinsic::getDeclaration(F->getParent(), ID, ArgTys);
1892  }();
1893 
1894  NewDecl->setCallingConv(F->getCallingConv());
1895  assert(NewDecl->getFunctionType() == F->getFunctionType() &&
1896  "Shouldn't change the signature");
1897  return NewDecl;
1898 }
1899 
1900 /// hasAddressTaken - returns true if there are any uses of this function
1901 /// other than direct calls or invokes to it. Optionally ignores callback
1902 /// uses, assume like pointer annotation calls, and references in llvm.used
1903 /// and llvm.compiler.used variables.
1904 bool Function::hasAddressTaken(const User **PutOffender,
1905  bool IgnoreCallbackUses,
1906  bool IgnoreAssumeLikeCalls, bool IgnoreLLVMUsed,
1907  bool IgnoreARCAttachedCall) const {
1908  for (const Use &U : uses()) {
1909  const User *FU = U.getUser();
1910  if (isa<BlockAddress>(FU))
1911  continue;
1912 
1913  if (IgnoreCallbackUses) {
1914  AbstractCallSite ACS(&U);
1915  if (ACS && ACS.isCallbackCall())
1916  continue;
1917  }
1918 
1919  const auto *Call = dyn_cast<CallBase>(FU);
1920  if (!Call) {
1921  if (IgnoreAssumeLikeCalls &&
1922  isa<BitCastOperator, AddrSpaceCastOperator>(FU) &&
1923  all_of(FU->users(), [](const User *U) {
1924  if (const auto *I = dyn_cast<IntrinsicInst>(U))
1925  return I->isAssumeLikeIntrinsic();
1926  return false;
1927  })) {
1928  continue;
1929  }
1930 
1931  if (IgnoreLLVMUsed && !FU->user_empty()) {
1932  const User *FUU = FU;
1933  if (isa<BitCastOperator, AddrSpaceCastOperator>(FU) &&
1934  FU->hasOneUse() && !FU->user_begin()->user_empty())
1935  FUU = *FU->user_begin();
1936  if (llvm::all_of(FUU->users(), [](const User *U) {
1937  if (const auto *GV = dyn_cast<GlobalVariable>(U))
1938  return GV->hasName() &&
1939  (GV->getName().equals("llvm.compiler.used") ||
1940  GV->getName().equals("llvm.used"));
1941  return false;
1942  }))
1943  continue;
1944  }
1945  if (PutOffender)
1946  *PutOffender = FU;
1947  return true;
1948  }
1949 
1950  if (IgnoreAssumeLikeCalls) {
1951  if (const auto *I = dyn_cast<IntrinsicInst>(Call))
1952  if (I->isAssumeLikeIntrinsic())
1953  continue;
1954  }
1955 
1956  if (!Call->isCallee(&U) || Call->getFunctionType() != getFunctionType()) {
1957  if (IgnoreARCAttachedCall &&
1958  Call->isOperandBundleOfType(LLVMContext::OB_clang_arc_attachedcall,
1959  U.getOperandNo()))
1960  continue;
1961 
1962  if (PutOffender)
1963  *PutOffender = FU;
1964  return true;
1965  }
1966  }
1967  return false;
1968 }
1969 
1971  // Check the linkage
1972  if (!hasLinkOnceLinkage() && !hasLocalLinkage() &&
1974  return false;
1975 
1976  // Check if the function is used by anything other than a blockaddress.
1977  for (const User *U : users())
1978  if (!isa<BlockAddress>(U))
1979  return false;
1980 
1981  return true;
1982 }
1983 
1984 /// callsFunctionThatReturnsTwice - Return true if the function has a call to
1985 /// setjmp or other function that gcc recognizes as "returning twice".
1987  for (const Instruction &I : instructions(this))
1988  if (const auto *Call = dyn_cast<CallBase>(&I))
1989  if (Call->hasFnAttr(Attribute::ReturnsTwice))
1990  return true;
1991 
1992  return false;
1993 }
1994 
1997  return cast<Constant>(Op<0>());
1998 }
1999 
2001  setHungoffOperand<0>(Fn);
2002  setValueSubclassDataBit(3, Fn != nullptr);
2003 }
2004 
2007  return cast<Constant>(Op<1>());
2008 }
2009 
2011  setHungoffOperand<1>(PrefixData);
2012  setValueSubclassDataBit(1, PrefixData != nullptr);
2013 }
2014 
2017  return cast<Constant>(Op<2>());
2018 }
2019 
2021  setHungoffOperand<2>(PrologueData);
2022  setValueSubclassDataBit(2, PrologueData != nullptr);
2023 }
2024 
2025 void Function::allocHungoffUselist() {
2026  // If we've already allocated a uselist, stop here.
2027  if (getNumOperands())
2028  return;
2029 
2030  allocHungoffUses(3, /*IsPhi=*/ false);
2032 
2033  // Initialize the uselist with placeholder operands to allow traversal.
2035  Op<0>().set(CPN);
2036  Op<1>().set(CPN);
2037  Op<2>().set(CPN);
2038 }
2039 
2040 template <int Idx>
2041 void Function::setHungoffOperand(Constant *C) {
2042  if (C) {
2043  allocHungoffUselist();
2044  Op<Idx>().set(C);
2045  } else if (getNumOperands()) {
2046  Op<Idx>().set(
2048  }
2049 }
2050 
2051 void Function::setValueSubclassDataBit(unsigned Bit, bool On) {
2052  assert(Bit < 16 && "SubclassData contains only 16 bits");
2053  if (On)
2054  setValueSubclassData(getSubclassDataFromValue() | (1 << Bit));
2055  else
2056  setValueSubclassData(getSubclassDataFromValue() & ~(1 << Bit));
2057 }
2058 
2060  const DenseSet<GlobalValue::GUID> *S) {
2061 #if !defined(NDEBUG)
2062  auto PrevCount = getEntryCount();
2063  assert(!PrevCount || PrevCount->getType() == Count.getType());
2064 #endif
2065 
2066  auto ImportGUIDs = getImportGUIDs();
2067  if (S == nullptr && ImportGUIDs.size())
2068  S = &ImportGUIDs;
2069 
2070  MDBuilder MDB(getContext());
2071  setMetadata(
2072  LLVMContext::MD_prof,
2073  MDB.createFunctionEntryCount(Count.getCount(), Count.isSynthetic(), S));
2074 }
2075 
2077  const DenseSet<GlobalValue::GUID> *Imports) {
2078  setEntryCount(ProfileCount(Count, Type), Imports);
2079 }
2080 
2081 std::optional<ProfileCount> Function::getEntryCount(bool AllowSynthetic) const {
2082  MDNode *MD = getMetadata(LLVMContext::MD_prof);
2083  if (MD && MD->getOperand(0))
2084  if (MDString *MDS = dyn_cast<MDString>(MD->getOperand(0))) {
2085  if (MDS->getString().equals("function_entry_count")) {
2086  ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(1));
2087  uint64_t Count = CI->getValue().getZExtValue();
2088  // A value of -1 is used for SamplePGO when there were no samples.
2089  // Treat this the same as unknown.
2090  if (Count == (uint64_t)-1)
2091  return std::nullopt;
2092  return ProfileCount(Count, PCT_Real);
2093  } else if (AllowSynthetic &&
2094  MDS->getString().equals("synthetic_function_entry_count")) {
2095  ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(1));
2096  uint64_t Count = CI->getValue().getZExtValue();
2097  return ProfileCount(Count, PCT_Synthetic);
2098  }
2099  }
2100  return std::nullopt;
2101 }
2102 
2105  if (MDNode *MD = getMetadata(LLVMContext::MD_prof))
2106  if (MDString *MDS = dyn_cast<MDString>(MD->getOperand(0)))
2107  if (MDS->getString().equals("function_entry_count"))
2108  for (unsigned i = 2; i < MD->getNumOperands(); i++)
2109  R.insert(mdconst::extract<ConstantInt>(MD->getOperand(i))
2110  ->getValue()
2111  .getZExtValue());
2112  return R;
2113 }
2114 
2116  MDBuilder MDB(getContext());
2117  setMetadata(LLVMContext::MD_section_prefix,
2119 }
2120 
2121 std::optional<StringRef> Function::getSectionPrefix() const {
2122  if (MDNode *MD = getMetadata(LLVMContext::MD_section_prefix)) {
2123  assert(cast<MDString>(MD->getOperand(0))
2124  ->getString()
2125  .equals("function_section_prefix") &&
2126  "Metadata not match");
2127  return cast<MDString>(MD->getOperand(1))->getString();
2128  }
2129  return std::nullopt;
2130 }
2131 
2133  return hasFnAttribute(Attribute::NullPointerIsValid);
2134 }
2135 
2136 bool llvm::NullPointerIsDefined(const Function *F, unsigned AS) {
2137  if (F && F->nullPointerIsDefined())
2138  return true;
2139 
2140  if (AS != 0)
2141  return true;
2142 
2143  return false;
2144 }
llvm::Function::getParamAttribute
Attribute getParamAttribute(unsigned ArgNo, Attribute::AttrKind Kind) const
gets the specified attribute from the list of attributes.
Definition: Function.cpp:688
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::Function::getEntryCount
std::optional< ProfileCount > getEntryCount(bool AllowSynthetic=false) const
Get the entry count for this function.
Definition: Function.cpp:2081
llvm::Intrinsic::getBaseName
StringRef getBaseName(ID id)
Return the LLVM name for an intrinsic, without encoded types for overloading, such as "llvm....
Definition: Function.cpp:970
i
i
Definition: README.txt:29
llvm::Intrinsic::IITDescriptor::AK_AnyVector
@ AK_AnyVector
Definition: Intrinsics.h:156
llvm::Intrinsic::IITDescriptor::Subdivide4Argument
@ Subdivide4Argument
Definition: Intrinsics.h:136
IIT_STRUCT2
@ IIT_STRUCT2
Definition: Function.cpp:1048
llvm::Argument
This class represents an incoming formal argument to a Function.
Definition: Argument.h:28
IIT_AMX
@ IIT_AMX
Definition: Function.cpp:1078
llvm::Argument::hasStructRetAttr
bool hasStructRetAttr() const
Return true if this argument has the sret attribute.
Definition: Function.cpp:252
IIT_SUBDIVIDE4_ARG
@ IIT_SUBDIVIDE4_ARG
Definition: Function.cpp:1072
llvm::Type::FloatTyID
@ FloatTyID
32-bit floating point type
Definition: Type.h:58
Attrs
Function Attrs
Definition: README_ALTIVEC.txt:215
IIT_V128
@ IIT_V128
Definition: Function.cpp:1074
IIT_F32
@ IIT_F32
Definition: Function.cpp:1032
llvm::Intrinsic::isOverloaded
bool isOverloaded(ID id)
Returns true if the intrinsic can be overloaded.
Definition: Function.cpp:1491
getName
static StringRef getName(Value *V)
Definition: ProvenanceAnalysisEvaluator.cpp:20
llvm::MemoryEffects::onlyWritesMemory
bool onlyWritesMemory() const
Whether this function only (at most) writes memory.
Definition: ModRef.h:197
llvm::VectorType::getSubdividedVectorType
static VectorType * getSubdividedVectorType(VectorType *VTy, int NumSubdivs)
Definition: DerivedTypes.h:483
llvm::Argument::hasInAllocaAttr
bool hasInAllocaAttr() const
Return true if this argument has the inalloca attribute.
Definition: Function.cpp:128
llvm::Type::DoubleTyID
@ DoubleTyID
64-bit floating point type
Definition: Type.h:59
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
llvm::LLVMContext::emitError
void emitError(uint64_t LocCookie, const Twine &ErrorStr)
emitError - Emit an error message to the currently installed error handler with optional location inf...
Definition: LLVMContext.cpp:271
ModRef.h
llvm::Argument::hasPassPointeeByValueCopyAttr
bool hasPassPointeeByValueCopyAttr() const
Return true if this argument has the byval, inalloca, or preallocated attribute.
Definition: Function.cpp:139
llvm::Intrinsic::MatchIntrinsicTypes_NoMatchArg
@ MatchIntrinsicTypes_NoMatchArg
Definition: Intrinsics.h:217
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::Intrinsic::IITDescriptor::VecOfBitcastsToInt
@ VecOfBitcastsToInt
Definition: Intrinsics.h:137
M
We currently emits eax Perhaps this is what we really should generate is Is imull three or four cycles eax eax The current instruction priority is based on pattern complexity The former is more complex because it folds a load so the latter will not be emitted Perhaps we should use AddedComplexity to give LEA32r a higher priority We should always try to match LEA first since the LEA matching code does some estimate to determine whether the match is profitable if we care more about code then imull is better It s two bytes shorter than movl leal On a Pentium M
Definition: README.txt:252
llvm::Function::setMemoryEffects
void setMemoryEffects(MemoryEffects ME)
Definition: Function.cpp:758
llvm::AArch64CC::AL
@ AL
Definition: AArch64BaseInfo.h:269
IIT_EXTEND_ARG
@ IIT_EXTEND_ARG
Definition: Function.cpp:1052
llvm::StructType::get
static StructType * get(LLVMContext &Context, ArrayRef< Type * > Elements, bool isPacked=false)
This static method is the primary way to create a literal StructType.
Definition: Type.cpp:408
llvm::DataLayout
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:114
llvm::Value::hasOneUse
bool hasOneUse() const
Return true if there is exactly one use of this value.
Definition: Value.h:434
llvm::Intrinsic::IITDescriptor::Kind
enum llvm::Intrinsic::IITDescriptor::IITDescriptorKind Kind
Metadata.h
llvm::Function::end
iterator end()
Definition: Function.h:753
llvm::Type::isX86_MMXTy
bool isX86_MMXTy() const
Return true if this is X86 MMX.
Definition: Type.h:201
llvm::Function::setSectionPrefix
void setSectionPrefix(StringRef Prefix)
Set the section prefix for this function.
Definition: Function.cpp:2115
llvm::Function::clearGC
void clearGC()
Definition: Function.cpp:724
llvm::Type::getFP128Ty
static Type * getFP128Ty(LLVMContext &C)
Definition: Type.cpp:233
IntrinsicInst.h
llvm::Function::getPrefixData
Constant * getPrefixData() const
Get the prefix data associated with this function.
Definition: Function.cpp:2005
llvm::ElementCount
Definition: TypeSize.h:279
llvm::Intrinsic::IITDescriptor::BFloat
@ BFloat
Definition: Intrinsics.h:118
llvm::APFloatBase::IEEEsingle
static const fltSemantics & IEEEsingle() LLVM_READNONE
Definition: APFloat.cpp:201
llvm::Argument::removeAttrs
void removeAttrs(const AttributeMask &AM)
Definition: Function.cpp:297
llvm::cl::Prefix
@ Prefix
Definition: CommandLine.h:159
IIT_ANYPTR_TO_ELT
@ IIT_ANYPTR_TO_ELT
Definition: Function.cpp:1083
InstIterator.h
ReferenceType
Definition: ItaniumDemangle.h:638
llvm::Function::removeFnAttrs
void removeFnAttrs(const AttributeMask &Attrs)
Definition: Function.cpp:606
T
llvm::Function
Definition: Function.h:59
IIT_EXTERNREF
@ IIT_EXTERNREF
Definition: Function.cpp:1081
llvm::Attribute
Definition: Attributes.h:67
llvm::Type::VoidTyID
@ VoidTyID
type with no size
Definition: Type.h:63
StringRef.h
llvm::Value::getSubclassDataFromValue
unsigned short getSubclassDataFromValue() const
Definition: Value.h:849
DecodeFixedType
static Type * DecodeFixedType(ArrayRef< Intrinsic::IITDescriptor > &Infos, ArrayRef< Type * > Tys, LLVMContext &Context)
Definition: Function.cpp:1365
llvm::Function::getParamDereferenceableBytes
uint64_t getParamDereferenceableBytes(unsigned ArgNo) const
Extract the number of dereferenceable bytes for a parameter.
Definition: Function.h:475
llvm::Function::setOnlyAccessesArgMemory
void setOnlyAccessesArgMemory()
Definition: Function.cpp:791
llvm::Intrinsic::IITDescriptor::VarArg
@ VarArg
Definition: Intrinsics.h:113
llvm::PointerType::get
static PointerType * get(Type *ElementType, unsigned AddressSpace)
This constructs a pointer to an object of the specified type in a numbered address space.
Definition: Type.cpp:729
name
static const char * name
Definition: SMEABIPass.cpp:49
llvm::Target
Target - Wrapper for Target specific information.
Definition: TargetRegistry.h:149
llvm::AttributeList::addFnAttributes
AttributeList addFnAttributes(LLVMContext &C, const AttrBuilder &B) const
Add function attribute to the list.
Definition: Attributes.h:541
llvm::Function::eraseFromParent
void eraseFromParent()
eraseFromParent - This method unlinks 'this' from the containing module and deletes it.
Definition: Function.cpp:362
llvm::ConstantInt::getValue
const APInt & getValue() const
Return the constant as an APInt value reference.
Definition: Constants.h:132
llvm::Argument::hasPointeeInMemoryValueAttr
bool hasPointeeInMemoryValueAttr() const
Return true if this argument has the byval, sret, inalloca, preallocated, or byref attribute.
Definition: Function.cpp:147
llvm::SmallVector< unsigned char, 8 >
llvm::Intrinsic::IITDescriptor::Quad
@ Quad
Definition: Intrinsics.h:121
llvm::UWTableKind::None
@ None
No unwind table requested.
llvm::Function::onlyAccessesInaccessibleMemOrArgMem
bool onlyAccessesInaccessibleMemOrArgMem() const
Determine if the function may only access memory that is either inaccessible from the IR or pointed t...
Definition: Function.cpp:806
llvm::Function::getParamByValType
Type * getParamByValType(unsigned ArgNo) const
Extract the byval type for a parameter.
Definition: Function.h:449
llvm::User::dropAllReferences
void dropAllReferences()
Drop all references to operands.
Definition: User.h:299
llvm::Function::hasParamAttribute
bool hasParamAttribute(unsigned ArgNo, Attribute::AttrKind Kind) const
check if an attributes is in the list of attributes.
Definition: Function.cpp:652
ErrorHandling.h
IIT_I4
@ IIT_I4
Definition: Function.cpp:1085
makeArgArray
static MutableArrayRef< Argument > makeArgArray(Argument *Args, size_t Count)
Definition: Function.cpp:454
llvm::Intrinsic::getName
StringRef getName(ID id)
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
Definition: Function.cpp:975
llvm::Intrinsic::IITDescriptor::MMX
@ MMX
Definition: Intrinsics.h:114
llvm::PointerType::getAddressSpace
unsigned getAddressSpace() const
Return the address space of the Pointer type.
Definition: DerivedTypes.h:682
llvm::Type::X86_AMXTyID
@ X86_AMXTyID
AMX vectors (8192 bits, X86 specific)
Definition: Type.h:67
llvm::FunctionType::get
static FunctionType * get(Type *Result, ArrayRef< Type * > Params, bool isVarArg)
This static method is the primary way of constructing a FunctionType.
Definition: Type.cpp:363
llvm::Intrinsic::IITDescriptor::AnyPtrToElt
@ AnyPtrToElt
Definition: Intrinsics.h:140
IIT_I1
@ IIT_I1
Definition: Function.cpp:1026
llvm::Type::getTypeID
TypeID getTypeID() const
Return the type id for the type.
Definition: Type.h:137
llvm::Argument::getParamInAllocaType
Type * getParamInAllocaType() const
If this is an inalloca argument, return its type.
Definition: Function.cpp:215
IIT_V8
@ IIT_V8
Definition: Function.cpp:1036
llvm::Type::isFPOrFPVectorTy
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
Definition: Type.h:210
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:138
llvm::Intrinsic::IITDescriptor::Metadata
@ Metadata
Definition: Intrinsics.h:116
llvm::Intrinsic::IITDescriptor::PtrToArgument
@ PtrToArgument
Definition: Intrinsics.h:131
llvm::Function::getContext
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function.
Definition: Function.cpp:315
llvm::Function::arg_size
size_t arg_size() const
Definition: Function.h:799
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::Function::addRetAttr
void addRetAttr(Attribute::AttrKind Kind)
Add return value attributes to this function.
Definition: Function.cpp:566
llvm::AttributeList::removeParamAttributes
AttributeList removeParamAttributes(LLVMContext &C, unsigned ArgNo, const AttributeMask &AttrsToRemove) const
Remove the specified attribute at the specified arg index from this attribute list.
Definition: Attributes.h:689
llvm::Intrinsic::lookupLLVMIntrinsicByName
int lookupLLVMIntrinsicByName(ArrayRef< const char * > NameTable, StringRef Name)
Looks up Name in NameTable via binary search.
Definition: IntrinsicInst.cpp:231
Module.h
llvm::AttributeList
Definition: Attributes.h:432
llvm::AttributeMask
Definition: Attributes.h:979
llvm::Function::doesNotAccessMemory
bool doesNotAccessMemory() const
Determine if the function does not access memory.
Definition: Function.cpp:763
llvm::Type::getTokenTy
static Type * getTokenTy(LLVMContext &C)
Definition: Type.cpp:231
llvm::Argument::getArgNo
unsigned getArgNo() const
Return the index of this formal argument in its containing function.
Definition: Argument.h:46
llvm::Argument::hasInRegAttr
bool hasInRegAttr() const
Return true if this argument has the inreg attribute.
Definition: Function.cpp:257
llvm::Function::addParamAttrs
void addParamAttrs(unsigned ArgNo, const AttrBuilder &Attrs)
adds the attributes to the list of attributes for the given arg.
Definition: Function.cpp:586
llvm::Argument::getParent
const Function * getParent() const
Definition: Argument.h:40
llvm::Intrinsic::getAttributes
AttributeList getAttributes(LLVMContext &C, ID id)
Return the attributes for an intrinsic.
Operator.h
llvm::VectorType::getElementType
Type * getElementType() const
Definition: DerivedTypes.h:422
llvm::Value::user_begin
user_iterator user_begin()
Definition: Value.h:397
llvm::Intrinsic::IITDescriptor::ExtendArgument
@ ExtendArgument
Definition: Intrinsics.h:127
getBitWidth
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type.
Definition: ValueTracking.cpp:89
llvm::Function::hasStackProtectorFnAttr
bool hasStackProtectorFnAttr() const
Returns true if the function has ssp, sspstrong, or sspreq fn attrs.
Definition: Function.cpp:731
llvm::FunctionType::getNumParams
unsigned getNumParams() const
Return the number of fixed parameters this function type requires.
Definition: DerivedTypes.h:139
llvm::Function::ProfileCount::isSynthetic
bool isSynthetic() const
Definition: Function.h:262
llvm::Intrinsic::remangleIntrinsicFunction
std::optional< Function * > remangleIntrinsicFunction(Function *F)
Definition: Function.cpp:1867
llvm::Function::hasRetAttribute
bool hasRetAttribute(Attribute::AttrKind Kind) const
check if an attribute is in the list of attributes for the return value.
Definition: Function.cpp:648
llvm::Intrinsic::not_intrinsic
@ not_intrinsic
Definition: Intrinsics.h:44
llvm::Intrinsic::IITDescriptor::Pointer
@ Pointer
Definition: Intrinsics.h:124
STLExtras.h
llvm::AbstractCallSite
AbstractCallSite.
Definition: AbstractCallSite.h:50
llvm::Intrinsic::IITDescriptor::AK_Any
@ AK_Any
Definition: Intrinsics.h:153
llvm::Function::isDefTriviallyDead
bool isDefTriviallyDead() const
isDefTriviallyDead - Return true if it is trivially safe to remove this function definition from the ...
Definition: Function.cpp:1970
llvm::MemoryEffects::writeOnly
static MemoryEffects writeOnly()
Create MemoryEffects that can write any memory.
Definition: ModRef.h:128
llvm::GlobalValue::LinkageTypes
LinkageTypes
An enumeration for the kinds of linkage for global values.
Definition: GlobalValue.h:47
llvm::ArrayType
Class to represent array types.
Definition: DerivedTypes.h:357
IIT_V1
@ IIT_V1
Definition: Function.cpp:1055
llvm::Argument::hasSwiftSelfAttr
bool hasSwiftSelfAttr() const
Return true if this argument has the swiftself attribute.
Definition: Function.cpp:120
llvm::MemoryEffects::onlyAccessesInaccessibleMem
bool onlyAccessesInaccessibleMem() const
Whether this function only (at most) accesses inaccessible memory.
Definition: ModRef.h:210
llvm::Intrinsic::IITDescriptor::Void
@ Void
Definition: Intrinsics.h:112
IIT_METADATA
@ IIT_METADATA
Definition: Function.cpp:1046
llvm::Type::getNonOpaquePointerElementType
Type * getNonOpaquePointerElementType() const
Only use this method in code that is not reachable with opaque pointers, or part of deprecated method...
Definition: Type.h:416
llvm::Type::isMetadataTy
bool isMetadataTy() const
Return true if this is 'metadata'.
Definition: Type.h:216
Use.h
llvm::Intrinsic::IITDescriptor::AK_MatchType
@ AK_MatchType
Definition: Intrinsics.h:158
llvm::Intrinsic::getIntrinsicSignature
bool getIntrinsicSignature(Function *F, SmallVectorImpl< Type * > &ArgTys)
Gets the type arguments of an intrinsic call by matching type contraints specified by the ....
Definition: Function.cpp:1846
llvm::ArrayRef::empty
bool empty() const
empty - Check if the array is empty.
Definition: ArrayRef.h:158
llvm::ArrayRef::data
const T * data() const
Definition: ArrayRef.h:160
llvm::AttributeList::removeFnAttributes
AttributeList removeFnAttributes(LLVMContext &C, const AttributeMask &AttrsToRemove) const
Remove the specified attribute at the function index from this attribute list.
Definition: Attributes.h:639
llvm::Function::addAttributeAtIndex
void addAttributeAtIndex(unsigned i, Attribute Attr)
adds the attribute to the list of attributes.
Definition: Function.cpp:546
F
#define F(x, y, z)
Definition: MD5.cpp:55
llvm::Intrinsic::IITDescriptor::Float
@ Float
Definition: Intrinsics.h:119
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:55
llvm::Function::addFnAttrs
void addFnAttrs(const AttrBuilder &Attrs)
Add function attributes to this function.
Definition: Function.cpp:562
llvm::Intrinsic::MatchIntrinsicTypes_NoMatchRet
@ MatchIntrinsicTypes_NoMatchRet
Definition: Intrinsics.h:216
llvm::parseDenormalFPAttribute
DenormalMode parseDenormalFPAttribute(StringRef Str)
Returns the denormal mode to use for inputs and outputs.
Definition: FloatingPointMode.h:176
Context
LLVMContext & Context
Definition: NVVMIntrRange.cpp:66
llvm::MemoryEffects
Summary of how a function affects memory in the program.
Definition: ModRef.h:63
llvm::Intrinsic::IITDescriptor::AK_AnyPointer
@ AK_AnyPointer
Definition: Intrinsics.h:157
llvm::Function::setGC
void setGC(std::string Str)
Definition: Function.cpp:719
Instruction.h
CommandLine.h
llvm::ConstantInt
This is the shared class of boolean and integer constants.
Definition: Constants.h:78
llvm::PointerType::isOpaqueOrPointeeTypeMatches
bool isOpaqueOrPointeeTypeMatches(Type *Ty)
Return true if either this is an opaque pointer type or if this pointee type matches Ty.
Definition: DerivedTypes.h:688
llvm::Type::getMetadataTy
static Type * getMetadataTy(LLVMContext &C)
Definition: Type.cpp:230
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::Type::MetadataTyID
@ MetadataTyID
Metadata.
Definition: Type.h:65
llvm::VectorType::getTruncatedElementVectorType
static VectorType * getTruncatedElementVectorType(VectorType *VTy)
Definition: DerivedTypes.h:458
llvm::Type::getX86_AMXTy
static Type * getX86_AMXTy(LLVMContext &C)
Definition: Type.cpp:236
GlobalValue.h
llvm::OperandTraits
Compile-time customization of User operands.
Definition: User.h:42
llvm::AttributeList::addParamAttributes
AttributeList addParamAttributes(LLVMContext &C, unsigned ArgNo, const AttrBuilder &B) const
Add an argument attribute to the list.
Definition: Attributes.h:591
getMemoryParamAllocType
static Type * getMemoryParamAllocType(AttributeSet ParamAttrs)
For a byval, sret, inalloca, or preallocated parameter, get the in-memory parameter type.
Definition: Function.cpp:160
llvm::Function::PCT_Synthetic
@ PCT_Synthetic
Definition: Function.h:247
llvm::GlobalValue::isDeclaration
bool isDeclaration() const
Return true if the primary definition of this global value is outside of the current translation unit...
Definition: Globals.cpp:265
llvm::MutableArrayRef
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Definition: ArrayRef.h:27
llvm::StringRef::startswith
bool startswith(StringRef Prefix) const
Definition: StringRef.h:261
llvm::Argument::hasZExtAttr
bool hasZExtAttr() const
Return true if this argument has the zext attribute.
Definition: Function.cpp:265
llvm::Argument::getParamStackAlign
MaybeAlign getParamStackAlign() const
Definition: Function.cpp:196
Constants.h
llvm::Function::stealArgumentListFrom
void stealArgumentListFrom(Function &Src)
Steal arguments from another function.
Definition: Function.cpp:479
llvm::Intrinsic::IITDescriptor::Struct_NumElements
unsigned Struct_NumElements
Definition: Intrinsics.h:147
IIT_BF16
@ IIT_BF16
Definition: Function.cpp:1075
IIT_VEC_OF_BITCASTS_TO_INT
@ IIT_VEC_OF_BITCASTS_TO_INT
Definition: Function.cpp:1073
SmallString.h
llvm::Type::getPPC_FP128Ty
static Type * getPPC_FP128Ty(LLVMContext &C)
Definition: Type.cpp:234
llvm::AttributeList::removeFnAttribute
AttributeList removeFnAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Remove the specified attribute at the function index from this attribute list.
Definition: Attributes.h:625
llvm::Intrinsic::IITDescriptor::Double
@ Double
Definition: Intrinsics.h:120
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::User
Definition: User.h:44
llvm::Function::getFnAttributeAsParsedInteger
uint64_t getFnAttributeAsParsedInteger(StringRef Kind, uint64_t Default=0) const
For a string attribute Kind, parse attribute as an integer.
Definition: Function.cpp:674
llvm::Intrinsic::IITDescriptor::SameVecWidthArgument
@ SameVecWidthArgument
Definition: Intrinsics.h:130
DecodeIITType
static void DecodeIITType(unsigned &NextElt, ArrayRef< unsigned char > Infos, IIT_Info LastInfo, SmallVectorImpl< Intrinsic::IITDescriptor > &OutputTable)
Definition: Function.cpp:1088
Intrinsics.h
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::Type::getDoubleTy
static Type * getDoubleTy(LLVMContext &C)
Definition: Type.cpp:229
llvm::GlobalObject
Definition: GlobalObject.h:27
llvm::Intrinsic::IITDescriptor::HalfVecArgument
@ HalfVecArgument
Definition: Intrinsics.h:129
llvm::Argument::hasSwiftErrorAttr
bool hasSwiftErrorAttr() const
Return true if this argument has the swifterror attribute.
Definition: Function.cpp:124
IIT_V16
@ IIT_V16
Definition: Function.cpp:1037
llvm::VectorType::getInteger
static VectorType * getInteger(VectorType *VTy)
This static method gets a VectorType with the same number of elements as the input type,...
Definition: DerivedTypes.h:440
llvm::Attribute::getWithMemoryEffects
static Attribute getWithMemoryEffects(LLVMContext &Context, MemoryEffects ME)
Definition: Attributes.cpp:214
IIT_Info
IIT_Info
IIT_Info - These are enumerators that describe the entries returned by the getIntrinsicInfoTableEntri...
Definition: Function.cpp:1023
llvm::Argument::hasNoCaptureAttr
bool hasNoCaptureAttr() const
Return true if this argument has the nocapture attribute.
Definition: Function.cpp:242
IIT_STRUCT9
@ IIT_STRUCT9
Definition: Function.cpp:1076
SymbolTableListTraitsImpl.h
Check
#define Check(C,...)
Definition: Lint.cpp:170
llvm::Intrinsic::getType
FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type * > Tys=std::nullopt)
Return the function type for an intrinsic.
Definition: Function.cpp:1470
llvm::Function::removeRetAttrs
void removeRetAttrs(const AttributeMask &Attrs)
removes the attributes from the return value list of attributes.
Definition: Function.cpp:618
llvm::Value::uses
iterator_range< use_iterator > uses()
Definition: Value.h:376
DenseSet.h
llvm::VectorType::getElementCount
ElementCount getElementCount() const
Return an ElementCount instance to represent the (possibly scalable) number of elements in the vector...
Definition: DerivedTypes.h:627
llvm::Function::removeRetAttr
void removeRetAttr(Attribute::AttrKind Kind)
removes the attribute from the return value list of attributes.
Definition: Function.cpp:610
llvm::MaybeAlign
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition: Alignment.h:117
llvm::MemoryEffects::doesNotAccessMemory
bool doesNotAccessMemory() const
Whether this function accesses no memory.
Definition: ModRef.h:191
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
llvm::Function::getFnAttribute
Attribute getFnAttribute(Attribute::AttrKind Kind) const
Return the attribute for the given attribute kind.
Definition: Function.cpp:666
llvm::IntegerType
Class to represent integer types.
Definition: DerivedTypes.h:40
llvm::Argument::getDereferenceableBytes
uint64_t getDereferenceableBytes() const
If this argument has the dereferenceable attribute, return the number of bytes known to be dereferenc...
Definition: Function.cpp:220
IIT_Done
@ IIT_Done
Definition: Function.cpp:1025
llvm::Type::isTokenTy
bool isTokenTy() const
Return true if this is 'token'.
Definition: Type.h:219
llvm::Instruction
Definition: Instruction.h:41
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
llvm::LLVMContext::getGC
const std::string & getGC(const Function &Fn)
Return the GC for a function.
Definition: LLVMContext.cpp:328
MDBuilder.h
llvm::APInt::getZExtValue
uint64_t getZExtValue() const
Get zero extended value.
Definition: APInt.h:1494
llvm::Function::copyAttributesFrom
void copyAttributesFrom(const Function *Src)
copyAttributesFrom - copy all additional attributes (those not needed to create a Function) from the ...
Definition: Function.cpp:739
llvm::Function::removeParamAttr
void removeParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
removes the attribute from the list of attributes.
Definition: Function.cpp:622
llvm::Value::setName
void setName(const Twine &Name)
Change the name of the value.
Definition: Value.cpp:375
llvm::Function::hasPersonalityFn
bool hasPersonalityFn() const
Check whether this function has a personality function.
Definition: Function.h:803
llvm::AttributeSet::getInAllocaType
Type * getInAllocaType() const
Definition: Attributes.cpp:808
llvm::FunctionType::params
ArrayRef< Type * > params() const
Definition: DerivedTypes.h:130
llvm::Argument::getAttribute
Attribute getAttribute(Attribute::AttrKind Kind) const
Definition: Function.cpp:307
IIT_V1024
@ IIT_V1024
Definition: Function.cpp:1064
IIT_V64
@ IIT_V64
Definition: Function.cpp:1043
llvm::Function::PCT_Real
@ PCT_Real
Definition: Function.h:247
Info
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
llvm::Intrinsic::IITDescriptor::PPCQuad
@ PPCQuad
Definition: Intrinsics.h:139
llvm::Argument::hasNestAttr
bool hasNestAttr() const
Return true if this argument has the nest attribute.
Definition: Function.cpp:232
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
llvm::Type::getInt1PtrTy
static PointerType * getInt1PtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:289
llvm::PointerType::isOpaque
bool isOpaque() const
Definition: DerivedTypes.h:673
getMangledTypeStr
static std::string getMangledTypeStr(Type *Ty, bool &HasUnnamedType)
Returns a stable mangling for the type specified for use in the name mangling scheme used by 'any' ty...
Definition: Function.cpp:899
llvm::Type::BFloatTyID
@ BFloatTyID
16-bit floating point type (7-bit significand)
Definition: Type.h:57
llvm::ArrayRef::slice
ArrayRef< T > slice(size_t N, size_t M) const
slice(n, m) - Chop off the first N elements of the array, and keep M elements in the array.
Definition: ArrayRef.h:193
llvm::Attribute::getValueAsString
StringRef getValueAsString() const
Return the attribute's value as a string.
Definition: Attributes.cpp:312
llvm::GlobalValue::IntID
Intrinsic::ID IntID
The intrinsic ID for this subclass (which must be a Function).
Definition: GlobalValue.h:169
llvm::Function::getParamInAllocaType
Type * getParamInAllocaType(unsigned ArgNo) const
Extract the inalloca type for a parameter.
Definition: Function.h:459
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::MemoryEffects::readOnly
static MemoryEffects readOnly()
Create MemoryEffects that can read any memory.
Definition: ModRef.h:123
Type.h
llvm::Argument::hasByRefAttr
bool hasByRefAttr() const
Return true if this argument has the byref attribute.
Definition: Function.cpp:114
IIT_PPCF128
@ IIT_PPCF128
Definition: Function.cpp:1079
llvm::Function::setOnlyAccessesInaccessibleMemory
void setOnlyAccessesInaccessibleMemory()
Definition: Function.cpp:800
llvm::Function::hasPrologueData
bool hasPrologueData() const
Check whether this function has prologue data.
Definition: Function.h:821
llvm::SmallString< 128 >
llvm::Intrinsic::IITDescriptor::TruncArgument
@ TruncArgument
Definition: Intrinsics.h:128
ValueSymbolTable.h
llvm::AttributeList::removeRetAttributes
AttributeList removeRetAttributes(LLVMContext &C, const AttributeMask &AttrsToRemove) const
Remove the specified attribute at the return value index from this attribute list.
Definition: Attributes.h:666
llvm::Function::getAttributes
AttributeList getAttributes() const
Return the attribute list for this Function.
Definition: Function.h:313
llvm::Argument::getDereferenceableOrNullBytes
uint64_t getDereferenceableOrNullBytes() const
If this argument has the dereferenceable_or_null attribute, return the number of bytes known to be de...
Definition: Function.cpp:226
llvm::Argument::getParamStructRetType
Type * getParamStructRetType() const
If this is an sret argument, return its type.
Definition: Function.cpp:205
llvm::Function::getGC
const std::string & getGC() const
Definition: Function.cpp:714
llvm::Type::isIntegerTy
bool isIntegerTy() const
True if this is an instance of IntegerType.
Definition: Type.h:222
llvm::MDNode::getOperand
const MDOperand & getOperand(unsigned I) const
Definition: Metadata.h:1291
llvm::StringRef::empty
constexpr bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:134
llvm::Intrinsic::MatchIntrinsicTypes_Match
@ MatchIntrinsicTypes_Match
Definition: Intrinsics.h:215
llvm::Argument::hasAttribute
bool hasAttribute(Attribute::AttrKind Kind) const
Check if an argument has a given attribute.
Definition: Function.cpp:303
llvm::VectorType
Base class of all SIMD vector types.
Definition: DerivedTypes.h:389
getIntrinsicNameImpl
static std::string getIntrinsicNameImpl(Intrinsic::ID Id, ArrayRef< Type * > Tys, Module *M, FunctionType *FT, bool EarlyModuleCheck)
Definition: Function.cpp:982
llvm::DenseSet
Implements a dense probed hash-table based set.
Definition: DenseSet.h:268
IIT_F128
@ IIT_F128
Definition: Function.cpp:1068
llvm::Intrinsic::IITDescriptor::get
static IITDescriptor get(IITDescriptorKind K, unsigned Field)
Definition: Intrinsics.h:191
llvm::Function::hasFnAttribute
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
Definition: Function.cpp:640
BasicBlock.h
llvm::cl::opt
Definition: CommandLine.h:1410
llvm::GlobalValue::hasAvailableExternallyLinkage
bool hasAvailableExternallyLinkage() const
Definition: GlobalValue.h:507
llvm::ProfileCount
Function::ProfileCount ProfileCount
Definition: SampleProfileLoaderBaseImpl.h:47
llvm::Function::setOnlyAccessesInaccessibleMemOrArgMem
void setOnlyAccessesInaccessibleMemOrArgMem()
Definition: Function.cpp:809
llvm::instructions
inst_range instructions(Function *F)
Definition: InstIterator.h:133
llvm::Function::getAttributeAtIndex
Attribute getAttributeAtIndex(unsigned i, Attribute::AttrKind Kind) const
gets the attribute from the list of attributes.
Definition: Function.cpp:657
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::PointerType::getUnqual
static PointerType * getUnqual(Type *ElementType)
This constructs a pointer to an object of the specified type in the default address space (address sp...
Definition: DerivedTypes.h:651
llvm::SymbolTableListTraits
Definition: GlobalAlias.h:26
uint64_t
llvm::Intrinsic::matchIntrinsicVarArg
bool matchIntrinsicVarArg(bool isVarArg, ArrayRef< IITDescriptor > &Infos)
Verify if the intrinsic has variable arguments.
Definition: Function.cpp:1827
llvm::Function::hasPrefixData
bool hasPrefixData() const
Check whether this function has prefix data.
Definition: Function.h:812
llvm::Intrinsic::IITDescriptor::Half
@ Half
Definition: Intrinsics.h:117
llvm::Function::dropAllReferences
void dropAllReferences()
dropAllReferences() - This method causes all the subinstructions to "let go" of all references that t...
Definition: Function.cpp:524
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
llvm::User::allocHungoffUses
void allocHungoffUses(unsigned N, bool IsPhi=false)
Allocate the array of Uses, followed by a pointer (with bottom bit set) to the User.
Definition: User.cpp:50
llvm::GlobalValue::getParent
Module * getParent()
Get the module that this global value is contained inside of...
Definition: GlobalValue.h:652
llvm::Type::X86_MMXTyID
@ X86_MMXTyID
MMX vectors (64 bits, X86 specific)
Definition: Type.h:66
llvm::ARM_MB::ST
@ ST
Definition: ARMBaseInfo.h:73
llvm::AttributeList::addRetAttribute
AttributeList addRetAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Add a return value attribute to the list.
Definition: Attributes.h:548
llvm::Function::hasGC
bool hasGC() const
hasGC/getGC/setGC/clearGC - The name of the garbage collection algorithm to use during code generatio...
Definition: Function.h:305
llvm::ConstantPointerNull::get
static ConstantPointerNull * get(PointerType *T)
Static factory methods - Return objects of the specified value.
Definition: Constants.cpp:1707
llvm::Intrinsic::getIntrinsicInfoTableEntries
void getIntrinsicInfoTableEntries(ID id, SmallVectorImpl< IITDescriptor > &T)
Return the IIT table descriptor for the specified intrinsic into an array of IITDescriptors.
Definition: Function.cpp:1332
IIT_F16
@ IIT_F16
Definition: Function.cpp:1031
move
compiles ldr LCPI1_0 ldr ldr mov lsr tst moveq r1 ldr LCPI1_1 and r0 bx lr It would be better to do something like to fold the shift into the conditional move
Definition: README.txt:546
IIT_FUNCREF
@ IIT_FUNCREF
Definition: Function.cpp:1082
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
ProfileCount
Function::ProfileCount ProfileCount
Definition: Function.cpp:73
llvm::numbers::e
constexpr double e
Definition: MathExtras.h:31
llvm::Function::setDoesNotAccessMemory
void setDoesNotAccessMemory()
Definition: Function.cpp:766
llvm::Function::setOnlyReadsMemory
void setOnlyReadsMemory()
Definition: Function.cpp:774
true
basic Basic Alias true
Definition: BasicAliasAnalysis.cpp:1804
IIT_STRUCT4
@ IIT_STRUCT4
Definition: Function.cpp:1050
I
#define I(x, y, z)
Definition: MD5.cpp:58
llvm::AttrBuilder
Definition: Attributes.h:1040
StringExtras.h
IIT_I8
@ IIT_I8
Definition: Function.cpp:1027
llvm::Function::addDereferenceableOrNullParamAttr
void addDereferenceableOrNullParamAttr(unsigned ArgNo, uint64_t Bytes)
adds the dereferenceable_or_null attribute to the list of attributes for the given arg.
Definition: Function.cpp:693
llvm::Intrinsic::IITDescriptor::AK_AnyInteger
@ AK_AnyInteger
Definition: Intrinsics.h:154
llvm::DenormalMode
Represent subnormal handling kind for floating point instruction inputs and outputs.
Definition: FloatingPointMode.h:69
llvm::Attribute::AttrKind
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
Definition: Attributes.h:86
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:445
llvm::LLVMContext::setGC
void setGC(const Function &Fn, std::string GCName)
Define the GC for a function.
Definition: LLVMContext.cpp:318
llvm::MemoryEffects::onlyReadsMemory
bool onlyReadsMemory() const
Whether this function only (at most) reads memory.
Definition: ModRef.h:194
llvm::Argument::hasNoFreeAttr
bool hasNoFreeAttr() const
Return true if this argument has the nofree attribute.
Definition: Function.cpp:247
llvm::Intrinsic::IITDescriptor::VecOfAnyPtrsToElt
@ VecOfAnyPtrsToElt
Definition: Intrinsics.h:133
llvm::PointerType
Class to represent pointers.
Definition: DerivedTypes.h:632
ArrayRef.h
llvm::Argument::hasPreallocatedAttr
bool hasPreallocatedAttr() const
Return true if this argument has the preallocated attribute.
Definition: Function.cpp:133
llvm::Type::isHalfTy
bool isHalfTy() const
Return true if this is 'half', a 16-bit IEEE fp type.
Definition: Type.h:143
llvm::GlobalValue::Linkage
unsigned Linkage
Definition: GlobalValue.h:94
llvm::Argument::removeAttr
void removeAttr(Attribute::AttrKind Kind)
Remove attributes from an argument.
Definition: Function.cpp:293
llvm::Function::Create
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
Definition: Function.h:136
llvm::Function::ProfileCountType
ProfileCountType
Definition: Function.h:247
llvm::MemoryEffects::none
static MemoryEffects none()
Create MemoryEffects that cannot read or write any memory.
Definition: ModRef.h:118
llvm::FramePointerKind::All
@ All
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::Function::setOnlyWritesMemory
void setOnlyWritesMemory()
Definition: Function.cpp:782
llvm::GlobalValue::hasLocalLinkage
bool hasLocalLinkage() const
Definition: GlobalValue.h:523
llvm::Function::lookupIntrinsicID
static Intrinsic::ID lookupIntrinsicID(StringRef Name)
This does the actual lookup of an intrinsic ID which matches the given function name.
Definition: Function.cpp:856
IIT_V4
@ IIT_V4
Definition: Function.cpp:1035
llvm::Function::onlyWritesMemory
bool onlyWritesMemory() const
Determine if the function does not access or only writes memory.
Definition: Function.cpp:779
llvm::Argument::Argument
Argument(Type *Ty, const Twine &Name="", Function *F=nullptr, unsigned ArgNo=0)
Argument constructor.
Definition: Function.cpp:87
NonGlobalValueMaxNameSize
static cl::opt< unsigned > NonGlobalValueMaxNameSize("non-global-value-max-name-size", cl::Hidden, cl::init(1024), cl::desc("Maximum size for the name of non-global values."))
llvm::Value::user_empty
bool user_empty() const
Definition: Value.h:385
llvm::Type::isVoidTy
bool isVoidTy() const
Return true if this is 'void'.
Definition: Type.h:140
llvm::Function::setPersonalityFn
void setPersonalityFn(Constant *Fn)
Definition: Function.cpp:2000
llvm::Intrinsic::IITDescriptor::AMX
@ AMX
Definition: Intrinsics.h:138
llvm::Function::getSectionPrefix
std::optional< StringRef > getSectionPrefix() const
Get the section prefix for this function.
Definition: Function.cpp:2121
DeferredIntrinsicMatchPair
std::pair< Type *, ArrayRef< Intrinsic::IITDescriptor > > DeferredIntrinsicMatchPair
Definition: Function.cpp:1523
IIT_I2
@ IIT_I2
Definition: Function.cpp:1084
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
llvm::MDNode
Metadata node.
Definition: Metadata.h:943
IIT_ARG
@ IIT_ARG
Definition: Function.cpp:1040
IIT_V256
@ IIT_V256
Definition: Function.cpp:1077
llvm::Value::clearMetadata
void clearMetadata()
Erase all metadata attached to this Value.
Definition: Metadata.cpp:1382
IIT_VARARG
@ IIT_VARARG
Definition: Function.cpp:1056
IIT_I16
@ IIT_I16
Definition: Function.cpp:1028
llvm::AbstractCallSite::isCallbackCall
bool isCallbackCall() const
Return true if this ACS represents a callback call.
Definition: AbstractCallSite.h:125
llvm::Intrinsic::IITDescriptor::Argument
@ Argument
Definition: Intrinsics.h:126
IIT_PTR_TO_ELT
@ IIT_PTR_TO_ELT
Definition: Function.cpp:1060
getType
static M68kRelType getType(unsigned Kind, MCSymbolRefExpr::VariantKind &Modifier, bool &IsPCRel)
Definition: M68kELFObjectWriter.cpp:48
llvm::Intrinsic::IITDescriptor::Subdivide2Argument
@ Subdivide2Argument
Definition: Intrinsics.h:135
llvm::Type::FP128TyID
@ FP128TyID
128-bit floating point type (112-bit significand)
Definition: Type.h:61
llvm::Function::getIntrinsicID
Intrinsic::ID getIntrinsicID() const LLVM_READONLY
getIntrinsicID - This method returns the ID number of the specified function, or Intrinsic::not_intri...
Definition: Function.h:204
llvm::Function::createWithDefaultAttr
static Function * createWithDefaultAttr(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
Creates a function with some attributes recorded in llvm.module.flags applied.
Definition: Function.cpp:332
llvm::Function::setEntryCount
void setEntryCount(ProfileCount Count, const DenseSet< GlobalValue::GUID > *Imports=nullptr)
Set the entry count for this function.
Definition: Function.cpp:2059
llvm::ArrayRef< const char * >
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::StructType
Class to represent struct types.
Definition: DerivedTypes.h:213
llvm::Type::PPC_FP128TyID
@ PPC_FP128TyID
128-bit floating point type (two 64-bits, PowerPC)
Definition: Type.h:62
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
this
Analysis the ScalarEvolution expression for r is this
Definition: README.txt:8
llvm::Function::setCallingConv
void setCallingConv(CallingConv::ID CC)
Definition: Function.h:241
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:143
llvm::Value::getType
Type * getType() const
All values are typed, get the type of this value.
Definition: Value.h:255
llvm::Argument::getParamByRefType
Type * getParamByRefType() const
If this is a byref argument, return its type.
Definition: Function.cpp:210
llvm::MemoryEffects::inaccessibleOrArgMemOnly
static MemoryEffects inaccessibleOrArgMemOnly(ModRefInfo MR=ModRefInfo::ModRef)
Create MemoryEffects that can only access inaccessible or argument memory.
Definition: ModRef.h:144
Compiler.h
llvm::Function::getParamAlign
MaybeAlign getParamAlign(unsigned ArgNo) const
Definition: Function.h:440
llvm::ilist_node_impl< ilist_detail::compute_node_options< Function, Options... >::type >::getIterator
self_iterator getIterator()
Definition: ilist_node.h:82
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition: AArch64SLSHardening.cpp:76
llvm::Value::getMetadata
MDNode * getMetadata(unsigned KindID) const
Get the current metadata attachments for the given kind, if any.
Definition: Metadata.cpp:1288
llvm::Function::onlyReadsMemory
bool onlyReadsMemory() const
Determine if the function does not access or only reads memory.
Definition: Function.cpp:771
llvm::Argument::getPassPointeeByValueCopySize
uint64_t getPassPointeeByValueCopySize(const DataLayout &DL) const
If this argument satisfies has hasPassPointeeByValueAttr, return the in-memory ABI size copied to the...
Definition: Function.cpp:177
S
add sub stmia L5 ldr r0 bl L_printf $stub Instead of a and a wouldn t it be better to do three moves *Return an aggregate type is even return S
Definition: README.txt:210
llvm::Function::ProfileCount::getType
ProfileCountType getType() const
Definition: Function.h:261
IIT_STRUCT6
@ IIT_STRUCT6
Definition: Function.cpp:1065
llvm::Module::getFunctionList
const FunctionListType & getFunctionList() const
Get the Module's list of functions (constant).
Definition: Module.h:559
llvm::VectorType::getHalfElementsVectorType
static VectorType * getHalfElementsVectorType(VectorType *VTy)
This static method returns a VectorType with half as many elements as the input type and the same ele...
Definition: DerivedTypes.h:493
llvm::Function::hasAddressTaken
bool hasAddressTaken(const User **=nullptr, bool IgnoreCallbackUses=false, bool IgnoreAssumeLikeCalls=true, bool IngoreLLVMUsed=false, bool IgnoreARCAttachedCall=false) const
hasAddressTaken - returns true if there are any uses of this function other than direct calls or invo...
Definition: Function.cpp:1904
llvm::Function::callsFunctionThatReturnsTwice
bool callsFunctionThatReturnsTwice() const
callsFunctionThatReturnsTwice - Return true if the function has a call to setjmp or other function th...
Definition: Function.cpp:1986
llvm::Value::setMetadata
void setMetadata(unsigned KindID, MDNode *Node)
Set a particular kind of metadata attachment.
Definition: Metadata.cpp:1325
llvm::Intrinsic::IITDescriptor::PtrToElt
@ PtrToElt
Definition: Intrinsics.h:132
llvm::Value::getName
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:308
llvm::Type::getContext
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
Definition: Type.h:129
llvm::ArgInfo
Helper struct shared between Function Specialization and SCCP Solver.
Definition: SCCPSolver.h:51
IIT_ANYPTR
@ IIT_ANYPTR
Definition: Function.cpp:1054
findTargetSubtable
static ArrayRef< const char * > findTargetSubtable(StringRef Name)
Find the segment of IntrinsicNameTable for intrinsics with the same target as Name,...
Definition: Function.cpp:839
IIT_V3
@ IIT_V3
Definition: Function.cpp:1080
llvm::Function::setIsMaterializable
void setIsMaterializable(bool V)
Definition: Function.h:192
llvm::ArrayRef::front
const T & front() const
front - Get the first element.
Definition: ArrayRef.h:166
llvm::Intrinsic::IITDescriptor::VecElementArgument
@ VecElementArgument
Definition: Intrinsics.h:134
llvm::Function::getDenormalMode
DenormalMode getDenormalMode(const fltSemantics &FPType) const
Returns the denormal handling type for the default rounding mode of the function.
Definition: Function.cpp:699
llvm::Intrinsic::getDeclaration
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=std::nullopt)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
Definition: Function.cpp:1502
llvm::Function::ProfileCount::getCount
uint64_t getCount() const
Definition: Function.h:260
IIT_I32
@ IIT_I32
Definition: Function.cpp:1029
llvm::MDBuilder::createFunctionSectionPrefix
MDNode * createFunctionSectionPrefix(StringRef Prefix)
Return metadata containing the section prefix for a function.
Definition: MDBuilder.cpp:78
Argument.h
llvm::Intrinsic::IITDescriptor::AK_AnyFloat
@ AK_AnyFloat
Definition: Intrinsics.h:155
IIT_STRUCT7
@ IIT_STRUCT7
Definition: Function.cpp:1066
llvm::Type::IntegerTyID
@ IntegerTyID
Arbitrary bit width integers.
Definition: Type.h:71
llvm::Argument::addAttrs
void addAttrs(AttrBuilder &B)
Add attributes to an argument.
Definition: Function.cpp:279
llvm::VectorType::getExtendedElementVectorType
static VectorType * getExtendedElementVectorType(VectorType *VTy)
This static method is like getInteger except that the element types are twice as wide as the elements...
Definition: DerivedTypes.h:449
Attributes.h
llvm::Function::hasLazyArguments
bool hasLazyArguments() const
hasLazyArguments/CheckLazyArguments - The argument list of a function is built on demand,...
Definition: Function.h:105
llvm::partition_point
auto partition_point(R &&Range, Predicate P)
Binary search for the first iterator in a range where a predicate is false.
Definition: STLExtras.h:1961
llvm::Function::getMemoryEffects
MemoryEffects getMemoryEffects() const
Definition: Function.cpp:755
IIT_SUBDIVIDE2_ARG
@ IIT_SUBDIVIDE2_ARG
Definition: Function.cpp:1071
llvm::Function::addParamAttr
void addParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
adds the attribute to the list of attributes for the given arg.
Definition: Function.cpp:578
Constant.h
llvm::TargetExtType
Class to represent target extensions types, which are generally unintrospectable from target-independ...
Definition: DerivedTypes.h:739
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
IIT_VEC_OF_ANYPTRS_TO_ELT
@ IIT_VEC_OF_ANYPTRS_TO_ELT
Definition: Function.cpp:1061
llvm::AttributeSet::getPreallocatedType
Type * getPreallocatedType() const
Definition: Attributes.cpp:804
llvm::Function::removeAttributeAtIndex
void removeAttributeAtIndex(unsigned i, Attribute::AttrKind Kind)
removes the attribute from the list of attributes.
Definition: Function.cpp:590
llvm::Type::isFloatTy
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
Definition: Type.h:154
llvm::AttributeList::addFnAttribute
AttributeList addFnAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Add a function attribute to the list.
Definition: Attributes.h:519
llvm::AttributeSet::getByRefType
Type * getByRefType() const
Definition: Attributes.cpp:792
llvm::Type::getHalfTy
static Type * getHalfTy(LLVMContext &C)
Definition: Type.cpp:226
IIT_HALF_VEC_ARG
@ IIT_HALF_VEC_ARG
Definition: Function.cpp:1057
llvm::AttributeSet::getByValType
Type * getByValType() const
Definition: Attributes.cpp:796
llvm::Type::isIntOrIntVectorTy
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
Definition: Type.h:228
llvm::Function::getParamDereferenceableOrNullBytes
uint64_t getParamDereferenceableOrNullBytes(unsigned ArgNo) const
Extract the number of dereferenceable_or_null bytes for a parameter.
Definition: Function.h:482
llvm::Argument::hasNonNullAttr
bool hasNonNullAttr(bool AllowUndefOrPoison=true) const
Return true if this argument has the nonnull attribute.
Definition: Function.cpp:96
Casting.h
llvm::Argument::hasByValAttr
bool hasByValAttr() const
Return true if this argument has the byval attribute.
Definition: Function.cpp:109
IIT_I64
@ IIT_I64
Definition: Function.cpp:1030
llvm::fltSemantics
Definition: APFloat.cpp:71
llvm::Argument::getParamByValType
Type * getParamByValType() const
If this is a byval argument, return its type.
Definition: Function.cpp:200
Function.h
IIT_TRUNC_ARG
@ IIT_TRUNC_ARG
Definition: Function.cpp:1053
llvm::FramePointerKind::NonLeaf
@ NonLeaf
IIT_I128
@ IIT_I128
Definition: Function.cpp:1062
llvm::Function::addDereferenceableParamAttr
void addDereferenceableParamAttr(unsigned ArgNo, uint64_t Bytes)
adds the dereferenceable attribute to the list of attributes for the given arg.
Definition: Function.cpp:635
IIT_PTR
@ IIT_PTR
Definition: Function.cpp:1039
IntrinsicNameTable
static const char *const IntrinsicNameTable[]
Table of string intrinsic names indexed by enum value.
Definition: Function.cpp:815
llvm::Type::isDoubleTy
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
Definition: Type.h:157
llvm::Function::isTargetIntrinsic
bool isTargetIntrinsic() const
isTargetIntrinsic - Returns true if this function is an intrinsic and the intrinsic is specific to a ...
Definition: Function.cpp:831
IIT_MMX
@ IIT_MMX
Definition: Function.cpp:1044
llvm::Type::isPPC_FP128Ty
bool isPPC_FP128Ty() const
Return true if this is powerpc long double.
Definition: Type.h:166
llvm::Function::getFunctionType
FunctionType * getFunctionType() const
Returns the FunctionType for me.
Definition: Function.h:174
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::Function::addRetAttrs
void addRetAttrs(const AttrBuilder &Attrs)
Add return value attributes to this function.
Definition: Function.cpp:574
llvm::Function::splice
void splice(Function::iterator ToIt, Function *FromF)
Transfer all blocks from FromF to this function at ToIt.
Definition: Function.h:687
IIT_V32
@ IIT_V32
Definition: Function.cpp:1038
llvm::Function::isConstrainedFPIntrinsic
bool isConstrainedFPIntrinsic() const
Returns true if the function is one of the "Constrained Floating-Point Intrinsics".
Definition: Function.cpp:458
llvm::Type::getBFloatTy
static Type * getBFloatTy(LLVMContext &C)
Definition: Type.cpp:227
llvm::Function::getParamStackAlign
MaybeAlign getParamStackAlign(unsigned ArgNo) const
Definition: Function.h:444
llvm::Function::getPersonalityFn
Constant * getPersonalityFn() const
Get the personality function associated with this function.
Definition: Function.cpp:1995
llvm::AttributeList::removeRetAttribute
AttributeList removeRetAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Remove the specified attribute at the return value index from this attribute list.
Definition: Attributes.h:652
llvm::Function::getInstructionCount
unsigned getInstructionCount() const
Returns the number of non-debug IR instructions in this function.
Definition: Function.cpp:319
llvm::Intrinsic::getNameNoUnnamedTypes
std::string getNameNoUnnamedTypes(ID Id, ArrayRef< Type * > Tys)
Return the LLVM name for an intrinsic.
Definition: Function.cpp:1015
IIT_PTR_TO_ARG
@ IIT_PTR_TO_ARG
Definition: Function.cpp:1059
computeAddrSpace
static unsigned computeAddrSpace(unsigned AddrSpace, Module *M)
Definition: Function.cpp:387
llvm::LLVMContext::deleteGC
void deleteGC(const Function &Fn)
Remove the GC for a function.
Definition: LLVMContext.cpp:332
llvm::Function::getParamByRefType
Type * getParamByRefType(unsigned ArgNo) const
Extract the byref type for a parameter.
Definition: Function.h:464
llvm::MDBuilder
Definition: MDBuilder.h:36
llvm::Function::removeParamAttrs
void removeParamAttrs(unsigned ArgNo, const AttributeMask &Attrs)
removes the attribute from the list of attributes.
Definition: Function.cpp:630
llvm::GlobalValue::HasLLVMReservedName
unsigned HasLLVMReservedName
True if the function's name starts with "llvm.".
Definition: GlobalValue.h:105
llvm::Intrinsic::IITDescriptor::Struct
@ Struct
Definition: Intrinsics.h:125
llvm::Function::onlyAccessesInaccessibleMemory
bool onlyAccessesInaccessibleMemory() const
Determine if the function may only access memory that is inaccessible from the IR.
Definition: Function.cpp:797
llvm::MemoryEffects::onlyAccessesArgPointees
bool onlyAccessesArgPointees() const
Whether this function only (at most) accesses argument memory.
Definition: ModRef.h:200
IIT_EMPTYSTRUCT
@ IIT_EMPTYSTRUCT
Definition: Function.cpp:1047
llvm::Type::getVoidTy
static Type * getVoidTy(LLVMContext &C)
Definition: Type.cpp:224
llvm::Function::onlyAccessesArgMemory
bool onlyAccessesArgMemory() const
Determine if the call can access memmory only using pointers based on its arguments.
Definition: Function.cpp:788
llvm::Function::nullPointerIsDefined
bool nullPointerIsDefined() const
Check if null pointer dereferencing is considered undefined behavior for the function.
Definition: Function.cpp:2132
llvm::User::getNumOperands
unsigned getNumOperands() const
Definition: User.h:191
llvm::MemoryEffects::onlyAccessesInaccessibleOrArgMem
bool onlyAccessesInaccessibleOrArgMem() const
Whether this function only (at most) accesses argument and inaccessible memory.
Definition: ModRef.h:216
llvm::AttributeSet
Definition: Attributes.h:295
llvm::Argument::getPointeeInMemoryValueType
Type * getPointeeInMemoryValueType() const
If hasPointeeInMemoryValueAttr returns true, the in-memory ABI type is returned.
Definition: Function.cpp:185
matchIntrinsicType
static bool matchIntrinsicType(Type *Ty, ArrayRef< Intrinsic::IITDescriptor > &Infos, SmallVectorImpl< Type * > &ArgTys, SmallVectorImpl< DeferredIntrinsicMatchPair > &DeferredChecks, bool IsDeferredCheck)
Definition: Function.cpp:1525
SmallVector.h
llvm::Function::setPrefixData
void setPrefixData(Constant *PrefixData)
Definition: Function.cpp:2010
llvm::Intrinsic::IITDescriptor::Token
@ Token
Definition: Intrinsics.h:115
llvm::Type::isBFloatTy
bool isBFloatTy() const
Return true if this is 'bfloat', a 16-bit bfloat type.
Definition: Type.h:146
User.h
llvm::MemoryEffects::argMemOnly
static MemoryEffects argMemOnly(ModRefInfo MR=ModRefInfo::ModRef)
Create MemoryEffects that can only access argument memory.
Definition: ModRef.h:133
llvm::Intrinsic::IITDescriptor::Vector
@ Vector
Definition: Intrinsics.h:123
N
#define N
llvm::AttributeList::hasRetAttr
bool hasRetAttr(Attribute::AttrKind Kind) const
Return true if the attribute exists for the return value.
Definition: Attributes.h:779
llvm::Function::removeFnAttr
void removeFnAttr(Attribute::AttrKind Kind)
Remove function attributes from this function.
Definition: Function.cpp:598
llvm::AttributeList::addRetAttributes
AttributeList addRetAttributes(LLVMContext &C, const AttrBuilder &B) const
Add a return value attribute to the list.
Definition: Attributes.h:562
llvm::Argument::hasNoAliasAttr
bool hasNoAliasAttr() const
Return true if this argument has the noalias attribute.
Definition: Function.cpp:237
llvm::ArrayRef::size
size_t size() const
size - Get the array size.
Definition: ArrayRef.h:163
llvm::IntegerType::getBitWidth
unsigned getBitWidth() const
Get the number of bits in this IntegerType.
Definition: DerivedTypes.h:72
llvm::Intrinsic::matchIntrinsicSignature
MatchIntrinsicTypesResult matchIntrinsicSignature(FunctionType *FTy, ArrayRef< IITDescriptor > &Infos, SmallVectorImpl< Type * > &ArgTys)
Match the specified function type with the type constraints specified by the .td file.
Definition: Function.cpp:1801
llvm::tgtok::Bit
@ Bit
Definition: TGLexer.h:50
llvm::Function::addFnAttr
void addFnAttr(Attribute::AttrKind Kind)
Add function attributes to this function.
Definition: Function.cpp:550
llvm::GlobalObject::copyAttributesFrom
void copyAttributesFrom(const GlobalObject *Src)
Definition: Globals.cpp:130
llvm::Intrinsic::IITDescriptor::getVector
static IITDescriptor getVector(unsigned Width, bool IsScalable)
Definition: Intrinsics.h:203
llvm::Argument::getParamAlign
MaybeAlign getParamAlign() const
If this is a byval or inalloca argument, return its alignment.
Definition: Function.cpp:191
IIT_TOKEN
@ IIT_TOKEN
Definition: Function.cpp:1045
llvm::GlobalValue::hasLinkOnceLinkage
bool hasLinkOnceLinkage() const
Definition: GlobalValue.h:510
llvm::Function::removeFromParent
void removeFromParent()
removeFromParent - This method unlinks 'this' from the containing module, but does not delete it.
Definition: Function.cpp:358
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::AttributeSet::getStructRetType
Type * getStructRetType() const
Definition: Attributes.cpp:800
llvm::GlobalValue::getType
PointerType * getType() const
Global values are always pointers.
Definition: GlobalValue.h:290
llvm::ArrayRef
ArrayRef(const T &OneElt) -> ArrayRef< T >
DerivedTypes.h
llvm::Function::setPrologueData
void setPrologueData(Constant *PrologueData)
Definition: Function.cpp:2020
llvm::LLVMContext::OB_clang_arc_attachedcall
@ OB_clang_arc_attachedcall
Definition: LLVMContext.h:95
llvm::Function::recalculateIntrinsicID
void recalculateIntrinsicID()
Recalculate the ID for this function if it is an Intrinsic defined in llvm/Intrinsics....
Definition: Function.cpp:876
llvm::IntegerType::get
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
Definition: Type.cpp:313
llvm::Function::getPrologueData
Constant * getPrologueData() const
Get the prologue data associated with this function.
Definition: Function.cpp:2015
BB
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
Definition: README.txt:39
llvm::Intrinsic::IITDescriptor::Integer
@ Integer
Definition: Intrinsics.h:122
LLVMContext.h
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:394
llvm::FramePointerKind::None
@ None
llvm::Function::ProfileCount
Class to represent profile counts.
Definition: Function.h:252
llvm::cl::desc
Definition: CommandLine.h:411
AbstractCallSite.h
llvm::Intrinsic::IITDescriptor
This is a type descriptor which explains the type requirements of an intrinsic.
Definition: Intrinsics.h:110
IIT_V512
@ IIT_V512
Definition: Function.cpp:1063
llvm::NullPointerIsDefined
bool NullPointerIsDefined(const Function *F, unsigned AS=0)
Check whether null pointer dereferencing is considered undefined behavior for a given function or an ...
Definition: Function.cpp:2136
llvm::Type::getX86_MMXTy
static Type * getX86_MMXTy(LLVMContext &C)
Definition: Type.cpp:235
llvm::AMDGPU::VGPRIndexMode::Id
Id
Definition: SIDefines.h:247
IIT_SAME_VEC_WIDTH_ARG
@ IIT_SAME_VEC_WIDTH_ARG
Definition: Function.cpp:1058
IIT_STRUCT5
@ IIT_STRUCT5
Definition: Function.cpp:1051
llvm::AttributeList::hasParamAttr
bool hasParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Return true if the attribute exists for the given argument.
Definition: Attributes.h:764
SymbolTableListTraits.h
llvm::Intrinsic::MatchIntrinsicTypesResult
MatchIntrinsicTypesResult
Definition: Intrinsics.h:214
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::Argument::onlyReadsMemory
bool onlyReadsMemory() const
Return true if this argument has the readonly or readnone attribute.
Definition: Function.cpp:273
llvm::Function::erase
Function::iterator erase(Function::iterator FromIt, Function::iterator ToIt)
Erases a range of BasicBlocks from FromIt to (not including) ToIt.
Definition: Function.cpp:378
llvm::MDString
A single uniqued string.
Definition: Metadata.h:611
llvm::MDBuilder::createFunctionEntryCount
MDNode * createFunctionEntryCount(uint64_t Count, bool Synthetic, const DenseSet< GlobalValue::GUID > *Imports)
Return metadata containing the entry Count for a function, a boolean \Synthetic indicating whether th...
Definition: MDBuilder.cpp:59
llvm::AttributeList::getFnAttr
Attribute getFnAttr(Attribute::AttrKind Kind) const
Return the attribute object that exists for the function.
Definition: Attributes.h:823
IIT_STRUCT3
@ IIT_STRUCT3
Definition: Function.cpp:1049
Value.h
IIT_V2
@ IIT_V2
Definition: Function.cpp:1034
llvm::Function::getParamStructRetType
Type * getParamStructRetType(unsigned ArgNo) const
Extract the sret type for a parameter.
Definition: Function.h:454
llvm::Function::setAttributes
void setAttributes(AttributeList Attrs)
Set the attribute list for this Function.
Definition: Function.h:316
llvm::Argument::hasSExtAttr
bool hasSExtAttr() const
Return true if this argument has the sext attribute.
Definition: Function.cpp:269
IIT_STRUCT8
@ IIT_STRUCT8
Definition: Function.cpp:1067
llvm::FunctionType::getReturnType
Type * getReturnType() const
Definition: DerivedTypes.h:124
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::Type::isFP128Ty
bool isFP128Ty() const
Return true if this is 'fp128'.
Definition: Type.h:163
llvm::User::setNumHungOffUseOperands
void setNumHungOffUseOperands(unsigned NumOps)
Subclasses with hung off uses need to manage the operand count themselves.
Definition: User.h:215
llvm::VectorType::get
static VectorType * get(Type *ElementType, ElementCount EC)
This static method is the primary way to construct an VectorType.
Definition: Type.cpp:670
llvm::Type::HalfTyID
@ HalfTyID
16-bit floating point type
Definition: Type.h:56
llvm::Value::users
iterator_range< user_iterator > users()
Definition: Value.h:421
llvm::Type::X86_FP80TyID
@ X86_FP80TyID
80-bit floating point type (X87)
Definition: Type.h:60
IIT_VEC_ELEMENT
@ IIT_VEC_ELEMENT
Definition: Function.cpp:1069
llvm::AttributeList::getParamAttr
Attribute getParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Return the attribute object that exists at the arg index.
Definition: Attributes.h:813
llvm::Type::getFloatTy
static Type * getFloatTy(LLVMContext &C)
Definition: Type.cpp:228
llvm::ArrayRef::end
iterator end() const
Definition: ArrayRef.h:152
llvm::Intrinsic::IITDescriptor::getArgumentKind
ArgKind getArgumentKind() const
Definition: Intrinsics.h:170
llvm::MemoryEffects::inaccessibleMemOnly
static MemoryEffects inaccessibleMemOnly(ModRefInfo MR=ModRefInfo::ModRef)
Create MemoryEffects that can only access inaccessible memory.
Definition: ModRef.h:138
llvm::Type::isX86_AMXTy
bool isX86_AMXTy() const
Return true if this is X86 AMX.
Definition: Type.h:204
IIT_F64
@ IIT_F64
Definition: Function.cpp:1033
llvm::Argument::hasReturnedAttr
bool hasReturnedAttr() const
Return true if this argument has the returned attribute.
Definition: Function.cpp:261
IIT_SCALABLE_VEC
@ IIT_SCALABLE_VEC
Definition: Function.cpp:1070
llvm::FunctionType
Class to represent function types.
Definition: DerivedTypes.h:103
llvm::Argument::addAttr
void addAttr(Attribute::AttrKind Kind)
Definition: Function.cpp:285
llvm::Use
A Use represents the edge between a Value definition and its users.
Definition: Use.h:43
llvm::SmallVectorImpl::emplace_back
reference emplace_back(ArgTypes &&... Args)
Definition: SmallVector.h:941
llvm::Function::iterator
BasicBlockListType::iterator iterator
Definition: Function.h:65
llvm::Function::getImportGUIDs
DenseSet< GlobalValue::GUID > getImportGUIDs() const
Returns the set of GUIDs that needs to be imported to the function for sample PGO,...
Definition: Function.cpp:2103
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:39
llvm::AttributeList::removeParamAttribute
AttributeList removeParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
Remove the specified attribute at the specified arg index from this attribute list.
Definition: Attributes.h:674