LLVM 19.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"
31#include "llvm/IR/GlobalValue.h"
34#include "llvm/IR/Value.h"
35#include <cassert>
36#include <cstddef>
37#include <cstdint>
38#include <memory>
39#include <string>
40
41namespace llvm {
42
43namespace Intrinsic {
44typedef unsigned ID;
45}
46
47class AssemblyAnnotationWriter;
48class Constant;
49class ConstantRange;
50struct DenormalMode;
51class DISubprogram;
52enum LibFunc : unsigned;
53class LLVMContext;
54class Module;
55class raw_ostream;
56class TargetLibraryInfoImpl;
57class Type;
58class User;
59class BranchProbabilityInfo;
60class BlockFrequencyInfo;
61
63 public ilist_node<Function> {
64public:
66
67 // BasicBlock iterators...
70
73
74private:
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
101 friend class SymbolTableListTraits<Function>;
102
103public:
104 /// Is this function using intrinsics to record the position of debugging
105 /// information, or non-intrinsic records? See IsNewDbgInfoFormat in
106 /// \ref BasicBlock.
108
109 /// hasLazyArguments/CheckLazyArguments - The argument list of a function is
110 /// built on demand, so that the list isn't allocated until the first client
111 /// needs it. The hasLazyArguments predicate returns true if the arg list
112 /// hasn't been set up yet.
113 bool hasLazyArguments() const {
114 return getSubclassDataFromValue() & (1<<0);
115 }
116
117 /// \see BasicBlock::convertToNewDbgValues.
118 void convertToNewDbgValues();
119
120 /// \see BasicBlock::convertFromNewDbgValues.
121 void convertFromNewDbgValues();
122
123 void setIsNewDbgInfoFormat(bool NewVal);
124 void setNewDbgInfoFormatFlag(bool NewVal);
125
126private:
128
129 static constexpr LibFunc UnknownLibFunc = LibFunc(-1);
130
131 /// Cache for TLI::getLibFunc() result without prototype validation.
132 /// UnknownLibFunc if uninitialized. NotLibFunc if definitely not lib func.
133 /// Otherwise may be libfunc if prototype validation passes.
134 mutable LibFunc LibFuncCache = UnknownLibFunc;
135
136 void CheckLazyArguments() const {
137 if (hasLazyArguments())
138 BuildLazyArguments();
139 }
140
141 void BuildLazyArguments() const;
142
143 void clearArguments();
144
145 void deleteBodyImpl(bool ShouldDrop);
146
147 /// Function ctor - If the (optional) Module argument is specified, the
148 /// function is automatically inserted into the end of the function list for
149 /// the module.
150 ///
151 Function(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace,
152 const Twine &N = "", Module *M = nullptr);
153
154public:
155 Function(const Function&) = delete;
156 void operator=(const Function&) = delete;
157 ~Function();
158
159 // This is here to help easily convert from FunctionT * (Function * or
160 // MachineFunction *) in BlockFrequencyInfoImpl to Function * by calling
161 // FunctionT->getFunction().
162 const Function &getFunction() const { return *this; }
163
165 unsigned AddrSpace, const Twine &N = "",
166 Module *M = nullptr) {
167 return new Function(Ty, Linkage, AddrSpace, N, M);
168 }
169
170 // TODO: remove this once all users have been updated to pass an AddrSpace
172 const Twine &N = "", Module *M = nullptr) {
173 return new Function(Ty, Linkage, static_cast<unsigned>(-1), N, M);
174 }
175
176 /// Creates a new function and attaches it to a module.
177 ///
178 /// Places the function in the program address space as specified
179 /// by the module's data layout.
180 static Function *Create(FunctionType *Ty, LinkageTypes Linkage,
181 const Twine &N, Module &M);
182
183 /// Creates a function with some attributes recorded in llvm.module.flags
184 /// applied.
185 ///
186 /// Use this when synthesizing new functions that need attributes that would
187 /// have been set by command line options.
188 static Function *createWithDefaultAttr(FunctionType *Ty, LinkageTypes Linkage,
189 unsigned AddrSpace,
190 const Twine &N = "",
191 Module *M = nullptr);
192
193 // Provide fast operand accessors.
195
196 /// Returns the number of non-debug IR instructions in this function.
197 /// This is equivalent to the sum of the sizes of each basic block contained
198 /// within this function.
199 unsigned getInstructionCount() const;
200
201 /// Returns the FunctionType for me.
203 return cast<FunctionType>(getValueType());
204 }
205
206 /// Returns the type of the ret val.
207 Type *getReturnType() const { return getFunctionType()->getReturnType(); }
208
209 /// getContext - Return a reference to the LLVMContext associated with this
210 /// function.
211 LLVMContext &getContext() const;
212
213 /// isVarArg - Return true if this function takes a variable number of
214 /// arguments.
215 bool isVarArg() const { return getFunctionType()->isVarArg(); }
216
217 bool isMaterializable() const {
218 return getGlobalObjectSubClassData() & (1 << IsMaterializableBit);
219 }
220 void setIsMaterializable(bool V) {
221 unsigned Mask = 1 << IsMaterializableBit;
222 setGlobalObjectSubClassData((~Mask & getGlobalObjectSubClassData()) |
223 (V ? Mask : 0u));
224 }
225
226 /// getIntrinsicID - This method returns the ID number of the specified
227 /// function, or Intrinsic::not_intrinsic if the function is not an
228 /// intrinsic, or if the pointer is null. This value is always defined to be
229 /// zero to allow easy checking for whether a function is intrinsic or not.
230 /// The particular intrinsic functions which correspond to this value are
231 /// defined in llvm/Intrinsics.h.
233
234 /// isIntrinsic - Returns true if the function's name starts with "llvm.".
235 /// It's possible for this function to return true while getIntrinsicID()
236 /// returns Intrinsic::not_intrinsic!
237 bool isIntrinsic() const { return HasLLVMReservedName; }
238
239 /// isTargetIntrinsic - Returns true if IID is an intrinsic specific to a
240 /// certain target. If it is a generic intrinsic false is returned.
241 static bool isTargetIntrinsic(Intrinsic::ID IID);
242
243 /// isTargetIntrinsic - Returns true if this function is an intrinsic and the
244 /// intrinsic is specific to a certain target. If this is not an intrinsic
245 /// or a generic intrinsic, false is returned.
246 bool isTargetIntrinsic() const;
247
248 /// Returns true if the function is one of the "Constrained Floating-Point
249 /// Intrinsics". Returns false if not, and returns false when
250 /// getIntrinsicID() returns Intrinsic::not_intrinsic.
251 bool isConstrainedFPIntrinsic() const;
252
253 static Intrinsic::ID lookupIntrinsicID(StringRef Name);
254
255 /// Update internal caches that depend on the function name (such as the
256 /// intrinsic ID and libcall cache).
257 /// Note, this method does not need to be called directly, as it is called
258 /// from Value::setName() whenever the name of this function changes.
259 void updateAfterNameChange();
260
261 /// getCallingConv()/setCallingConv(CC) - These method get and set the
262 /// calling convention of this function. The enum values for the known
263 /// calling conventions are defined in CallingConv.h.
265 return static_cast<CallingConv::ID>((getSubclassDataFromValue() >> 4) &
266 CallingConv::MaxID);
267 }
269 auto ID = static_cast<unsigned>(CC);
270 assert(!(ID & ~CallingConv::MaxID) && "Unsupported calling convention");
271 setValueSubclassData((getSubclassDataFromValue() & 0xc00f) | (ID << 4));
272 }
273
274 enum ProfileCountType { PCT_Real, PCT_Synthetic };
275
276 /// Class to represent profile counts.
277 ///
278 /// This class represents both real and synthetic profile counts.
280 private:
281 uint64_t Count = 0;
282 ProfileCountType PCT = PCT_Real;
283
284 public:
286 : Count(Count), PCT(PCT) {}
287 uint64_t getCount() const { return Count; }
288 ProfileCountType getType() const { return PCT; }
289 bool isSynthetic() const { return PCT == PCT_Synthetic; }
290 };
291
292 /// Set the entry count for this function.
293 ///
294 /// Entry count is the number of times this function was executed based on
295 /// pgo data. \p Imports points to a set of GUIDs that needs to
296 /// be imported by the function for sample PGO, to enable the same inlines as
297 /// the profiled optimized binary.
298 void setEntryCount(ProfileCount Count,
299 const DenseSet<GlobalValue::GUID> *Imports = nullptr);
300
301 /// A convenience wrapper for setting entry count
302 void setEntryCount(uint64_t Count, ProfileCountType Type = PCT_Real,
303 const DenseSet<GlobalValue::GUID> *Imports = nullptr);
304
305 /// Get the entry count for this function.
306 ///
307 /// Entry count is the number of times the function was executed.
308 /// When AllowSynthetic is false, only pgo_data will be returned.
309 std::optional<ProfileCount> getEntryCount(bool AllowSynthetic = false) const;
310
311 /// Return true if the function is annotated with profile data.
312 ///
313 /// Presence of entry counts from a profile run implies the function has
314 /// profile annotations. If IncludeSynthetic is false, only return true
315 /// when the profile data is real.
316 bool hasProfileData(bool IncludeSynthetic = false) const {
317 return getEntryCount(IncludeSynthetic).has_value();
318 }
319
320 /// Returns the set of GUIDs that needs to be imported to the function for
321 /// sample PGO, to enable the same inlines as the profiled optimized binary.
322 DenseSet<GlobalValue::GUID> getImportGUIDs() const;
323
324 /// Set the section prefix for this function.
325 void setSectionPrefix(StringRef Prefix);
326
327 /// Get the section prefix for this function.
328 std::optional<StringRef> getSectionPrefix() const;
329
330 /// hasGC/getGC/setGC/clearGC - The name of the garbage collection algorithm
331 /// to use during code generation.
332 bool hasGC() const {
333 return getSubclassDataFromValue() & (1<<14);
334 }
335 const std::string &getGC() const;
336 void setGC(std::string Str);
337 void clearGC();
338
339 /// Return the attribute list for this Function.
340 AttributeList getAttributes() const { return AttributeSets; }
341
342 /// Set the attribute list for this Function.
343 void setAttributes(AttributeList Attrs) { AttributeSets = Attrs; }
344
345 // TODO: remove non-AtIndex versions of these methods.
346 /// adds the attribute to the list of attributes.
347 void addAttributeAtIndex(unsigned i, Attribute Attr);
348
349 /// Add function attributes to this function.
350 void addFnAttr(Attribute::AttrKind Kind);
351
352 /// Add function attributes to this function.
353 void addFnAttr(StringRef Kind, StringRef Val = StringRef());
354
355 /// Add function attributes to this function.
356 void addFnAttr(Attribute Attr);
357
358 /// Add function attributes to this function.
359 void addFnAttrs(const AttrBuilder &Attrs);
360
361 /// Add return value attributes to this function.
362 void addRetAttr(Attribute::AttrKind Kind);
363
364 /// Add return value attributes to this function.
365 void addRetAttr(Attribute Attr);
366
367 /// Add return value attributes to this function.
368 void addRetAttrs(const AttrBuilder &Attrs);
369
370 /// adds the attribute to the list of attributes for the given arg.
371 void addParamAttr(unsigned ArgNo, Attribute::AttrKind Kind);
372
373 /// adds the attribute to the list of attributes for the given arg.
374 void addParamAttr(unsigned ArgNo, Attribute Attr);
375
376 /// adds the attributes to the list of attributes for the given arg.
377 void addParamAttrs(unsigned ArgNo, const AttrBuilder &Attrs);
378
379 /// removes the attribute from the list of attributes.
380 void removeAttributeAtIndex(unsigned i, Attribute::AttrKind Kind);
381
382 /// removes the attribute from the list of attributes.
383 void removeAttributeAtIndex(unsigned i, StringRef Kind);
384
385 /// Remove function attributes from this function.
386 void removeFnAttr(Attribute::AttrKind Kind);
387
388 /// Remove function attribute from this function.
389 void removeFnAttr(StringRef Kind);
390
391 void removeFnAttrs(const AttributeMask &Attrs);
392
393 /// removes the attribute from the return value list of attributes.
394 void removeRetAttr(Attribute::AttrKind Kind);
395
396 /// removes the attribute from the return value list of attributes.
397 void removeRetAttr(StringRef Kind);
398
399 /// removes the attributes from the return value list of attributes.
400 void removeRetAttrs(const AttributeMask &Attrs);
401
402 /// removes the attribute from the list of attributes.
403 void removeParamAttr(unsigned ArgNo, Attribute::AttrKind Kind);
404
405 /// removes the attribute from the list of attributes.
406 void removeParamAttr(unsigned ArgNo, StringRef Kind);
407
408 /// removes the attribute from the list of attributes.
409 void removeParamAttrs(unsigned ArgNo, const AttributeMask &Attrs);
410
411 /// Return true if the function has the attribute.
412 bool hasFnAttribute(Attribute::AttrKind Kind) const;
413
414 /// Return true if the function has the attribute.
415 bool hasFnAttribute(StringRef Kind) const;
416
417 /// check if an attribute is in the list of attributes for the return value.
418 bool hasRetAttribute(Attribute::AttrKind Kind) const;
419
420 /// check if an attributes is in the list of attributes.
421 bool hasParamAttribute(unsigned ArgNo, Attribute::AttrKind Kind) const;
422
423 /// gets the attribute from the list of attributes.
424 Attribute getAttributeAtIndex(unsigned i, Attribute::AttrKind Kind) const;
425
426 /// gets the attribute from the list of attributes.
427 Attribute getAttributeAtIndex(unsigned i, StringRef Kind) const;
428
429 /// Return the attribute for the given attribute kind.
430 Attribute getFnAttribute(Attribute::AttrKind Kind) const;
431
432 /// Return the attribute for the given attribute kind.
433 Attribute getFnAttribute(StringRef Kind) const;
434
435 /// Return the attribute for the given attribute kind for the return value.
436 Attribute getRetAttribute(Attribute::AttrKind Kind) const;
437
438 /// For a string attribute \p Kind, parse attribute as an integer.
439 ///
440 /// \returns \p Default if attribute is not present.
441 ///
442 /// \returns \p Default if there is an error parsing the attribute integer,
443 /// and error is emitted to the LLVMContext
444 uint64_t getFnAttributeAsParsedInteger(StringRef Kind,
445 uint64_t Default = 0) const;
446
447 /// gets the specified attribute from the list of attributes.
448 Attribute getParamAttribute(unsigned ArgNo, Attribute::AttrKind Kind) const;
449
450 /// Return the stack alignment for the function.
452 return AttributeSets.getFnStackAlignment();
453 }
454
455 /// Returns true if the function has ssp, sspstrong, or sspreq fn attrs.
456 bool hasStackProtectorFnAttr() const;
457
458 /// adds the dereferenceable attribute to the list of attributes for
459 /// the given arg.
460 void addDereferenceableParamAttr(unsigned ArgNo, uint64_t Bytes);
461
462 /// adds the dereferenceable_or_null attribute to the list of
463 /// attributes for the given arg.
464 void addDereferenceableOrNullParamAttr(unsigned ArgNo, uint64_t Bytes);
465
466 /// adds the range attribute to the list of attributes for the return value.
467 void addRangeRetAttr(const ConstantRange &CR);
468
469 MaybeAlign getParamAlign(unsigned ArgNo) const {
470 return AttributeSets.getParamAlignment(ArgNo);
471 }
472
473 MaybeAlign getParamStackAlign(unsigned ArgNo) const {
474 return AttributeSets.getParamStackAlignment(ArgNo);
475 }
476
477 /// Extract the byval type for a parameter.
478 Type *getParamByValType(unsigned ArgNo) const {
479 return AttributeSets.getParamByValType(ArgNo);
480 }
481
482 /// Extract the sret type for a parameter.
483 Type *getParamStructRetType(unsigned ArgNo) const {
484 return AttributeSets.getParamStructRetType(ArgNo);
485 }
486
487 /// Extract the inalloca type for a parameter.
488 Type *getParamInAllocaType(unsigned ArgNo) const {
489 return AttributeSets.getParamInAllocaType(ArgNo);
490 }
491
492 /// Extract the byref type for a parameter.
493 Type *getParamByRefType(unsigned ArgNo) const {
494 return AttributeSets.getParamByRefType(ArgNo);
495 }
496
497 /// Extract the preallocated type for a parameter.
498 Type *getParamPreallocatedType(unsigned ArgNo) const {
499 return AttributeSets.getParamPreallocatedType(ArgNo);
500 }
501
502 /// Extract the number of dereferenceable bytes for a parameter.
503 /// @param ArgNo Index of an argument, with 0 being the first function arg.
505 return AttributeSets.getParamDereferenceableBytes(ArgNo);
506 }
507
508 /// Extract the number of dereferenceable_or_null bytes for a
509 /// parameter.
510 /// @param ArgNo AttributeList ArgNo, referring to an argument.
512 return AttributeSets.getParamDereferenceableOrNullBytes(ArgNo);
513 }
514
515 /// Extract the nofpclass attribute for a parameter.
516 FPClassTest getParamNoFPClass(unsigned ArgNo) const {
517 return AttributeSets.getParamNoFPClass(ArgNo);
518 }
519
520 /// Determine if the function is presplit coroutine.
521 bool isPresplitCoroutine() const {
522 return hasFnAttribute(Attribute::PresplitCoroutine);
523 }
524 void setPresplitCoroutine() { addFnAttr(Attribute::PresplitCoroutine); }
525 void setSplittedCoroutine() { removeFnAttr(Attribute::PresplitCoroutine); }
526
528 return hasFnAttribute(Attribute::CoroDestroyOnlyWhenComplete);
529 }
531 addFnAttr(Attribute::CoroDestroyOnlyWhenComplete);
532 }
533
534 MemoryEffects getMemoryEffects() const;
535 void setMemoryEffects(MemoryEffects ME);
536
537 /// Determine if the function does not access memory.
538 bool doesNotAccessMemory() const;
540
541 /// Determine if the function does not access or only reads memory.
542 bool onlyReadsMemory() const;
543 void setOnlyReadsMemory();
544
545 /// Determine if the function does not access or only writes memory.
546 bool onlyWritesMemory() const;
547 void setOnlyWritesMemory();
548
549 /// Determine if the call can access memmory only using pointers based
550 /// on its arguments.
551 bool onlyAccessesArgMemory() const;
553
554 /// Determine if the function may only access memory that is
555 /// inaccessible from the IR.
556 bool onlyAccessesInaccessibleMemory() const;
558
559 /// Determine if the function may only access memory that is
560 /// either inaccessible from the IR or pointed to by its arguments.
561 bool onlyAccessesInaccessibleMemOrArgMem() const;
563
564 /// Determine if the function cannot return.
565 bool doesNotReturn() const {
566 return hasFnAttribute(Attribute::NoReturn);
567 }
569 addFnAttr(Attribute::NoReturn);
570 }
571
572 /// Determine if the function should not perform indirect branch tracking.
573 bool doesNoCfCheck() const { return hasFnAttribute(Attribute::NoCfCheck); }
574
575 /// Determine if the function cannot unwind.
576 bool doesNotThrow() const {
577 return hasFnAttribute(Attribute::NoUnwind);
578 }
580 addFnAttr(Attribute::NoUnwind);
581 }
582
583 /// Determine if the call cannot be duplicated.
584 bool cannotDuplicate() const {
585 return hasFnAttribute(Attribute::NoDuplicate);
586 }
588 addFnAttr(Attribute::NoDuplicate);
589 }
590
591 /// Determine if the call is convergent.
592 bool isConvergent() const {
593 return hasFnAttribute(Attribute::Convergent);
594 }
596 addFnAttr(Attribute::Convergent);
597 }
599 removeFnAttr(Attribute::Convergent);
600 }
601
602 /// Determine if the call has sideeffects.
603 bool isSpeculatable() const {
604 return hasFnAttribute(Attribute::Speculatable);
605 }
607 addFnAttr(Attribute::Speculatable);
608 }
609
610 /// Determine if the call might deallocate memory.
611 bool doesNotFreeMemory() const {
612 return onlyReadsMemory() || hasFnAttribute(Attribute::NoFree);
613 }
615 addFnAttr(Attribute::NoFree);
616 }
617
618 /// Determine if the call can synchroize with other threads
619 bool hasNoSync() const {
620 return hasFnAttribute(Attribute::NoSync);
621 }
622 void setNoSync() {
623 addFnAttr(Attribute::NoSync);
624 }
625
626 /// Determine if the function is known not to recurse, directly or
627 /// indirectly.
628 bool doesNotRecurse() const {
629 return hasFnAttribute(Attribute::NoRecurse);
630 }
632 addFnAttr(Attribute::NoRecurse);
633 }
634
635 /// Determine if the function is required to make forward progress.
636 bool mustProgress() const {
637 return hasFnAttribute(Attribute::MustProgress) ||
638 hasFnAttribute(Attribute::WillReturn);
639 }
640 void setMustProgress() { addFnAttr(Attribute::MustProgress); }
641
642 /// Determine if the function will return.
643 bool willReturn() const { return hasFnAttribute(Attribute::WillReturn); }
644 void setWillReturn() { addFnAttr(Attribute::WillReturn); }
645
646 /// Get what kind of unwind table entry to generate for this function.
648 return AttributeSets.getUWTableKind();
649 }
650
651 /// True if the ABI mandates (or the user requested) that this
652 /// function be in a unwind table.
653 bool hasUWTable() const {
654 return getUWTableKind() != UWTableKind::None;
655 }
657 addFnAttr(Attribute::getWithUWTableKind(getContext(), K));
658 }
659 /// True if this function needs an unwind table.
661 return hasUWTable() || !doesNotThrow() || hasPersonalityFn();
662 }
663
664 /// Determine if the function returns a structure through first
665 /// or second pointer argument.
666 bool hasStructRetAttr() const {
667 return AttributeSets.hasParamAttr(0, Attribute::StructRet) ||
668 AttributeSets.hasParamAttr(1, Attribute::StructRet);
669 }
670
671 /// Determine if the parameter or return value is marked with NoAlias
672 /// attribute.
673 bool returnDoesNotAlias() const {
674 return AttributeSets.hasRetAttr(Attribute::NoAlias);
675 }
676 void setReturnDoesNotAlias() { addRetAttr(Attribute::NoAlias); }
677
678 /// Do not optimize this function (-O0).
679 bool hasOptNone() const { return hasFnAttribute(Attribute::OptimizeNone); }
680
681 /// Optimize this function for minimum size (-Oz).
682 bool hasMinSize() const { return hasFnAttribute(Attribute::MinSize); }
683
684 /// Optimize this function for size (-Os) or minimum size (-Oz).
685 bool hasOptSize() const {
686 return hasFnAttribute(Attribute::OptimizeForSize) || hasMinSize();
687 }
688
689 /// Returns the denormal handling type for the default rounding mode of the
690 /// function.
691 DenormalMode getDenormalMode(const fltSemantics &FPType) const;
692
693 /// Return the representational value of "denormal-fp-math". Code interested
694 /// in the semantics of the function should use getDenormalMode instead.
695 DenormalMode getDenormalModeRaw() const;
696
697 /// Return the representational value of "denormal-fp-math-f32". Code
698 /// interested in the semantics of the function should use getDenormalMode
699 /// instead.
700 DenormalMode getDenormalModeF32Raw() const;
701
702 /// copyAttributesFrom - copy all additional attributes (those not needed to
703 /// create a Function) from the Function Src to this one.
704 void copyAttributesFrom(const Function *Src);
705
706 /// deleteBody - This method deletes the body of the function, and converts
707 /// the linkage to external.
708 ///
709 void deleteBody() {
710 deleteBodyImpl(/*ShouldDrop=*/false);
711 setLinkage(ExternalLinkage);
712 }
713
714 /// removeFromParent - This method unlinks 'this' from the containing module,
715 /// but does not delete it.
716 ///
717 void removeFromParent();
718
719 /// eraseFromParent - This method unlinks 'this' from the containing module
720 /// and deletes it.
721 ///
722 void eraseFromParent();
723
724 /// Steal arguments from another function.
725 ///
726 /// Drop this function's arguments and splice in the ones from \c Src.
727 /// Requires that this has no function body.
728 void stealArgumentListFrom(Function &Src);
729
730 /// Insert \p BB in the basic block list at \p Position. \Returns an iterator
731 /// to the newly inserted BB.
733 Function::iterator FIt = BasicBlocks.insert(Position, BB);
734 BB->setIsNewDbgInfoFormat(IsNewDbgInfoFormat);
735 return FIt;
736 }
737
738 /// Transfer all blocks from \p FromF to this function at \p ToIt.
739 void splice(Function::iterator ToIt, Function *FromF) {
740 splice(ToIt, FromF, FromF->begin(), FromF->end());
741 }
742
743 /// Transfer one BasicBlock from \p FromF at \p FromIt to this function
744 /// at \p ToIt.
746 Function::iterator FromIt) {
747 auto FromItNext = std::next(FromIt);
748 // Single-element splice is a noop if destination == source.
749 if (ToIt == FromIt || ToIt == FromItNext)
750 return;
751 splice(ToIt, FromF, FromIt, FromItNext);
752 }
753
754 /// Transfer a range of basic blocks that belong to \p FromF from \p
755 /// FromBeginIt to \p FromEndIt, to this function at \p ToIt.
756 void splice(Function::iterator ToIt, Function *FromF,
757 Function::iterator FromBeginIt,
758 Function::iterator FromEndIt);
759
760 /// Erases a range of BasicBlocks from \p FromIt to (not including) \p ToIt.
761 /// \Returns \p ToIt.
763
764private:
765 // These need access to the underlying BB list.
766 friend void BasicBlock::removeFromParent();
767 friend iplist<BasicBlock>::iterator BasicBlock::eraseFromParent();
768 template <class BB_t, class BB_i_t, class BI_t, class II_t>
769 friend class InstIterator;
771 friend class llvm::ilist_node_with_parent<llvm::BasicBlock, llvm::Function>;
772
773 /// Get the underlying elements of the Function... the basic block list is
774 /// empty for external functions.
775 ///
776 /// This is deliberately private because we have implemented an adequate set
777 /// of functions to modify the list, including Function::splice(),
778 /// Function::erase(), Function::insert() etc.
779 const BasicBlockListType &getBasicBlockList() const { return BasicBlocks; }
780 BasicBlockListType &getBasicBlockList() { return BasicBlocks; }
781
782 static BasicBlockListType Function::*getSublistAccess(BasicBlock*) {
783 return &Function::BasicBlocks;
784 }
785
786public:
787 const BasicBlock &getEntryBlock() const { return front(); }
788 BasicBlock &getEntryBlock() { return front(); }
789
790 //===--------------------------------------------------------------------===//
791 // Symbol Table Accessing functions...
792
793 /// getSymbolTable() - Return the symbol table if any, otherwise nullptr.
794 ///
795 inline ValueSymbolTable *getValueSymbolTable() { return SymTab.get(); }
796 inline const ValueSymbolTable *getValueSymbolTable() const {
797 return SymTab.get();
798 }
799
800 //===--------------------------------------------------------------------===//
801 // BasicBlock iterator forwarding functions
802 //
803 iterator begin() { return BasicBlocks.begin(); }
804 const_iterator begin() const { return BasicBlocks.begin(); }
805 iterator end () { return BasicBlocks.end(); }
806 const_iterator end () const { return BasicBlocks.end(); }
807
808 size_t size() const { return BasicBlocks.size(); }
809 bool empty() const { return BasicBlocks.empty(); }
810 const BasicBlock &front() const { return BasicBlocks.front(); }
811 BasicBlock &front() { return BasicBlocks.front(); }
812 const BasicBlock &back() const { return BasicBlocks.back(); }
813 BasicBlock &back() { return BasicBlocks.back(); }
814
815/// @name Function Argument Iteration
816/// @{
817
819 CheckLazyArguments();
820 return Arguments;
821 }
823 CheckLazyArguments();
824 return Arguments;
825 }
826
828 CheckLazyArguments();
829 return Arguments + NumArgs;
830 }
832 CheckLazyArguments();
833 return Arguments + NumArgs;
834 }
835
836 Argument* getArg(unsigned i) const {
837 assert (i < NumArgs && "getArg() out of range!");
838 CheckLazyArguments();
839 return Arguments + i;
840 }
841
843 return make_range(arg_begin(), arg_end());
844 }
846 return make_range(arg_begin(), arg_end());
847 }
848
849/// @}
850
851 size_t arg_size() const { return NumArgs; }
852 bool arg_empty() const { return arg_size() == 0; }
853
854 /// Check whether this function has a personality function.
855 bool hasPersonalityFn() const {
856 return getSubclassDataFromValue() & (1<<3);
857 }
858
859 /// Get the personality function associated with this function.
860 Constant *getPersonalityFn() const;
861 void setPersonalityFn(Constant *Fn);
862
863 /// Check whether this function has prefix data.
864 bool hasPrefixData() const {
865 return getSubclassDataFromValue() & (1<<1);
866 }
867
868 /// Get the prefix data associated with this function.
869 Constant *getPrefixData() const;
870 void setPrefixData(Constant *PrefixData);
871
872 /// Check whether this function has prologue data.
873 bool hasPrologueData() const {
874 return getSubclassDataFromValue() & (1<<2);
875 }
876
877 /// Get the prologue data associated with this function.
878 Constant *getPrologueData() const;
879 void setPrologueData(Constant *PrologueData);
880
881 /// Print the function to an output stream with an optional
882 /// AssemblyAnnotationWriter.
883 void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW = nullptr,
884 bool ShouldPreserveUseListOrder = false,
885 bool IsForDebug = false) const;
886
887 /// viewCFG - This function is meant for use from the debugger. You can just
888 /// say 'call F->viewCFG()' and a ghostview window should pop up from the
889 /// program, displaying the CFG of the current function with the code for each
890 /// basic block inside. This depends on there being a 'dot' and 'gv' program
891 /// in your path.
892 ///
893 void viewCFG() const;
894
895 /// Extended form to print edge weights.
896 void viewCFG(bool ViewCFGOnly, const BlockFrequencyInfo *BFI,
897 const BranchProbabilityInfo *BPI) const;
898
899 /// viewCFGOnly - This function is meant for use from the debugger. It works
900 /// just like viewCFG, but it does not include the contents of basic blocks
901 /// into the nodes, just the label. If you are only interested in the CFG
902 /// this can make the graph smaller.
903 ///
904 void viewCFGOnly() const;
905
906 /// Extended form to print edge weights.
907 void viewCFGOnly(const BlockFrequencyInfo *BFI,
908 const BranchProbabilityInfo *BPI) const;
909
910 /// Methods for support type inquiry through isa, cast, and dyn_cast:
911 static bool classof(const Value *V) {
912 return V->getValueID() == Value::FunctionVal;
913 }
914
915 /// dropAllReferences() - This method causes all the subinstructions to "let
916 /// go" of all references that they are maintaining. This allows one to
917 /// 'delete' a whole module at a time, even though there may be circular
918 /// references... first all references are dropped, and all use counts go to
919 /// zero. Then everything is deleted for real. Note that no operations are
920 /// valid on an object that has "dropped all references", except operator
921 /// delete.
922 ///
923 /// Since no other object in the module can have references into the body of a
924 /// function, dropping all references deletes the entire body of the function,
925 /// including any contained basic blocks.
926 ///
928 deleteBodyImpl(/*ShouldDrop=*/true);
929 }
930
931 /// hasAddressTaken - returns true if there are any uses of this function
932 /// other than direct calls or invokes to it, or blockaddress expressions.
933 /// Optionally passes back an offending user for diagnostic purposes,
934 /// ignores callback uses, assume like pointer annotation calls, references in
935 /// llvm.used and llvm.compiler.used variables, operand bundle
936 /// "clang.arc.attachedcall", and direct calls with a different call site
937 /// signature (the function is implicitly casted).
938 bool hasAddressTaken(const User ** = nullptr, bool IgnoreCallbackUses = false,
939 bool IgnoreAssumeLikeCalls = true,
940 bool IngoreLLVMUsed = false,
941 bool IgnoreARCAttachedCall = false,
942 bool IgnoreCastedDirectCall = false) const;
943
944 /// isDefTriviallyDead - Return true if it is trivially safe to remove
945 /// this function definition from the module (because it isn't externally
946 /// visible, does not have its address taken, and has no callers). To make
947 /// this more accurate, call removeDeadConstantUsers first.
948 bool isDefTriviallyDead() const;
949
950 /// callsFunctionThatReturnsTwice - Return true if the function has a call to
951 /// setjmp or other function that gcc recognizes as "returning twice".
952 bool callsFunctionThatReturnsTwice() const;
953
954 /// Set the attached subprogram.
955 ///
956 /// Calls \a setMetadata() with \a LLVMContext::MD_dbg.
957 void setSubprogram(DISubprogram *SP);
958
959 /// Get the attached subprogram.
960 ///
961 /// Calls \a getMetadata() with \a LLVMContext::MD_dbg and casts the result
962 /// to \a DISubprogram.
964
965 /// Returns true if we should emit debug info for profiling.
966 bool shouldEmitDebugInfoForProfiling() const;
967
968 /// Check if null pointer dereferencing is considered undefined behavior for
969 /// the function.
970 /// Return value: false => null pointer dereference is undefined.
971 /// Return value: true => null pointer dereference is not undefined.
972 bool nullPointerIsDefined() const;
973
974private:
975 void allocHungoffUselist();
976 template<int Idx> void setHungoffOperand(Constant *C);
977
978 /// Shadow Value::setValueSubclassData with a private forwarding method so
979 /// that subclasses cannot accidentally use it.
980 void setValueSubclassData(unsigned short D) {
981 Value::setValueSubclassData(D);
982 }
983 void setValueSubclassDataBit(unsigned Bit, bool On);
984};
985
986/// Check whether null pointer dereferencing is considered undefined behavior
987/// for a given function or an address space.
988/// Null pointer access in non-zero address space is not considered undefined.
989/// Return value: false => null pointer dereference is undefined.
990/// Return value: true => null pointer dereference is not undefined.
991bool NullPointerIsDefined(const Function *F, unsigned AS = 0);
992
993template <>
995
997
998} // end namespace llvm
999
1000#endif // LLVM_IR_FUNCTION_H
aarch64 promote const
AMDGPU Lower Kernel Arguments
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
This file contains the simple types necessary to represent the attributes associated with functions a...
static bool setDoesNotAccessMemory(Function &F)
static bool setOnlyAccessesInaccessibleMemOrArgMem(Function &F)
static bool setOnlyAccessesInaccessibleMemory(Function &F)
static bool setOnlyAccessesArgMemory(Function &F)
static bool setOnlyWritesMemory(Function &F)
static bool setOnlyReadsMemory(Function &F)
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
static void viewCFG(Function &F, const BlockFrequencyInfo *BFI, const BranchProbabilityInfo *BPI, uint64_t MaxFreq, bool CFGOnly=false)
Definition: CFGPrinter.cpp:82
RelocType Type
Definition: COFFYAML.cpp:391
#define LLVM_READONLY
Definition: Compiler.h:227
#define LLVM_EXTERNAL_VISIBILITY
Definition: Compiler.h:135
static DISubprogram * getSubprogram(bool IsDistinct, Ts &&...Args)
Definition: DIBuilder.cpp:849
This file defines the DenseSet and SmallDenseSet classes.
@ Default
Definition: DwarfDebug.cpp:87
std::string Name
#define F(x, y, z)
Definition: MD5.cpp:55
Machine Check Debug Module
ToRemove erase(NewLastIter, ToRemove.end())
#define DEFINE_TRANSPARENT_OPERAND_ACCESSORS(CLASS, VALUECLASS)
Macro for generating out-of-class operand accessor definitions.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
raw_pwrite_stream & OS
This class represents an incoming formal argument to a Function.
Definition: Argument.h:31
Type * getParamStructRetType(unsigned ArgNo) const
Return the sret type for the specified function parameter.
uint64_t getParamDereferenceableBytes(unsigned Index) const
Get the number of dereferenceable bytes (or zero if unknown) of an arg.
MaybeAlign getParamAlignment(unsigned ArgNo) const
Return the alignment for the specified function parameter.
Type * getParamInAllocaType(unsigned ArgNo) const
Return the inalloca type for the specified function parameter.
UWTableKind getUWTableKind() const
Get the unwind table kind requested for the function.
Type * getParamPreallocatedType(unsigned ArgNo) const
Return the preallocated type for the specified function parameter.
bool hasParamAttr(unsigned ArgNo, Attribute::AttrKind Kind) const
Return true if the attribute exists for the given argument.
Definition: Attributes.h:788
MaybeAlign getFnStackAlignment() const
Get the stack alignment of the function.
Type * getParamByValType(unsigned ArgNo) const
Return the byval type for the specified function parameter.
MaybeAlign getParamStackAlignment(unsigned ArgNo) const
Return the stack alignment for the specified function parameter.
uint64_t getParamDereferenceableOrNullBytes(unsigned ArgNo) const
Get the number of dereferenceable_or_null bytes (or zero if unknown) of an arg.
FPClassTest getParamNoFPClass(unsigned ArgNo) const
Get the disallowed floating-point classes of the argument value.
Type * getParamByRefType(unsigned ArgNo) const
Return the byref type for the specified function parameter.
bool hasRetAttr(Attribute::AttrKind Kind) const
Return true if the attribute exists for the return value.
Definition: Attributes.h:803
AttrKind
This enumeration lists the attributes that can be associated with parameters, function results,...
Definition: Attributes.h:85
LLVM Basic Block Representation.
Definition: BasicBlock.h:60
void setIsNewDbgInfoFormat(bool NewFlag)
Ensure the block is in "old" dbg.value format (NewFlag == false) or in the new format (NewFlag == tru...
Definition: BasicBlock.cpp:152
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
Analysis providing branch probability information.
This class represents a range of values.
Definition: ConstantRange.h:47
This is an important base class in LLVM.
Definition: Constant.h:41
Subprogram description.
Implements a dense probed hash-table based set.
Definition: DenseSet.h:271
Class to represent function types.
Definition: DerivedTypes.h:103
Class to represent profile counts.
Definition: Function.h:279
uint64_t getCount() const
Definition: Function.h:287
ProfileCount(uint64_t Count, ProfileCountType PCT)
Definition: Function.h:285
ProfileCountType getType() const
Definition: Function.h:288
void deleteBody()
deleteBody - This method deletes the body of the function, and converts the linkage to external.
Definition: Function.h:709
const ValueSymbolTable * getValueSymbolTable() const
Definition: Function.h:796
bool isConvergent() const
Determine if the call is convergent.
Definition: Function.h:592
void setCoroDestroyOnlyWhenComplete()
Definition: Function.h:530
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace, const Twine &N="", Module *M=nullptr)
Definition: Function.h:164
BasicBlock & getEntryBlock()
Definition: Function.h:788
void splice(Function::iterator ToIt, Function *FromF)
Transfer all blocks from FromF to this function at ToIt.
Definition: Function.h:739
const BasicBlock & getEntryBlock() const
Definition: Function.h:787
BasicBlockListType::iterator iterator
Definition: Function.h:68
bool hasOptSize() const
Optimize this function for size (-Os) or minimum size (-Oz).
Definition: Function.h:685
void splice(Function::iterator ToIt, Function *FromF, Function::iterator FromIt)
Transfer one BasicBlock from FromF at FromIt to this function at ToIt.
Definition: Function.h:745
bool empty() const
Definition: Function.h:809
FunctionType * getFunctionType() const
Returns the FunctionType for me.
Definition: Function.h:202
bool isMaterializable() const
Definition: Function.h:217
MaybeAlign getFnStackAlign() const
Return the stack alignment for the function.
Definition: Function.h:451
iterator_range< const_arg_iterator > args() const
Definition: Function.h:845
bool arg_empty() const
Definition: Function.h:852
static bool classof(const Value *V)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition: Function.h:911
const BasicBlock & front() const
Definition: Function.h:810
const_arg_iterator arg_end() const
Definition: Function.h:831
const_arg_iterator arg_begin() const
Definition: Function.h:822
bool mustProgress() const
Determine if the function is required to make forward progress.
Definition: Function.h:636
bool returnDoesNotAlias() const
Determine if the parameter or return value is marked with NoAlias attribute.
Definition: Function.h:673
bool cannotDuplicate() const
Determine if the call cannot be duplicated.
Definition: Function.h:584
const BasicBlock & back() const
Definition: Function.h:812
void setWillReturn()
Definition: Function.h:644
bool willReturn() const
Determine if the function will return.
Definition: Function.h:643
iterator_range< arg_iterator > args()
Definition: Function.h:842
Intrinsic::ID getIntrinsicID() const LLVM_READONLY
getIntrinsicID - This method returns the ID number of the specified function, or Intrinsic::not_intri...
Definition: Function.h:232
bool doesNotRecurse() const
Determine if the function is known not to recurse, directly or indirectly.
Definition: Function.h:628
bool hasMinSize() const
Optimize this function for minimum size (-Oz).
Definition: Function.h:682
void setDoesNotReturn()
Definition: Function.h:568
bool doesNoCfCheck() const
Determine if the function should not perform indirect branch tracking.
Definition: Function.h:573
void setIsMaterializable(bool V)
Definition: Function.h:220
uint64_t getParamDereferenceableBytes(unsigned ArgNo) const
Extract the number of dereferenceable bytes for a parameter.
Definition: Function.h:504
bool isSpeculatable() const
Determine if the call has sideeffects.
Definition: Function.h:603
bool hasGC() const
hasGC/getGC/setGC/clearGC - The name of the garbage collection algorithm to use during code generatio...
Definition: Function.h:332
bool IsNewDbgInfoFormat
Is this function using intrinsics to record the position of debugging information,...
Definition: Function.h:107
CallingConv::ID getCallingConv() const
getCallingConv()/setCallingConv(CC) - These method get and set the calling convention of this functio...
Definition: Function.h:264
Type * getParamByValType(unsigned ArgNo) const
Extract the byval type for a parameter.
Definition: Function.h:478
FPClassTest getParamNoFPClass(unsigned ArgNo) const
Extract the nofpclass attribute for a parameter.
Definition: Function.h:516
bool hasPrefixData() const
Check whether this function has prefix data.
Definition: Function.h:864
void setReturnDoesNotAlias()
Definition: Function.h:676
bool hasPersonalityFn() const
Check whether this function has a personality function.
Definition: Function.h:855
static Function * Create(FunctionType *Ty, LinkageTypes Linkage, const Twine &N="", Module *M=nullptr)
Definition: Function.h:171
AttributeList getAttributes() const
Return the attribute list for this Function.
Definition: Function.h:340
void dropAllReferences()
dropAllReferences() - This method causes all the subinstructions to "let go" of all references that t...
Definition: Function.h:927
void setUWTableKind(UWTableKind K)
Definition: Function.h:656
BasicBlockListType::const_iterator const_iterator
Definition: Function.h:69
UWTableKind getUWTableKind() const
Get what kind of unwind table entry to generate for this function.
Definition: Function.h:647
Type * getParamByRefType(unsigned ArgNo) const
Extract the byref type for a parameter.
Definition: Function.h:493
bool hasNoSync() const
Determine if the call can synchroize with other threads.
Definition: Function.h:619
bool doesNotThrow() const
Determine if the function cannot unwind.
Definition: Function.h:576
arg_iterator arg_end()
Definition: Function.h:827
const Function & getFunction() const
Definition: Function.h:162
iterator begin()
Definition: Function.h:803
const_iterator end() const
Definition: Function.h:806
uint64_t getParamDereferenceableOrNullBytes(unsigned ArgNo) const
Extract the number of dereferenceable_or_null bytes for a parameter.
Definition: Function.h:511
arg_iterator arg_begin()
Definition: Function.h:818
bool isIntrinsic() const
isIntrinsic - Returns true if the function's name starts with "llvm.".
Definition: Function.h:237
bool hasProfileData(bool IncludeSynthetic=false) const
Return true if the function is annotated with profile data.
Definition: Function.h:316
const_iterator begin() const
Definition: Function.h:804
void setConvergent()
Definition: Function.h:595
void setPresplitCoroutine()
Definition: Function.h:524
size_t size() const
Definition: Function.h:808
MaybeAlign getParamAlign(unsigned ArgNo) const
Definition: Function.h:469
void setSpeculatable()
Definition: Function.h:606
ValueSymbolTable * getValueSymbolTable()
getSymbolTable() - Return the symbol table if any, otherwise nullptr.
Definition: Function.h:795
bool hasOptNone() const
Do not optimize this function (-O0).
Definition: Function.h:679
void setCannotDuplicate()
Definition: Function.h:587
Type * getParamPreallocatedType(unsigned ArgNo) const
Extract the preallocated type for a parameter.
Definition: Function.h:498
void setAttributes(AttributeList Attrs)
Set the attribute list for this Function.
Definition: Function.h:343
bool isPresplitCoroutine() const
Determine if the function is presplit coroutine.
Definition: Function.h:521
BasicBlock & back()
Definition: Function.h:813
bool hasStructRetAttr() const
Determine if the function returns a structure through first or second pointer argument.
Definition: Function.h:666
Function::iterator insert(Function::iterator Position, BasicBlock *BB)
Insert BB in the basic block list at Position.
Definition: Function.h:732
void setNotConvergent()
Definition: Function.h:598
bool doesNotFreeMemory() const
Determine if the call might deallocate memory.
Definition: Function.h:611
Type * getParamInAllocaType(unsigned ArgNo) const
Extract the inalloca type for a parameter.
Definition: Function.h:488
bool doesNotReturn() const
Determine if the function cannot return.
Definition: Function.h:565
BasicBlock & front()
Definition: Function.h:811
bool isCoroOnlyDestroyWhenComplete() const
Definition: Function.h:527
void setSplittedCoroutine()
Definition: Function.h:525
MaybeAlign getParamStackAlign(unsigned ArgNo) const
Definition: Function.h:473
size_t arg_size() const
Definition: Function.h:851
void setNoSync()
Definition: Function.h:622
bool hasUWTable() const
True if the ABI mandates (or the user requested) that this function be in a unwind table.
Definition: Function.h:653
void operator=(const Function &)=delete
Type * getReturnType() const
Returns the type of the ret val.
Definition: Function.h:207
bool needsUnwindTableEntry() const
True if this function needs an unwind table.
Definition: Function.h:660
bool hasLazyArguments() const
hasLazyArguments/CheckLazyArguments - The argument list of a function is built on demand,...
Definition: Function.h:113
iterator end()
Definition: Function.h:805
void setCallingConv(CallingConv::ID CC)
Definition: Function.h:268
Function(const Function &)=delete
bool hasPrologueData() const
Check whether this function has prologue data.
Definition: Function.h:873
Type * getParamStructRetType(unsigned ArgNo) const
Extract the sret type for a parameter.
Definition: Function.h:483
DECLARE_TRANSPARENT_OPERAND_ACCESSORS(Value)
void setDoesNotRecurse()
Definition: Function.h:631
Argument * getArg(unsigned i) const
Definition: Function.h:836
bool isVarArg() const
isVarArg - Return true if this function takes a variable number of arguments.
Definition: Function.h:215
void setMustProgress()
Definition: Function.h:640
void setDoesNotFreeMemory()
Definition: Function.h:614
void setDoesNotThrow()
Definition: Function.h:579
LinkageTypes
An enumeration for the kinds of linkage for global values.
Definition: GlobalValue.h:51
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
A Module instance is used to store all the information related to an LLVM module.
Definition: Module.h:65
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition: SmallVector.h:1209
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:50
Implementation of the target library information.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
Definition: Twine.h:81
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
This class provides a symbol table of name/value pairs.
LLVM Value Representation.
Definition: Value.h:74
An ilist node that can access its parent list.
Definition: ilist_node.h:284
iterator insert(iterator where, pointer New)
Definition: ilist.h:165
A range adaptor for a pair of iterators.
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition: raw_ostream.h:52
This file defines the ilist_node class template, which is a convenient base class for creating classe...
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
@ User
could "use" a pointer
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
UWTableKind
Definition: CodeGen.h:120
FPClassTest
Floating-point class tests, supported by 'is_fpclass' intrinsic.
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:2047
#define N
Represent subnormal handling kind for floating point instruction inputs and outputs.
HungoffOperandTraits - determine the allocation regime of the Use array when it is not a prefix to th...
Definition: OperandTraits.h:95
This struct is a compact representation of a valid (power of two) or undefined (0) alignment.
Definition: Alignment.h:117
Compile-time customization of User operands.
Definition: User.h:42