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