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