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