LLVM  14.0.0git
Function.h
Go to the documentation of this file.
1 //===- llvm/Function.h - Class to represent a single function ---*- C++ -*-===//
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 contains the declaration of the Function class, which represents a
10 // single function/procedure in LLVM.
11 //
12 // A function basically consists of a list of basic blocks, a list of arguments,
13 // and a symbol table.
14 //
15 //===----------------------------------------------------------------------===//
16 
17 #ifndef LLVM_IR_FUNCTION_H
18 #define LLVM_IR_FUNCTION_H
19 
20 #include "llvm/ADT/DenseSet.h"
21 #include "llvm/ADT/StringRef.h"
22 #include "llvm/ADT/Twine.h"
23 #include "llvm/ADT/ilist_node.h"
25 #include "llvm/IR/Argument.h"
26 #include "llvm/IR/Attributes.h"
27 #include "llvm/IR/BasicBlock.h"
28 #include "llvm/IR/CallingConv.h"
29 #include "llvm/IR/DerivedTypes.h"
30 #include "llvm/IR/GlobalObject.h"
31 #include "llvm/IR/GlobalValue.h"
32 #include "llvm/IR/OperandTraits.h"
34 #include "llvm/IR/Value.h"
35 #include "llvm/Support/Casting.h"
36 #include "llvm/Support/Compiler.h"
37 #include <cassert>
38 #include <cstddef>
39 #include <cstdint>
40 #include <memory>
41 #include <string>
42 
43 namespace llvm {
44 
45 namespace Intrinsic {
46 typedef unsigned ID;
47 }
48 
49 class AssemblyAnnotationWriter;
50 class Constant;
51 struct DenormalMode;
52 class DISubprogram;
53 class LLVMContext;
54 class Module;
55 template <typename T> class Optional;
56 class raw_ostream;
57 class Type;
58 class User;
59 class BranchProbabilityInfo;
60 class BlockFrequencyInfo;
61 
63  public ilist_node<Function> {
64 public:
66 
67  // BasicBlock iterators...
70 
72  using const_arg_iterator = const Argument *;
73 
74 private:
75  // Important things that make up a function!
76  BasicBlockListType BasicBlocks; ///< The basic blocks
77  mutable Argument *Arguments = nullptr; ///< The formal arguments
78  size_t NumArgs;
79  std::unique_ptr<ValueSymbolTable>
80  SymTab; ///< Symbol table of args/instructions
81  AttributeList AttributeSets; ///< Parameter attributes
82 
83  /*
84  * Value::SubclassData
85  *
86  * bit 0 : HasLazyArguments
87  * bit 1 : HasPrefixData
88  * bit 2 : HasPrologueData
89  * bit 3 : HasPersonalityFn
90  * bits 4-13 : CallingConvention
91  * bits 14 : HasGC
92  * bits 15 : [reserved]
93  */
94 
95  /// Bits from GlobalObject::GlobalObjectSubclassData.
96  enum {
97  /// Whether this function is materializable.
98  IsMaterializableBit = 0,
99  };
100 
102 
103  /// hasLazyArguments/CheckLazyArguments - The argument list of a function is
104  /// built on demand, so that the list isn't allocated until the first client
105  /// needs it. The hasLazyArguments predicate returns true if the arg list
106  /// hasn't been set up yet.
107 public:
108  bool hasLazyArguments() const {
109  return getSubclassDataFromValue() & (1<<0);
110  }
111 
112 private:
113  void CheckLazyArguments() const {
114  if (hasLazyArguments())
115  BuildLazyArguments();
116  }
117 
118  void BuildLazyArguments() const;
119 
120  void clearArguments();
121 
122  /// Function ctor - If the (optional) Module argument is specified, the
123  /// function is automatically inserted into the end of the function list for
124  /// the module.
125  ///
126  Function(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace,
127  const Twine &N = "", Module *M = nullptr);
128 
129 public:
130  Function(const Function&) = delete;
131  void operator=(const Function&) = delete;
132  ~Function();
133 
134  // This is here to help easily convert from FunctionT * (Function * or
135  // MachineFunction *) in BlockFrequencyInfoImpl to Function * by calling
136  // FunctionT->getFunction().
137  const Function &getFunction() const { return *this; }
138 
140  unsigned AddrSpace, const Twine &N = "",
141  Module *M = nullptr) {
142  return new Function(Ty, Linkage, AddrSpace, N, M);
143  }
144 
145  // TODO: remove this once all users have been updated to pass an AddrSpace
147  const Twine &N = "", Module *M = nullptr) {
148  return new Function(Ty, Linkage, static_cast<unsigned>(-1), N, M);
149  }
150 
151  /// Creates a new function and attaches it to a module.
152  ///
153  /// Places the function in the program address space as specified
154  /// by the module's data layout.
155  static Function *Create(FunctionType *Ty, LinkageTypes Linkage,
156  const Twine &N, Module &M);
157 
158  /// Creates a function with some attributes recorded in llvm.module.flags
159  /// applied.
160  ///
161  /// Use this when synthesizing new functions that need attributes that would
162  /// have been set by command line options.
163  static Function *createWithDefaultAttr(FunctionType *Ty, LinkageTypes Linkage,
164  unsigned AddrSpace,
165  const Twine &N = "",
166  Module *M = nullptr);
167 
168  // Provide fast operand accessors.
170 
171  /// Returns the number of non-debug IR instructions in this function.
172  /// This is equivalent to the sum of the sizes of each basic block contained
173  /// within this function.
174  unsigned getInstructionCount() const;
175 
176  /// Returns the FunctionType for me.
178  return cast<FunctionType>(getValueType());
179  }
180 
181  /// Returns the type of the ret val.
182  Type *getReturnType() const { return getFunctionType()->getReturnType(); }
183 
184  /// getContext - Return a reference to the LLVMContext associated with this
185  /// function.
186  LLVMContext &getContext() const;
187 
188  /// isVarArg - Return true if this function takes a variable number of
189  /// arguments.
190  bool isVarArg() const { return getFunctionType()->isVarArg(); }
191 
192  bool isMaterializable() const {
193  return getGlobalObjectSubClassData() & (1 << IsMaterializableBit);
194  }
195  void setIsMaterializable(bool V) {
196  unsigned Mask = 1 << IsMaterializableBit;
197  setGlobalObjectSubClassData((~Mask & getGlobalObjectSubClassData()) |
198  (V ? Mask : 0u));
199  }
200 
201  /// getIntrinsicID - This method returns the ID number of the specified
202  /// function, or Intrinsic::not_intrinsic if the function is not an
203  /// intrinsic, or if the pointer is null. This value is always defined to be
204  /// zero to allow easy checking for whether a function is intrinsic or not.
205  /// The particular intrinsic functions which correspond to this value are
206  /// defined in llvm/Intrinsics.h.
208 
209  /// isIntrinsic - Returns true if the function's name starts with "llvm.".
210  /// It's possible for this function to return true while getIntrinsicID()
211  /// returns Intrinsic::not_intrinsic!
212  bool isIntrinsic() const { return HasLLVMReservedName; }
213 
214  /// isTargetIntrinsic - Returns true if IID is an intrinsic specific to a
215  /// certain target. If it is a generic intrinsic false is returned.
216  static bool isTargetIntrinsic(Intrinsic::ID IID);
217 
218  /// isTargetIntrinsic - Returns true if this function is an intrinsic and the
219  /// intrinsic is specific to a certain target. If this is not an intrinsic
220  /// or a generic intrinsic, false is returned.
221  bool isTargetIntrinsic() const;
222 
223  /// Returns true if the function is one of the "Constrained Floating-Point
224  /// Intrinsics". Returns false if not, and returns false when
225  /// getIntrinsicID() returns Intrinsic::not_intrinsic.
226  bool isConstrainedFPIntrinsic() const;
227 
228  static Intrinsic::ID lookupIntrinsicID(StringRef Name);
229 
230  /// Recalculate the ID for this function if it is an Intrinsic defined
231  /// in llvm/Intrinsics.h. Sets the intrinsic ID to Intrinsic::not_intrinsic
232  /// if the name of this function does not match an intrinsic in that header.
233  /// Note, this method does not need to be called directly, as it is called
234  /// from Value::setName() whenever the name of this function changes.
235  void recalculateIntrinsicID();
236 
237  /// getCallingConv()/setCallingConv(CC) - These method get and set the
238  /// calling convention of this function. The enum values for the known
239  /// calling conventions are defined in CallingConv.h.
241  return static_cast<CallingConv::ID>((getSubclassDataFromValue() >> 4) &
243  }
245  auto ID = static_cast<unsigned>(CC);
246  assert(!(ID & ~CallingConv::MaxID) && "Unsupported calling convention");
247  setValueSubclassData((getSubclassDataFromValue() & 0xc00f) | (ID << 4));
248  }
249 
250  enum ProfileCountType { PCT_Invalid, PCT_Real, PCT_Synthetic };
251 
252  /// Class to represent profile counts.
253  ///
254  /// This class represents both real and synthetic profile counts.
255  class ProfileCount {
256  private:
257  uint64_t Count;
258  ProfileCountType PCT;
259  static ProfileCount Invalid;
260 
261  public:
262  ProfileCount() : Count(-1), PCT(PCT_Invalid) {}
264  : Count(Count), PCT(PCT) {}
265  bool hasValue() const { return PCT != PCT_Invalid; }
266  uint64_t getCount() const { return Count; }
267  ProfileCountType getType() const { return PCT; }
268  bool isSynthetic() const { return PCT == PCT_Synthetic; }
269  explicit operator bool() { return hasValue(); }
270  bool operator!() const { return !hasValue(); }
271  // Update the count retaining the same profile count type.
273  Count = C;
274  return *this;
275  }
276  static ProfileCount getInvalid() { return ProfileCount(-1, PCT_Invalid); }
277  };
278 
279  /// Set the entry count for this function.
280  ///
281  /// Entry count is the number of times this function was executed based on
282  /// pgo data. \p Imports points to a set of GUIDs that needs to
283  /// be imported by the function for sample PGO, to enable the same inlines as
284  /// the profiled optimized binary.
285  void setEntryCount(ProfileCount Count,
286  const DenseSet<GlobalValue::GUID> *Imports = nullptr);
287 
288  /// A convenience wrapper for setting entry count
289  void setEntryCount(uint64_t Count, ProfileCountType Type = PCT_Real,
290  const DenseSet<GlobalValue::GUID> *Imports = nullptr);
291 
292  /// Get the entry count for this function.
293  ///
294  /// Entry count is the number of times the function was executed.
295  /// When AllowSynthetic is false, only pgo_data will be returned.
296  ProfileCount getEntryCount(bool AllowSynthetic = false) const;
297 
298  /// Return true if the function is annotated with profile data.
299  ///
300  /// Presence of entry counts from a profile run implies the function has
301  /// profile annotations. If IncludeSynthetic is false, only return true
302  /// when the profile data is real.
303  bool hasProfileData(bool IncludeSynthetic = false) const {
304  return getEntryCount(IncludeSynthetic).hasValue();
305  }
306 
307  /// Returns the set of GUIDs that needs to be imported to the function for
308  /// sample PGO, to enable the same inlines as the profiled optimized binary.
309  DenseSet<GlobalValue::GUID> getImportGUIDs() const;
310 
311  /// Set the section prefix for this function.
312  void setSectionPrefix(StringRef Prefix);
313 
314  /// Get the section prefix for this function.
315  Optional<StringRef> getSectionPrefix() const;
316 
317  /// hasGC/getGC/setGC/clearGC - The name of the garbage collection algorithm
318  /// to use during code generation.
319  bool hasGC() const {
320  return getSubclassDataFromValue() & (1<<14);
321  }
322  const std::string &getGC() const;
323  void setGC(std::string Str);
324  void clearGC();
325 
326  /// Return the attribute list for this Function.
327  AttributeList getAttributes() const { return AttributeSets; }
328 
329  /// Set the attribute list for this Function.
330  void setAttributes(AttributeList Attrs) { AttributeSets = Attrs; }
331 
332  // TODO: remove non-AtIndex versions of these methods.
333  /// adds the attribute to the list of attributes.
334  void addAttributeAtIndex(unsigned i, Attribute Attr);
335 
336  /// Add function attributes to this function.
337  void addFnAttr(Attribute::AttrKind Kind);
338 
339  /// Add function attributes to this function.
340  void addFnAttr(StringRef Kind, StringRef Val = StringRef());
341 
342  /// Add function attributes to this function.
343  void addFnAttr(Attribute Attr);
344 
345  /// Add function attributes to this function.
346  void addFnAttrs(const AttrBuilder &Attrs);
347 
348  /// Add return value attributes to this function.
349  void addRetAttr(Attribute::AttrKind Kind);
350 
351  /// Add return value attributes to this function.
352  void addRetAttr(Attribute Attr);
353 
354  /// Add return value attributes to this function.
355  void addRetAttrs(const AttrBuilder &Attrs);
356 
357  /// adds the attribute to the list of attributes for the given arg.
358  void addParamAttr(unsigned ArgNo, Attribute::AttrKind Kind);
359 
360  /// adds the attribute to the list of attributes for the given arg.
361  void addParamAttr(unsigned ArgNo, Attribute Attr);
362 
363  /// adds the attributes to the list of attributes for the given arg.
364  void addParamAttrs(unsigned ArgNo, const AttrBuilder &Attrs);
365 
366  /// removes the attribute from the list of attributes.
367  void removeAttributeAtIndex(unsigned i, Attribute::AttrKind Kind);
368 
369  /// removes the attribute from the list of attributes.
370  void removeAttributeAtIndex(unsigned i, StringRef Kind);
371 
372  /// Remove function attributes from this function.
373  void removeFnAttr(Attribute::AttrKind Kind);
374 
375  /// Remove function attribute from this function.
376  void removeFnAttr(StringRef Kind);
377 
378  void removeFnAttrs(const AttrBuilder &Attrs);
379 
380  /// removes the attribute from the return value list of attributes.
381  void removeRetAttr(Attribute::AttrKind Kind);
382 
383  /// removes the attribute from the return value list of attributes.
384  void removeRetAttr(StringRef Kind);
385 
386  /// removes the attributes from the return value list of attributes.
387  void removeRetAttrs(const AttrBuilder &Attrs);
388 
389  /// removes the attribute from the list of attributes.
390  void removeParamAttr(unsigned ArgNo, Attribute::AttrKind Kind);
391 
392  /// removes the attribute from the list of attributes.
393  void removeParamAttr(unsigned ArgNo, StringRef Kind);
394 
395  /// removes the attribute from the list of attributes.
396  void removeParamAttrs(unsigned ArgNo, const AttrBuilder &Attrs);
397 
398  /// Return true if the function has the attribute.
399  bool hasFnAttribute(Attribute::AttrKind Kind) const;
400 
401  /// Return true if the function has the attribute.
402  bool hasFnAttribute(StringRef Kind) const;
403 
404  /// check if an attribute is in the list of attributes for the return value.
405  bool hasRetAttribute(Attribute::AttrKind Kind) const;
406 
407  /// check if an attributes is in the list of attributes.
408  bool hasParamAttribute(unsigned ArgNo, Attribute::AttrKind Kind) const;
409 
410  /// gets the attribute from the list of attributes.
411  Attribute getAttributeAtIndex(unsigned i, Attribute::AttrKind Kind) const;
412 
413  /// gets the attribute from the list of attributes.
414  Attribute getAttributeAtIndex(unsigned i, StringRef Kind) const;
415 
416  /// Return the attribute for the given attribute kind.
417  Attribute getFnAttribute(Attribute::AttrKind Kind) const;
418 
419  /// Return the attribute for the given attribute kind.
420  Attribute getFnAttribute(StringRef Kind) const;
421 
422  /// gets the specified attribute from the list of attributes.
423  Attribute getParamAttribute(unsigned ArgNo, Attribute::AttrKind Kind) const;
424 
425  /// removes noundef and other attributes that imply undefined behavior if a
426  /// `undef` or `poison` value is passed from the list of attributes.
427  void removeParamUndefImplyingAttrs(unsigned ArgNo);
428 
429  /// Return the stack alignment for the function.
431  return AttributeSets.getFnStackAlignment();
432  }
433 
434  /// Returns true if the function has ssp, sspstrong, or sspreq fn attrs.
435  bool hasStackProtectorFnAttr() const;
436 
437  /// adds the dereferenceable attribute to the list of attributes for
438  /// the given arg.
439  void addDereferenceableParamAttr(unsigned ArgNo, uint64_t Bytes);
440 
441  /// adds the dereferenceable_or_null attribute to the list of
442  /// attributes for the given arg.
443  void addDereferenceableOrNullParamAttr(unsigned ArgNo, uint64_t Bytes);
444 
445  /// Extract the alignment for a call or parameter (0=unknown).
446  /// FIXME: Remove this function once transition to Align is over.
447  /// Use getParamAlign() instead.
448  uint64_t getParamAlignment(unsigned ArgNo) const {
449  if (const auto MA = getParamAlign(ArgNo))
450  return MA->value();
451  return 0;
452  }
453 
454  MaybeAlign getParamAlign(unsigned ArgNo) const {
455  return AttributeSets.getParamAlignment(ArgNo);
456  }
457 
458  MaybeAlign getParamStackAlign(unsigned ArgNo) const {
459  return AttributeSets.getParamStackAlignment(ArgNo);
460  }
461 
462  /// Extract the byval type for a parameter.
463  Type *getParamByValType(unsigned ArgNo) const {
464  return AttributeSets.getParamByValType(ArgNo);
465  }
466 
467  /// Extract the sret type for a parameter.
468  Type *getParamStructRetType(unsigned ArgNo) const {
469  return AttributeSets.getParamStructRetType(ArgNo);
470  }
471 
472  /// Extract the inalloca type for a parameter.
473  Type *getParamInAllocaType(unsigned ArgNo) const {
474  return AttributeSets.getParamInAllocaType(ArgNo);
475  }
476 
477  /// Extract the byref type for a parameter.
478  Type *getParamByRefType(unsigned ArgNo) const {
479  return AttributeSets.getParamByRefType(ArgNo);
480  }
481 
482  /// Extract the preallocated type for a parameter.
483  Type *getParamPreallocatedType(unsigned ArgNo) const {
484  return AttributeSets.getParamPreallocatedType(ArgNo);
485  }
486 
487  /// Extract the number of dereferenceable bytes for a parameter.
488  /// @param ArgNo Index of an argument, with 0 being the first function arg.
489  uint64_t getParamDereferenceableBytes(unsigned ArgNo) const {
490  return AttributeSets.getParamDereferenceableBytes(ArgNo);
491  }
492 
493  /// Extract the number of dereferenceable_or_null bytes for a
494  /// parameter.
495  /// @param ArgNo AttributeList ArgNo, referring to an argument.
497  return AttributeSets.getParamDereferenceableOrNullBytes(ArgNo);
498  }
499 
500  /// A function will have the "coroutine.presplit" attribute if it's
501  /// a coroutine and has not gone through full CoroSplit pass.
502  bool isPresplitCoroutine() const {
503  return hasFnAttribute("coroutine.presplit");
504  }
505 
506  /// Determine if the function does not access memory.
507  bool doesNotAccessMemory() const {
508  return hasFnAttribute(Attribute::ReadNone);
509  }
511  addFnAttr(Attribute::ReadNone);
512  }
513 
514  /// Determine if the function does not access or only reads memory.
515  bool onlyReadsMemory() const {
516  return doesNotAccessMemory() || hasFnAttribute(Attribute::ReadOnly);
517  }
519  addFnAttr(Attribute::ReadOnly);
520  }
521 
522  /// Determine if the function does not access or only writes memory.
523  bool doesNotReadMemory() const {
524  return doesNotAccessMemory() || hasFnAttribute(Attribute::WriteOnly);
525  }
527  addFnAttr(Attribute::WriteOnly);
528  }
529 
530  /// Determine if the call can access memmory only using pointers based
531  /// on its arguments.
532  bool onlyAccessesArgMemory() const {
533  return hasFnAttribute(Attribute::ArgMemOnly);
534  }
535  void setOnlyAccessesArgMemory() { addFnAttr(Attribute::ArgMemOnly); }
536 
537  /// Determine if the function may only access memory that is
538  /// inaccessible from the IR.
540  return hasFnAttribute(Attribute::InaccessibleMemOnly);
541  }
543  addFnAttr(Attribute::InaccessibleMemOnly);
544  }
545 
546  /// Determine if the function may only access memory that is
547  /// either inaccessible from the IR or pointed to by its arguments.
549  return hasFnAttribute(Attribute::InaccessibleMemOrArgMemOnly);
550  }
552  addFnAttr(Attribute::InaccessibleMemOrArgMemOnly);
553  }
554 
555  /// Determine if the function cannot return.
556  bool doesNotReturn() const {
557  return hasFnAttribute(Attribute::NoReturn);
558  }
560  addFnAttr(Attribute::NoReturn);
561  }
562 
563  /// Determine if the function should not perform indirect branch tracking.
564  bool doesNoCfCheck() const { return hasFnAttribute(Attribute::NoCfCheck); }
565 
566  /// Determine if the function cannot unwind.
567  bool doesNotThrow() const {
568  return hasFnAttribute(Attribute::NoUnwind);
569  }
571  addFnAttr(Attribute::NoUnwind);
572  }
573 
574  /// Determine if the call cannot be duplicated.
575  bool cannotDuplicate() const {
576  return hasFnAttribute(Attribute::NoDuplicate);
577  }
579  addFnAttr(Attribute::NoDuplicate);
580  }
581 
582  /// Determine if the call is convergent.
583  bool isConvergent() const {
584  return hasFnAttribute(Attribute::Convergent);
585  }
586  void setConvergent() {
587  addFnAttr(Attribute::Convergent);
588  }
590  removeFnAttr(Attribute::Convergent);
591  }
592 
593  /// Determine if the call has sideeffects.
594  bool isSpeculatable() const {
595  return hasFnAttribute(Attribute::Speculatable);
596  }
598  addFnAttr(Attribute::Speculatable);
599  }
600 
601  /// Determine if the call might deallocate memory.
602  bool doesNotFreeMemory() const {
603  return onlyReadsMemory() || hasFnAttribute(Attribute::NoFree);
604  }
606  addFnAttr(Attribute::NoFree);
607  }
608 
609  /// Determine if the call can synchroize with other threads
610  bool hasNoSync() const {
611  return hasFnAttribute(Attribute::NoSync);
612  }
613  void setNoSync() {
614  addFnAttr(Attribute::NoSync);
615  }
616 
617  /// Determine if the function is known not to recurse, directly or
618  /// indirectly.
619  bool doesNotRecurse() const {
620  return hasFnAttribute(Attribute::NoRecurse);
621  }
623  addFnAttr(Attribute::NoRecurse);
624  }
625 
626  /// Determine if the function is required to make forward progress.
627  bool mustProgress() const {
628  return hasFnAttribute(Attribute::MustProgress) ||
629  hasFnAttribute(Attribute::WillReturn);
630  }
631  void setMustProgress() { addFnAttr(Attribute::MustProgress); }
632 
633  /// Determine if the function will return.
634  bool willReturn() const { return hasFnAttribute(Attribute::WillReturn); }
635  void setWillReturn() { addFnAttr(Attribute::WillReturn); }
636 
637  /// True if the ABI mandates (or the user requested) that this
638  /// function be in a unwind table.
639  bool hasUWTable() const {
640  return hasFnAttribute(Attribute::UWTable);
641  }
642  void setHasUWTable() {
643  addFnAttr(Attribute::UWTable);
644  }
645 
646  /// True if this function needs an unwind table.
647  bool needsUnwindTableEntry() const {
648  return hasUWTable() || !doesNotThrow() || hasPersonalityFn();
649  }
650 
651  /// Determine if the function returns a structure through first
652  /// or second pointer argument.
653  bool hasStructRetAttr() const {
654  return AttributeSets.hasParamAttr(0, Attribute::StructRet) ||
655  AttributeSets.hasParamAttr(1, Attribute::StructRet);
656  }
657 
658  /// Determine if the parameter or return value is marked with NoAlias
659  /// attribute.
660  bool returnDoesNotAlias() const {
661  return AttributeSets.hasRetAttr(Attribute::NoAlias);
662  }
663  void setReturnDoesNotAlias() { addRetAttr(Attribute::NoAlias); }
664 
665  /// Do not optimize this function (-O0).
666  bool hasOptNone() const { return hasFnAttribute(Attribute::OptimizeNone); }
667 
668  /// Optimize this function for minimum size (-Oz).
669  bool hasMinSize() const { return hasFnAttribute(Attribute::MinSize); }
670 
671  /// Optimize this function for size (-Os) or minimum size (-Oz).
672  bool hasOptSize() const {
673  return hasFnAttribute(Attribute::OptimizeForSize) || hasMinSize();
674  }
675 
676  /// Returns the denormal handling type for the default rounding mode of the
677  /// function.
678  DenormalMode getDenormalMode(const fltSemantics &FPType) const;
679 
680  /// copyAttributesFrom - copy all additional attributes (those not needed to
681  /// create a Function) from the Function Src to this one.
682  void copyAttributesFrom(const Function *Src);
683 
684  /// deleteBody - This method deletes the body of the function, and converts
685  /// the linkage to external.
686  ///
687  void deleteBody() {
688  dropAllReferences();
689  setLinkage(ExternalLinkage);
690  }
691 
692  /// removeFromParent - This method unlinks 'this' from the containing module,
693  /// but does not delete it.
694  ///
695  void removeFromParent();
696 
697  /// eraseFromParent - This method unlinks 'this' from the containing module
698  /// and deletes it.
699  ///
700  void eraseFromParent();
701 
702  /// Steal arguments from another function.
703  ///
704  /// Drop this function's arguments and splice in the ones from \c Src.
705  /// Requires that this has no function body.
706  void stealArgumentListFrom(Function &Src);
707 
708  /// Get the underlying elements of the Function... the basic block list is
709  /// empty for external functions.
710  ///
711  const BasicBlockListType &getBasicBlockList() const { return BasicBlocks; }
712  BasicBlockListType &getBasicBlockList() { return BasicBlocks; }
713 
715  return &Function::BasicBlocks;
716  }
717 
718  const BasicBlock &getEntryBlock() const { return front(); }
719  BasicBlock &getEntryBlock() { return front(); }
720 
721  //===--------------------------------------------------------------------===//
722  // Symbol Table Accessing functions...
723 
724  /// getSymbolTable() - Return the symbol table if any, otherwise nullptr.
725  ///
726  inline ValueSymbolTable *getValueSymbolTable() { return SymTab.get(); }
727  inline const ValueSymbolTable *getValueSymbolTable() const {
728  return SymTab.get();
729  }
730 
731  //===--------------------------------------------------------------------===//
732  // BasicBlock iterator forwarding functions
733  //
734  iterator begin() { return BasicBlocks.begin(); }
735  const_iterator begin() const { return BasicBlocks.begin(); }
736  iterator end () { return BasicBlocks.end(); }
737  const_iterator end () const { return BasicBlocks.end(); }
738 
739  size_t size() const { return BasicBlocks.size(); }
740  bool empty() const { return BasicBlocks.empty(); }
741  const BasicBlock &front() const { return BasicBlocks.front(); }
742  BasicBlock &front() { return BasicBlocks.front(); }
743  const BasicBlock &back() const { return BasicBlocks.back(); }
744  BasicBlock &back() { return BasicBlocks.back(); }
745 
746 /// @name Function Argument Iteration
747 /// @{
748 
750  CheckLazyArguments();
751  return Arguments;
752  }
754  CheckLazyArguments();
755  return Arguments;
756  }
757 
759  CheckLazyArguments();
760  return Arguments + NumArgs;
761  }
763  CheckLazyArguments();
764  return Arguments + NumArgs;
765  }
766 
767  Argument* getArg(unsigned i) const {
768  assert (i < NumArgs && "getArg() out of range!");
769  CheckLazyArguments();
770  return Arguments + i;
771  }
772 
774  return make_range(arg_begin(), arg_end());
775  }
777  return make_range(arg_begin(), arg_end());
778  }
779 
780 /// @}
781 
782  size_t arg_size() const { return NumArgs; }
783  bool arg_empty() const { return arg_size() == 0; }
784 
785  /// Check whether this function has a personality function.
786  bool hasPersonalityFn() const {
787  return getSubclassDataFromValue() & (1<<3);
788  }
789 
790  /// Get the personality function associated with this function.
791  Constant *getPersonalityFn() const;
792  void setPersonalityFn(Constant *Fn);
793 
794  /// Check whether this function has prefix data.
795  bool hasPrefixData() const {
796  return getSubclassDataFromValue() & (1<<1);
797  }
798 
799  /// Get the prefix data associated with this function.
800  Constant *getPrefixData() const;
801  void setPrefixData(Constant *PrefixData);
802 
803  /// Check whether this function has prologue data.
804  bool hasPrologueData() const {
805  return getSubclassDataFromValue() & (1<<2);
806  }
807 
808  /// Get the prologue data associated with this function.
809  Constant *getPrologueData() const;
810  void setPrologueData(Constant *PrologueData);
811 
812  /// Print the function to an output stream with an optional
813  /// AssemblyAnnotationWriter.
814  void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW = nullptr,
815  bool ShouldPreserveUseListOrder = false,
816  bool IsForDebug = false) const;
817 
818  /// viewCFG - This function is meant for use from the debugger. You can just
819  /// say 'call F->viewCFG()' and a ghostview window should pop up from the
820  /// program, displaying the CFG of the current function with the code for each
821  /// basic block inside. This depends on there being a 'dot' and 'gv' program
822  /// in your path.
823  ///
824  void viewCFG() const;
825 
826  /// Extended form to print edge weights.
827  void viewCFG(bool ViewCFGOnly, const BlockFrequencyInfo *BFI,
828  const BranchProbabilityInfo *BPI) const;
829 
830  /// viewCFGOnly - This function is meant for use from the debugger. It works
831  /// just like viewCFG, but it does not include the contents of basic blocks
832  /// into the nodes, just the label. If you are only interested in the CFG
833  /// this can make the graph smaller.
834  ///
835  void viewCFGOnly() const;
836 
837  /// Extended form to print edge weights.
838  void viewCFGOnly(const BlockFrequencyInfo *BFI,
839  const BranchProbabilityInfo *BPI) const;
840 
841  /// Methods for support type inquiry through isa, cast, and dyn_cast:
842  static bool classof(const Value *V) {
843  return V->getValueID() == Value::FunctionVal;
844  }
845 
846  /// dropAllReferences() - This method causes all the subinstructions to "let
847  /// go" of all references that they are maintaining. This allows one to
848  /// 'delete' a whole module at a time, even though there may be circular
849  /// references... first all references are dropped, and all use counts go to
850  /// zero. Then everything is deleted for real. Note that no operations are
851  /// valid on an object that has "dropped all references", except operator
852  /// delete.
853  ///
854  /// Since no other object in the module can have references into the body of a
855  /// function, dropping all references deletes the entire body of the function,
856  /// including any contained basic blocks.
857  ///
858  void dropAllReferences();
859 
860  /// hasAddressTaken - returns true if there are any uses of this function
861  /// other than direct calls or invokes to it, or blockaddress expressions.
862  /// Optionally passes back an offending user for diagnostic purposes,
863  /// ignores callback uses, assume like pointer annotation calls, references in
864  /// llvm.used and llvm.compiler.used variables, and operand bundle
865  /// "clang.arc.attachedcall".
866  bool hasAddressTaken(const User ** = nullptr,
867  bool IgnoreCallbackUses = false,
868  bool IgnoreAssumeLikeCalls = true,
869  bool IngoreLLVMUsed = false,
870  bool IgnoreARCAttachedCall = false) const;
871 
872  /// isDefTriviallyDead - Return true if it is trivially safe to remove
873  /// this function definition from the module (because it isn't externally
874  /// visible, does not have its address taken, and has no callers). To make
875  /// this more accurate, call removeDeadConstantUsers first.
876  bool isDefTriviallyDead() const;
877 
878  /// callsFunctionThatReturnsTwice - Return true if the function has a call to
879  /// setjmp or other function that gcc recognizes as "returning twice".
880  bool callsFunctionThatReturnsTwice() const;
881 
882  /// Set the attached subprogram.
883  ///
884  /// Calls \a setMetadata() with \a LLVMContext::MD_dbg.
885  void setSubprogram(DISubprogram *SP);
886 
887  /// Get the attached subprogram.
888  ///
889  /// Calls \a getMetadata() with \a LLVMContext::MD_dbg and casts the result
890  /// to \a DISubprogram.
891  DISubprogram *getSubprogram() const;
892 
893  /// Returns true if we should emit debug info for profiling.
894  bool isDebugInfoForProfiling() const;
895 
896  /// Check if null pointer dereferencing is considered undefined behavior for
897  /// the function.
898  /// Return value: false => null pointer dereference is undefined.
899  /// Return value: true => null pointer dereference is not undefined.
900  bool nullPointerIsDefined() const;
901 
902 private:
903  void allocHungoffUselist();
904  template<int Idx> void setHungoffOperand(Constant *C);
905 
906  /// Shadow Value::setValueSubclassData with a private forwarding method so
907  /// that subclasses cannot accidentally use it.
908  void setValueSubclassData(unsigned short D) {
910  }
911  void setValueSubclassDataBit(unsigned Bit, bool On);
912 };
913 
914 /// Check whether null pointer dereferencing is considered undefined behavior
915 /// for a given function or an address space.
916 /// Null pointer access in non-zero address space is not considered undefined.
917 /// Return value: false => null pointer dereference is undefined.
918 /// Return value: true => null pointer dereference is not undefined.
919 bool NullPointerIsDefined(const Function *F, unsigned AS = 0);
920 
921 template <>
923 
925 
926 } // end namespace llvm
927 
928 #endif // LLVM_IR_FUNCTION_H
i
i
Definition: README.txt:29
llvm::AttributeList::getParamInAllocaType
Type * getParamInAllocaType(unsigned ArgNo) const
Return the inalloca type for the specified function parameter.
Definition: Attributes.cpp:1430
llvm::Function::getBasicBlockList
BasicBlockListType & getBasicBlockList()
Definition: Function.h:712
llvm::objcarc::ARCInstKind::User
@ User
could "use" a pointer
llvm::Argument
This class represents an incoming formal argument to a Function.
Definition: Argument.h:29
llvm::Function::Create
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, const Twine &N="", Module *M=nullptr)
Definition: Function.h:146
llvm::Function::setOnlyAccessesInaccessibleMemOrArgMem
void setOnlyAccessesInaccessibleMemOrArgMem()
Definition: Function.h:551
Attrs
Function Attrs
Definition: README_ALTIVEC.txt:215
llvm::Function::isIntrinsic
bool isIntrinsic() const
isIntrinsic - Returns true if the function's name starts with "llvm.".
Definition: Function.h:212
llvm::Function::setNoSync
void setNoSync()
Definition: Function.h:613
llvm::Function::arg_empty
bool arg_empty() const
Definition: Function.h:783
LLVM_READONLY
#define LLVM_READONLY
Definition: Compiler.h:212
llvm
This file implements support for optimizing divisions by a constant.
Definition: AllocatorList.h:23
llvm::Function::args
iterator_range< arg_iterator > args()
Definition: Function.h:773
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::make_range
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Definition: iterator_range.h:53
print
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
Definition: ArchiveWriter.cpp:147
llvm::Function::end
iterator end()
Definition: Function.h:736
FunctionType
Definition: ItaniumDemangle.h:783
llvm::Function::hasOptNone
bool hasOptNone() const
Do not optimize this function (-O0).
Definition: Function.h:666
llvm::cl::Prefix
@ Prefix
Definition: CommandLine.h:164
llvm::Function::empty
bool empty() const
Definition: Function.h:740
llvm::Function::getBasicBlockList
const BasicBlockListType & getBasicBlockList() const
Get the underlying elements of the Function...
Definition: Function.h:711
llvm::Function::doesNoCfCheck
bool doesNoCfCheck() const
Determine if the function should not perform indirect branch tracking.
Definition: Function.h:564
llvm::Function
Definition: Function.h:62
llvm::Attribute
Definition: Attributes.h:52
StringRef.h
llvm::Function::getParamDereferenceableBytes
uint64_t getParamDereferenceableBytes(unsigned ArgNo) const
Extract the number of dereferenceable bytes for a parameter.
Definition: Function.h:489
llvm::AttributeList::getParamPreallocatedType
Type * getParamPreallocatedType(unsigned ArgNo) const
Return the preallocated type for the specified function parameter.
Definition: Attributes.cpp:1426
llvm::Function::getFnStackAlign
MaybeAlign getFnStackAlign() const
Return the stack alignment for the function.
Definition: Function.h:430
llvm::Function::getParamByValType
Type * getParamByValType(unsigned ArgNo) const
Extract the byval type for a parameter.
Definition: Function.h:463
llvm::Function::begin
const_iterator begin() const
Definition: Function.h:735
viewCFG
static void viewCFG(Function &F, const BlockFrequencyInfo *BFI, const BranchProbabilityInfo *BPI, uint64_t MaxFreq, bool CFGOnly=false)
Definition: CFGPrinter.cpp:84
llvm::Function::getEntryBlock
const BasicBlock & getEntryBlock() const
Definition: Function.h:718
llvm::AttributeList::getParamByValType
Type * getParamByValType(unsigned ArgNo) const
Return the byval type for the specified function parameter.
Definition: Attributes.cpp:1414
llvm::Function::setDoesNotThrow
void setDoesNotThrow()
Definition: Function.h:570
llvm::Function::setWillReturn
void setWillReturn()
Definition: Function.h:635
llvm::Function::arg_size
size_t arg_size() const
Definition: Function.h:782
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
llvm::AttributeList
Definition: Attributes.h:399
DEFINE_TRANSPARENT_OPERAND_ACCESSORS
#define DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CLASS, VALUECLASS)
Macro for generating out-of-class operand accessor definitions.
Definition: OperandTraits.h:125
llvm::Function::front
BasicBlock & front()
Definition: Function.h:742
llvm::Optional
Definition: APInt.h:33
GlobalObject.h
llvm::Function::setCannotDuplicate
void setCannotDuplicate()
Definition: Function.h:578
llvm::MCID::Convergent
@ Convergent
Definition: MCInstrDesc.h:182
llvm::Function::ProfileCount::isSynthetic
bool isSynthetic() const
Definition: Function.h:268
llvm::GlobalValue::LinkageTypes
LinkageTypes
An enumeration for the kinds of linkage for global values.
Definition: GlobalValue.h:47
llvm::Value::setValueSubclassData
void setValueSubclassData(unsigned short D)
Definition: Value.h:848
llvm::BitmaskEnumDetail::Mask
std::underlying_type_t< E > Mask()
Get a bitmask with 1s in all places up to the high-order bit of E's largest value.
Definition: BitmaskEnum.h:80
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::BasicBlock
LLVM Basic Block Representation.
Definition: BasicBlock.h:58
llvm::AttributeList::getParamDereferenceableBytes
uint64_t getParamDereferenceableBytes(unsigned Index) const
Get the number of dereferenceable bytes (or zero if unknown) of an arg.
Definition: Attributes.cpp:1450
llvm::Function::setOnlyAccessesArgMemory
void setOnlyAccessesArgMemory()
Definition: Function.h:535
llvm::AttributeList::getParamStackAlignment
MaybeAlign getParamStackAlignment(unsigned ArgNo) const
Return the stack alignment for the specified function parameter.
Definition: Attributes.cpp:1410
llvm::Function::setConvergent
void setConvergent()
Definition: Function.h:586
llvm::Function::hasUWTable
bool hasUWTable() const
True if the ABI mandates (or the user requested) that this function be in a unwind table.
Definition: Function.h:639
llvm::BlockFrequencyInfo
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
Definition: BlockFrequencyInfo.h:37
llvm::Function::getSublistAccess
static BasicBlockListType Function::* getSublistAccess(BasicBlock *)
Definition: Function.h:714
GlobalValue.h
llvm::OperandTraits
Compile-time customization of User operands.
Definition: User.h:42
llvm::Function::end
const_iterator end() const
Definition: Function.h:737
llvm::Function::ProfileCount::ProfileCount
ProfileCount()
Definition: Function.h:262
llvm::ISD::Constant
@ Constant
Definition: ISDOpcodes.h:76
llvm::Function::getEntryBlock
BasicBlock & getEntryBlock()
Definition: Function.h:719
llvm::User
Definition: User.h:44
llvm::Function::onlyAccessesInaccessibleMemory
bool onlyAccessesInaccessibleMemory() const
Determine if the function may only access memory that is inaccessible from the IR.
Definition: Function.h:539
C
(vector float) vec_cmpeq(*A, *B) C
Definition: README_ALTIVEC.txt:86
llvm::AttributeList::getParamDereferenceableOrNullBytes
uint64_t getParamDereferenceableOrNullBytes(unsigned ArgNo) const
Get the number of dereferenceable_or_null bytes (or zero if unknown) of an arg.
Definition: Attributes.cpp:1459
Twine.h
llvm::GlobalObject
Definition: GlobalObject.h:28
llvm::Function::ProfileCount::operator!
bool operator!() const
Definition: Function.h:270
llvm::BranchProbabilityInfo
Analysis providing branch probability information.
Definition: BranchProbabilityInfo.h:115
llvm::Function::setSpeculatable
void setSpeculatable()
Definition: Function.h:597
llvm::Function::back
BasicBlock & back()
Definition: Function.h:744
DenseSet.h
llvm::Function::cannotDuplicate
bool cannotDuplicate() const
Determine if the call cannot be duplicated.
Definition: Function.h:575
llvm::MaybeAlign
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition: Alignment.h:109
llvm::Function::arg_end
arg_iterator arg_end()
Definition: Function.h:758
llvm::Value::getValueID
unsigned getValueID() const
Return an ID for the concrete type of this object.
Definition: Value.h:532
llvm::Function::ProfileCount::ProfileCount
ProfileCount(uint64_t Count, ProfileCountType PCT)
Definition: Function.h:263
llvm::Function::setDoesNotRecurse
void setDoesNotRecurse()
Definition: Function.h:622
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:53
llvm::Function::hasPersonalityFn
bool hasPersonalityFn() const
Check whether this function has a personality function.
Definition: Function.h:786
OperandTraits.h
llvm::Function::isSpeculatable
bool isSpeculatable() const
Determine if the call has sideeffects.
Definition: Function.h:594
llvm::Function::isMaterializable
bool isMaterializable() const
Definition: Function.h:192
llvm::Function::doesNotAccessMemory
bool doesNotAccessMemory() const
Determine if the function does not access memory.
Definition: Function.h:507
llvm::lltok::Kind
Kind
Definition: LLToken.h:18
llvm::Function::getParamInAllocaType
Type * getParamInAllocaType(unsigned ArgNo) const
Extract the inalloca type for a parameter.
Definition: Function.h:473
llvm::Function::getValueSymbolTable
const ValueSymbolTable * getValueSymbolTable() const
Definition: Function.h:727
llvm::CallingConv::ID
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition: CallingConv.h:24
llvm::codeview::ClassOptions::Intrinsic
@ Intrinsic
llvm::Function::hasPrologueData
bool hasPrologueData() const
Check whether this function has prologue data.
Definition: Function.h:804
llvm::Function::getAttributes
AttributeList getAttributes() const
Return the attribute list for this Function.
Definition: Function.h:327
llvm::DenseSet
Implements a dense probed hash-table based set.
Definition: DenseSet.h:268
BasicBlock.h
llvm::ProfileCount
Function::ProfileCount ProfileCount
Definition: SampleProfileLoaderBaseImpl.h:46
llvm::Function::setDoesNotFreeMemory
void setDoesNotFreeMemory()
Definition: Function.h:605
llvm::Constant
This is an important base class in LLVM.
Definition: Constant.h:41
llvm::CallingConv::MaxID
@ MaxID
The highest possible calling convention ID. Must be some 2^k - 1.
Definition: CallingConv.h:256
llvm::Function::getReturnType
Type * getReturnType() const
Returns the type of the ret val.
Definition: Function.h:182
llvm::Function::willReturn
bool willReturn() const
Determine if the function will return.
Definition: Function.h:634
llvm::SymbolTableListTraits
Definition: GlobalAlias.h:26
uint64_t
llvm::Function::hasPrefixData
bool hasPrefixData() const
Check whether this function has prefix data.
Definition: Function.h:795
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
llvm::Function::getCallingConv
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
Definition: Function.h:240
const
aarch64 promote const
Definition: AArch64PromoteConstant.cpp:232
LLVM_EXTERNAL_VISIBILITY
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:132
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:319
llvm::Function::setDoesNotAccessMemory
void setDoesNotAccessMemory()
Definition: Function.h:510
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:68
llvm::Function::setDoesNotReadMemory
void setDoesNotReadMemory()
Definition: Function.h:526
llvm::AttrBuilder
Definition: Attributes.h:931
llvm::Function::args
iterator_range< const_arg_iterator > args() const
Definition: Function.h:776
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::Function::setMustProgress
void setMustProgress()
Definition: Function.h:631
llvm::Function::getParamPreallocatedType
Type * getParamPreallocatedType(unsigned ArgNo) const
Extract the preallocated type for a parameter.
Definition: Function.h:483
llvm::AttributeList::getParamAlignment
MaybeAlign getParamAlignment(unsigned ArgNo) const
Return the alignment for the specified function parameter.
Definition: Attributes.cpp:1406
llvm::Function::hasStructRetAttr
bool hasStructRetAttr() const
Determine if the function returns a structure through first or second pointer argument.
Definition: Function.h:653
TemplateParamKind::Type
@ Type
llvm::Function::onlyAccessesInaccessibleMemOrArgMem
bool onlyAccessesInaccessibleMemOrArgMem() const
Determine if the function may only access memory that is either inaccessible from the IR or pointed t...
Definition: Function.h:548
llvm::Function::Create
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
Definition: Function.h:139
llvm::Function::ProfileCountType
ProfileCountType
Definition: Function.h:250
llvm::SmallVectorImpl::const_iterator
typename SuperClass::const_iterator const_iterator
Definition: SmallVector.h:563
assert
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
iterator_range.h
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:67
llvm::Function::doesNotRecurse
bool doesNotRecurse() const
Determine if the function is known not to recurse, directly or indirectly.
Definition: Function.h:619
llvm::Function::getFunction
const Function & getFunction() const
Definition: Function.h:137
llvm::Function::classof
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition: Function.h:842
llvm::Function::getIntrinsicID
Intrinsic::ID getIntrinsicID() const LLVM_READONLY
getIntrinsicID - This method returns the ID number of the specified function, or Intrinsic::not_intri...
Definition: Function.h:207
llvm::Function::isConvergent
bool isConvergent() const
Determine if the call is convergent.
Definition: Function.h:583
llvm::SymbolTableList< BasicBlock >
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:58
llvm::Function::setCallingConv
void setCallingConv(CallingConv::ID CC)
Definition: Function.h:244
Compiler.h
llvm::AttributeList::getParamByRefType
Type * getParamByRefType(unsigned ArgNo) const
Return the byref type for the specified function parameter.
Definition: Attributes.cpp:1422
llvm::Function::getParamAlign
MaybeAlign getParamAlign(unsigned ArgNo) const
Definition: Function.h:454
llvm::Function::ProfileCount::getType
ProfileCountType getType() const
Definition: Function.h:267
Module
Machine Check Debug Module
Definition: MachineCheckDebugify.cpp:122
llvm::AMDGPUISD::BFI
@ BFI
Definition: AMDGPUISelLowering.h:421
llvm::Function::setOnlyReadsMemory
void setOnlyReadsMemory()
Definition: Function.h:518
llvm::Function::setIsMaterializable
void setIsMaterializable(bool V)
Definition: Function.h:195
llvm::Function::begin
iterator begin()
Definition: Function.h:734
llvm::Function::doesNotFreeMemory
bool doesNotFreeMemory() const
Determine if the call might deallocate memory.
Definition: Function.h:602
llvm::ilist_node
Definition: ilist_node.h:148
llvm::Function::hasOptSize
bool hasOptSize() const
Optimize this function for size (-Os) or minimum size (-Oz).
Definition: Function.h:672
llvm::Function::ProfileCount::getCount
uint64_t getCount() const
Definition: Function.h:266
llvm::cl::Optional
@ Optional
Definition: CommandLine.h:119
Argument.h
llvm::Function::returnDoesNotAlias
bool returnDoesNotAlias() const
Determine if the parameter or return value is marked with NoAlias attribute.
Definition: Function.h:660
CallingConv.h
llvm::Function::doesNotThrow
bool doesNotThrow() const
Determine if the function cannot unwind.
Definition: Function.h:567
Attributes.h
llvm::Function::hasLazyArguments
bool hasLazyArguments() const
hasLazyArguments/CheckLazyArguments - The argument list of a function is built on demand,...
Definition: Function.h:108
llvm::Function::getParamAlignment
uint64_t getParamAlignment(unsigned ArgNo) const
Extract the alignment for a call or parameter (0=unknown).
Definition: Function.h:448
llvm::Function::ProfileCount::setCount
ProfileCount & setCount(uint64_t C)
Definition: Function.h:272
llvm::Twine
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:83
llvm::Function::getValueSymbolTable
ValueSymbolTable * getValueSymbolTable()
getSymbolTable() - Return the symbol table if any, otherwise nullptr.
Definition: Function.h:726
llvm::GraphProgram::Name
Name
Definition: GraphWriter.h:52
llvm::AssemblyAnnotationWriter
Definition: AssemblyAnnotationWriter.h:27
llvm::Function::getArg
Argument * getArg(unsigned i) const
Definition: Function.h:767
llvm::Function::back
const BasicBlock & back() const
Definition: Function.h:743
llvm::Function::getParamDereferenceableOrNullBytes
uint64_t getParamDereferenceableOrNullBytes(unsigned ArgNo) const
Extract the number of dereferenceable_or_null bytes for a parameter.
Definition: Function.h:496
llvm::AttributeList::getParamStructRetType
Type * getParamStructRetType(unsigned ArgNo) const
Return the sret type for the specified function parameter.
Definition: Attributes.cpp:1418
Casting.h
llvm::fltSemantics
Definition: APFloat.cpp:54
llvm::Function::needsUnwindTableEntry
bool needsUnwindTableEntry() const
True if this function needs an unwind table.
Definition: Function.h:647
Arguments
AMDGPU Lower Kernel Arguments
Definition: AMDGPULowerKernelArguments.cpp:243
llvm::Function::getFunctionType
FunctionType * getFunctionType() const
Returns the FunctionType for me.
Definition: Function.h:177
llvm::Function::hasProfileData
bool hasProfileData(bool IncludeSynthetic=false) const
Return true if the function is annotated with profile data.
Definition: Function.h:303
llvm::Function::onlyAccessesArgMemory
bool onlyAccessesArgMemory() const
Determine if the call can access memmory only using pointers based on its arguments.
Definition: Function.h:532
llvm::Function::doesNotReadMemory
bool doesNotReadMemory() const
Determine if the function does not access or only writes memory.
Definition: Function.h:523
llvm::Function::ProfileCount::getInvalid
static ProfileCount getInvalid()
Definition: Function.h:276
llvm::Function::setNotConvergent
void setNotConvergent()
Definition: Function.h:589
llvm::Function::mustProgress
bool mustProgress() const
Determine if the function is required to make forward progress.
Definition: Function.h:627
llvm::Function::getParamStackAlign
MaybeAlign getParamStackAlign(unsigned ArgNo) const
Definition: Function.h:458
llvm::Function::arg_begin
arg_iterator arg_begin()
Definition: Function.h:749
llvm::Function::deleteBody
void deleteBody()
deleteBody - This method deletes the body of the function, and converts the linkage to external.
Definition: Function.h:687
llvm::Function::getParamByRefType
Type * getParamByRefType(unsigned ArgNo) const
Extract the byref type for a parameter.
Definition: Function.h:478
llvm::Function::front
const BasicBlock & front() const
Definition: Function.h:741
DECLARE_TRANSPARENT_OPERAND_ACCESSORS
#define DECLARE_TRANSPARENT_OPERAND_ACCESSORS(VALUECLASS)
Macro for generating in-class operand accessor declarations.
Definition: OperandTraits.h:110
llvm::Function::isVarArg
bool isVarArg() const
isVarArg - Return true if this function takes a variable number of arguments.
Definition: Function.h:190
llvm::Function::arg_end
const_arg_iterator arg_end() const
Definition: Function.h:762
llvm::ValueSymbolTable
This class provides a symbol table of name/value pairs.
Definition: ValueSymbolTable.h:37
llvm::SmallVectorImpl::iterator
typename SuperClass::iterator iterator
Definition: SmallVector.h:562
llvm::Function::setHasUWTable
void setHasUWTable()
Definition: Function.h:642
N
#define N
llvm::AttributeList::hasRetAttr
bool hasRetAttr(Attribute::AttrKind Kind) const
Return true if the attribute exists for the return value.
Definition: Attributes.h:737
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition: iterator_range.h:30
llvm::tgtok::Bit
@ Bit
Definition: TGLexer.h:50
getSubprogram
static DISubprogram * getSubprogram(bool IsDistinct, Ts &&... Args)
Definition: DIBuilder.cpp:821
llvm::Function::setDoesNotReturn
void setDoesNotReturn()
Definition: Function.h:559
llvm::Function::doesNotReturn
bool doesNotReturn() const
Determine if the function cannot return.
Definition: Function.h:556
llvm::Function::onlyReadsMemory
bool onlyReadsMemory() const
Determine if the function does not access or only reads memory.
Definition: Function.h:515
ilist_node.h
llvm::DISubprogram
Subprogram description.
Definition: DebugInfoMetadata.h:1820
llvm::Function::hasMinSize
bool hasMinSize() const
Optimize this function for minimum size (-Oz).
Definition: Function.h:669
DerivedTypes.h
llvm::Function::setOnlyAccessesInaccessibleMemory
void setOnlyAccessesInaccessibleMemory()
Definition: Function.h:542
llvm::Function::hasNoSync
bool hasNoSync() const
Determine if the call can synchroize with other threads.
Definition: Function.h:610
llvm::Function::ProfileCount
Class to represent profile counts.
Definition: Function.h:255
llvm::HungoffOperandTraits
HungoffOperandTraits - determine the allocation regime of the Use array when it is not a prefix to th...
Definition: OperandTraits.h:95
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:1965
llvm::Function::ProfileCount::hasValue
bool hasValue() const
Definition: Function.h:265
llvm::Function::arg_begin
const_arg_iterator arg_begin() const
Definition: Function.h:753
llvm::AttributeList::hasParamAttr
bool hasParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Return true if the attribute exists for the given argument.
Definition: Attributes.h:722
SymbolTableListTraits.h
Value.h
llvm::Function::getParamStructRetType
Type * getParamStructRetType(unsigned ArgNo) const
Extract the sret type for a parameter.
Definition: Function.h:468
llvm::Function::setAttributes
void setAttributes(AttributeList Attrs)
Set the attribute list for this Function.
Definition: Function.h:330
llvm::Value
LLVM Value Representation.
Definition: Value.h:74
llvm::Function::isPresplitCoroutine
bool isPresplitCoroutine() const
A function will have the "coroutine.presplit" attribute if it's a coroutine and has not gone through ...
Definition: Function.h:502
llvm::Function::const_iterator
BasicBlockListType::const_iterator const_iterator
Definition: Function.h:69
llvm::Function::setReturnDoesNotAlias
void setReturnDoesNotAlias()
Definition: Function.h:663
llvm::FunctionType
Class to represent function types.
Definition: DerivedTypes.h:103
llvm::Function::size
size_t size() const
Definition: Function.h:739
llvm::AttributeList::getFnStackAlignment
MaybeAlign getFnStackAlignment() const
Get the stack alignment of the function.
Definition: Attributes.cpp:1438
llvm::Function::iterator
BasicBlockListType::iterator iterator
Definition: Function.h:68
llvm::Intrinsic::ID
unsigned ID
Definition: TargetTransformInfo.h:37