LLVM  14.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/None.h"
18 #include "llvm/ADT/STLExtras.h"
19 #include "llvm/ADT/SmallString.h"
20 #include "llvm/ADT/SmallVector.h"
21 #include "llvm/ADT/StringExtras.h"
22 #include "llvm/ADT/StringRef.h"
24 #include "llvm/IR/Argument.h"
25 #include "llvm/IR/Attributes.h"
26 #include "llvm/IR/BasicBlock.h"
27 #include "llvm/IR/Constant.h"
28 #include "llvm/IR/Constants.h"
29 #include "llvm/IR/DerivedTypes.h"
30 #include "llvm/IR/GlobalValue.h"
31 #include "llvm/IR/InstIterator.h"
32 #include "llvm/IR/Instruction.h"
33 #include "llvm/IR/Instructions.h"
34 #include "llvm/IR/IntrinsicInst.h"
35 #include "llvm/IR/Intrinsics.h"
36 #include "llvm/IR/IntrinsicsAArch64.h"
37 #include "llvm/IR/IntrinsicsAMDGPU.h"
38 #include "llvm/IR/IntrinsicsARM.h"
39 #include "llvm/IR/IntrinsicsBPF.h"
40 #include "llvm/IR/IntrinsicsHexagon.h"
41 #include "llvm/IR/IntrinsicsMips.h"
42 #include "llvm/IR/IntrinsicsNVPTX.h"
43 #include "llvm/IR/IntrinsicsPowerPC.h"
44 #include "llvm/IR/IntrinsicsR600.h"
45 #include "llvm/IR/IntrinsicsRISCV.h"
46 #include "llvm/IR/IntrinsicsS390.h"
47 #include "llvm/IR/IntrinsicsVE.h"
48 #include "llvm/IR/IntrinsicsWebAssembly.h"
49 #include "llvm/IR/IntrinsicsX86.h"
50 #include "llvm/IR/IntrinsicsXCore.h"
51 #include "llvm/IR/LLVMContext.h"
52 #include "llvm/IR/MDBuilder.h"
53 #include "llvm/IR/Metadata.h"
54 #include "llvm/IR/Module.h"
55 #include "llvm/IR/Operator.h"
57 #include "llvm/IR/Type.h"
58 #include "llvm/IR/Use.h"
59 #include "llvm/IR/User.h"
60 #include "llvm/IR/Value.h"
62 #include "llvm/Support/Casting.h"
64 #include "llvm/Support/Compiler.h"
66 #include <algorithm>
67 #include <cassert>
68 #include <cstddef>
69 #include <cstdint>
70 #include <cstring>
71 #include <string>
72 
73 using namespace llvm;
75 
76 // Explicit instantiations of SymbolTableListTraits since some of the methods
77 // are not in the public header file...
79 
81  "non-global-value-max-name-size", cl::Hidden, cl::init(1024),
82  cl::desc("Maximum size for the name of non-global values."));
83 
84 //===----------------------------------------------------------------------===//
85 // Argument Implementation
86 //===----------------------------------------------------------------------===//
87 
88 Argument::Argument(Type *Ty, const Twine &Name, Function *Par, unsigned ArgNo)
89  : Value(Ty, Value::ArgumentVal), Parent(Par), ArgNo(ArgNo) {
90  setName(Name);
91 }
92 
93 void Argument::setParent(Function *parent) {
94  Parent = parent;
95 }
96 
97 bool Argument::hasNonNullAttr(bool AllowUndefOrPoison) const {
98  if (!getType()->isPointerTy()) return false;
99  if (getParent()->hasParamAttribute(getArgNo(), Attribute::NonNull) &&
100  (AllowUndefOrPoison ||
101  getParent()->hasParamAttribute(getArgNo(), Attribute::NoUndef)))
102  return true;
103  else if (getDereferenceableBytes() > 0 &&
105  getType()->getPointerAddressSpace()))
106  return true;
107  return false;
108 }
109 
111  if (!getType()->isPointerTy()) return false;
112  return hasAttribute(Attribute::ByVal);
113 }
114 
116  if (!getType()->isPointerTy())
117  return false;
118  return hasAttribute(Attribute::ByRef);
119 }
120 
122  return getParent()->hasParamAttribute(getArgNo(), Attribute::SwiftSelf);
123 }
124 
126  return getParent()->hasParamAttribute(getArgNo(), Attribute::SwiftError);
127 }
128 
130  if (!getType()->isPointerTy()) return false;
131  return hasAttribute(Attribute::InAlloca);
132 }
133 
135  if (!getType()->isPointerTy())
136  return false;
137  return hasAttribute(Attribute::Preallocated);
138 }
139 
141  if (!getType()->isPointerTy()) return false;
143  return Attrs.hasParamAttr(getArgNo(), Attribute::ByVal) ||
144  Attrs.hasParamAttr(getArgNo(), Attribute::InAlloca) ||
145  Attrs.hasParamAttr(getArgNo(), Attribute::Preallocated);
146 }
147 
149  if (!getType()->isPointerTy())
150  return false;
152  return Attrs.hasParamAttr(getArgNo(), Attribute::ByVal) ||
153  Attrs.hasParamAttr(getArgNo(), Attribute::StructRet) ||
154  Attrs.hasParamAttr(getArgNo(), Attribute::InAlloca) ||
155  Attrs.hasParamAttr(getArgNo(), Attribute::Preallocated) ||
156  Attrs.hasParamAttr(getArgNo(), Attribute::ByRef);
157 }
158 
159 /// For a byval, sret, inalloca, or preallocated parameter, get the in-memory
160 /// parameter type.
162  // FIXME: All the type carrying attributes are mutually exclusive, so there
163  // should be a single query to get the stored type that handles any of them.
164  if (Type *ByValTy = ParamAttrs.getByValType())
165  return ByValTy;
166  if (Type *ByRefTy = ParamAttrs.getByRefType())
167  return ByRefTy;
168  if (Type *PreAllocTy = ParamAttrs.getPreallocatedType())
169  return PreAllocTy;
170  if (Type *InAllocaTy = ParamAttrs.getInAllocaType())
171  return InAllocaTy;
172  if (Type *SRetTy = ParamAttrs.getStructRetType())
173  return SRetTy;
174 
175  return nullptr;
176 }
177 
179  AttributeSet ParamAttrs =
181  if (Type *MemTy = getMemoryParamAllocType(ParamAttrs))
182  return DL.getTypeAllocSize(MemTy);
183  return 0;
184 }
185 
187  AttributeSet ParamAttrs =
189  return getMemoryParamAllocType(ParamAttrs);
190 }
191 
193  assert(getType()->isPointerTy() && "Only pointers have alignments");
194  return getParent()->getParamAlignment(getArgNo());
195 }
196 
198  assert(getType()->isPointerTy() && "Only pointers have alignments");
199  return getParent()->getParamAlign(getArgNo());
200 }
201 
204 }
205 
207  assert(getType()->isPointerTy() && "Only pointers have byval types");
208  return getParent()->getParamByValType(getArgNo());
209 }
210 
212  assert(getType()->isPointerTy() && "Only pointers have sret types");
214 }
215 
217  assert(getType()->isPointerTy() && "Only pointers have byref types");
218  return getParent()->getParamByRefType(getArgNo());
219 }
220 
222  assert(getType()->isPointerTy() && "Only pointers have inalloca types");
224 }
225 
227  assert(getType()->isPointerTy() &&
228  "Only pointers have dereferenceable bytes");
230 }
231 
233  assert(getType()->isPointerTy() &&
234  "Only pointers have dereferenceable bytes");
236 }
237 
238 bool Argument::hasNestAttr() const {
239  if (!getType()->isPointerTy()) return false;
240  return hasAttribute(Attribute::Nest);
241 }
242 
244  if (!getType()->isPointerTy()) return false;
245  return hasAttribute(Attribute::NoAlias);
246 }
247 
249  if (!getType()->isPointerTy()) return false;
250  return hasAttribute(Attribute::NoCapture);
251 }
252 
254  if (!getType()->isPointerTy()) return false;
255  return hasAttribute(Attribute::NoFree);
256 }
257 
259  if (!getType()->isPointerTy()) return false;
260  return hasAttribute(Attribute::StructRet);
261 }
262 
264  return hasAttribute(Attribute::InReg);
265 }
266 
268  return hasAttribute(Attribute::Returned);
269 }
270 
271 bool Argument::hasZExtAttr() const {
272  return hasAttribute(Attribute::ZExt);
273 }
274 
275 bool Argument::hasSExtAttr() const {
276  return hasAttribute(Attribute::SExt);
277 }
278 
281  return Attrs.hasParamAttr(getArgNo(), Attribute::ReadOnly) ||
282  Attrs.hasParamAttr(getArgNo(), Attribute::ReadNone);
283 }
284 
287  AL = AL.addParamAttributes(Parent->getContext(), getArgNo(), B);
289 }
290 
293 }
294 
296  getParent()->addParamAttr(getArgNo(), Attr);
297 }
298 
301 }
302 
305  AL = AL.removeParamAttributes(Parent->getContext(), getArgNo(), B);
307 }
308 
311 }
312 
315 }
316 
317 //===----------------------------------------------------------------------===//
318 // Helper Methods in Function
319 //===----------------------------------------------------------------------===//
320 
322  return getType()->getContext();
323 }
324 
326  unsigned NumInstrs = 0;
327  for (const BasicBlock &BB : BasicBlocks)
328  NumInstrs += std::distance(BB.instructionsWithoutDebug().begin(),
329  BB.instructionsWithoutDebug().end());
330  return NumInstrs;
331 }
332 
334  const Twine &N, Module &M) {
335  return Create(Ty, Linkage, M.getDataLayout().getProgramAddressSpace(), N, &M);
336 }
337 
340  unsigned AddrSpace, const Twine &N,
341  Module *M) {
342  auto *F = new Function(Ty, Linkage, AddrSpace, N, M);
343  AttrBuilder B;
344  if (M->getUwtable())
345  B.addAttribute(Attribute::UWTable);
346  switch (M->getFramePointer()) {
348  // 0 ("none") is the default.
349  break;
351  B.addAttribute("frame-pointer", "non-leaf");
352  break;
354  B.addAttribute("frame-pointer", "all");
355  break;
356  }
357  F->addFnAttrs(B);
358  return F;
359 }
360 
362  getParent()->getFunctionList().remove(getIterator());
363 }
364 
366  getParent()->getFunctionList().erase(getIterator());
367 }
368 
369 //===----------------------------------------------------------------------===//
370 // Function Implementation
371 //===----------------------------------------------------------------------===//
372 
373 static unsigned computeAddrSpace(unsigned AddrSpace, Module *M) {
374  // If AS == -1 and we are passed a valid module pointer we place the function
375  // in the program address space. Otherwise we default to AS0.
376  if (AddrSpace == static_cast<unsigned>(-1))
377  return M ? M->getDataLayout().getProgramAddressSpace() : 0;
378  return AddrSpace;
379 }
380 
381 Function::Function(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace,
382  const Twine &name, Module *ParentModule)
383  : GlobalObject(Ty, Value::FunctionVal,
384  OperandTraits<Function>::op_begin(this), 0, Linkage, name,
385  computeAddrSpace(AddrSpace, ParentModule)),
386  NumArgs(Ty->getNumParams()) {
387  assert(FunctionType::isValidReturnType(getReturnType()) &&
388  "invalid return type");
389  setGlobalObjectSubClassData(0);
390 
391  // We only need a symbol table for a function if the context keeps value names
392  if (!getContext().shouldDiscardValueNames())
393  SymTab = std::make_unique<ValueSymbolTable>(NonGlobalValueMaxNameSize);
394 
395  // If the function has arguments, mark them as lazily built.
396  if (Ty->getNumParams())
397  setValueSubclassData(1); // Set the "has lazy arguments" bit.
398 
399  if (ParentModule)
400  ParentModule->getFunctionList().push_back(this);
401 
402  HasLLVMReservedName = getName().startswith("llvm.");
403  // Ensure intrinsics have the right parameter attributes.
404  // Note, the IntID field will have been set in Value::setName if this function
405  // name is a valid intrinsic ID.
406  if (IntID)
407  setAttributes(Intrinsic::getAttributes(getContext(), IntID));
408 }
409 
410 Function::~Function() {
411  dropAllReferences(); // After this it is safe to delete instructions.
412 
413  // Delete all of the method arguments and unlink from symbol table...
414  if (Arguments)
415  clearArguments();
416 
417  // Remove the function from the on-the-side GC table.
418  clearGC();
419 }
420 
421 void Function::BuildLazyArguments() const {
422  // Create the arguments vector, all arguments start out unnamed.
423  auto *FT = getFunctionType();
424  if (NumArgs > 0) {
425  Arguments = std::allocator<Argument>().allocate(NumArgs);
426  for (unsigned i = 0, e = NumArgs; i != e; ++i) {
427  Type *ArgTy = FT->getParamType(i);
428  assert(!ArgTy->isVoidTy() && "Cannot have void typed arguments!");
429  new (Arguments + i) Argument(ArgTy, "", const_cast<Function *>(this), i);
430  }
431  }
432 
433  // Clear the lazy arguments bit.
434  unsigned SDC = getSubclassDataFromValue();
435  SDC &= ~(1 << 0);
436  const_cast<Function*>(this)->setValueSubclassData(SDC);
438 }
439 
441  return MutableArrayRef<Argument>(Args, Count);
442 }
443 
445  switch (getIntrinsicID()) {
446 #define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC) \
447  case Intrinsic::INTRINSIC:
448 #include "llvm/IR/ConstrainedOps.def"
449  return true;
450 #undef INSTRUCTION
451  default:
452  return false;
453  }
454 }
455 
456 void Function::clearArguments() {
457  for (Argument &A : makeArgArray(Arguments, NumArgs)) {
458  A.setName("");
459  A.~Argument();
460  }
461  std::allocator<Argument>().deallocate(Arguments, NumArgs);
462  Arguments = nullptr;
463 }
464 
466  assert(isDeclaration() && "Expected no references to current arguments");
467 
468  // Drop the current arguments, if any, and set the lazy argument bit.
469  if (!hasLazyArguments()) {
470  assert(llvm::all_of(makeArgArray(Arguments, NumArgs),
471  [](const Argument &A) { return A.use_empty(); }) &&
472  "Expected arguments to be unused in declaration");
473  clearArguments();
474  setValueSubclassData(getSubclassDataFromValue() | (1 << 0));
475  }
476 
477  // Nothing to steal if Src has lazy arguments.
478  if (Src.hasLazyArguments())
479  return;
480 
481  // Steal arguments from Src, and fix the lazy argument bits.
482  assert(arg_size() == Src.arg_size());
483  Arguments = Src.Arguments;
484  Src.Arguments = nullptr;
485  for (Argument &A : makeArgArray(Arguments, NumArgs)) {
486  // FIXME: This does the work of transferNodesFromList inefficiently.
488  if (A.hasName())
489  Name = A.getName();
490  if (!Name.empty())
491  A.setName("");
492  A.setParent(this);
493  if (!Name.empty())
494  A.setName(Name);
495  }
496 
497  setValueSubclassData(getSubclassDataFromValue() & ~(1 << 0));
499  Src.setValueSubclassData(Src.getSubclassDataFromValue() | (1 << 0));
500 }
501 
502 // dropAllReferences() - This function causes all the subinstructions to "let
503 // go" of all references that they are maintaining. This allows one to
504 // 'delete' a whole class at a time, even though there may be circular
505 // references... first all references are dropped, and all use counts go to
506 // zero. Then everything is deleted for real. Note that no operations are
507 // valid on an object that has "dropped all references", except operator
508 // delete.
509 //
511  setIsMaterializable(false);
512 
513  for (BasicBlock &BB : *this)
514  BB.dropAllReferences();
515 
516  // Delete all basic blocks. They are now unused, except possibly by
517  // blockaddresses, but BasicBlock's destructor takes care of those.
518  while (!BasicBlocks.empty())
519  BasicBlocks.begin()->eraseFromParent();
520 
521  // Drop uses of any optional data (real or placeholder).
522  if (getNumOperands()) {
525  setValueSubclassData(getSubclassDataFromValue() & ~0xe);
526  }
527 
528  // Metadata is stored in a side-table.
529  clearMetadata();
530 }
531 
533  AttributeSets = AttributeSets.addAttributeAtIndex(getContext(), i, Attr);
534 }
535 
537  AttributeSets = AttributeSets.addFnAttribute(getContext(), Kind);
538 }
539 
541  AttributeSets = AttributeSets.addFnAttribute(getContext(), Kind, Val);
542 }
543 
545  AttributeSets = AttributeSets.addFnAttribute(getContext(), Attr);
546 }
547 
549  AttributeSets = AttributeSets.addFnAttributes(getContext(), Attrs);
550 }
551 
553  AttributeSets = AttributeSets.addRetAttribute(getContext(), Kind);
554 }
555 
557  AttributeSets = AttributeSets.addRetAttribute(getContext(), Attr);
558 }
559 
561  AttributeSets = AttributeSets.addRetAttributes(getContext(), Attrs);
562 }
563 
565  AttributeSets = AttributeSets.addParamAttribute(getContext(), ArgNo, Kind);
566 }
567 
568 void Function::addParamAttr(unsigned ArgNo, Attribute Attr) {
569  AttributeSets = AttributeSets.addParamAttribute(getContext(), ArgNo, Attr);
570 }
571 
572 void Function::addParamAttrs(unsigned ArgNo, const AttrBuilder &Attrs) {
573  AttributeSets = AttributeSets.addParamAttributes(getContext(), ArgNo, Attrs);
574 }
575 
577  AttributeSets = AttributeSets.removeAttributeAtIndex(getContext(), i, Kind);
578 }
579 
581  AttributeSets = AttributeSets.removeAttributeAtIndex(getContext(), i, Kind);
582 }
583 
585  AttributeSets = AttributeSets.removeFnAttribute(getContext(), Kind);
586 }
587 
589  AttributeSets = AttributeSets.removeFnAttribute(getContext(), Kind);
590 }
591 
593  AttributeSets = AttributeSets.removeFnAttributes(getContext(), Attrs);
594 }
595 
597  AttributeSets = AttributeSets.removeRetAttribute(getContext(), Kind);
598 }
599 
601  AttributeSets = AttributeSets.removeRetAttribute(getContext(), Kind);
602 }
603 
605  AttributeSets = AttributeSets.removeRetAttributes(getContext(), Attrs);
606 }
607 
609  AttributeSets = AttributeSets.removeParamAttribute(getContext(), ArgNo, Kind);
610 }
611 
612 void Function::removeParamAttr(unsigned ArgNo, StringRef Kind) {
613  AttributeSets = AttributeSets.removeParamAttribute(getContext(), ArgNo, Kind);
614 }
615 
616 void Function::removeParamAttrs(unsigned ArgNo, const AttrBuilder &Attrs) {
617  AttributeSets =
618  AttributeSets.removeParamAttributes(getContext(), ArgNo, Attrs);
619 }
620 
621 void Function::addDereferenceableParamAttr(unsigned ArgNo, uint64_t Bytes) {
622  AttributeSets =
623  AttributeSets.addDereferenceableParamAttr(getContext(), ArgNo, Bytes);
624 }
625 
627  return AttributeSets.hasFnAttr(Kind);
628 }
629 
631  return AttributeSets.hasFnAttr(Kind);
632 }
633 
635  return AttributeSets.hasRetAttr(Kind);
636 }
637 
638 bool Function::hasParamAttribute(unsigned ArgNo,
639  Attribute::AttrKind Kind) const {
640  return AttributeSets.hasParamAttr(ArgNo, Kind);
641 }
642 
644  Attribute::AttrKind Kind) const {
645  return AttributeSets.getAttributeAtIndex(i, Kind);
646 }
647 
649  return AttributeSets.getAttributeAtIndex(i, Kind);
650 }
651 
653  return AttributeSets.getFnAttr(Kind);
654 }
655 
657  return AttributeSets.getFnAttr(Kind);
658 }
659 
660 /// gets the specified attribute from the list of attributes.
662  Attribute::AttrKind Kind) const {
663  return AttributeSets.getParamAttr(ArgNo, Kind);
664 }
665 
667  uint64_t Bytes) {
668  AttributeSets = AttributeSets.addDereferenceableOrNullParamAttr(getContext(),
669  ArgNo, Bytes);
670 }
671 
673  if (&FPType == &APFloat::IEEEsingle()) {
674  Attribute Attr = getFnAttribute("denormal-fp-math-f32");
675  StringRef Val = Attr.getValueAsString();
676  if (!Val.empty())
677  return parseDenormalFPAttribute(Val);
678 
679  // If the f32 variant of the attribute isn't specified, try to use the
680  // generic one.
681  }
682 
683  Attribute Attr = getFnAttribute("denormal-fp-math");
685 }
686 
687 const std::string &Function::getGC() const {
688  assert(hasGC() && "Function has no collector");
689  return getContext().getGC(*this);
690 }
691 
692 void Function::setGC(std::string Str) {
693  setValueSubclassDataBit(14, !Str.empty());
694  getContext().setGC(*this, std::move(Str));
695 }
696 
698  if (!hasGC())
699  return;
700  getContext().deleteGC(*this);
701  setValueSubclassDataBit(14, false);
702 }
703 
705  return hasFnAttribute(Attribute::StackProtect) ||
706  hasFnAttribute(Attribute::StackProtectStrong) ||
707  hasFnAttribute(Attribute::StackProtectReq);
708 }
709 
710 /// Copy all additional attributes (those not needed to create a Function) from
711 /// the Function Src to this one.
714  setCallingConv(Src->getCallingConv());
715  setAttributes(Src->getAttributes());
716  if (Src->hasGC())
717  setGC(Src->getGC());
718  else
719  clearGC();
720  if (Src->hasPersonalityFn())
721  setPersonalityFn(Src->getPersonalityFn());
722  if (Src->hasPrefixData())
723  setPrefixData(Src->getPrefixData());
724  if (Src->hasPrologueData())
725  setPrologueData(Src->getPrologueData());
726 }
727 
728 /// Table of string intrinsic names indexed by enum value.
729 static const char * const IntrinsicNameTable[] = {
730  "not_intrinsic",
731 #define GET_INTRINSIC_NAME_TABLE
732 #include "llvm/IR/IntrinsicImpl.inc"
733 #undef GET_INTRINSIC_NAME_TABLE
734 };
735 
736 /// Table of per-target intrinsic name tables.
737 #define GET_INTRINSIC_TARGET_DATA
738 #include "llvm/IR/IntrinsicImpl.inc"
739 #undef GET_INTRINSIC_TARGET_DATA
740 
742  return IID > TargetInfos[0].Count;
743 }
744 
746  return isTargetIntrinsic(IntID);
747 }
748 
749 /// Find the segment of \c IntrinsicNameTable for intrinsics with the same
750 /// target as \c Name, or the generic table if \c Name is not target specific.
751 ///
752 /// Returns the relevant slice of \c IntrinsicNameTable
754  assert(Name.startswith("llvm."));
755 
756  ArrayRef<IntrinsicTargetInfo> Targets(TargetInfos);
757  // Drop "llvm." and take the first dotted component. That will be the target
758  // if this is target specific.
759  StringRef Target = Name.drop_front(5).split('.').first;
760  auto It = partition_point(
761  Targets, [=](const IntrinsicTargetInfo &TI) { return TI.Name < Target; });
762  // We've either found the target or just fall back to the generic set, which
763  // is always first.
764  const auto &TI = It != Targets.end() && It->Name == Target ? *It : Targets[0];
765  return makeArrayRef(&IntrinsicNameTable[1] + TI.Offset, TI.Count);
766 }
767 
768 /// This does the actual lookup of an intrinsic ID which
769 /// matches the given function name.
772  int Idx = Intrinsic::lookupLLVMIntrinsicByName(NameTable, Name);
773  if (Idx == -1)
775 
776  // Intrinsic IDs correspond to the location in IntrinsicNameTable, but we have
777  // an index into a sub-table.
778  int Adjust = NameTable.data() - IntrinsicNameTable;
779  Intrinsic::ID ID = static_cast<Intrinsic::ID>(Idx + Adjust);
780 
781  // If the intrinsic is not overloaded, require an exact match. If it is
782  // overloaded, require either exact or prefix match.
783  const auto MatchSize = strlen(NameTable[Idx]);
784  assert(Name.size() >= MatchSize && "Expected either exact or prefix match");
785  bool IsExactMatch = Name.size() == MatchSize;
786  return IsExactMatch || Intrinsic::isOverloaded(ID) ? ID
788 }
789 
791  StringRef Name = getName();
792  if (!Name.startswith("llvm.")) {
793  HasLLVMReservedName = false;
795  return;
796  }
797  HasLLVMReservedName = true;
799 }
800 
801 /// Returns a stable mangling for the type specified for use in the name
802 /// mangling scheme used by 'any' types in intrinsic signatures. The mangling
803 /// of named types is simply their name. Manglings for unnamed types consist
804 /// of a prefix ('p' for pointers, 'a' for arrays, 'f_' for functions)
805 /// combined with the mangling of their component types. A vararg function
806 /// type will have a suffix of 'vararg'. Since function types can contain
807 /// other function types, we close a function type mangling with suffix 'f'
808 /// which can't be confused with it's prefix. This ensures we don't have
809 /// collisions between two unrelated function types. Otherwise, you might
810 /// parse ffXX as f(fXX) or f(fX)X. (X is a placeholder for any other type.)
811 /// The HasUnnamedType boolean is set if an unnamed type was encountered,
812 /// indicating that extra care must be taken to ensure a unique name.
813 static std::string getMangledTypeStr(Type *Ty, bool &HasUnnamedType) {
814  std::string Result;
815  if (PointerType *PTyp = dyn_cast<PointerType>(Ty)) {
816  Result += "p" + utostr(PTyp->getAddressSpace());
817  // Opaque pointer doesn't have pointee type information, so we just mangle
818  // address space for opaque pointer.
819  if (!PTyp->isOpaque())
820  Result += getMangledTypeStr(PTyp->getElementType(), HasUnnamedType);
821  } else if (ArrayType *ATyp = dyn_cast<ArrayType>(Ty)) {
822  Result += "a" + utostr(ATyp->getNumElements()) +
823  getMangledTypeStr(ATyp->getElementType(), HasUnnamedType);
824  } else if (StructType *STyp = dyn_cast<StructType>(Ty)) {
825  if (!STyp->isLiteral()) {
826  Result += "s_";
827  if (STyp->hasName())
828  Result += STyp->getName();
829  else
830  HasUnnamedType = true;
831  } else {
832  Result += "sl_";
833  for (auto Elem : STyp->elements())
834  Result += getMangledTypeStr(Elem, HasUnnamedType);
835  }
836  // Ensure nested structs are distinguishable.
837  Result += "s";
838  } else if (FunctionType *FT = dyn_cast<FunctionType>(Ty)) {
839  Result += "f_" + getMangledTypeStr(FT->getReturnType(), HasUnnamedType);
840  for (size_t i = 0; i < FT->getNumParams(); i++)
841  Result += getMangledTypeStr(FT->getParamType(i), HasUnnamedType);
842  if (FT->isVarArg())
843  Result += "vararg";
844  // Ensure nested function types are distinguishable.
845  Result += "f";
846  } else if (VectorType *VTy = dyn_cast<VectorType>(Ty)) {
847  ElementCount EC = VTy->getElementCount();
848  if (EC.isScalable())
849  Result += "nx";
850  Result += "v" + utostr(EC.getKnownMinValue()) +
851  getMangledTypeStr(VTy->getElementType(), HasUnnamedType);
852  } else if (Ty) {
853  switch (Ty->getTypeID()) {
854  default: llvm_unreachable("Unhandled type");
855  case Type::VoidTyID: Result += "isVoid"; break;
856  case Type::MetadataTyID: Result += "Metadata"; break;
857  case Type::HalfTyID: Result += "f16"; break;
858  case Type::BFloatTyID: Result += "bf16"; break;
859  case Type::FloatTyID: Result += "f32"; break;
860  case Type::DoubleTyID: Result += "f64"; break;
861  case Type::X86_FP80TyID: Result += "f80"; break;
862  case Type::FP128TyID: Result += "f128"; break;
863  case Type::PPC_FP128TyID: Result += "ppcf128"; break;
864  case Type::X86_MMXTyID: Result += "x86mmx"; break;
865  case Type::X86_AMXTyID: Result += "x86amx"; break;
866  case Type::IntegerTyID:
867  Result += "i" + utostr(cast<IntegerType>(Ty)->getBitWidth());
868  break;
869  }
870  }
871  return Result;
872 }
873 
875  assert(id < num_intrinsics && "Invalid intrinsic ID!");
876  return IntrinsicNameTable[id];
877 }
878 
880  assert(id < num_intrinsics && "Invalid intrinsic ID!");
882  "This version of getName does not support overloading");
883  return getBaseName(id);
884 }
885 
887  Module *M, FunctionType *FT,
888  bool EarlyModuleCheck) {
889 
890  assert(Id < Intrinsic::num_intrinsics && "Invalid intrinsic ID!");
891  assert((Tys.empty() || Intrinsic::isOverloaded(Id)) &&
892  "This version of getName is for overloaded intrinsics only");
893  (void)EarlyModuleCheck;
894  assert((!EarlyModuleCheck || M ||
895  !any_of(Tys, [](Type *T) { return isa<PointerType>(T); })) &&
896  "Intrinsic overloading on pointer types need to provide a Module");
897  bool HasUnnamedType = false;
898  std::string Result(Intrinsic::getBaseName(Id));
899  for (Type *Ty : Tys)
900  Result += "." + getMangledTypeStr(Ty, HasUnnamedType);
901  if (HasUnnamedType) {
902  assert(M && "unnamed types need a module");
903  if (!FT)
904  FT = Intrinsic::getType(M->getContext(), Id, Tys);
905  else
906  assert((FT == Intrinsic::getType(M->getContext(), Id, Tys)) &&
907  "Provided FunctionType must match arguments");
908  return M->getUniqueIntrinsicName(Result, Id, FT);
909  }
910  return Result;
911 }
912 
914  FunctionType *FT) {
915  assert(M && "We need to have a Module");
916  return getIntrinsicNameImpl(Id, Tys, M, FT, true);
917 }
918 
920  return getIntrinsicNameImpl(Id, Tys, nullptr, nullptr, false);
921 }
922 
923 /// IIT_Info - These are enumerators that describe the entries returned by the
924 /// getIntrinsicInfoTableEntries function.
925 ///
926 /// NOTE: This must be kept in synch with the copy in TblGen/IntrinsicEmitter!
927 enum IIT_Info {
928  // Common values should be encoded with 0-15.
929  IIT_Done = 0,
930  IIT_I1 = 1,
931  IIT_I8 = 2,
932  IIT_I16 = 3,
933  IIT_I32 = 4,
934  IIT_I64 = 5,
935  IIT_F16 = 6,
936  IIT_F32 = 7,
937  IIT_F64 = 8,
938  IIT_V2 = 9,
939  IIT_V4 = 10,
940  IIT_V8 = 11,
941  IIT_V16 = 12,
942  IIT_V32 = 13,
943  IIT_PTR = 14,
944  IIT_ARG = 15,
945 
946  // Values from 16+ are only encodable with the inefficient encoding.
947  IIT_V64 = 16,
948  IIT_MMX = 17,
949  IIT_TOKEN = 18,
959  IIT_V1 = 28,
966  IIT_I128 = 35,
967  IIT_V512 = 36,
968  IIT_V1024 = 37,
972  IIT_F128 = 41,
978  IIT_V128 = 47,
979  IIT_BF16 = 48,
981  IIT_V256 = 50,
982  IIT_AMX = 51,
984  IIT_V3 = 53,
985 };
986 
987 static void DecodeIITType(unsigned &NextElt, ArrayRef<unsigned char> Infos,
988  IIT_Info LastInfo,
990  using namespace Intrinsic;
991 
992  bool IsScalableVector = (LastInfo == IIT_SCALABLE_VEC);
993 
994  IIT_Info Info = IIT_Info(Infos[NextElt++]);
995  unsigned StructElts = 2;
996 
997  switch (Info) {
998  case IIT_Done:
999  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Void, 0));
1000  return;
1001  case IIT_VARARG:
1002  OutputTable.push_back(IITDescriptor::get(IITDescriptor::VarArg, 0));
1003  return;
1004  case IIT_MMX:
1005  OutputTable.push_back(IITDescriptor::get(IITDescriptor::MMX, 0));
1006  return;
1007  case IIT_AMX:
1008  OutputTable.push_back(IITDescriptor::get(IITDescriptor::AMX, 0));
1009  return;
1010  case IIT_TOKEN:
1011  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Token, 0));
1012  return;
1013  case IIT_METADATA:
1014  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Metadata, 0));
1015  return;
1016  case IIT_F16:
1017  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Half, 0));
1018  return;
1019  case IIT_BF16:
1020  OutputTable.push_back(IITDescriptor::get(IITDescriptor::BFloat, 0));
1021  return;
1022  case IIT_F32:
1023  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Float, 0));
1024  return;
1025  case IIT_F64:
1026  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Double, 0));
1027  return;
1028  case IIT_F128:
1029  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Quad, 0));
1030  return;
1031  case IIT_PPCF128:
1032  OutputTable.push_back(IITDescriptor::get(IITDescriptor::PPCQuad, 0));
1033  return;
1034  case IIT_I1:
1035  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Integer, 1));
1036  return;
1037  case IIT_I8:
1038  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Integer, 8));
1039  return;
1040  case IIT_I16:
1041  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Integer,16));
1042  return;
1043  case IIT_I32:
1044  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Integer, 32));
1045  return;
1046  case IIT_I64:
1047  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Integer, 64));
1048  return;
1049  case IIT_I128:
1050  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Integer, 128));
1051  return;
1052  case IIT_V1:
1053  OutputTable.push_back(IITDescriptor::getVector(1, IsScalableVector));
1054  DecodeIITType(NextElt, Infos, Info, OutputTable);
1055  return;
1056  case IIT_V2:
1057  OutputTable.push_back(IITDescriptor::getVector(2, IsScalableVector));
1058  DecodeIITType(NextElt, Infos, Info, OutputTable);
1059  return;
1060  case IIT_V3:
1061  OutputTable.push_back(IITDescriptor::getVector(3, IsScalableVector));
1062  DecodeIITType(NextElt, Infos, Info, OutputTable);
1063  return;
1064  case IIT_V4:
1065  OutputTable.push_back(IITDescriptor::getVector(4, IsScalableVector));
1066  DecodeIITType(NextElt, Infos, Info, OutputTable);
1067  return;
1068  case IIT_V8:
1069  OutputTable.push_back(IITDescriptor::getVector(8, IsScalableVector));
1070  DecodeIITType(NextElt, Infos, Info, OutputTable);
1071  return;
1072  case IIT_V16:
1073  OutputTable.push_back(IITDescriptor::getVector(16, IsScalableVector));
1074  DecodeIITType(NextElt, Infos, Info, OutputTable);
1075  return;
1076  case IIT_V32:
1077  OutputTable.push_back(IITDescriptor::getVector(32, IsScalableVector));
1078  DecodeIITType(NextElt, Infos, Info, OutputTable);
1079  return;
1080  case IIT_V64:
1081  OutputTable.push_back(IITDescriptor::getVector(64, IsScalableVector));
1082  DecodeIITType(NextElt, Infos, Info, OutputTable);
1083  return;
1084  case IIT_V128:
1085  OutputTable.push_back(IITDescriptor::getVector(128, IsScalableVector));
1086  DecodeIITType(NextElt, Infos, Info, OutputTable);
1087  return;
1088  case IIT_V256:
1089  OutputTable.push_back(IITDescriptor::getVector(256, IsScalableVector));
1090  DecodeIITType(NextElt, Infos, Info, OutputTable);
1091  return;
1092  case IIT_V512:
1093  OutputTable.push_back(IITDescriptor::getVector(512, IsScalableVector));
1094  DecodeIITType(NextElt, Infos, Info, OutputTable);
1095  return;
1096  case IIT_V1024:
1097  OutputTable.push_back(IITDescriptor::getVector(1024, IsScalableVector));
1098  DecodeIITType(NextElt, Infos, Info, OutputTable);
1099  return;
1100  case IIT_PTR:
1101  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Pointer, 0));
1102  DecodeIITType(NextElt, Infos, Info, OutputTable);
1103  return;
1104  case IIT_ANYPTR: { // [ANYPTR addrspace, subtype]
1105  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Pointer,
1106  Infos[NextElt++]));
1107  DecodeIITType(NextElt, Infos, Info, OutputTable);
1108  return;
1109  }
1110  case IIT_ARG: {
1111  unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1112  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Argument, ArgInfo));
1113  return;
1114  }
1115  case IIT_EXTEND_ARG: {
1116  unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1117  OutputTable.push_back(IITDescriptor::get(IITDescriptor::ExtendArgument,
1118  ArgInfo));
1119  return;
1120  }
1121  case IIT_TRUNC_ARG: {
1122  unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1123  OutputTable.push_back(IITDescriptor::get(IITDescriptor::TruncArgument,
1124  ArgInfo));
1125  return;
1126  }
1127  case IIT_HALF_VEC_ARG: {
1128  unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1129  OutputTable.push_back(IITDescriptor::get(IITDescriptor::HalfVecArgument,
1130  ArgInfo));
1131  return;
1132  }
1133  case IIT_SAME_VEC_WIDTH_ARG: {
1134  unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1136  ArgInfo));
1137  return;
1138  }
1139  case IIT_PTR_TO_ARG: {
1140  unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1141  OutputTable.push_back(IITDescriptor::get(IITDescriptor::PtrToArgument,
1142  ArgInfo));
1143  return;
1144  }
1145  case IIT_PTR_TO_ELT: {
1146  unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1147  OutputTable.push_back(IITDescriptor::get(IITDescriptor::PtrToElt, ArgInfo));
1148  return;
1149  }
1151  unsigned short ArgNo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1152  unsigned short RefNo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1153  OutputTable.push_back(
1155  return;
1156  }
1157  case IIT_EMPTYSTRUCT:
1158  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Struct, 0));
1159  return;
1160  case IIT_STRUCT9: ++StructElts; LLVM_FALLTHROUGH;
1161  case IIT_STRUCT8: ++StructElts; LLVM_FALLTHROUGH;
1162  case IIT_STRUCT7: ++StructElts; LLVM_FALLTHROUGH;
1163  case IIT_STRUCT6: ++StructElts; LLVM_FALLTHROUGH;
1164  case IIT_STRUCT5: ++StructElts; LLVM_FALLTHROUGH;
1165  case IIT_STRUCT4: ++StructElts; LLVM_FALLTHROUGH;
1166  case IIT_STRUCT3: ++StructElts; LLVM_FALLTHROUGH;
1167  case IIT_STRUCT2: {
1168  OutputTable.push_back(IITDescriptor::get(IITDescriptor::Struct,StructElts));
1169 
1170  for (unsigned i = 0; i != StructElts; ++i)
1171  DecodeIITType(NextElt, Infos, Info, OutputTable);
1172  return;
1173  }
1174  case IIT_SUBDIVIDE2_ARG: {
1175  unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1177  ArgInfo));
1178  return;
1179  }
1180  case IIT_SUBDIVIDE4_ARG: {
1181  unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1183  ArgInfo));
1184  return;
1185  }
1186  case IIT_VEC_ELEMENT: {
1187  unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1189  ArgInfo));
1190  return;
1191  }
1192  case IIT_SCALABLE_VEC: {
1193  DecodeIITType(NextElt, Infos, Info, OutputTable);
1194  return;
1195  }
1197  unsigned ArgInfo = (NextElt == Infos.size() ? 0 : Infos[NextElt++]);
1199  ArgInfo));
1200  return;
1201  }
1202  }
1203  llvm_unreachable("unhandled");
1204 }
1205 
1206 #define GET_INTRINSIC_GENERATOR_GLOBAL
1207 #include "llvm/IR/IntrinsicImpl.inc"
1208 #undef GET_INTRINSIC_GENERATOR_GLOBAL
1209 
1212  // Check to see if the intrinsic's type was expressible by the table.
1213  unsigned TableVal = IIT_Table[id-1];
1214 
1215  // Decode the TableVal into an array of IITValues.
1217  ArrayRef<unsigned char> IITEntries;
1218  unsigned NextElt = 0;
1219  if ((TableVal >> 31) != 0) {
1220  // This is an offset into the IIT_LongEncodingTable.
1221  IITEntries = IIT_LongEncodingTable;
1222 
1223  // Strip sentinel bit.
1224  NextElt = (TableVal << 1) >> 1;
1225  } else {
1226  // Decode the TableVal into an array of IITValues. If the entry was encoded
1227  // into a single word in the table itself, decode it now.
1228  do {
1229  IITValues.push_back(TableVal & 0xF);
1230  TableVal >>= 4;
1231  } while (TableVal);
1232 
1233  IITEntries = IITValues;
1234  NextElt = 0;
1235  }
1236 
1237  // Okay, decode the table into the output vector of IITDescriptors.
1238  DecodeIITType(NextElt, IITEntries, IIT_Done, T);
1239  while (NextElt != IITEntries.size() && IITEntries[NextElt] != 0)
1240  DecodeIITType(NextElt, IITEntries, IIT_Done, T);
1241 }
1242 
1245  using namespace Intrinsic;
1246 
1247  IITDescriptor D = Infos.front();
1248  Infos = Infos.slice(1);
1249 
1250  switch (D.Kind) {
1263 
1265  return IntegerType::get(Context, D.Integer_Width);
1266  case IITDescriptor::Vector:
1267  return VectorType::get(DecodeFixedType(Infos, Tys, Context),
1268  D.Vector_Width);
1270  return PointerType::get(DecodeFixedType(Infos, Tys, Context),
1271  D.Pointer_AddressSpace);
1272  case IITDescriptor::Struct: {
1274  for (unsigned i = 0, e = D.Struct_NumElements; i != e; ++i)
1275  Elts.push_back(DecodeFixedType(Infos, Tys, Context));
1276  return StructType::get(Context, Elts);
1277  }
1279  return Tys[D.getArgumentNumber()];
1281  Type *Ty = Tys[D.getArgumentNumber()];
1282  if (VectorType *VTy = dyn_cast<VectorType>(Ty))
1284 
1285  return IntegerType::get(Context, 2 * cast<IntegerType>(Ty)->getBitWidth());
1286  }
1288  Type *Ty = Tys[D.getArgumentNumber()];
1289  if (VectorType *VTy = dyn_cast<VectorType>(Ty))
1291 
1292  IntegerType *ITy = cast<IntegerType>(Ty);
1293  assert(ITy->getBitWidth() % 2 == 0);
1294  return IntegerType::get(Context, ITy->getBitWidth() / 2);
1295  }
1298  Type *Ty = Tys[D.getArgumentNumber()];
1299  VectorType *VTy = dyn_cast<VectorType>(Ty);
1300  assert(VTy && "Expected an argument of Vector Type");
1301  int SubDivs = D.Kind == IITDescriptor::Subdivide2Argument ? 1 : 2;
1302  return VectorType::getSubdividedVectorType(VTy, SubDivs);
1303  }
1305  return VectorType::getHalfElementsVectorType(cast<VectorType>(
1306  Tys[D.getArgumentNumber()]));
1308  Type *EltTy = DecodeFixedType(Infos, Tys, Context);
1309  Type *Ty = Tys[D.getArgumentNumber()];
1310  if (auto *VTy = dyn_cast<VectorType>(Ty))
1311  return VectorType::get(EltTy, VTy->getElementCount());
1312  return EltTy;
1313  }
1315  Type *Ty = Tys[D.getArgumentNumber()];
1316  return PointerType::getUnqual(Ty);
1317  }
1318  case IITDescriptor::PtrToElt: {
1319  Type *Ty = Tys[D.getArgumentNumber()];
1320  VectorType *VTy = dyn_cast<VectorType>(Ty);
1321  if (!VTy)
1322  llvm_unreachable("Expected an argument of Vector Type");
1323  Type *EltTy = VTy->getElementType();
1324  return PointerType::getUnqual(EltTy);
1325  }
1327  Type *Ty = Tys[D.getArgumentNumber()];
1328  if (VectorType *VTy = dyn_cast<VectorType>(Ty))
1329  return VTy->getElementType();
1330  llvm_unreachable("Expected an argument of Vector Type");
1331  }
1333  Type *Ty = Tys[D.getArgumentNumber()];
1334  VectorType *VTy = dyn_cast<VectorType>(Ty);
1335  assert(VTy && "Expected an argument of Vector Type");
1336  return VectorType::getInteger(VTy);
1337  }
1339  // Return the overloaded type (which determines the pointers address space)
1340  return Tys[D.getOverloadArgNumber()];
1341  }
1342  llvm_unreachable("unhandled");
1343 }
1344 
1346  ID id, ArrayRef<Type*> Tys) {
1348  getIntrinsicInfoTableEntries(id, Table);
1349 
1351  Type *ResultTy = DecodeFixedType(TableRef, Tys, Context);
1352 
1353  SmallVector<Type*, 8> ArgTys;
1354  while (!TableRef.empty())
1355  ArgTys.push_back(DecodeFixedType(TableRef, Tys, Context));
1356 
1357  // DecodeFixedType returns Void for IITDescriptor::Void and IITDescriptor::VarArg
1358  // If we see void type as the type of the last argument, it is vararg intrinsic
1359  if (!ArgTys.empty() && ArgTys.back()->isVoidTy()) {
1360  ArgTys.pop_back();
1361  return FunctionType::get(ResultTy, ArgTys, true);
1362  }
1363  return FunctionType::get(ResultTy, ArgTys, false);
1364 }
1365 
1367 #define GET_INTRINSIC_OVERLOAD_TABLE
1368 #include "llvm/IR/IntrinsicImpl.inc"
1369 #undef GET_INTRINSIC_OVERLOAD_TABLE
1370 }
1371 
1373  switch (id) {
1374  default:
1375  return true;
1376 
1377  case Intrinsic::experimental_gc_statepoint:
1378  case Intrinsic::experimental_patchpoint_void:
1379  case Intrinsic::experimental_patchpoint_i64:
1380  return false;
1381  }
1382 }
1383 
1384 /// This defines the "Intrinsic::getAttributes(ID id)" method.
1385 #define GET_INTRINSIC_ATTRIBUTES
1386 #include "llvm/IR/IntrinsicImpl.inc"
1387 #undef GET_INTRINSIC_ATTRIBUTES
1388 
1390  // There can never be multiple globals with the same name of different types,
1391  // because intrinsics must be a specific type.
1392  auto *FT = getType(M->getContext(), id, Tys);
1393  return cast<Function>(
1394  M->getOrInsertFunction(Tys.empty() ? getName(id)
1395  : getName(id, Tys, M, FT),
1396  getType(M->getContext(), id, Tys))
1397  .getCallee());
1398 }
1399 
1400 // This defines the "Intrinsic::getIntrinsicForGCCBuiltin()" method.
1401 #define GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN
1402 #include "llvm/IR/IntrinsicImpl.inc"
1403 #undef GET_LLVM_INTRINSIC_FOR_GCC_BUILTIN
1404 
1405 // This defines the "Intrinsic::getIntrinsicForMSBuiltin()" method.
1406 #define GET_LLVM_INTRINSIC_FOR_MS_BUILTIN
1407 #include "llvm/IR/IntrinsicImpl.inc"
1408 #undef GET_LLVM_INTRINSIC_FOR_MS_BUILTIN
1409 
1411  std::pair<Type *, ArrayRef<Intrinsic::IITDescriptor>>;
1412 
1415  SmallVectorImpl<Type *> &ArgTys,
1417  bool IsDeferredCheck) {
1418  using namespace Intrinsic;
1419 
1420  // If we ran out of descriptors, there are too many arguments.
1421  if (Infos.empty()) return true;
1422 
1423  // Do this before slicing off the 'front' part
1424  auto InfosRef = Infos;
1425  auto DeferCheck = [&DeferredChecks, &InfosRef](Type *T) {
1426  DeferredChecks.emplace_back(T, InfosRef);
1427  return false;
1428  };
1429 
1430  IITDescriptor D = Infos.front();
1431  Infos = Infos.slice(1);
1432 
1433  switch (D.Kind) {
1434  case IITDescriptor::Void: return !Ty->isVoidTy();
1435  case IITDescriptor::VarArg: return true;
1436  case IITDescriptor::MMX: return !Ty->isX86_MMXTy();
1437  case IITDescriptor::AMX: return !Ty->isX86_AMXTy();
1438  case IITDescriptor::Token: return !Ty->isTokenTy();
1439  case IITDescriptor::Metadata: return !Ty->isMetadataTy();
1440  case IITDescriptor::Half: return !Ty->isHalfTy();
1441  case IITDescriptor::BFloat: return !Ty->isBFloatTy();
1442  case IITDescriptor::Float: return !Ty->isFloatTy();
1443  case IITDescriptor::Double: return !Ty->isDoubleTy();
1444  case IITDescriptor::Quad: return !Ty->isFP128Ty();
1445  case IITDescriptor::PPCQuad: return !Ty->isPPC_FP128Ty();
1446  case IITDescriptor::Integer: return !Ty->isIntegerTy(D.Integer_Width);
1447  case IITDescriptor::Vector: {
1448  VectorType *VT = dyn_cast<VectorType>(Ty);
1449  return !VT || VT->getElementCount() != D.Vector_Width ||
1450  matchIntrinsicType(VT->getElementType(), Infos, ArgTys,
1451  DeferredChecks, IsDeferredCheck);
1452  }
1453  case IITDescriptor::Pointer: {
1454  PointerType *PT = dyn_cast<PointerType>(Ty);
1455  if (!PT || PT->getAddressSpace() != D.Pointer_AddressSpace)
1456  return true;
1457  if (!PT->isOpaque())
1458  return matchIntrinsicType(PT->getElementType(), Infos, ArgTys,
1459  DeferredChecks, IsDeferredCheck);
1460  // Consume IIT descriptors relating to the pointer element type.
1461  while (Infos.front().Kind == IITDescriptor::Pointer)
1462  Infos = Infos.slice(1);
1463  Infos = Infos.slice(1);
1464  return false;
1465  }
1466 
1467  case IITDescriptor::Struct: {
1468  StructType *ST = dyn_cast<StructType>(Ty);
1469  if (!ST || ST->getNumElements() != D.Struct_NumElements)
1470  return true;
1471 
1472  for (unsigned i = 0, e = D.Struct_NumElements; i != e; ++i)
1473  if (matchIntrinsicType(ST->getElementType(i), Infos, ArgTys,
1474  DeferredChecks, IsDeferredCheck))
1475  return true;
1476  return false;
1477  }
1478 
1480  // If this is the second occurrence of an argument,
1481  // verify that the later instance matches the previous instance.
1482  if (D.getArgumentNumber() < ArgTys.size())
1483  return Ty != ArgTys[D.getArgumentNumber()];
1484 
1485  if (D.getArgumentNumber() > ArgTys.size() ||
1486  D.getArgumentKind() == IITDescriptor::AK_MatchType)
1487  return IsDeferredCheck || DeferCheck(Ty);
1488 
1489  assert(D.getArgumentNumber() == ArgTys.size() && !IsDeferredCheck &&
1490  "Table consistency error");
1491  ArgTys.push_back(Ty);
1492 
1493  switch (D.getArgumentKind()) {
1494  case IITDescriptor::AK_Any: return false; // Success
1496  case IITDescriptor::AK_AnyFloat: return !Ty->isFPOrFPVectorTy();
1497  case IITDescriptor::AK_AnyVector: return !isa<VectorType>(Ty);
1498  case IITDescriptor::AK_AnyPointer: return !isa<PointerType>(Ty);
1499  default: break;
1500  }
1501  llvm_unreachable("all argument kinds not covered");
1502 
1504  // If this is a forward reference, defer the check for later.
1505  if (D.getArgumentNumber() >= ArgTys.size())
1506  return IsDeferredCheck || DeferCheck(Ty);
1507 
1508  Type *NewTy = ArgTys[D.getArgumentNumber()];
1509  if (VectorType *VTy = dyn_cast<VectorType>(NewTy))
1511  else if (IntegerType *ITy = dyn_cast<IntegerType>(NewTy))
1512  NewTy = IntegerType::get(ITy->getContext(), 2 * ITy->getBitWidth());
1513  else
1514  return true;
1515 
1516  return Ty != NewTy;
1517  }
1519  // If this is a forward reference, defer the check for later.
1520  if (D.getArgumentNumber() >= ArgTys.size())
1521  return IsDeferredCheck || DeferCheck(Ty);
1522 
1523  Type *NewTy = ArgTys[D.getArgumentNumber()];
1524  if (VectorType *VTy = dyn_cast<VectorType>(NewTy))
1526  else if (IntegerType *ITy = dyn_cast<IntegerType>(NewTy))
1527  NewTy = IntegerType::get(ITy->getContext(), ITy->getBitWidth() / 2);
1528  else
1529  return true;
1530 
1531  return Ty != NewTy;
1532  }
1534  // If this is a forward reference, defer the check for later.
1535  if (D.getArgumentNumber() >= ArgTys.size())
1536  return IsDeferredCheck || DeferCheck(Ty);
1537  return !isa<VectorType>(ArgTys[D.getArgumentNumber()]) ||
1539  cast<VectorType>(ArgTys[D.getArgumentNumber()])) != Ty;
1541  if (D.getArgumentNumber() >= ArgTys.size()) {
1542  // Defer check and subsequent check for the vector element type.
1543  Infos = Infos.slice(1);
1544  return IsDeferredCheck || DeferCheck(Ty);
1545  }
1546  auto *ReferenceType = dyn_cast<VectorType>(ArgTys[D.getArgumentNumber()]);
1547  auto *ThisArgType = dyn_cast<VectorType>(Ty);
1548  // Both must be vectors of the same number of elements or neither.
1549  if ((ReferenceType != nullptr) != (ThisArgType != nullptr))
1550  return true;
1551  Type *EltTy = Ty;
1552  if (ThisArgType) {
1553  if (ReferenceType->getElementCount() !=
1554  ThisArgType->getElementCount())
1555  return true;
1556  EltTy = ThisArgType->getElementType();
1557  }
1558  return matchIntrinsicType(EltTy, Infos, ArgTys, DeferredChecks,
1559  IsDeferredCheck);
1560  }
1562  if (D.getArgumentNumber() >= ArgTys.size())
1563  return IsDeferredCheck || DeferCheck(Ty);
1564  Type * ReferenceType = ArgTys[D.getArgumentNumber()];
1565  PointerType *ThisArgType = dyn_cast<PointerType>(Ty);
1566  return (!ThisArgType || ThisArgType->getElementType() != ReferenceType);
1567  }
1568  case IITDescriptor::PtrToElt: {
1569  if (D.getArgumentNumber() >= ArgTys.size())
1570  return IsDeferredCheck || DeferCheck(Ty);
1572  dyn_cast<VectorType> (ArgTys[D.getArgumentNumber()]);
1573  PointerType *ThisArgType = dyn_cast<PointerType>(Ty);
1574 
1575  if (!ThisArgType || !ReferenceType)
1576  return true;
1577  return !ThisArgType->isOpaqueOrPointeeTypeMatches(
1578  ReferenceType->getElementType());
1579  }
1581  unsigned RefArgNumber = D.getRefArgNumber();
1582  if (RefArgNumber >= ArgTys.size()) {
1583  if (IsDeferredCheck)
1584  return true;
1585  // If forward referencing, already add the pointer-vector type and
1586  // defer the checks for later.
1587  ArgTys.push_back(Ty);
1588  return DeferCheck(Ty);
1589  }
1590 
1591  if (!IsDeferredCheck){
1592  assert(D.getOverloadArgNumber() == ArgTys.size() &&
1593  "Table consistency error");
1594  ArgTys.push_back(Ty);
1595  }
1596 
1597  // Verify the overloaded type "matches" the Ref type.
1598  // i.e. Ty is a vector with the same width as Ref.
1599  // Composed of pointers to the same element type as Ref.
1600  auto *ReferenceType = dyn_cast<VectorType>(ArgTys[RefArgNumber]);
1601  auto *ThisArgVecTy = dyn_cast<VectorType>(Ty);
1602  if (!ThisArgVecTy || !ReferenceType ||
1603  (ReferenceType->getElementCount() != ThisArgVecTy->getElementCount()))
1604  return true;
1605  PointerType *ThisArgEltTy =
1606  dyn_cast<PointerType>(ThisArgVecTy->getElementType());
1607  if (!ThisArgEltTy)
1608  return true;
1609  return !ThisArgEltTy->isOpaqueOrPointeeTypeMatches(
1610  ReferenceType->getElementType());
1611  }
1613  if (D.getArgumentNumber() >= ArgTys.size())
1614  return IsDeferredCheck ? true : DeferCheck(Ty);
1615  auto *ReferenceType = dyn_cast<VectorType>(ArgTys[D.getArgumentNumber()]);
1616  return !ReferenceType || Ty != ReferenceType->getElementType();
1617  }
1620  // If this is a forward reference, defer the check for later.
1621  if (D.getArgumentNumber() >= ArgTys.size())
1622  return IsDeferredCheck || DeferCheck(Ty);
1623 
1624  Type *NewTy = ArgTys[D.getArgumentNumber()];
1625  if (auto *VTy = dyn_cast<VectorType>(NewTy)) {
1626  int SubDivs = D.Kind == IITDescriptor::Subdivide2Argument ? 1 : 2;
1627  NewTy = VectorType::getSubdividedVectorType(VTy, SubDivs);
1628  return Ty != NewTy;
1629  }
1630  return true;
1631  }
1633  if (D.getArgumentNumber() >= ArgTys.size())
1634  return IsDeferredCheck || DeferCheck(Ty);
1635  auto *ReferenceType = dyn_cast<VectorType>(ArgTys[D.getArgumentNumber()]);
1636  auto *ThisArgVecTy = dyn_cast<VectorType>(Ty);
1637  if (!ThisArgVecTy || !ReferenceType)
1638  return true;
1639  return ThisArgVecTy != VectorType::getInteger(ReferenceType);
1640  }
1641  }
1642  llvm_unreachable("unhandled");
1643 }
1644 
1648  SmallVectorImpl<Type *> &ArgTys) {
1650  if (matchIntrinsicType(FTy->getReturnType(), Infos, ArgTys, DeferredChecks,
1651  false))
1653 
1654  unsigned NumDeferredReturnChecks = DeferredChecks.size();
1655 
1656  for (auto Ty : FTy->params())
1657  if (matchIntrinsicType(Ty, Infos, ArgTys, DeferredChecks, false))
1659 
1660  for (unsigned I = 0, E = DeferredChecks.size(); I != E; ++I) {
1661  DeferredIntrinsicMatchPair &Check = DeferredChecks[I];
1662  if (matchIntrinsicType(Check.first, Check.second, ArgTys, DeferredChecks,
1663  true))
1664  return I < NumDeferredReturnChecks ? MatchIntrinsicTypes_NoMatchRet
1666  }
1667 
1669 }
1670 
1671 bool
1674  // If there are no descriptors left, then it can't be a vararg.
1675  if (Infos.empty())
1676  return isVarArg;
1677 
1678  // There should be only one descriptor remaining at this point.
1679  if (Infos.size() != 1)
1680  return true;
1681 
1682  // Check and verify the descriptor.
1683  IITDescriptor D = Infos.front();
1684  Infos = Infos.slice(1);
1685  if (D.Kind == IITDescriptor::VarArg)
1686  return !isVarArg;
1687 
1688  return true;
1689 }
1690 
1692  SmallVectorImpl<Type *> &ArgTys) {
1693  Intrinsic::ID ID = F->getIntrinsicID();
1694  if (!ID)
1695  return false;
1696 
1700 
1701  if (Intrinsic::matchIntrinsicSignature(F->getFunctionType(), TableRef,
1702  ArgTys) !=
1704  return false;
1705  }
1706  if (Intrinsic::matchIntrinsicVarArg(F->getFunctionType()->isVarArg(),
1707  TableRef))
1708  return false;
1709  return true;
1710 }
1711 
1713  SmallVector<Type *, 4> ArgTys;
1714  if (!getIntrinsicSignature(F, ArgTys))
1715  return None;
1716 
1717  Intrinsic::ID ID = F->getIntrinsicID();
1718  StringRef Name = F->getName();
1719  std::string WantedName =
1720  Intrinsic::getName(ID, ArgTys, F->getParent(), F->getFunctionType());
1721  if (Name == WantedName)
1722  return None;
1723 
1724  Function *NewDecl = [&] {
1725  if (auto *ExistingGV = F->getParent()->getNamedValue(WantedName)) {
1726  if (auto *ExistingF = dyn_cast<Function>(ExistingGV))
1727  if (ExistingF->getFunctionType() == F->getFunctionType())
1728  return ExistingF;
1729 
1730  // The name already exists, but is not a function or has the wrong
1731  // prototype. Make place for the new one by renaming the old version.
1732  // Either this old version will be removed later on or the module is
1733  // invalid and we'll get an error.
1734  ExistingGV->setName(WantedName + ".renamed");
1735  }
1736  return Intrinsic::getDeclaration(F->getParent(), ID, ArgTys);
1737  }();
1738 
1739  NewDecl->setCallingConv(F->getCallingConv());
1740  assert(NewDecl->getFunctionType() == F->getFunctionType() &&
1741  "Shouldn't change the signature");
1742  return NewDecl;
1743 }
1744 
1745 /// hasAddressTaken - returns true if there are any uses of this function
1746 /// other than direct calls or invokes to it. Optionally ignores callback
1747 /// uses, assume like pointer annotation calls, and references in llvm.used
1748 /// and llvm.compiler.used variables.
1749 bool Function::hasAddressTaken(const User **PutOffender,
1750  bool IgnoreCallbackUses,
1751  bool IgnoreAssumeLikeCalls, bool IgnoreLLVMUsed,
1752  bool IgnoreARCAttachedCall) const {
1753  for (const Use &U : uses()) {
1754  const User *FU = U.getUser();
1755  if (isa<BlockAddress>(FU))
1756  continue;
1757 
1758  if (IgnoreCallbackUses) {
1759  AbstractCallSite ACS(&U);
1760  if (ACS && ACS.isCallbackCall())
1761  continue;
1762  }
1763 
1764  const auto *Call = dyn_cast<CallBase>(FU);
1765  if (!Call) {
1766  if (IgnoreAssumeLikeCalls) {
1767  if (const auto *FI = dyn_cast<Instruction>(FU)) {
1768  if (FI->isCast() && !FI->user_empty() &&
1769  llvm::all_of(FU->users(), [](const User *U) {
1770  if (const auto *I = dyn_cast<IntrinsicInst>(U))
1771  return I->isAssumeLikeIntrinsic();
1772  return false;
1773  }))
1774  continue;
1775  }
1776  }
1777  if (IgnoreLLVMUsed && !FU->user_empty()) {
1778  const User *FUU = FU;
1779  if (isa<BitCastOperator>(FU) && FU->hasOneUse() &&
1780  !FU->user_begin()->user_empty())
1781  FUU = *FU->user_begin();
1782  if (llvm::all_of(FUU->users(), [](const User *U) {
1783  if (const auto *GV = dyn_cast<GlobalVariable>(U))
1784  return GV->hasName() &&
1785  (GV->getName().equals("llvm.compiler.used") ||
1786  GV->getName().equals("llvm.used"));
1787  return false;
1788  }))
1789  continue;
1790  }
1791  if (PutOffender)
1792  *PutOffender = FU;
1793  return true;
1794  }
1795  if (!Call->isCallee(&U)) {
1796  if (IgnoreARCAttachedCall &&
1797  Call->isOperandBundleOfType(LLVMContext::OB_clang_arc_attachedcall,
1798  U.getOperandNo()))
1799  continue;
1800 
1801  if (PutOffender)
1802  *PutOffender = FU;
1803  return true;
1804  }
1805  }
1806  return false;
1807 }
1808 
1810  // Check the linkage
1811  if (!hasLinkOnceLinkage() && !hasLocalLinkage() &&
1813  return false;
1814 
1815  // Check if the function is used by anything other than a blockaddress.
1816  for (const User *U : users())
1817  if (!isa<BlockAddress>(U))
1818  return false;
1819 
1820  return true;
1821 }
1822 
1823 /// callsFunctionThatReturnsTwice - Return true if the function has a call to
1824 /// setjmp or other function that gcc recognizes as "returning twice".
1826  for (const Instruction &I : instructions(this))
1827  if (const auto *Call = dyn_cast<CallBase>(&I))
1828  if (Call->hasFnAttr(Attribute::ReturnsTwice))
1829  return true;
1830 
1831  return false;
1832 }
1833 
1836  return cast<Constant>(Op<0>());
1837 }
1838 
1840  setHungoffOperand<0>(Fn);
1841  setValueSubclassDataBit(3, Fn != nullptr);
1842 }
1843 
1846  return cast<Constant>(Op<1>());
1847 }
1848 
1850  setHungoffOperand<1>(PrefixData);
1851  setValueSubclassDataBit(1, PrefixData != nullptr);
1852 }
1853 
1856  return cast<Constant>(Op<2>());
1857 }
1858 
1860  setHungoffOperand<2>(PrologueData);
1861  setValueSubclassDataBit(2, PrologueData != nullptr);
1862 }
1863 
1864 void Function::allocHungoffUselist() {
1865  // If we've already allocated a uselist, stop here.
1866  if (getNumOperands())
1867  return;
1868 
1869  allocHungoffUses(3, /*IsPhi=*/ false);
1871 
1872  // Initialize the uselist with placeholder operands to allow traversal.
1874  Op<0>().set(CPN);
1875  Op<1>().set(CPN);
1876  Op<2>().set(CPN);
1877 }
1878 
1879 template <int Idx>
1880 void Function::setHungoffOperand(Constant *C) {
1881  if (C) {
1882  allocHungoffUselist();
1883  Op<Idx>().set(C);
1884  } else if (getNumOperands()) {
1885  Op<Idx>().set(
1887  }
1888 }
1889 
1890 void Function::setValueSubclassDataBit(unsigned Bit, bool On) {
1891  assert(Bit < 16 && "SubclassData contains only 16 bits");
1892  if (On)
1893  setValueSubclassData(getSubclassDataFromValue() | (1 << Bit));
1894  else
1895  setValueSubclassData(getSubclassDataFromValue() & ~(1 << Bit));
1896 }
1897 
1899  const DenseSet<GlobalValue::GUID> *S) {
1900 #if !defined(NDEBUG)
1901  auto PrevCount = getEntryCount();
1902  assert(!PrevCount.hasValue() || PrevCount->getType() == Count.getType());
1903 #endif
1904 
1905  auto ImportGUIDs = getImportGUIDs();
1906  if (S == nullptr && ImportGUIDs.size())
1907  S = &ImportGUIDs;
1908 
1909  MDBuilder MDB(getContext());
1910  setMetadata(
1911  LLVMContext::MD_prof,
1912  MDB.createFunctionEntryCount(Count.getCount(), Count.isSynthetic(), S));
1913 }
1914 
1916  const DenseSet<GlobalValue::GUID> *Imports) {
1917  setEntryCount(ProfileCount(Count, Type), Imports);
1918 }
1919 
1921  MDNode *MD = getMetadata(LLVMContext::MD_prof);
1922  if (MD && MD->getOperand(0))
1923  if (MDString *MDS = dyn_cast<MDString>(MD->getOperand(0))) {
1924  if (MDS->getString().equals("function_entry_count")) {
1925  ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(1));
1926  uint64_t Count = CI->getValue().getZExtValue();
1927  // A value of -1 is used for SamplePGO when there were no samples.
1928  // Treat this the same as unknown.
1929  if (Count == (uint64_t)-1)
1930  return None;
1931  return ProfileCount(Count, PCT_Real);
1932  } else if (AllowSynthetic &&
1933  MDS->getString().equals("synthetic_function_entry_count")) {
1934  ConstantInt *CI = mdconst::extract<ConstantInt>(MD->getOperand(1));
1935  uint64_t Count = CI->getValue().getZExtValue();
1936  return ProfileCount(Count, PCT_Synthetic);
1937  }
1938  }
1939  return None;
1940 }
1941 
1944  if (MDNode *MD = getMetadata(LLVMContext::MD_prof))
1945  if (MDString *MDS = dyn_cast<MDString>(MD->getOperand(0)))
1946  if (MDS->getString().equals("function_entry_count"))
1947  for (unsigned i = 2; i < MD->getNumOperands(); i++)
1948  R.insert(mdconst::extract<ConstantInt>(MD->getOperand(i))
1949  ->getValue()
1950  .getZExtValue());
1951  return R;
1952 }
1953 
1955  MDBuilder MDB(getContext());
1956  setMetadata(LLVMContext::MD_section_prefix,
1958 }
1959 
1961  if (MDNode *MD = getMetadata(LLVMContext::MD_section_prefix)) {
1962  assert(cast<MDString>(MD->getOperand(0))
1963  ->getString()
1964  .equals("function_section_prefix") &&
1965  "Metadata not match");
1966  return cast<MDString>(MD->getOperand(1))->getString();
1967  }
1968  return None;
1969 }
1970 
1972  return hasFnAttribute(Attribute::NullPointerIsValid);
1973 }
1974 
1975 bool llvm::NullPointerIsDefined(const Function *F, unsigned AS) {
1976  if (F && F->nullPointerIsDefined())
1977  return true;
1978 
1979  if (AS != 0)
1980  return true;
1981 
1982  return false;
1983 }
llvm::Function::getParamAttribute
Attribute getParamAttribute(unsigned ArgNo, Attribute::AttrKind Kind) const
gets the specified attribute from the list of attributes.
Definition: Function.cpp:661
llvm::AttributeList::removeAttributeAtIndex
LLVM_NODISCARD 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:1265
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:874
llvm::AttributeList::removeRetAttribute
LLVM_NODISCARD AttributeList removeRetAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Remove the specified attribute at the return value index from this attribute list.
Definition: Attributes.h:614
i
i
Definition: README.txt:29
llvm::Intrinsic::IITDescriptor::AK_AnyVector
@ AK_AnyVector
Definition: Intrinsics.h:160
llvm::Intrinsic::IITDescriptor::Subdivide4Argument
@ Subdivide4Argument
Definition: Intrinsics.h:141
IIT_STRUCT2
@ IIT_STRUCT2
Definition: Function.cpp:952
llvm::Argument
This class represents an incoming formal argument to a Function.
Definition: Argument.h:29
IIT_AMX
@ IIT_AMX
Definition: Function.cpp:982
llvm::Intrinsic::remangleIntrinsicFunction
llvm::Optional< Function * > remangleIntrinsicFunction(Function *F)
Definition: Function.cpp:1712
llvm::Argument::hasStructRetAttr
bool hasStructRetAttr() const
Return true if this argument has the sret attribute.
Definition: Function.cpp:258
llvm::StringRef::startswith
LLVM_NODISCARD bool startswith(StringRef Prefix) const
Check if this string starts with the given Prefix.
Definition: StringRef.h:285
IIT_SUBDIVIDE4_ARG
@ IIT_SUBDIVIDE4_ARG
Definition: Function.cpp:976
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:978
IIT_F32
@ IIT_F32
Definition: Function.cpp:936
llvm::Intrinsic::isOverloaded
bool isOverloaded(ID id)
Returns true if the intrinsic can be overloaded.
Definition: Function.cpp:1366
getName
static StringRef getName(Value *V)
Definition: ProvenanceAnalysisEvaluator.cpp:42
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:129
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: AllocatorList.h:23
llvm::AttributeList::addRetAttributes
LLVM_NODISCARD AttributeList addRetAttributes(LLVMContext &C, const AttrBuilder &B) const
Add a return value attribute to the list.
Definition: Attributes.h:525
llvm::Argument::hasPassPointeeByValueCopyAttr
bool hasPassPointeeByValueCopyAttr() const
Return true if this argument has the byval, inalloca, or preallocated attribute.
Definition: Function.cpp:140
llvm::Intrinsic::MatchIntrinsicTypes_NoMatchArg
@ MatchIntrinsicTypes_NoMatchArg
Definition: Intrinsics.h:220
llvm::AttributeList::addDereferenceableParamAttr
LLVM_NODISCARD 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:1325
llvm::Intrinsic::IITDescriptor::VecOfBitcastsToInt
@ VecOfBitcastsToInt
Definition: Intrinsics.h:142
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::AArch64CC::AL
@ AL
Definition: AArch64BaseInfo.h:269
llvm::StringRef::empty
LLVM_NODISCARD bool empty() const
empty - Check if the string is empty.
Definition: StringRef.h:152
llvm::AttributeList::addFnAttribute
LLVM_NODISCARD AttributeList addFnAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Add a function attribute to the list.
Definition: Attributes.h:483
IIT_EXTEND_ARG
@ IIT_EXTEND_ARG
Definition: Function.cpp:956
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:113
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
llvm::Intrinsic::getDeclaration
Function * getDeclaration(Module *M, ID id, ArrayRef< Type * > Tys=None)
Create or insert an LLVM Function declaration for an intrinsic, and return it.
Definition: Function.cpp:1389
Metadata.h
llvm::Type::isX86_MMXTy
bool isX86_MMXTy() const
Return true if this is X86 MMX.
Definition: Type.h:172
llvm::Function::setSectionPrefix
void setSectionPrefix(StringRef Prefix)
Set the section prefix for this function.
Definition: Function.cpp:1954
llvm::Function::clearGC
void clearGC()
Definition: Function.cpp:697
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:1844
llvm::ElementCount
Definition: TypeSize.h:385
llvm::Intrinsic::IITDescriptor::BFloat
@ BFloat
Definition: Intrinsics.h:123
llvm::APFloatBase::IEEEsingle
static const fltSemantics & IEEEsingle() LLVM_READNONE
Definition: APFloat.cpp:170
llvm::cl::Prefix
@ Prefix
Definition: CommandLine.h:164
InstIterator.h
ReferenceType
Definition: ItaniumDemangle.h:642
T
llvm::PointerType::getElementType
Type * getElementType() const
Definition: DerivedTypes.h:673
llvm::Function
Definition: Function.h:62
llvm::Attribute
Definition: Attributes.h:51
llvm::Type::VoidTyID
@ VoidTyID
type with no size
Definition: Type.h:63
StringRef.h
llvm::Value::getSubclassDataFromValue
unsigned short getSubclassDataFromValue() const
Definition: Value.h:852
DecodeFixedType
static Type * DecodeFixedType(ArrayRef< Intrinsic::IITDescriptor > &Infos, ArrayRef< Type * > Tys, LLVMContext &Context)
Definition: Function.cpp:1243
llvm::Function::getParamDereferenceableBytes
uint64_t getParamDereferenceableBytes(unsigned ArgNo) const
Extract the number of dereferenceable bytes for a parameter.
Definition: Function.h:478
llvm::Intrinsic::IITDescriptor::VarArg
@ VarArg
Definition: Intrinsics.h:118
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
llvm::Target
Target - Wrapper for Target specific information.
Definition: TargetRegistry.h:137
llvm::Argument::removeAttrs
void removeAttrs(const AttrBuilder &B)
Definition: Function.cpp:303
llvm::Function::eraseFromParent
void eraseFromParent()
eraseFromParent - This method unlinks 'this' from the containing module and deletes it.
Definition: Function.cpp:365
llvm::ConstantInt::getValue
const APInt & getValue() const
Return the constant as an APInt value reference.
Definition: Constants.h:133
llvm::Argument::hasPointeeInMemoryValueAttr
bool hasPointeeInMemoryValueAttr() const
Return true if this argument has the byval, sret, inalloca, preallocated, or byref attribute.
Definition: Function.cpp:148
llvm::SmallVector< unsigned char, 8 >
llvm::Intrinsic::IITDescriptor::Quad
@ Quad
Definition: Intrinsics.h:126
llvm::AttributeList::addParamAttribute
LLVM_NODISCARD AttributeList addParamAttribute(LLVMContext &C, unsigned ArgNo, Attribute::AttrKind Kind) const
Add an argument attribute to the list.
Definition: Attributes.h:532
llvm::Function::getParamByValType
Type * getParamByValType(unsigned ArgNo) const
Extract the byval type for a parameter.
Definition: Function.h:452
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:638
ErrorHandling.h
makeArgArray
static MutableArrayRef< Argument > makeArgArray(Argument *Args, size_t Count)
Definition: Function.cpp:440
llvm::Intrinsic::getName
StringRef getName(ID id)
Return the LLVM name for an intrinsic, such as "llvm.ppc.altivec.lvx".
Definition: Function.cpp:879
llvm::Intrinsic::IITDescriptor::MMX
@ MMX
Definition: Intrinsics.h:119
llvm::PointerType::getAddressSpace
unsigned getAddressSpace() const
Return the address space of the Pointer type.
Definition: DerivedTypes.h:687
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
IIT_I1
@ IIT_I1
Definition: Function.cpp:930
llvm::Type::getTypeID
TypeID getTypeID() const
Return the type id for the type.
Definition: Type.h:135
llvm::Argument::getParamInAllocaType
Type * getParamInAllocaType() const
If this is an inalloca argument, return its type.
Definition: Function.cpp:221
IIT_V8
@ IIT_V8
Definition: Function.cpp:940
llvm::LLVMContext::OB_clang_arc_attachedcall
@ OB_clang_arc_attachedcall
Definition: LLVMContext.h:96
llvm::Type::isFPOrFPVectorTy
bool isFPOrFPVectorTy() const
Return true if this is a FP type or a vector of FP.
Definition: Type.h:178
llvm::cl::Hidden
@ Hidden
Definition: CommandLine.h:143
llvm::Intrinsic::IITDescriptor::Metadata
@ Metadata
Definition: Intrinsics.h:121
llvm::Intrinsic::IITDescriptor::PtrToArgument
@ PtrToArgument
Definition: Intrinsics.h:136
llvm::Function::getContext
LLVMContext & getContext() const
getContext - Return a reference to the LLVMContext associated with this function.
Definition: Function.cpp:321
llvm::Function::arg_size
size_t arg_size() const
Definition: Function.h:771
llvm::Argument::getParamAlignment
uint64_t getParamAlignment() const
If this is a byval or inalloca argument, return its alignment.
Definition: Function.cpp:192
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:552
llvm::Intrinsic::lookupLLVMIntrinsicByName
int lookupLLVMIntrinsicByName(ArrayRef< const char * > NameTable, StringRef Name)
Looks up Name in NameTable via binary search.
Definition: IntrinsicInst.cpp:144
Module.h
llvm::AttributeList
Definition: Attributes.h:398
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:47
llvm::Argument::hasInRegAttr
bool hasInRegAttr() const
Return true if this argument has the inreg attribute.
Definition: Function.cpp:263
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:572
llvm::AMDGPU::Exp::Target
Target
Definition: SIDefines.h:743
llvm::Optional
Definition: APInt.h:33
llvm::Argument::getParent
const Function * getParent() const
Definition: Argument.h:41
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:132
getBitWidth
static unsigned getBitWidth(Type *Ty, const DataLayout &DL)
Returns the bitwidth of the given scalar or pointer type.
Definition: ValueTracking.cpp:100
llvm::Function::hasStackProtectorFnAttr
bool hasStackProtectorFnAttr() const
Returns true if the function has ssp, sspstrong, or sspreq fn attrs.
Definition: Function.cpp:704
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:265
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:634
llvm::Intrinsic::not_intrinsic
@ not_intrinsic
Definition: Intrinsics.h:45
llvm::Intrinsic::IITDescriptor::Pointer
@ Pointer
Definition: Intrinsics.h:129
STLExtras.h
llvm::AbstractCallSite
AbstractCallSite.
Definition: AbstractCallSite.h:50
llvm::Intrinsic::IITDescriptor::AK_Any
@ AK_Any
Definition: Intrinsics.h:157
llvm::Function::isDefTriviallyDead
bool isDefTriviallyDead() const
isDefTriviallyDead - Return true if it is trivially safe to remove this function definition from the ...
Definition: Function.cpp:1809
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:959
llvm::Argument::hasSwiftSelfAttr
bool hasSwiftSelfAttr() const
Return true if this argument has the swiftself attribute.
Definition: Function.cpp:121
llvm::Intrinsic::IITDescriptor::Void
@ Void
Definition: Intrinsics.h:117
IIT_METADATA
@ IIT_METADATA
Definition: Function.cpp:950
llvm::Type::isMetadataTy
bool isMetadataTy() const
Return true if this is 'metadata'.
Definition: Type.h:184
Use.h
llvm::Intrinsic::IITDescriptor::AK_MatchType
@ AK_MatchType
Definition: Intrinsics.h:162
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:1691
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::Function::addAttributeAtIndex
void addAttributeAtIndex(unsigned i, Attribute Attr)
adds the attribute to the list of attributes.
Definition: Function.cpp:532
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::Intrinsic::IITDescriptor::Float
@ Float
Definition: Intrinsics.h:124
Context
ManagedStatic< detail::RecordContext > Context
Definition: Record.cpp:96
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:58
llvm::Function::addFnAttrs
void addFnAttrs(const AttrBuilder &Attrs)
Add function attributes to this function.
Definition: Function.cpp:548
llvm::Intrinsic::MatchIntrinsicTypes_NoMatchRet
@ MatchIntrinsicTypes_NoMatchRet
Definition: Intrinsics.h:219
llvm::parseDenormalFPAttribute
DenormalMode parseDenormalFPAttribute(StringRef Str)
Returns the denormal mode to use for inputs and outputs.
Definition: FloatingPointMode.h:174
llvm::Intrinsic::IITDescriptor::AK_AnyPointer
@ AK_AnyPointer
Definition: Intrinsics.h:161
llvm::Function::setGC
void setGC(std::string Str)
Definition: Function.cpp:692
Instruction.h
CommandLine.h
llvm::ConstantInt
This is the shared class of boolean and integer constants.
Definition: Constants.h:79
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:693
llvm::Type::getMetadataTy
static Type * getMetadataTy(LLVMContext &C)
Definition: Type.cpp:230
llvm::Intrinsic::getType
FunctionType * getType(LLVMContext &Context, ID id, ArrayRef< Type * > Tys=None)
Return the function type for an intrinsic.
Definition: Function.cpp:1345
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:1600
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
getMemoryParamAllocType
static Type * getMemoryParamAllocType(AttributeSet ParamAttrs)
For a byval, sret, inalloca, or preallocated parameter, get the in-memory parameter type.
Definition: Function.cpp:161
llvm::Function::PCT_Synthetic
@ PCT_Synthetic
Definition: Function.h:250
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:228
llvm::MutableArrayRef
MutableArrayRef - Represent a mutable reference to an array (0 or more elements consecutively in memo...
Definition: ArrayRef.h:305
llvm::Argument::hasZExtAttr
bool hasZExtAttr() const
Return true if this argument has the zext attribute.
Definition: Function.cpp:271
llvm::Argument::getParamStackAlign
MaybeAlign getParamStackAlign() const
Definition: Function.cpp:202
Constants.h
llvm::Function::stealArgumentListFrom
void stealArgumentListFrom(Function &Src)
Steal arguments from another function.
Definition: Function.cpp:465
IIT_BF16
@ IIT_BF16
Definition: Function.cpp:979
IIT_VEC_OF_BITCASTS_TO_INT
@ IIT_VEC_OF_BITCASTS_TO_INT
Definition: Function.cpp:977
SmallString.h
llvm::Type::getPPC_FP128Ty
static Type * getPPC_FP128Ty(LLVMContext &C)
Definition: Type.cpp:234
llvm::Intrinsic::IITDescriptor::Double
@ Double
Definition: Intrinsics.h:125
E
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
llvm::User
Definition: User.h:44
llvm::AttributeList::removeParamAttributes
LLVM_NODISCARD AttributeList removeParamAttributes(LLVMContext &C, unsigned ArgNo, const AttrBuilder &AttrsToRemove) const
Remove the specified attribute at the specified arg index from this attribute list.
Definition: Attributes.h:649
llvm::Intrinsic::IITDescriptor::SameVecWidthArgument
@ SameVecWidthArgument
Definition: Intrinsics.h:135
DecodeIITType
static void DecodeIITType(unsigned &NextElt, ArrayRef< unsigned char > Infos, IIT_Info LastInfo, SmallVectorImpl< Intrinsic::IITDescriptor > &OutputTable)
Definition: Function.cpp:987
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::AttributeList::removeFnAttributes
LLVM_NODISCARD AttributeList removeFnAttributes(LLVMContext &C, const AttrBuilder &AttrsToRemove) const
Remove the specified attribute at the function index from this attribute list.
Definition: Attributes.h:601
llvm::GlobalObject
Definition: GlobalObject.h:28
llvm::Intrinsic::IITDescriptor::HalfVecArgument
@ HalfVecArgument
Definition: Intrinsics.h:134
llvm::Argument::hasSwiftErrorAttr
bool hasSwiftErrorAttr() const
Return true if this argument has the swifterror attribute.
Definition: Function.cpp:125
IIT_V16
@ IIT_V16
Definition: Function.cpp:941
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
IIT_Info
IIT_Info
IIT_Info - These are enumerators that describe the entries returned by the getIntrinsicInfoTableEntri...
Definition: Function.cpp:927
llvm::Argument::hasNoCaptureAttr
bool hasNoCaptureAttr() const
Return true if this argument has the nocapture attribute.
Definition: Function.cpp:248
IIT_STRUCT9
@ IIT_STRUCT9
Definition: Function.cpp:980
SymbolTableListTraitsImpl.h
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:596
llvm::MaybeAlign
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition: Alignment.h:109
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:652
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:226
IIT_Done
@ IIT_Done
Definition: Function.cpp:929
llvm::Type::isTokenTy
bool isTokenTy() const
Return true if this is 'token'.
Definition: Type.h:187
llvm::Instruction
Definition: Instruction.h:45
llvm::AttributeList::hasFnAttr
bool hasFnAttr(Attribute::AttrKind Kind) const
Return true if the attribute exists for the function.
Definition: Attributes.cpp:1379
llvm::LLVMContext::getGC
const std::string & getGC(const Function &Fn)
Return the GC for a function.
Definition: LLVMContext.cpp:308
MDBuilder.h
llvm::APInt::getZExtValue
uint64_t getZExtValue() const
Get zero extended value.
Definition: APInt.h:1460
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:712
llvm::Function::removeParamAttr
void removeParamAttr(unsigned ArgNo, Attribute::AttrKind Kind)
removes the attribute from the list of attributes.
Definition: Function.cpp:608
llvm::Value::setName
void setName(const Twine &Name)
Change the name of the value.
Definition: Value.cpp:376
llvm::Function::hasPersonalityFn
bool hasPersonalityFn() const
Check whether this function has a personality function.
Definition: Function.h:775
llvm::AttributeSet::getInAllocaType
Type * getInAllocaType() const
Definition: Attributes.cpp:707
llvm::FunctionType::params
ArrayRef< Type * > params() const
Definition: DerivedTypes.h:130
llvm::Argument::getAttribute
Attribute getAttribute(Attribute::AttrKind Kind) const
Definition: Function.cpp:313
IIT_V1024
@ IIT_V1024
Definition: Function.cpp:968
IIT_V64
@ IIT_V64
Definition: Function.cpp:947
llvm::Function::PCT_Real
@ PCT_Real
Definition: Function.h:250
Info
Analysis containing CSE Info
Definition: CSEInfo.cpp:27
llvm::Intrinsic::IITDescriptor::PPCQuad
@ PPCQuad
Definition: Intrinsics.h:144
llvm::Argument::hasNestAttr
bool hasNestAttr() const
Return true if this argument has the nest attribute.
Definition: Function.cpp:238
llvm::AttributeList::removeParamAttribute
LLVM_NODISCARD 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:634
llvm::AttributeList::addDereferenceableOrNullParamAttr
LLVM_NODISCARD 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:1334
llvm::Type::getInt1PtrTy
static PointerType * getInt1PtrTy(LLVMContext &C, unsigned AS=0)
Definition: Type.cpp:289
llvm::Function::getSectionPrefix
Optional< StringRef > getSectionPrefix() const
Get the section prefix for this function.
Definition: Function.cpp:1960
llvm::PointerType::isOpaque
bool isOpaque() const
Definition: DerivedTypes.h:678
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:813
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:301
llvm::None
const NoneType None
Definition: None.h:23
llvm::GlobalValue::IntID
Intrinsic::ID IntID
The intrinsic ID for this subclass (which must be a Function).
Definition: GlobalValue.h:156
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::Function::getParamInAllocaType
Type * getParamInAllocaType(unsigned ArgNo) const
Extract the inalloca type for a parameter.
Definition: Function.h:462
Type.h
llvm::Argument::hasByRefAttr
bool hasByRefAttr() const
Return true if this argument has the byref attribute.
Definition: Function.cpp:115
IIT_PPCF128
@ IIT_PPCF128
Definition: Function.cpp:983
llvm::Function::hasPrologueData
bool hasPrologueData() const
Check whether this function has prologue data.
Definition: Function.h:793
llvm::SmallString< 128 >
llvm::Intrinsic::IITDescriptor::TruncArgument
@ TruncArgument
Definition: Intrinsics.h:133
ValueSymbolTable.h
llvm::AttributeList::addFnAttributes
LLVM_NODISCARD AttributeList addFnAttributes(LLVMContext &C, const AttrBuilder &B) const
Add function attribute to the list.
Definition: Attributes.h:504
llvm::Function::getAttributes
AttributeList getAttributes() const
Return the attribute list for this Function.
Definition: Function.h:316
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:232
llvm::Argument::getParamStructRetType
Type * getParamStructRetType() const
If this is an sret argument, return its type.
Definition: Function.cpp:211
llvm::Function::getGC
const std::string & getGC() const
Definition: Function.cpp:687
llvm::Type::isIntegerTy
bool isIntegerTy() const
True if this is an instance of IntegerType.
Definition: Type.h:190
llvm::MDNode::getOperand
const MDOperand & getOperand(unsigned I) const
Definition: Metadata.h:1137
llvm::Intrinsic::MatchIntrinsicTypes_Match
@ MatchIntrinsicTypes_Match
Definition: Intrinsics.h:218
llvm::Argument::hasAttribute
bool hasAttribute(Attribute::AttrKind Kind) const
Check if an argument has a given attribute.
Definition: Function.cpp:309
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:886
llvm::DenseSet
Implements a dense probed hash-table based set.
Definition: DenseSet.h:268
Check
static bool Check(DecodeStatus &Out, DecodeStatus In)
Definition: AArch64Disassembler.cpp:242
IIT_F128
@ IIT_F128
Definition: Function.cpp:972
llvm::AttributeList::removeRetAttributes
LLVM_NODISCARD AttributeList removeRetAttributes(LLVMContext &C, const AttrBuilder &AttrsToRemove) const
Remove the specified attribute at the return value index from this attribute list.
Definition: Attributes.h:628
llvm::Intrinsic::IITDescriptor::get
static IITDescriptor get(IITDescriptorKind K, unsigned Field)
Definition: Intrinsics.h:194
llvm::Function::hasFnAttribute
bool hasFnAttribute(Attribute::AttrKind Kind) const
Return true if the function has the attribute.
Definition: Function.cpp:626
BasicBlock.h
llvm::cl::opt
Definition: CommandLine.h:1432
llvm::GlobalValue::hasAvailableExternallyLinkage
bool hasAvailableExternallyLinkage() const
Definition: GlobalValue.h:435
llvm::ProfileCount
Function::ProfileCount ProfileCount
Definition: SampleProfileLoaderBaseImpl.h:47
llvm::Function::getEntryCount
Optional< ProfileCount > getEntryCount(bool AllowSynthetic=false) const
Get the entry count for this function.
Definition: Function.cpp:1920
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:643
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:1672
llvm::Function::hasPrefixData
bool hasPrefixData() const
Check whether this function has prefix data.
Definition: Function.h:784
llvm::Intrinsic::IITDescriptor::Half
@ Half
Definition: Intrinsics.h:122
llvm::Function::dropAllReferences
void dropAllReferences()
dropAllReferences() - This method causes all the subinstructions to "let go" of all references that t...
Definition: Function.cpp:510
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:44
llvm::GlobalValue::getParent
Module * getParent()
Get the module that this global value is contained inside of...
Definition: GlobalValue.h:578
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::addParamAttributes
LLVM_NODISCARD AttributeList addParamAttributes(LLVMContext &C, unsigned ArgNo, const AttrBuilder &B) const
Add an argument attribute to the list.
Definition: Attributes.h:553
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:308
llvm::ConstantPointerNull::get
static ConstantPointerNull * get(PointerType *T)
Static factory methods - Return objects of the specified value.
Definition: Constants.cpp:1782
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:1210
IIT_F16
@ IIT_F16
Definition: Function.cpp:935
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
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:68
ProfileCount
Function::ProfileCount ProfileCount
Definition: Function.cpp:74
llvm::Function::removeParamAttrs
void removeParamAttrs(unsigned ArgNo, const AttrBuilder &Attrs)
removes the attribute from the list of attributes.
Definition: Function.cpp:616
llvm::numbers::e
constexpr double e
Definition: MathExtras.h:57
IIT_STRUCT4
@ IIT_STRUCT4
Definition: Function.cpp:954
I
#define I(x, y, z)
Definition: MD5.cpp:59
llvm::AttrBuilder
Definition: Attributes.h:930
StringExtras.h
IIT_I8
@ IIT_I8
Definition: Function.cpp:931
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:666
llvm::Intrinsic::IITDescriptor::AK_AnyInteger
@ AK_AnyInteger
Definition: Intrinsics.h:158
llvm::DenormalMode
Represent subnormal handling kind for floating point instruction inputs and outputs.
Definition: FloatingPointMode.h:67
llvm::Attribute::AttrKind
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
Definition: Attributes.h:70
llvm::cl::init
initializer< Ty > init(const Ty &Val)
Definition: CommandLine.h:441
llvm::LLVMContext::setGC
void setGC(const Function &Fn, std::string GCName)
Define the GC for a function.
Definition: LLVMContext.cpp:298
llvm::Argument::hasNoFreeAttr
bool hasNoFreeAttr() const
Return true if this argument has the nofree attribute.
Definition: Function.cpp:253
llvm::Intrinsic::IITDescriptor::VecOfAnyPtrsToElt
@ VecOfAnyPtrsToElt
Definition: Intrinsics.h:138
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:134
llvm::Type::isHalfTy
bool isHalfTy() const
Return true if this is 'half', a 16-bit IEEE fp type.
Definition: Type.h:141
llvm::GlobalValue::Linkage
unsigned Linkage
Definition: GlobalValue.h:94
llvm::Intrinsic::isLeaf
bool isLeaf(ID id)
Returns true if the intrinsic is a leaf, i.e.
Definition: Function.cpp:1372
llvm::Argument::removeAttr
void removeAttr(Attribute::AttrKind Kind)
Remove attributes from an argument.
Definition: Function.cpp:299
llvm::Function::Create
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
Definition: Function.h:139
llvm::Function::ProfileCountType
ProfileCountType
Definition: Function.h:250
llvm::FramePointerKind::All
@ All
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
llvm::GlobalValue::hasLocalLinkage
bool hasLocalLinkage() const
Definition: GlobalValue.h:451
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:770
IIT_V4
@ IIT_V4
Definition: Function.cpp:939
llvm::Argument::Argument
Argument(Type *Ty, const Twine &Name="", Function *F=nullptr, unsigned ArgNo=0)
Argument constructor.
Definition: Function.cpp:88
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:138
llvm::Function::setPersonalityFn
void setPersonalityFn(Constant *Fn)
Definition: Function.cpp:1839
llvm::Intrinsic::IITDescriptor::AMX
@ AMX
Definition: Intrinsics.h:143
DeferredIntrinsicMatchPair
std::pair< Type *, ArrayRef< Intrinsic::IITDescriptor > > DeferredIntrinsicMatchPair
Definition: Function.cpp:1411
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::MDNode
Metadata node.
Definition: Metadata.h:906
IIT_ARG
@ IIT_ARG
Definition: Function.cpp:944
IIT_V256
@ IIT_V256
Definition: Function.cpp:981
llvm::Value::clearMetadata
void clearMetadata()
Erase all metadata attached to this Value.
Definition: Metadata.cpp:1291
IIT_VARARG
@ IIT_VARARG
Definition: Function.cpp:960
IIT_I16
@ IIT_I16
Definition: Function.cpp:932
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:131
IIT_PTR_TO_ELT
@ IIT_PTR_TO_ELT
Definition: Function.cpp:964
llvm::Intrinsic::IITDescriptor::Subdivide2Argument
@ Subdivide2Argument
Definition: Intrinsics.h:140
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:207
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:338
llvm::Function::setEntryCount
void setEntryCount(ProfileCount Count, const DenseSet< GlobalValue::GUID > *Imports=nullptr)
Set the entry count for this function.
Definition: Function.cpp:1898
llvm::ArrayRef< const char * >
None.h
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:1607
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:57
this
Analysis the ScalarEvolution expression for r is this
Definition: README.txt:8
llvm::Function::setCallingConv
void setCallingConv(CallingConv::ID CC)
Definition: Function.h:244
llvm_unreachable
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
Definition: ErrorHandling.h:134
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:216
Compiler.h
llvm::Function::getParamAlign
MaybeAlign getParamAlign(unsigned ArgNo) const
Definition: Function.h:443
llvm::ilist_node_impl< ilist_detail::compute_node_options< Function, Options... >::type >::getIterator
self_iterator getIterator()
Definition: ilist_node.h:81
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:1197
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:178
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:264
IIT_STRUCT6
@ IIT_STRUCT6
Definition: Function.cpp:969
llvm::Module::getFunctionList
const FunctionListType & getFunctionList() const
Get the Module's list of functions (constant).
Definition: Module.h:556
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:1749
llvm::Function::callsFunctionThatReturnsTwice
bool callsFunctionThatReturnsTwice() const
callsFunctionThatReturnsTwice - Return true if the function has a call to setjmp or other function th...
Definition: Function.cpp:1825
llvm::Value::setMetadata
void setMetadata(unsigned KindID, MDNode *Node)
Set a particular kind of metadata attachment.
Definition: Metadata.cpp:1234
LLVM_FALLTHROUGH
#define LLVM_FALLTHROUGH
LLVM_FALLTHROUGH - Mark fallthrough cases in switch statements.
Definition: Compiler.h:286
llvm::Intrinsic::IITDescriptor::PtrToElt
@ PtrToElt
Definition: Intrinsics.h:137
llvm::Value::getName
StringRef getName() const
Return a constant reference to the value's name.
Definition: Value.cpp:309
llvm::Type::getContext
LLVMContext & getContext() const
Return the LLVMContext in which this type was uniqued.
Definition: Type.h:127
IIT_ANYPTR
@ IIT_ANYPTR
Definition: Function.cpp:958
findTargetSubtable
static ArrayRef< const char * > findTargetSubtable(StringRef Name)
Find the segment of IntrinsicNameTable for intrinsics with the same target as Name,...
Definition: Function.cpp:753
IIT_V3
@ IIT_V3
Definition: Function.cpp:984
llvm::Function::setIsMaterializable
void setIsMaterializable(bool V)
Definition: Function.h:195
llvm::ArrayRef::front
const T & front() const
front - Get the first element.
Definition: ArrayRef.h:166
llvm::Intrinsic::IITDescriptor::VecElementArgument
@ VecElementArgument
Definition: Intrinsics.h:139
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:672
llvm::Function::ProfileCount::getCount
uint64_t getCount() const
Definition: Function.h:263
IIT_I32
@ IIT_I32
Definition: Function.cpp:933
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:159
llvm::Function::removeFnAttrs
void removeFnAttrs(const AttrBuilder &Attrs)
Definition: Function.cpp:592
IIT_STRUCT7
@ IIT_STRUCT7
Definition: Function.cpp:970
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:285
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:108
name
static const char * name
Definition: SVEIntrinsicOpts.cpp:78
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:1748
llvm::Function::getParamAlignment
uint64_t getParamAlignment(unsigned ArgNo) const
Extract the alignment for a call or parameter (0=unknown).
Definition: Function.h:437
IIT_SUBDIVIDE2_ARG
@ IIT_SUBDIVIDE2_ARG
Definition: Function.cpp:975
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:564
Constant.h
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:83
IIT_VEC_OF_ANYPTRS_TO_ELT
@ IIT_VEC_OF_ANYPTRS_TO_ELT
Definition: Function.cpp:965
llvm::AttributeSet::getPreallocatedType
Type * getPreallocatedType() const
Definition: Attributes.cpp:703
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::Function::removeAttributeAtIndex
void removeAttributeAtIndex(unsigned i, Attribute::AttrKind Kind)
removes the attribute from the list of attributes.
Definition: Function.cpp:576
llvm::Type::isFloatTy
bool isFloatTy() const
Return true if this is 'float', a 32-bit IEEE fp type.
Definition: Type.h:147
llvm::AttributeSet::getByRefType
Type * getByRefType() const
Definition: Attributes.cpp:691
llvm::Type::getHalfTy
static Type * getHalfTy(LLVMContext &C)
Definition: Type.cpp:226
IIT_HALF_VEC_ARG
@ IIT_HALF_VEC_ARG
Definition: Function.cpp:961
llvm::AttributeSet::getByValType
Type * getByValType() const
Definition: Attributes.cpp:695
llvm::Type::isIntOrIntVectorTy
bool isIntOrIntVectorTy() const
Return true if this is an integer type or a vector of integer types.
Definition: Type.h:196
llvm::Function::getParamDereferenceableOrNullBytes
uint64_t getParamDereferenceableOrNullBytes(unsigned ArgNo) const
Extract the number of dereferenceable_or_null bytes for a parameter.
Definition: Function.h:485
llvm::Argument::hasNonNullAttr
bool hasNonNullAttr(bool AllowUndefOrPoison=true) const
Return true if this argument has the nonnull attribute.
Definition: Function.cpp:97
Casting.h
llvm::Argument::hasByValAttr
bool hasByValAttr() const
Return true if this argument has the byval attribute.
Definition: Function.cpp:110
IIT_I64
@ IIT_I64
Definition: Function.cpp:934
llvm::fltSemantics
Definition: APFloat.cpp:54
llvm::Argument::getParamByValType
Type * getParamByValType() const
If this is a byval argument, return its type.
Definition: Function.cpp:206
Function.h
IIT_TRUNC_ARG
@ IIT_TRUNC_ARG
Definition: Function.cpp:957
llvm::FramePointerKind::NonLeaf
@ NonLeaf
IIT_I128
@ IIT_I128
Definition: Function.cpp:966
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:621
IIT_PTR
@ IIT_PTR
Definition: Function.cpp:943
IntrinsicNameTable
static const char *const IntrinsicNameTable[]
Table of string intrinsic names indexed by enum value.
Definition: Function.cpp:729
llvm::Type::isDoubleTy
bool isDoubleTy() const
Return true if this is 'double', a 64-bit IEEE fp type.
Definition: Type.h:150
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:745
IIT_MMX
@ IIT_MMX
Definition: Function.cpp:948
llvm::Type::isPPC_FP128Ty
bool isPPC_FP128Ty() const
Return true if this is powerpc long double.
Definition: Type.h:159
llvm::Function::getFunctionType
FunctionType * getFunctionType() const
Returns the FunctionType for me.
Definition: Function.h:177
llvm::AttributeList::addRetAttribute
LLVM_NODISCARD AttributeList addRetAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Add a return value attribute to the list.
Definition: Attributes.h:511
llvm::AttributeList::getAttributeAtIndex
Attribute getAttributeAtIndex(unsigned Index, Attribute::AttrKind Kind) const
Return the attribute object that exists at the given index.
Definition: Attributes.cpp:1392
llvm::Function::addRetAttrs
void addRetAttrs(const AttrBuilder &Attrs)
Add return value attributes to this function.
Definition: Function.cpp:560
IIT_V32
@ IIT_V32
Definition: Function.cpp:942
llvm::Function::isConstrainedFPIntrinsic
bool isConstrainedFPIntrinsic() const
Returns true if the function is one of the "Constrained Floating-Point Intrinsics".
Definition: Function.cpp:444
llvm::Type::getBFloatTy
static Type * getBFloatTy(LLVMContext &C)
Definition: Type.cpp:227
llvm::Function::getParamStackAlign
MaybeAlign getParamStackAlign(unsigned ArgNo) const
Definition: Function.h:447
llvm::Function::getPersonalityFn
Constant * getPersonalityFn() const
Get the personality function associated with this function.
Definition: Function.cpp:1834
llvm::Function::getInstructionCount
unsigned getInstructionCount() const
Returns the number of non-debug IR instructions in this function.
Definition: Function.cpp:325
llvm::Intrinsic::getNameNoUnnamedTypes
std::string getNameNoUnnamedTypes(ID Id, ArrayRef< Type * > Tys)
Return the LLVM name for an intrinsic.
Definition: Function.cpp:919
IIT_PTR_TO_ARG
@ IIT_PTR_TO_ARG
Definition: Function.cpp:963
computeAddrSpace
static unsigned computeAddrSpace(unsigned AddrSpace, Module *M)
Definition: Function.cpp:373
llvm::LLVMContext::deleteGC
void deleteGC(const Function &Fn)
Remove the GC for a function.
Definition: LLVMContext.cpp:312
llvm::Function::getParamByRefType
Type * getParamByRefType(unsigned ArgNo) const
Extract the byref type for a parameter.
Definition: Function.h:467
llvm::makeArrayRef
ArrayRef< T > makeArrayRef(const T &OneElt)
Construct an ArrayRef from a single element.
Definition: ArrayRef.h:474
llvm::MDBuilder
Definition: MDBuilder.h:35
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:130
IIT_EMPTYSTRUCT
@ IIT_EMPTYSTRUCT
Definition: Function.cpp:951
llvm::Type::getVoidTy
static Type * getVoidTy(LLVMContext &C)
Definition: Type.cpp:224
Instructions.h
llvm::Function::nullPointerIsDefined
bool nullPointerIsDefined() const
Check if null pointer dereferencing is considered undefined behavior for the function.
Definition: Function.cpp:1971
llvm::User::getNumOperands
unsigned getNumOperands() const
Definition: User.h:191
llvm::AttributeSet
Definition: Attributes.h:266
llvm::Argument::getPointeeInMemoryValueType
Type * getPointeeInMemoryValueType() const
If hasPointeeInMemoryValueAttr returns true, the in-memory ABI type is returned.
Definition: Function.cpp:186
matchIntrinsicType
static bool matchIntrinsicType(Type *Ty, ArrayRef< Intrinsic::IITDescriptor > &Infos, SmallVectorImpl< Type * > &ArgTys, SmallVectorImpl< DeferredIntrinsicMatchPair > &DeferredChecks, bool IsDeferredCheck)
Definition: Function.cpp:1413
SmallVector.h
llvm::Function::setPrefixData
void setPrefixData(Constant *PrefixData)
Definition: Function.cpp:1849
llvm::Intrinsic::IITDescriptor::Token
@ Token
Definition: Intrinsics.h:120
llvm::Function::removeRetAttrs
void removeRetAttrs(const AttrBuilder &Attrs)
removes the attributes from the return value list of attributes.
Definition: Function.cpp:604
llvm::Type::isBFloatTy
bool isBFloatTy() const
Return true if this is 'bfloat', a 16-bit bfloat type.
Definition: Type.h:144
User.h
llvm::Intrinsic::IITDescriptor::Vector
@ Vector
Definition: Intrinsics.h:128
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:736
llvm::Function::removeFnAttr
void removeFnAttr(Attribute::AttrKind Kind)
Remove function attributes from this function.
Definition: Function.cpp:584
llvm::AttributeList::removeFnAttribute
LLVM_NODISCARD AttributeList removeFnAttribute(LLVMContext &C, Attribute::AttrKind Kind) const
Remove the specified attribute at the function index from this attribute list.
Definition: Attributes.h:587
llvm::Argument::hasNoAliasAttr
bool hasNoAliasAttr() const
Return true if this argument has the noalias attribute.
Definition: Function.cpp:243
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:1646
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:536
llvm::GlobalObject::copyAttributesFrom
void copyAttributesFrom(const GlobalObject *Src)
Definition: Globals.cpp:127
llvm::Intrinsic::IITDescriptor::getVector
static IITDescriptor getVector(unsigned Width, bool IsScalable)
Definition: Intrinsics.h:206
llvm::Argument::getParamAlign
MaybeAlign getParamAlign() const
If this is a byval or inalloca argument, return its alignment.
Definition: Function.cpp:197
IIT_TOKEN
@ IIT_TOKEN
Definition: Function.cpp:949
llvm::GlobalValue::hasLinkOnceLinkage
bool hasLinkOnceLinkage() const
Definition: GlobalValue.h:438
llvm::Function::removeFromParent
void removeFromParent()
removeFromParent - This method unlinks 'this' from the containing module, but does not delete it.
Definition: Function.cpp:361
llvm::AttributeList::addAttributeAtIndex
LLVM_NODISCARD AttributeList addAttributeAtIndex(LLVMContext &C, unsigned Index, Attribute::AttrKind Kind) const
Add an attribute to the attribute set at the given index.
Definition: Attributes.cpp:1184
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition: APFloat.h:43
llvm::AttributeSet::getStructRetType
Type * getStructRetType() const
Definition: Attributes.cpp:699
llvm::GlobalValue::getType
PointerType * getType() const
Global values are always pointers.
Definition: GlobalValue.h:271
DerivedTypes.h
llvm::Function::setPrologueData
void setPrologueData(Constant *PrologueData)
Definition: Function.cpp:1859
llvm::Function::recalculateIntrinsicID
void recalculateIntrinsicID()
Recalculate the ID for this function if it is an Intrinsic defined in llvm/Intrinsics....
Definition: Function.cpp:790
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:1854
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:127
LLVMContext.h
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition: AMDGPUMetadata.h:389
llvm::FramePointerKind::None
@ None
llvm::Function::ProfileCount
Class to represent profile counts.
Definition: Function.h:255
llvm::cl::desc
Definition: CommandLine.h:412
AbstractCallSite.h
llvm::Intrinsic::IITDescriptor
This is a type descriptor which explains the type requirements of an intrinsic.
Definition: Intrinsics.h:115
IIT_V512
@ IIT_V512
Definition: Function.cpp:967
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:1975
llvm::Type::getX86_MMXTy
static Type * getX86_MMXTy(LLVMContext &C)
Definition: Type.cpp:235
llvm::AMDGPU::VGPRIndexMode::Id
Id
Definition: SIDefines.h:232
IIT_SAME_VEC_WIDTH_ARG
@ IIT_SAME_VEC_WIDTH_ARG
Definition: Function.cpp:962
IIT_STRUCT5
@ IIT_STRUCT5
Definition: Function.cpp:955
llvm::AttributeList::hasParamAttr
bool hasParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Return true if the attribute exists for the given argument.
Definition: Attributes.h:721
SymbolTableListTraits.h
llvm::Intrinsic::MatchIntrinsicTypesResult
MatchIntrinsicTypesResult
Definition: Intrinsics.h:217
llvm::AttributeList::getParamAttrs
AttributeSet getParamAttrs(unsigned ArgNo) const
The attributes for the argument or parameter at the given index are returned.
Definition: Attributes.cpp:1354
llvm::Argument::onlyReadsMemory
bool onlyReadsMemory() const
Return true if this argument has the readonly or readnone attribute.
Definition: Function.cpp:279
llvm::MDString
A single uniqued string.
Definition: Metadata.h:611
true
basic Basic Alias true
Definition: BasicAliasAnalysis.cpp:1883
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:780
IIT_STRUCT3
@ IIT_STRUCT3
Definition: Function.cpp:953
Value.h
IIT_V2
@ IIT_V2
Definition: Function.cpp:938
TableRef
Definition: AMDGPULibCalls.cpp:399
llvm::Function::getParamStructRetType
Type * getParamStructRetType(unsigned ArgNo) const
Extract the sret type for a parameter.
Definition: Function.h:457
llvm::Function::setAttributes
void setAttributes(AttributeList Attrs)
Set the attribute list for this Function.
Definition: Function.h:319
llvm::Argument::hasSExtAttr
bool hasSExtAttr() const
Return true if this argument has the sext attribute.
Definition: Function.cpp:275
IIT_STRUCT8
@ IIT_STRUCT8
Definition: Function.cpp:971
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:156
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:973
llvm::AttributeList::getParamAttr
Attribute getParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Return the attribute object that exists at the arg index.
Definition: Attributes.h:770
llvm::Type::getFloatTy
static Type * getFloatTy(LLVMContext &C)
Definition: Type.cpp:228
llvm::ArrayRef::end
iterator end() const
Definition: ArrayRef.h:152
llvm::Type::isX86_AMXTy
bool isX86_AMXTy() const
Return true if this is X86 AMX.
Definition: Type.h:175
IIT_F64
@ IIT_F64
Definition: Function.cpp:937
llvm::Argument::hasReturnedAttr
bool hasReturnedAttr() const
Return true if this argument has the returned attribute.
Definition: Function.cpp:267
IIT_SCALABLE_VEC
@ IIT_SCALABLE_VEC
Definition: Function.cpp:974
llvm::FunctionType
Class to represent function types.
Definition: DerivedTypes.h:103
llvm::Argument::addAttr
void addAttr(Attribute::AttrKind Kind)
Definition: Function.cpp:291
llvm::Use
A Use represents the edge between a Value definition and its users.
Definition: Use.h:44
llvm::SmallVectorImpl::emplace_back
reference emplace_back(ArgTypes &&... Args)
Definition: SmallVector.h:908
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:1942
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:38