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