Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
Module.h
Go to the documentation of this file.
1//===- llvm/Module.h - C++ class to represent a VM module -------*- 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/// @file
10/// Module.h This file contains the declarations for the Module class.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_IR_MODULE_H
15#define LLVM_IR_MODULE_H
16
17#include "llvm-c/Types.h"
18#include "llvm/ADT/STLExtras.h"
19#include "llvm/ADT/StringMap.h"
20#include "llvm/ADT/StringRef.h"
21#include "llvm/ADT/iterator_range.h"
22#include "llvm/IR/Attributes.h"
23#include "llvm/IR/Comdat.h"
24#include "llvm/IR/DataLayout.h"
25#include "llvm/IR/Function.h"
26#include "llvm/IR/GlobalAlias.h"
27#include "llvm/IR/GlobalIFunc.h"
28#include "llvm/IR/GlobalVariable.h"
29#include "llvm/IR/Metadata.h"
30#include "llvm/IR/ProfileSummary.h"
31#include "llvm/IR/SymbolTableListTraits.h"
32#include "llvm/Support/CBindingWrapping.h"
33#include "llvm/Support/CodeGen.h"
34#include <cstddef>
35#include <cstdint>
36#include <iterator>
37#include <memory>
38#include <optional>
39#include <string>
40#include <vector>
41
42namespacellvm {
43
44classError;
45classFunctionType;
46classGVMaterializer;
47classLLVMContext;
48classMemoryBuffer;
49classModuleSummaryIndex;
50classRandomNumberGenerator;
51classStructType;
52classVersionTuple;
53
54/// A Module instance is used to store all the information related to an
55/// LLVM module. Modules are the top level container of all other LLVM
56/// Intermediate Representation (IR) objects. Each module directly contains a
57/// list of globals variables, a list of functions, a list of libraries (or
58/// other modules) this module depends on, a symbol table, and various data
59/// about the target's characteristics.
60///
61/// A module maintains a GlobalList object that is used to hold all
62/// constant references to global variables in the module. When a global
63/// variable is destroyed, it should have no entries in the GlobalList.
64/// The main container class for the LLVM Intermediate Representation.
65classLLVM_ABIModule {
66 /// @name Types And Enumerations
67 /// @{
68public:
69 /// The type for the list of global variables.
70usingGlobalListType =SymbolTableList<GlobalVariable>;
71 /// The type for the list of functions.
72usingFunctionListType =SymbolTableList<Function>;
73 /// The type for the list of aliases.
74usingAliasListType =SymbolTableList<GlobalAlias>;
75 /// The type for the list of ifuncs.
76usingIFuncListType =SymbolTableList<GlobalIFunc>;
77 /// The type for the list of named metadata.
78usingNamedMDListType =ilist<NamedMDNode>;
79 /// The type of the comdat "symbol" table.
80usingComdatSymTabType =StringMap<Comdat>;
81 /// The type for mapping names to named metadata.
82usingNamedMDSymTabType =StringMap<NamedMDNode *>;
83
84 /// The Global Variable iterator.
85usingglobal_iterator =GlobalListType::iterator;
86 /// The Global Variable constant iterator.
87usingconst_global_iterator =GlobalListType::const_iterator;
88
89 /// The Function iterators.
90usingiterator =FunctionListType::iterator;
91 /// The Function constant iterator
92usingconst_iterator =FunctionListType::const_iterator;
93
94 /// The Function reverse iterator.
95usingreverse_iterator =FunctionListType::reverse_iterator;
96 /// The Function constant reverse iterator.
97usingconst_reverse_iterator =FunctionListType::const_reverse_iterator;
98
99 /// The Global Alias iterators.
100usingalias_iterator =AliasListType::iterator;
101 /// The Global Alias constant iterator
102usingconst_alias_iterator =AliasListType::const_iterator;
103
104 /// The Global IFunc iterators.
105usingifunc_iterator =IFuncListType::iterator;
106 /// The Global IFunc constant iterator
107usingconst_ifunc_iterator =IFuncListType::const_iterator;
108
109 /// The named metadata iterators.
110usingnamed_metadata_iterator =NamedMDListType::iterator;
111 /// The named metadata constant iterators.
112usingconst_named_metadata_iterator =NamedMDListType::const_iterator;
113
114 /// This enumeration defines the supported behaviors of module flags.
115enumModFlagBehavior {
116 /// Emits an error if two values disagree, otherwise the resulting value is
117 /// that of the operands.
118Error = 1,
119
120 /// Emits a warning if two values disagree. The result value will be the
121 /// operand for the flag from the first module being linked.
122 Warning = 2,
123
124 /// Adds a requirement that another module flag be present and have a
125 /// specified value after linking is performed. The value must be a metadata
126 /// pair, where the first element of the pair is the ID of the module flag
127 /// to be restricted, and the second element of the pair is the value the
128 /// module flag should be restricted to. This behavior can be used to
129 /// restrict the allowable results (via triggering of an error) of linking
130 /// IDs with the **Override** behavior.
131 Require = 3,
132
133 /// Uses the specified value, regardless of the behavior or value of the
134 /// other module. If both modules specify **Override**, but the values
135 /// differ, an error will be emitted.
136 Override = 4,
137
138 /// Appends the two values, which are required to be metadata nodes.
139 Append = 5,
140
141 /// Appends the two values, which are required to be metadata
142 /// nodes. However, duplicate entries in the second list are dropped
143 /// during the append operation.
144 AppendUnique = 6,
145
146 /// Takes the max of the two values, which are required to be integers.
147 Max = 7,
148
149 /// Takes the min of the two values, which are required to be integers.
150 Min = 8,
151
152// Markers:
153 ModFlagBehaviorFirstVal =Error,
154 ModFlagBehaviorLastVal = Min
155 };
156
157 /// Checks if Metadata represents a valid ModFlagBehavior, and stores the
158 /// converted result in MFB.
159staticbool isValidModFlagBehavior(Metadata *MD, ModFlagBehavior &MFB);
160
161structModuleFlagEntry {
162ModFlagBehaviorBehavior;
163MDString *Key;
164Metadata *Val;
165
166ModuleFlagEntry(ModFlagBehaviorB,MDString *K,Metadata *V)
167 : Behavior(B), Key(K), Val(V) {}
168 };
169
170/// @}
171/// @name Member Variables
172/// @{
173private:
174LLVMContext &Context;///< The LLVMContext from which types and
175 ///< constants are allocated.
176 GlobalListType GlobalList;///< The Global Variables in the module
177 FunctionListType FunctionList;///< The Functions in the module
178 AliasListType AliasList;///< The Aliases in the module
179 IFuncListType IFuncList;///< The IFuncs in the module
180 NamedMDListType NamedMDList;///< The named metadata in the module
181 std::string GlobalScopeAsm;///< Inline Asm at global scope.
182 std::unique_ptr<ValueSymbolTable> ValSymTab;///< Symbol table for values
183 ComdatSymTabType ComdatSymTab;///< Symbol table for COMDATs
184 std::unique_ptr<MemoryBuffer>
185 OwnedMemoryBuffer;///< Memory buffer directly owned by this
186 ///< module, for legacy clients only.
187 std::unique_ptr<GVMaterializer>
188 Materializer;///< Used to materialize GlobalValues
189 std::string ModuleID;///< Human readable identifier for the module
190 std::string SourceFileName;///< Original source file name for module,
191 ///< recorded in bitcode.
192 std::string TargetTriple;///< Platform target triple Module compiled on
193 ///< Format: (arch)(sub)-(vendor)-(sys0-(abi)
194 NamedMDSymTabType NamedMDSymTab;///< NamedMDNode names.
195DataLayoutDL;///< DataLayout associated with the module
196StringMap<unsigned>
197 CurrentIntrinsicIds;///< Keep track of the current unique id count for
198 ///< the specified intrinsic basename.
199DenseMap<std::pair<Intrinsic::ID, const FunctionType *>,unsigned>
200 UniquedIntrinsicNames;///< Keep track of uniqued names of intrinsics
201 ///< based on unnamed types. The combination of
202 ///< ID and FunctionType maps to the extension that
203 ///< is used to make the intrinsic name unique.
204
205 /// llvm.module.flags metadata
206NamedMDNode *ModuleFlags =nullptr;
207
208friendclassConstant;
209
210/// @}
211/// @name Constructors
212/// @{
213public:
214 /// Is this Module using intrinsics to record the position of debugging
215 /// information, or non-intrinsic records? See IsNewDbgInfoFormat in
216 /// \ref BasicBlock.
217boolIsNewDbgInfoFormat;
218
219 /// Used when printing this module in the new debug info format; removes all
220 /// declarations of debug intrinsics that are replaced by non-intrinsic
221 /// records in the new format.
222void removeDebugIntrinsicDeclarations();
223
224 /// \see BasicBlock::convertToNewDbgValues.
225voidconvertToNewDbgValues() {
226for (auto &F : *this) {
227F.convertToNewDbgValues();
228 }
229 IsNewDbgInfoFormat =true;
230 }
231
232 /// \see BasicBlock::convertFromNewDbgValues.
233voidconvertFromNewDbgValues() {
234for (auto &F : *this) {
235F.convertFromNewDbgValues();
236 }
237 IsNewDbgInfoFormat =false;
238 }
239
240voidsetIsNewDbgInfoFormat(bool UseNewFormat) {
241if (UseNewFormat && !IsNewDbgInfoFormat)
242 convertToNewDbgValues();
243elseif (!UseNewFormat && IsNewDbgInfoFormat)
244 convertFromNewDbgValues();
245 }
246voidsetNewDbgInfoFormatFlag(bool NewFlag) {
247for (auto &F : *this) {
248F.setNewDbgInfoFormatFlag(NewFlag);
249 }
250 IsNewDbgInfoFormat = NewFlag;
251 }
252
253 /// The Module constructor. Note that there is no default constructor. You
254 /// must provide a name for the module upon construction.
255explicitModule(StringRef ModuleID,LLVMContext&C);
256 /// The module destructor. This will dropAllReferences.
257~Module();
258
259 /// Move assignment.
260Module &operator=(Module &&Other);
261
262 /// @}
263 /// @name Module Level Accessors
264 /// @{
265
266 /// Get the module identifier which is, essentially, the name of the module.
267 /// @returns the module identifier as a string
268const std::string &getModuleIdentifier() const{return ModuleID; }
269
270 /// Returns the number of non-debug IR instructions in the module.
271 /// This is equivalent to the sum of the IR instruction counts of each
272 /// function contained in the module.
273unsigned getInstructionCount()const;
274
275 /// Get the module's original source file name. When compiling from
276 /// bitcode, this is taken from a bitcode record where it was recorded.
277 /// For other compiles it is the same as the ModuleID, which would
278 /// contain the source file name.
279const std::string &getSourceFileName() const{return SourceFileName; }
280
281 /// Get a short "name" for the module.
282 ///
283 /// This is useful for debugging or logging. It is essentially a convenience
284 /// wrapper around getModuleIdentifier().
285StringRefgetName() const{return ModuleID; }
286
287 /// Get the data layout string for the module's target platform. This is
288 /// equivalent to getDataLayout()->getStringRepresentation().
289const std::string &getDataLayoutStr() const{
290returnDL.getStringRepresentation();
291 }
292
293 /// Get the data layout for the module's target platform.
294constDataLayout &getDataLayout() const{returnDL; }
295
296 /// Get the target triple which is a string describing the target host.
297 /// @returns a string containing the target triple.
298const std::string &getTargetTriple() const{return TargetTriple; }
299
300 /// Get the global data context.
301 /// @returns LLVMContext - a container for LLVM's global information
302LLVMContext &getContext() const{return Context; }
303
304 /// Get any module-scope inline assembly blocks.
305 /// @returns a string containing the module-scope inline assembly blocks.
306const std::string &getModuleInlineAsm() const{return GlobalScopeAsm; }
307
308 /// Get a RandomNumberGenerator salted for use with this module. The
309 /// RNG can be seeded via -rng-seed=<uint64> and is salted with the
310 /// ModuleID and the provided pass salt. The returned RNG should not
311 /// be shared across threads or passes.
312 ///
313 /// A unique RNG per pass ensures a reproducible random stream even
314 /// when other randomness consuming passes are added or removed. In
315 /// addition, the random stream will be reproducible across LLVM
316 /// versions when the pass does not change.
317 std::unique_ptr<RandomNumberGenerator> createRNG(constStringRefName)const;
318
319 /// Return true if size-info optimization remark is enabled, false
320 /// otherwise.
321boolshouldEmitInstrCountChangedRemark() {
322return getContext().getDiagHandlerPtr()->isAnalysisRemarkEnabled(
323"size-info");
324 }
325
326 /// @}
327 /// @name Module Level Mutators
328 /// @{
329
330 /// Set the module identifier.
331voidsetModuleIdentifier(StringRefID) { ModuleID = std::string(ID); }
332
333 /// Set the module's original source file name.
334voidsetSourceFileName(StringRefName) { SourceFileName = std::string(Name); }
335
336 /// Set the data layout
337void setDataLayout(StringRefDesc);
338void setDataLayout(constDataLayout &Other);
339
340 /// Set the target triple.
341voidsetTargetTriple(StringRefT) { TargetTriple = std::string(T); }
342
343 /// Set the module-scope inline assembly blocks.
344 /// A trailing newline is added if the input doesn't have one.
345voidsetModuleInlineAsm(StringRef Asm) {
346 GlobalScopeAsm = std::string(Asm);
347if (!GlobalScopeAsm.empty() && GlobalScopeAsm.back() !='\n')
348 GlobalScopeAsm +='\n';
349 }
350
351 /// Append to the module-scope inline assembly blocks.
352 /// A trailing newline is added if the input doesn't have one.
353voidappendModuleInlineAsm(StringRef Asm) {
354 GlobalScopeAsm += Asm;
355if (!GlobalScopeAsm.empty() && GlobalScopeAsm.back() !='\n')
356 GlobalScopeAsm +='\n';
357 }
358
359/// @}
360/// @name Generic Value Accessors
361/// @{
362
363 /// Return the global value in the module with the specified name, of
364 /// arbitrary type. This method returns null if a global with the specified
365 /// name is not found.
366GlobalValue *getNamedValue(StringRefName)const;
367
368 /// Return the number of global values in the module.
369unsigned getNumNamedValues()const;
370
371 /// Return a unique non-zero ID for the specified metadata kind. This ID is
372 /// uniqued across modules in the current LLVMContext.
373unsigned getMDKindID(StringRefName)const;
374
375 /// Populate client supplied SmallVector with the name for custom metadata IDs
376 /// registered in this LLVMContext.
377void getMDKindNames(SmallVectorImpl<StringRef> &Result)const;
378
379 /// Populate client supplied SmallVector with the bundle tags registered in
380 /// this LLVMContext. The bundle tags are ordered by increasing bundle IDs.
381 /// \see LLVMContext::getOperandBundleTagID
382void getOperandBundleTags(SmallVectorImpl<StringRef> &Result)const;
383
384 std::vector<StructType *> getIdentifiedStructTypes()const;
385
386 /// Return a unique name for an intrinsic whose mangling is based on an
387 /// unnamed type. The Proto represents the function prototype.
388 std::string getUniqueIntrinsicName(StringRef BaseName,Intrinsic::ID Id,
389constFunctionType *Proto);
390
391/// @}
392/// @name Function Accessors
393/// @{
394
395 /// Look up the specified function in the module symbol table. If it does not
396 /// exist, add a prototype for the function and return it. Otherwise, return
397 /// the existing function.
398 ///
399 /// In all cases, the returned value is a FunctionCallee wrapper around the
400 /// 'FunctionType *T' passed in, as well as the 'Value*' of the Function. The
401 /// function type of the function may differ from the function type stored in
402 /// FunctionCallee if it was previously created with a different type.
403 ///
404 /// Note: For library calls getOrInsertLibFunc() should be used instead.
405FunctionCallee getOrInsertFunction(StringRefName,FunctionType *T,
406AttributeListAttributeList);
407
408FunctionCallee getOrInsertFunction(StringRefName,FunctionType *T);
409
410 /// Same as above, but takes a list of function arguments, which makes it
411 /// easier for clients to use.
412template <typename... ArgsTy>
413FunctionCalleegetOrInsertFunction(StringRefName,
414AttributeListAttributeList,Type *RetTy,
415 ArgsTy... Args) {
416SmallVector<Type*,sizeof...(ArgsTy)> ArgTys{Args...};
417return getOrInsertFunction(Name,
418 FunctionType::get(RetTy, ArgTys,false),
419AttributeList);
420 }
421
422 /// Same as above, but without the attributes.
423template <typename... ArgsTy>
424FunctionCalleegetOrInsertFunction(StringRefName,Type *RetTy,
425 ArgsTy... Args) {
426return getOrInsertFunction(Name,AttributeList{},RetTy, Args...);
427 }
428
429// Avoid an incorrect ordering that'd otherwise compile incorrectly.
430template <typename... ArgsTy>
431FunctionCallee
432getOrInsertFunction(StringRefName,AttributeListAttributeList,
433FunctionType *Invalid, ArgsTy... Args) =delete;
434
435 /// Look up the specified function in the module symbol table. If it does not
436 /// exist, return null.
437Function *getFunction(StringRefName)const;
438
439/// @}
440/// @name Global Variable Accessors
441/// @{
442
443 /// Look up the specified global variable in the module symbol table. If it
444 /// does not exist, return null. If AllowInternal is set to true, this
445 /// function will return types that have InternalLinkage. By default, these
446 /// types are not returned.
447GlobalVariable *getGlobalVariable(StringRefName) const{
448returngetGlobalVariable(Name,false);
449 }
450
451GlobalVariable *getGlobalVariable(StringRefName,bool AllowInternal)const;
452
453GlobalVariable *getGlobalVariable(StringRefName,
454bool AllowInternal =false) {
455returnstatic_cast<constModule *>(this)->getGlobalVariable(Name,
456 AllowInternal);
457 }
458
459 /// Return the global variable in the module with the specified name, of
460 /// arbitrary type. This method returns null if a global with the specified
461 /// name is not found.
462constGlobalVariable *getNamedGlobal(StringRefName) const{
463returngetGlobalVariable(Name,true);
464 }
465GlobalVariable *getNamedGlobal(StringRefName) {
466returnconst_cast<GlobalVariable *>(
467static_cast<constModule *>(this)->getNamedGlobal(Name));
468 }
469
470 /// Look up the specified global in the module symbol table.
471 /// If it does not exist, invoke a callback to create a declaration of the
472 /// global and return it. The global is constantexpr casted to the expected
473 /// type if necessary.
474Constant *
475getOrInsertGlobal(StringRefName,Type *Ty,
476function_ref<GlobalVariable *()> CreateGlobalCallback);
477
478 /// Look up the specified global in the module symbol table. If required, this
479 /// overload constructs the global variable using its constructor's defaults.
480Constant *getOrInsertGlobal(StringRefName,Type *Ty);
481
482/// @}
483/// @name Global Alias Accessors
484/// @{
485
486 /// Return the global alias in the module with the specified name, of
487 /// arbitrary type. This method returns null if a global with the specified
488 /// name is not found.
489GlobalAlias *getNamedAlias(StringRefName)const;
490
491/// @}
492/// @name Global IFunc Accessors
493/// @{
494
495 /// Return the global ifunc in the module with the specified name, of
496 /// arbitrary type. This method returns null if a global with the specified
497 /// name is not found.
498GlobalIFunc *getNamedIFunc(StringRefName)const;
499
500/// @}
501/// @name Named Metadata Accessors
502/// @{
503
504 /// Return the first NamedMDNode in the module with the specified name. This
505 /// method returns null if a NamedMDNode with the specified name is not found.
506NamedMDNode *getNamedMetadata(StringRefName)const;
507
508 /// Return the named MDNode in the module with the specified name. This method
509 /// returns a new NamedMDNode if a NamedMDNode with the specified name is not
510 /// found.
511NamedMDNode *getOrInsertNamedMetadata(StringRefName);
512
513 /// Remove the given NamedMDNode from this module and delete it.
514void eraseNamedMetadata(NamedMDNode *NMD);
515
516/// @}
517/// @name Comdat Accessors
518/// @{
519
520 /// Return the Comdat in the module with the specified name. It is created
521 /// if it didn't already exist.
522Comdat *getOrInsertComdat(StringRefName);
523
524/// @}
525/// @name Module Flags Accessors
526/// @{
527
528 /// Returns the module flags in the provided vector.
529void getModuleFlagsMetadata(SmallVectorImpl<ModuleFlagEntry> &Flags)const;
530
531 /// Return the corresponding value if Key appears in module flags, otherwise
532 /// return null.
533Metadata *getModuleFlag(StringRef Key)const;
534
535 /// Returns the NamedMDNode in the module that represents module-level flags.
536 /// This method returns null if there are no module-level flags.
537NamedMDNode *getModuleFlagsMetadata() const{return ModuleFlags; }
538
539 /// Returns the NamedMDNode in the module that represents module-level flags.
540 /// If module-level flags aren't found, it creates the named metadata that
541 /// contains them.
542NamedMDNode *getOrInsertModuleFlagsMetadata();
543
544 /// Add a module-level flag to the module-level flags metadata. It will create
545 /// the module-level flags named metadata if it doesn't already exist.
546void addModuleFlag(ModFlagBehavior Behavior,StringRef Key,Metadata *Val);
547void addModuleFlag(ModFlagBehavior Behavior,StringRef Key,Constant *Val);
548void addModuleFlag(ModFlagBehavior Behavior,StringRef Key,uint32_t Val);
549void addModuleFlag(MDNode *Node);
550 /// Like addModuleFlag but replaces the old module flag if it already exists.
551void setModuleFlag(ModFlagBehavior Behavior,StringRef Key,Metadata *Val);
552void setModuleFlag(ModFlagBehavior Behavior,StringRef Key,Constant *Val);
553void setModuleFlag(ModFlagBehavior Behavior,StringRef Key,uint32_t Val);
554
555 /// @}
556 /// @name Materialization
557 /// @{
558
559 /// Sets the GVMaterializer to GVM. This module must not yet have a
560 /// Materializer. To reset the materializer for a module that already has one,
561 /// call materializeAll first. Destroying this module will destroy
562 /// its materializer without materializing any more GlobalValues. Without
563 /// destroying the Module, there is no way to detach or destroy a materializer
564 /// without materializing all the GVs it controls, to avoid leaving orphan
565 /// unmaterialized GVs.
566void setMaterializer(GVMaterializer *GVM);
567 /// Retrieves the GVMaterializer, if any, for this Module.
568GVMaterializer *getMaterializer() const{return Materializer.get(); }
569boolisMaterialized() const{return !getMaterializer(); }
570
571 /// Make sure the GlobalValue is fully read.
572llvm::Error materialize(GlobalValue *GV);
573
574 /// Make sure all GlobalValues in this Module are fully read and clear the
575 /// Materializer.
576llvm::Error materializeAll();
577
578llvm::Error materializeMetadata();
579
580 /// Detach global variable \p GV from the list but don't delete it.
581voidremoveGlobalVariable(GlobalVariable *GV) { GlobalList.remove(GV); }
582 /// Remove global variable \p GV from the list and delete it.
583voideraseGlobalVariable(GlobalVariable *GV) { GlobalList.erase(GV); }
584 /// Insert global variable \p GV at the end of the global variable list and
585 /// take ownership.
586voidinsertGlobalVariable(GlobalVariable *GV) {
587 insertGlobalVariable(GlobalList.end(), GV);
588 }
589 /// Insert global variable \p GV into the global variable list before \p
590 /// Where and take ownership.
591voidinsertGlobalVariable(GlobalListType::iterator Where,GlobalVariable *GV) {
592 GlobalList.insert(Where, GV);
593 }
594// Use global_size() to get the total number of global variables.
595// Use globals() to get the range of all global variables.
596
597private:
598/// @}
599/// @name Direct access to the globals list, functions list, and symbol table
600/// @{
601
602 /// Get the Module's list of global variables (constant).
603const GlobalListType &getGlobalList() const{return GlobalList; }
604 /// Get the Module's list of global variables.
605 GlobalListType &getGlobalList() {return GlobalList; }
606
607staticGlobalListTypeModule::*getSublistAccess(GlobalVariable*) {
608return &Module::GlobalList;
609 }
610friendclassllvm::SymbolTableListTraits<llvm::GlobalVariable>;
611
612public:
613 /// Get the Module's list of functions (constant).
614constFunctionListType &getFunctionList()const {return FunctionList; }
615 /// Get the Module's list of functions.
616FunctionListType &getFunctionList() {return FunctionList; }
617staticFunctionListTypeModule::*getSublistAccess(Function*) {
618return &Module::FunctionList;
619 }
620
621 /// Detach \p Alias from the list but don't delete it.
622voidremoveAlias(GlobalAlias *Alias) { AliasList.remove(Alias); }
623 /// Remove \p Alias from the list and delete it.
624voideraseAlias(GlobalAlias *Alias) { AliasList.erase(Alias); }
625 /// Insert \p Alias at the end of the alias list and take ownership.
626voidinsertAlias(GlobalAlias *Alias) { AliasList.insert(AliasList.end(), Alias); }
627// Use alias_size() to get the size of AliasList.
628// Use aliases() to get a range of all Alias objects in AliasList.
629
630 /// Detach \p IFunc from the list but don't delete it.
631voidremoveIFunc(GlobalIFunc *IFunc) { IFuncList.remove(IFunc); }
632 /// Remove \p IFunc from the list and delete it.
633voideraseIFunc(GlobalIFunc *IFunc) { IFuncList.erase(IFunc); }
634 /// Insert \p IFunc at the end of the alias list and take ownership.
635voidinsertIFunc(GlobalIFunc *IFunc) { IFuncList.push_back(IFunc); }
636// Use ifunc_size() to get the number of functions in IFuncList.
637// Use ifuncs() to get the range of all IFuncs.
638
639 /// Detach \p MDNode from the list but don't delete it.
640voidremoveNamedMDNode(NamedMDNode *MDNode) { NamedMDList.remove(MDNode); }
641 /// Remove \p MDNode from the list and delete it.
642voideraseNamedMDNode(NamedMDNode *MDNode) { NamedMDList.erase(MDNode); }
643 /// Insert \p MDNode at the end of the alias list and take ownership.
644voidinsertNamedMDNode(NamedMDNode *MDNode) {
645 NamedMDList.push_back(MDNode);
646 }
647// Use named_metadata_size() to get the size of the named meatadata list.
648// Use named_metadata() to get the range of all named metadata.
649
650private:// Please use functions like insertAlias(), removeAlias() etc.
651 /// Get the Module's list of aliases (constant).
652const AliasListType &getAliasList() const{return AliasList; }
653 /// Get the Module's list of aliases.
654 AliasListType &getAliasList() {return AliasList; }
655
656staticAliasListTypeModule::*getSublistAccess(GlobalAlias*) {
657return &Module::AliasList;
658 }
659friendclassllvm::SymbolTableListTraits<llvm::GlobalAlias>;
660
661 /// Get the Module's list of ifuncs (constant).
662const IFuncListType &getIFuncList()const {return IFuncList; }
663 /// Get the Module's list of ifuncs.
664 IFuncListType &getIFuncList() {return IFuncList; }
665
666staticIFuncListTypeModule::*getSublistAccess(GlobalIFunc*) {
667return &Module::IFuncList;
668 }
669friendclassllvm::SymbolTableListTraits<llvm::GlobalIFunc>;
670
671 /// Get the Module's list of named metadata (constant).
672const NamedMDListType &getNamedMDList()const {return NamedMDList; }
673 /// Get the Module's list of named metadata.
674 NamedMDListType &getNamedMDList() {return NamedMDList; }
675
676static NamedMDListTypeModule::*getSublistAccess(NamedMDNode*) {
677return &Module::NamedMDList;
678 }
679
680public:
681 /// Get the symbol table of global variable and function identifiers
682constValueSymbolTable &getValueSymbolTable() const{return *ValSymTab; }
683 /// Get the Module's symbol table of global variable and function identifiers.
684ValueSymbolTable &getValueSymbolTable() {return *ValSymTab; }
685
686 /// Get the Module's symbol table for COMDATs (constant).
687constComdatSymTabType &getComdatSymbolTable() const{return ComdatSymTab; }
688 /// Get the Module's symbol table for COMDATs.
689ComdatSymTabType &getComdatSymbolTable() {return ComdatSymTab; }
690
691/// @}
692/// @name Global Variable Iteration
693/// @{
694
695global_iteratorglobal_begin() {return GlobalList.begin(); }
696const_global_iteratorglobal_begin() const{return GlobalList.begin(); }
697global_iteratorglobal_end () {return GlobalList.end(); }
698const_global_iteratorglobal_end () const{return GlobalList.end(); }
699size_tglobal_size () const{return GlobalList.size(); }
700boolglobal_empty() const{return GlobalList.empty(); }
701
702iterator_range<global_iterator>globals() {
703returnmake_range(global_begin(), global_end());
704 }
705iterator_range<const_global_iterator>globals() const{
706returnmake_range(global_begin(), global_end());
707 }
708
709/// @}
710/// @name Function Iteration
711/// @{
712
713iteratorbegin() {return FunctionList.begin(); }
714const_iteratorbegin() const{return FunctionList.begin(); }
715iteratorend () {return FunctionList.end(); }
716const_iteratorend () const{return FunctionList.end(); }
717reverse_iteratorrbegin() {return FunctionList.rbegin(); }
718const_reverse_iteratorrbegin() const{return FunctionList.rbegin(); }
719reverse_iteratorrend() {return FunctionList.rend(); }
720const_reverse_iteratorrend() const{return FunctionList.rend(); }
721size_tsize() const{return FunctionList.size(); }
722boolempty() const{return FunctionList.empty(); }
723
724iterator_range<iterator>functions() {
725returnmake_range(begin(), end());
726 }
727iterator_range<const_iterator>functions() const{
728returnmake_range(begin(), end());
729 }
730
731/// @}
732/// @name Alias Iteration
733/// @{
734
735alias_iteratoralias_begin() {return AliasList.begin(); }
736const_alias_iteratoralias_begin() const{return AliasList.begin(); }
737alias_iteratoralias_end () {return AliasList.end(); }
738const_alias_iteratoralias_end () const{return AliasList.end(); }
739size_talias_size () const{return AliasList.size(); }
740boolalias_empty() const{return AliasList.empty(); }
741
742iterator_range<alias_iterator>aliases() {
743returnmake_range(alias_begin(), alias_end());
744 }
745iterator_range<const_alias_iterator>aliases() const{
746returnmake_range(alias_begin(), alias_end());
747 }
748
749/// @}
750/// @name IFunc Iteration
751/// @{
752
753ifunc_iteratorifunc_begin() {return IFuncList.begin(); }
754const_ifunc_iteratorifunc_begin() const{return IFuncList.begin(); }
755ifunc_iteratorifunc_end () {return IFuncList.end(); }
756const_ifunc_iteratorifunc_end () const{return IFuncList.end(); }
757size_tifunc_size () const{return IFuncList.size(); }
758boolifunc_empty() const{return IFuncList.empty(); }
759
760iterator_range<ifunc_iterator>ifuncs() {
761returnmake_range(ifunc_begin(), ifunc_end());
762 }
763iterator_range<const_ifunc_iterator>ifuncs() const{
764returnmake_range(ifunc_begin(), ifunc_end());
765 }
766
767 /// @}
768 /// @name Convenience iterators
769 /// @{
770
771usingglobal_object_iterator =
772concat_iterator<GlobalObject, iterator, global_iterator>;
773usingconst_global_object_iterator =
774concat_iterator<constGlobalObject,const_iterator,
775const_global_iterator>;
776
777iterator_range<global_object_iterator> global_objects();
778iterator_range<const_global_object_iterator> global_objects()const;
779
780usingglobal_value_iterator =
781concat_iterator<GlobalValue,iterator,global_iterator,alias_iterator,
782ifunc_iterator>;
783usingconst_global_value_iterator =
784concat_iterator<constGlobalValue,const_iterator,const_global_iterator,
785const_alias_iterator,const_ifunc_iterator>;
786
787iterator_range<global_value_iterator> global_values();
788iterator_range<const_global_value_iterator> global_values()const;
789
790 /// @}
791 /// @name Named Metadata Iteration
792 /// @{
793
794named_metadata_iteratornamed_metadata_begin() {return NamedMDList.begin(); }
795const_named_metadata_iteratornamed_metadata_begin() const{
796return NamedMDList.begin();
797 }
798
799named_metadata_iteratornamed_metadata_end() {return NamedMDList.end(); }
800const_named_metadata_iteratornamed_metadata_end() const{
801return NamedMDList.end();
802 }
803
804size_tnamed_metadata_size() const{return NamedMDList.size(); }
805boolnamed_metadata_empty() const{return NamedMDList.empty(); }
806
807iterator_range<named_metadata_iterator>named_metadata() {
808returnmake_range(named_metadata_begin(), named_metadata_end());
809 }
810iterator_range<const_named_metadata_iterator>named_metadata() const{
811returnmake_range(named_metadata_begin(), named_metadata_end());
812 }
813
814 /// An iterator for DICompileUnits that skips those marked NoDebug.
815classdebug_compile_units_iterator {
816NamedMDNode *CUs;
817unsignedIdx;
818
819void SkipNoDebugCUs();
820
821public:
822usingiterator_category = std::input_iterator_tag;
823usingvalue_type =DICompileUnit *;
824usingdifference_type = std::ptrdiff_t;
825usingpointer =value_type *;
826usingreference =value_type &;
827
828explicitdebug_compile_units_iterator(NamedMDNode *CUs,unsignedIdx)
829 : CUs(CUs),Idx(Idx) {
830 SkipNoDebugCUs();
831 }
832
833debug_compile_units_iterator &operator++() {
834 ++Idx;
835 SkipNoDebugCUs();
836return *this;
837 }
838
839debug_compile_units_iteratoroperator++(int) {
840debug_compile_units_iteratorT(*this);
841 ++Idx;
842returnT;
843 }
844
845booloperator==(constdebug_compile_units_iterator &I) const{
846returnIdx ==I.Idx;
847 }
848
849booloperator!=(constdebug_compile_units_iterator &I) const{
850returnIdx !=I.Idx;
851 }
852
853DICompileUnit *operator*()const;
854DICompileUnit *operator->()const;
855 };
856
857debug_compile_units_iteratordebug_compile_units_begin() const{
858auto *CUs = getNamedMetadata("llvm.dbg.cu");
859returndebug_compile_units_iterator(CUs, 0);
860 }
861
862debug_compile_units_iteratordebug_compile_units_end() const{
863auto *CUs = getNamedMetadata("llvm.dbg.cu");
864returndebug_compile_units_iterator(CUs, CUs ? CUs->getNumOperands() : 0);
865 }
866
867 /// Return an iterator for all DICompileUnits listed in this Module's
868 /// llvm.dbg.cu named metadata node and aren't explicitly marked as
869 /// NoDebug.
870iterator_range<debug_compile_units_iterator>debug_compile_units() const{
871auto *CUs = getNamedMetadata("llvm.dbg.cu");
872returnmake_range(
873debug_compile_units_iterator(CUs, 0),
874debug_compile_units_iterator(CUs, CUs ? CUs->getNumOperands() : 0));
875 }
876/// @}
877
878 /// Destroy ConstantArrays in LLVMContext if they are not used.
879 /// ConstantArrays constructed during linking can cause quadratic memory
880 /// explosion. Releasing all unused constants can cause a 20% LTO compile-time
881 /// slowdown for a large application.
882 ///
883 /// NOTE: Constants are currently owned by LLVMContext. This can then only
884 /// be called where all uses of the LLVMContext are understood.
885void dropTriviallyDeadConstantArrays();
886
887/// @name Utility functions for printing and dumping Module objects
888/// @{
889
890 /// Print the module to an output stream with an optional
891 /// AssemblyAnnotationWriter. If \c ShouldPreserveUseListOrder, then include
892 /// uselistorder directives so that use-lists can be recreated when reading
893 /// the assembly.
894voidprint(raw_ostream &OS,AssemblyAnnotationWriter *AAW,
895bool ShouldPreserveUseListOrder =false,
896bool IsForDebug =false)const;
897
898 /// Dump the module to stderr (for debugging).
899voiddump()const;
900
901 /// This function causes all the subinstructions to "let go" of all references
902 /// that they are maintaining. This allows one to 'delete' a whole class at
903 /// a time, even though there may be circular references... first all
904 /// references are dropped, and all use counts go to zero. Then everything
905 /// is delete'd for real. Note that no operations are valid on an object
906 /// that has "dropped all references", except operator delete.
907void dropAllReferences();
908
909/// @}
910/// @name Utility functions for querying Debug information.
911/// @{
912
913 /// Returns the Number of Register ParametersDwarf Version by checking
914 /// module flags.
915unsigned getNumberRegisterParameters()const;
916
917 /// Returns the Dwarf Version by checking module flags.
918unsigned getDwarfVersion()const;
919
920 /// Returns the DWARF format by checking module flags.
921bool isDwarf64()const;
922
923 /// Returns the CodeView Version by checking module flags.
924 /// Returns zero if not present in module.
925unsigned getCodeViewFlag()const;
926
927/// @}
928/// @name Utility functions for querying and setting PIC level
929/// @{
930
931 /// Returns the PIC level (small or large model)
932PICLevel::Level getPICLevel()const;
933
934 /// Set the PIC level (small or large model)
935void setPICLevel(PICLevel::Level PL);
936/// @}
937
938/// @}
939/// @name Utility functions for querying and setting PIE level
940/// @{
941
942 /// Returns the PIE level (small or large model)
943PIELevel::Level getPIELevel()const;
944
945 /// Set the PIE level (small or large model)
946void setPIELevel(PIELevel::Level PL);
947/// @}
948
949 /// @}
950 /// @name Utility function for querying and setting code model
951 /// @{
952
953 /// Returns the code model (tiny, small, kernel, medium or large model)
954 std::optional<CodeModel::Model>getCodeModel()const;
955
956 /// Set the code model (tiny, small, kernel, medium or large)
957void setCodeModel(CodeModel::Model CL);
958 /// @}
959
960 /// @}
961 /// @name Utility function for querying and setting the large data threshold
962 /// @{
963
964 /// Returns the code model (tiny, small, kernel, medium or large model)
965 std::optional<uint64_t> getLargeDataThreshold()const;
966
967 /// Set the code model (tiny, small, kernel, medium or large)
968void setLargeDataThreshold(uint64_t Threshold);
969 /// @}
970
971 /// @name Utility functions for querying and setting PGO summary
972 /// @{
973
974 /// Attach profile summary metadata to this module.
975void setProfileSummary(Metadata *M,ProfileSummary::Kind Kind);
976
977 /// Returns profile summary metadata. When IsCS is true, use the context
978 /// sensitive profile summary.
979Metadata *getProfileSummary(bool IsCS)const;
980 /// @}
981
982 /// Returns whether semantic interposition is to be respected.
983bool getSemanticInterposition()const;
984
985 /// Set whether semantic interposition is to be respected.
986void setSemanticInterposition(bool);
987
988 /// Returns true if PLT should be avoided for RTLib calls.
989bool getRtLibUseGOT()const;
990
991 /// Set that PLT should be avoid for RTLib calls.
992void setRtLibUseGOT();
993
994 /// Get/set whether referencing global variables can use direct access
995 /// relocations on ELF targets.
996bool getDirectAccessExternalData()const;
997void setDirectAccessExternalData(boolValue);
998
999 /// Get/set whether synthesized functions should get the uwtable attribute.
1000UWTableKind getUwtable()const;
1001void setUwtable(UWTableKind Kind);
1002
1003 /// Get/set whether synthesized functions should get the "frame-pointer"
1004 /// attribute.
1005FramePointerKind getFramePointer()const;
1006void setFramePointer(FramePointerKind Kind);
1007
1008 /// Get/set what kind of stack protector guard to use.
1009StringRef getStackProtectorGuard()const;
1010void setStackProtectorGuard(StringRef Kind);
1011
1012 /// Get/set which register to use as the stack protector guard register. The
1013 /// empty string is equivalent to "global". Other values may be "tls" or
1014 /// "sysreg".
1015StringRef getStackProtectorGuardReg()const;
1016void setStackProtectorGuardReg(StringRefReg);
1017
1018 /// Get/set a symbol to use as the stack protector guard.
1019StringRef getStackProtectorGuardSymbol()const;
1020void setStackProtectorGuardSymbol(StringRef Symbol);
1021
1022 /// Get/set what offset from the stack protector to use.
1023int getStackProtectorGuardOffset()const;
1024void setStackProtectorGuardOffset(intOffset);
1025
1026 /// Get/set the stack alignment overridden from the default.
1027unsigned getOverrideStackAlignment()const;
1028void setOverrideStackAlignment(unsignedAlign);
1029
1030unsigned getMaxTLSAlignment()const;
1031
1032 /// @name Utility functions for querying and setting the build SDK version
1033 /// @{
1034
1035 /// Attach a build SDK version metadata to this module.
1036void setSDKVersion(constVersionTuple &V);
1037
1038 /// Get the build SDK version metadata.
1039 ///
1040 /// An empty version is returned if no such metadata is attached.
1041VersionTuple getSDKVersion()const;
1042 /// @}
1043
1044 /// Take ownership of the given memory buffer.
1045void setOwnedMemoryBuffer(std::unique_ptr<MemoryBuffer> MB);
1046
1047 /// Set the partial sample profile ratio in the profile summary module flag,
1048 /// if applicable.
1049void setPartialSampleProfileRatio(constModuleSummaryIndex &Index);
1050
1051 /// Get the target variant triple which is a string describing a variant of
1052 /// the target host platform. For example, Mac Catalyst can be a variant
1053 /// target triple for a macOS target.
1054 /// @returns a string containing the target variant triple.
1055StringRef getDarwinTargetVariantTriple()const;
1056
1057 /// Set the target variant triple which is a string describing a variant of
1058 /// the target host platform.
1059void setDarwinTargetVariantTriple(StringRefT);
1060
1061 /// Get the target variant version build SDK version metadata.
1062 ///
1063 /// An empty version is returned if no such metadata is attached.
1064VersionTuple getDarwinTargetVariantSDKVersion()const;
1065
1066 /// Set the target variant version build SDK version metadata.
1067void setDarwinTargetVariantSDKVersion(VersionTuple Version);
1068};
1069
1070/// Given "llvm.used" or "llvm.compiler.used" as a global name, collect the
1071/// initializer elements of that global in a SmallVector and return the global
1072/// itself.
1073GlobalVariable *collectUsedGlobalVariables(const Module &M,
1074 SmallVectorImpl<GlobalValue *> &Vec,
1075bool CompilerUsed);
1076
1077/// An raw_ostream inserter for modules.
1078inlineraw_ostream &operator<<(raw_ostream &O,constModule &M) {
1079 M.print(O,nullptr);
1080return O;
1081}
1082
1083// Create wrappers for C Binding types (see CBindingWrapping.h).
1084DEFINE_SIMPLE_CONVERSION_FUNCTIONS(Module,LLVMModuleRef)
1085
1086/* LLVMModuleProviderRef exists for historical reasons, but now just holds a
1087 * Module.
1088 */
1089inlineModule *unwrap(LLVMModuleProviderRef MP) {
1090returnreinterpret_cast<Module*>(MP);
1091}
1092
1093}// end namespace llvm
1094
1095#endif// LLVM_IR_MODULE_H
const
aarch64 promote const
Definition:AArch64PromoteConstant.cpp:230
StringMap.h
This file defines the StringMap class.
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition:ARMSLSHardening.cpp:73
inline
always inline
Definition:AlwaysInliner.cpp:161
print
static void print(raw_ostream &Out, object::Archive::Kind Kind, T Val)
Definition:ArchiveWriter.cpp:205
Attributes.h
This file contains the simple types necessary to represent the attributes associated with functions a...
B
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
C
static GCRegistry::Add< ShadowStackGC > C("shadow-stack", "Very portable GC for uncooperative code generators")
CBindingWrapping.h
DEFINE_SIMPLE_CONVERSION_FUNCTIONS
#define DEFINE_SIMPLE_CONVERSION_FUNCTIONS(ty, ref)
Definition:CBindingWrapping.h:19
CodeGen.h
DataLayout.h
RetTy
return RetTy
Definition:DeadArgumentElimination.cpp:361
Idx
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
Definition:DeadArgumentElimination.cpp:353
Name
std::string Name
Definition:ELFObjHandler.cpp:77
Index
uint32_t Index
Definition:ELFObjHandler.cpp:83
Other
std::optional< std::vector< StOtherPiece > > Other
Definition:ELFYAML.cpp:1315
Offset
uint64_t Offset
Definition:ELF_riscv.cpp:478
getFunction
static Function * getFunction(Constant *C)
Definition:Evaluator.cpp:235
GlobalAlias.h
GlobalIFunc.h
This file contains the declaration of the GlobalIFunc class, which represents a single indirect funct...
GlobalVariable.h
Function.h
F
#define F(x, y, z)
Definition:MD5.cpp:55
I
#define I(x, y, z)
Definition:MD5.cpp:58
Module
Machine Check Debug Module
Definition:MachineCheckDebugify.cpp:124
Reg
unsigned Reg
Definition:MachineSink.cpp:2028
getOrInsertGlobal
static Constant * getOrInsertGlobal(Module &M, StringRef Name, Type *Ty)
Definition:MemorySanitizer.cpp:858
Metadata.h
This file contains the declarations for metadata subclasses.
T
#define T
Definition:Mips16ISelLowering.cpp:341
getCodeModel
static CodeModel::Model getCodeModel(const PPCSubtarget &S, const TargetMachine &TM, const MachineOperand &MO)
Definition:PPCAsmPrinter.cpp:479
ProfileSummary.h
STLExtras.h
This file contains some templates that are useful if you are working with the STL at all.
OS
raw_pwrite_stream & OS
Definition:SampleProfWriter.cpp:51
StringRef.h
SymbolTableListTraits.h
Types.h
getGlobalVariable
static GlobalVariable * getGlobalVariable(Module &M, Type *Ty, WebAssemblyTargetMachine &TM, const char *Name)
Definition:WebAssemblyLowerEmscriptenEHSjLj.cpp:407
FunctionType
Definition:ItaniumDemangle.h:823
Node
Definition:ItaniumDemangle.h:163
T
llvm::AssemblyAnnotationWriter
Definition:AssemblyAnnotationWriter.h:27
llvm::AttributeList
Definition:Attributes.h:490
llvm::Comdat
Definition:Comdat.h:33
llvm::Constant
This is an important base class in LLVM.
Definition:Constant.h:42
llvm::DICompileUnit
Compile unit.
Definition:DebugInfoMetadata.h:1469
llvm::DataLayout
A parsed version of the target data layout string in and methods for querying it.
Definition:DataLayout.h:63
llvm::DenseMap
Definition:DenseMap.h:727
llvm::Error
Lightweight error class with error context and mandatory checking.
Definition:Error.h:160
llvm::FunctionCallee
A handy container for a FunctionType+Callee-pointer pair, which can be passed around as a single enti...
Definition:DerivedTypes.h:170
llvm::FunctionType
Class to represent function types.
Definition:DerivedTypes.h:105
llvm::Function
Definition:Function.h:63
llvm::GVMaterializer
Definition:GVMaterializer.h:28
llvm::GlobalAlias
Definition:GlobalAlias.h:28
llvm::GlobalIFunc
Definition:GlobalIFunc.h:34
llvm::GlobalObject
Definition:GlobalObject.h:27
llvm::GlobalValue
Definition:GlobalValue.h:48
llvm::GlobalVariable
Definition:GlobalVariable.h:39
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition:LLVMContext.h:67
llvm::MDNode
Metadata node.
Definition:Metadata.h:1073
llvm::MDString
A single uniqued string.
Definition:Metadata.h:724
llvm::Metadata
Root of the metadata hierarchy.
Definition:Metadata.h:62
llvm::ModuleSummaryIndex
Class to hold module path string table and global value map, and encapsulate methods for operating on...
Definition:ModuleSummaryIndex.h:1345
llvm::Module::debug_compile_units_iterator
An iterator for DICompileUnits that skips those marked NoDebug.
Definition:Module.h:815
llvm::Module::debug_compile_units_iterator::operator++
debug_compile_units_iterator & operator++()
Definition:Module.h:833
llvm::Module::debug_compile_units_iterator::operator==
bool operator==(const debug_compile_units_iterator &I) const
Definition:Module.h:845
llvm::Module::debug_compile_units_iterator::operator++
debug_compile_units_iterator operator++(int)
Definition:Module.h:839
llvm::Module::debug_compile_units_iterator::iterator_category
std::input_iterator_tag iterator_category
Definition:Module.h:822
llvm::Module::debug_compile_units_iterator::difference_type
std::ptrdiff_t difference_type
Definition:Module.h:824
llvm::Module::debug_compile_units_iterator::debug_compile_units_iterator
debug_compile_units_iterator(NamedMDNode *CUs, unsigned Idx)
Definition:Module.h:828
llvm::Module::debug_compile_units_iterator::operator!=
bool operator!=(const debug_compile_units_iterator &I) const
Definition:Module.h:849
llvm::Module
A Module instance is used to store all the information related to an LLVM module.
Definition:Module.h:65
llvm::Module::global_begin
global_iterator global_begin()
Definition:Module.h:695
llvm::Module::removeIFunc
void removeIFunc(GlobalIFunc *IFunc)
Detach IFunc from the list but don't delete it.
Definition:Module.h:631
llvm::Module::global_begin
const_global_iterator global_begin() const
Definition:Module.h:696
llvm::Module::begin
const_iterator begin() const
Definition:Module.h:714
llvm::Module::ifunc_begin
ifunc_iterator ifunc_begin()
Definition:Module.h:753
llvm::Module::eraseNamedMDNode
void eraseNamedMDNode(NamedMDNode *MDNode)
Remove MDNode from the list and delete it.
Definition:Module.h:642
llvm::Module::getModuleInlineAsm
const std::string & getModuleInlineAsm() const
Get any module-scope inline assembly blocks.
Definition:Module.h:306
llvm::Module::ModFlagBehavior
ModFlagBehavior
This enumeration defines the supported behaviors of module flags.
Definition:Module.h:115
llvm::Module::getContext
LLVMContext & getContext() const
Get the global data context.
Definition:Module.h:302
llvm::Module::insertIFunc
void insertIFunc(GlobalIFunc *IFunc)
Insert IFunc at the end of the alias list and take ownership.
Definition:Module.h:635
llvm::Module::aliases
iterator_range< const_alias_iterator > aliases() const
Definition:Module.h:745
llvm::Module::setModuleInlineAsm
void setModuleInlineAsm(StringRef Asm)
Set the module-scope inline assembly blocks.
Definition:Module.h:345
llvm::Module::getComdatSymbolTable
const ComdatSymTabType & getComdatSymbolTable() const
Get the Module's symbol table for COMDATs (constant).
Definition:Module.h:687
llvm::Module::IsNewDbgInfoFormat
bool IsNewDbgInfoFormat
Is this Module using intrinsics to record the position of debugging information, or non-intrinsic rec...
Definition:Module.h:217
llvm::Module::global_end
global_iterator global_end()
Definition:Module.h:697
llvm::Module::getNamedGlobal
GlobalVariable * getNamedGlobal(StringRef Name)
Definition:Module.h:465
llvm::Module::named_metadata_iterator
NamedMDListType::iterator named_metadata_iterator
The named metadata iterators.
Definition:Module.h:110
llvm::Module::alias_size
size_t alias_size() const
Definition:Module.h:739
llvm::Module::global_end
const_global_iterator global_end() const
Definition:Module.h:698
llvm::Module::global_empty
bool global_empty() const
Definition:Module.h:700
llvm::Module::begin
iterator begin()
Definition:Module.h:713
llvm::Module::convertToNewDbgValues
void convertToNewDbgValues()
Definition:Module.h:225
llvm::Module::getOrInsertFunction
FunctionCallee getOrInsertFunction(StringRef Name, AttributeList AttributeList, Type *RetTy, ArgsTy... Args)
Same as above, but takes a list of function arguments, which makes it easier for clients to use.
Definition:Module.h:413
llvm::Module::ifunc_end
const_ifunc_iterator ifunc_end() const
Definition:Module.h:756
llvm::Module::convertFromNewDbgValues
void convertFromNewDbgValues()
Definition:Module.h:233
llvm::Module::ifuncs
iterator_range< ifunc_iterator > ifuncs()
Definition:Module.h:760
llvm::Module::named_metadata_empty
bool named_metadata_empty() const
Definition:Module.h:805
llvm::Module::getValueSymbolTable
ValueSymbolTable & getValueSymbolTable()
Get the Module's symbol table of global variable and function identifiers.
Definition:Module.h:684
llvm::Module::const_named_metadata_iterator
NamedMDListType::const_iterator const_named_metadata_iterator
The named metadata constant iterators.
Definition:Module.h:112
llvm::Module::named_metadata_begin
const_named_metadata_iterator named_metadata_begin() const
Definition:Module.h:795
llvm::Module::global_size
size_t global_size() const
Definition:Module.h:699
llvm::Module::debug_compile_units
iterator_range< debug_compile_units_iterator > debug_compile_units() const
Return an iterator for all DICompileUnits listed in this Module's llvm.dbg.cu named metadata node and...
Definition:Module.h:870
llvm::Module::functions
iterator_range< iterator > functions()
Definition:Module.h:724
llvm::Module::getName
StringRef getName() const
Get a short "name" for the module.
Definition:Module.h:285
llvm::Module::getMaterializer
GVMaterializer * getMaterializer() const
Retrieves the GVMaterializer, if any, for this Module.
Definition:Module.h:568
llvm::Module::getSourceFileName
const std::string & getSourceFileName() const
Get the module's original source file name.
Definition:Module.h:279
llvm::Module::ifunc_iterator
IFuncListType::iterator ifunc_iterator
The Global IFunc iterators.
Definition:Module.h:105
llvm::Module::alias_end
const_alias_iterator alias_end() const
Definition:Module.h:738
llvm::Module::removeAlias
void removeAlias(GlobalAlias *Alias)
Detach Alias from the list but don't delete it.
Definition:Module.h:622
llvm::Module::named_metadata
iterator_range< named_metadata_iterator > named_metadata()
Definition:Module.h:807
llvm::Module::named_metadata_begin
named_metadata_iterator named_metadata_begin()
Definition:Module.h:794
llvm::Module::ifunc_end
ifunc_iterator ifunc_end()
Definition:Module.h:755
llvm::Module::const_global_iterator
GlobalListType::const_iterator const_global_iterator
The Global Variable constant iterator.
Definition:Module.h:87
llvm::Module::aliases
iterator_range< alias_iterator > aliases()
Definition:Module.h:742
llvm::Module::getTargetTriple
const std::string & getTargetTriple() const
Get the target triple which is a string describing the target host.
Definition:Module.h:298
llvm::Module::insertGlobalVariable
void insertGlobalVariable(GlobalListType::iterator Where, GlobalVariable *GV)
Insert global variable GV into the global variable list before Where and take ownership.
Definition:Module.h:591
llvm::Module::alias_end
alias_iterator alias_end()
Definition:Module.h:737
llvm::Module::alias_begin
const_alias_iterator alias_begin() const
Definition:Module.h:736
llvm::Module::rbegin
const_reverse_iterator rbegin() const
Definition:Module.h:718
llvm::Module::alias_begin
alias_iterator alias_begin()
Definition:Module.h:735
llvm::Module::rend
reverse_iterator rend()
Definition:Module.h:719
llvm::Module::iterator
FunctionListType::iterator iterator
The Function iterators.
Definition:Module.h:90
llvm::Module::getGlobalVariable
GlobalVariable * getGlobalVariable(StringRef Name, bool AllowInternal=false)
Definition:Module.h:453
llvm::Module::eraseIFunc
void eraseIFunc(GlobalIFunc *IFunc)
Remove IFunc from the list and delete it.
Definition:Module.h:633
llvm::Module::shouldEmitInstrCountChangedRemark
bool shouldEmitInstrCountChangedRemark()
Return true if size-info optimization remark is enabled, false otherwise.
Definition:Module.h:321
llvm::Module::global_iterator
GlobalListType::iterator global_iterator
The Global Variable iterator.
Definition:Module.h:85
llvm::Module::size
size_t size() const
Definition:Module.h:721
llvm::Module::setNewDbgInfoFormatFlag
void setNewDbgInfoFormatFlag(bool NewFlag)
Definition:Module.h:246
llvm::Module::const_reverse_iterator
FunctionListType::const_reverse_iterator const_reverse_iterator
The Function constant reverse iterator.
Definition:Module.h:97
llvm::Module::alias_empty
bool alias_empty() const
Definition:Module.h:740
llvm::Module::getOrInsertFunction
FunctionCallee getOrInsertFunction(StringRef Name, AttributeList AttributeList, FunctionType *Invalid, ArgsTy... Args)=delete
llvm::Module::globals
iterator_range< global_iterator > globals()
Definition:Module.h:702
llvm::Module::rend
const_reverse_iterator rend() const
Definition:Module.h:720
llvm::Module::named_metadata
iterator_range< const_named_metadata_iterator > named_metadata() const
Definition:Module.h:810
llvm::Module::const_ifunc_iterator
IFuncListType::const_iterator const_ifunc_iterator
The Global IFunc constant iterator.
Definition:Module.h:107
llvm::Module::ifunc_size
size_t ifunc_size() const
Definition:Module.h:757
llvm::Module::getFunctionList
FunctionListType & getFunctionList()
Get the Module's list of functions.
Definition:Module.h:616
llvm::Module::eraseAlias
void eraseAlias(GlobalAlias *Alias)
Remove Alias from the list and delete it.
Definition:Module.h:624
llvm::Module::getModuleIdentifier
const std::string & getModuleIdentifier() const
Get the module identifier which is, essentially, the name of the module.
Definition:Module.h:268
llvm::Module::eraseGlobalVariable
void eraseGlobalVariable(GlobalVariable *GV)
Remove global variable GV from the list and delete it.
Definition:Module.h:583
llvm::Module::rbegin
reverse_iterator rbegin()
Definition:Module.h:717
llvm::Module::getOrInsertFunction
FunctionCallee getOrInsertFunction(StringRef Name, Type *RetTy, ArgsTy... Args)
Same as above, but without the attributes.
Definition:Module.h:424
llvm::Module::insertNamedMDNode
void insertNamedMDNode(NamedMDNode *MDNode)
Insert MDNode at the end of the alias list and take ownership.
Definition:Module.h:644
llvm::Module::named_metadata_end
const_named_metadata_iterator named_metadata_end() const
Definition:Module.h:800
llvm::Module::empty
bool empty() const
Definition:Module.h:722
llvm::Module::removeNamedMDNode
void removeNamedMDNode(NamedMDNode *MDNode)
Detach MDNode from the list but don't delete it.
Definition:Module.h:640
llvm::Module::alias_iterator
AliasListType::iterator alias_iterator
The Global Alias iterators.
Definition:Module.h:100
llvm::Module::end
iterator end()
Definition:Module.h:715
llvm::Module::getGlobalVariable
GlobalVariable * getGlobalVariable(StringRef Name) const
Look up the specified global variable in the module symbol table.
Definition:Module.h:447
llvm::Module::insertGlobalVariable
void insertGlobalVariable(GlobalVariable *GV)
Insert global variable GV at the end of the global variable list and take ownership.
Definition:Module.h:586
llvm::Module::getValueSymbolTable
const ValueSymbolTable & getValueSymbolTable() const
Get the symbol table of global variable and function identifiers.
Definition:Module.h:682
llvm::Module::named_metadata_size
size_t named_metadata_size() const
Definition:Module.h:804
llvm::Module::named_metadata_end
named_metadata_iterator named_metadata_end()
Definition:Module.h:799
llvm::Module::isMaterialized
bool isMaterialized() const
Definition:Module.h:569
llvm::Module::getNamedGlobal
const GlobalVariable * getNamedGlobal(StringRef Name) const
Return the global variable in the module with the specified name, of arbitrary type.
Definition:Module.h:462
llvm::Module::const_alias_iterator
AliasListType::const_iterator const_alias_iterator
The Global Alias constant iterator.
Definition:Module.h:102
llvm::Module::getComdatSymbolTable
ComdatSymTabType & getComdatSymbolTable()
Get the Module's symbol table for COMDATs.
Definition:Module.h:689
llvm::Module::reverse_iterator
FunctionListType::reverse_iterator reverse_iterator
The Function reverse iterator.
Definition:Module.h:95
llvm::Module::getDataLayout
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
Definition:Module.h:294
llvm::Module::functions
iterator_range< const_iterator > functions() const
Definition:Module.h:727
llvm::Module::setIsNewDbgInfoFormat
void setIsNewDbgInfoFormat(bool UseNewFormat)
Definition:Module.h:240
llvm::Module::getModuleFlagsMetadata
NamedMDNode * getModuleFlagsMetadata() const
Returns the NamedMDNode in the module that represents module-level flags.
Definition:Module.h:537
llvm::Module::globals
iterator_range< const_global_iterator > globals() const
Definition:Module.h:705
llvm::Module::setModuleIdentifier
void setModuleIdentifier(StringRef ID)
Set the module identifier.
Definition:Module.h:331
llvm::Module::ifuncs
iterator_range< const_ifunc_iterator > ifuncs() const
Definition:Module.h:763
llvm::Module::end
const_iterator end() const
Definition:Module.h:716
llvm::Module::setSourceFileName
void setSourceFileName(StringRef Name)
Set the module's original source file name.
Definition:Module.h:334
llvm::Module::ifunc_begin
const_ifunc_iterator ifunc_begin() const
Definition:Module.h:754
llvm::Module::getDataLayoutStr
const std::string & getDataLayoutStr() const
Get the data layout string for the module's target platform.
Definition:Module.h:289
llvm::Module::getSublistAccess
static FunctionListType Module::* getSublistAccess(Function *)
Definition:Module.h:617
llvm::Module::appendModuleInlineAsm
void appendModuleInlineAsm(StringRef Asm)
Append to the module-scope inline assembly blocks.
Definition:Module.h:353
llvm::Module::const_iterator
FunctionListType::const_iterator const_iterator
The Function constant iterator.
Definition:Module.h:92
llvm::Module::insertAlias
void insertAlias(GlobalAlias *Alias)
Insert Alias at the end of the alias list and take ownership.
Definition:Module.h:626
llvm::Module::debug_compile_units_begin
debug_compile_units_iterator debug_compile_units_begin() const
Definition:Module.h:857
llvm::Module::setTargetTriple
void setTargetTriple(StringRef T)
Set the target triple.
Definition:Module.h:341
llvm::Module::ifunc_empty
bool ifunc_empty() const
Definition:Module.h:758
llvm::Module::removeGlobalVariable
void removeGlobalVariable(GlobalVariable *GV)
Detach global variable GV from the list but don't delete it.
Definition:Module.h:581
llvm::Module::debug_compile_units_end
debug_compile_units_iterator debug_compile_units_end() const
Definition:Module.h:862
llvm::NamedMDNode
A tuple of MDNodes.
Definition:Metadata.h:1737
llvm::ProfileSummary::Kind
Kind
Definition:ProfileSummary.h:47
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition:SmallVector.h:573
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition:SmallVector.h:1196
llvm::StringMap< Comdat >
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition:StringRef.h:51
llvm::SymbolTableListTraits
Definition:SymbolTableListTraits.h:67
llvm::SymbolTableList< GlobalVariable >
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition:Type.h:45
llvm::ValueSymbolTable
This class provides a symbol table of name/value pairs.
Definition:ValueSymbolTable.h:39
llvm::Value
LLVM Value Representation.
Definition:Value.h:74
llvm::VersionTuple
Represents a version number in the form major[.minor[.subminor[.build]]].
Definition:VersionTuple.h:29
llvm::concat_iterator
Iterator wrapper that concatenates sequences together.
Definition:STLExtras.h:1024
llvm::function_ref
An efficient, type-erasing, non-owning reference to a callable.
Definition:STLFunctionalExtras.h:37
llvm::iplist_impl::const_reverse_iterator
base_list_type::const_reverse_iterator const_reverse_iterator
Definition:ilist.h:125
llvm::iplist_impl::reverse_iterator
base_list_type::reverse_iterator reverse_iterator
Definition:ilist.h:123
llvm::iplist_impl::const_iterator
base_list_type::const_iterator const_iterator
Definition:ilist.h:122
llvm::iplist_impl::iterator
base_list_type::iterator iterator
Definition:ilist.h:121
llvm::iplist
An intrusive list with ownership and callbacks specified/controlled by ilist_traits,...
Definition:ilist.h:328
llvm::iterator_range
A range adaptor for a pair of iterators.
Definition:iterator_range.h:42
llvm::raw_ostream
This class implements an extremely fast bulk output stream that can only output to a stream.
Definition:raw_ostream.h:52
uint32_t
uint64_t
unsigned
LLVMModuleRef
struct LLVMOpaqueModule * LLVMModuleRef
The top-level container for all other LLVM Intermediate Representation (IR) objects.
Definition:Types.h:61
LLVMModuleProviderRef
struct LLVMOpaqueModuleProvider * LLVMModuleProviderRef
Interface used to provide a module to JIT or interpreter.
Definition:Types.h:124
iterator_range.h
This provides a very simple, boring adaptor for a begin and end iterator into a range type.
Comdat.h
This file contains the declaration of the Comdat class, which represents a single COMDAT in LLVM.
llvm::CodeModel::Model
Model
Definition:CodeGen.h:31
llvm::Intrinsic::ID
unsigned ID
Definition:GenericSSAContext.h:28
llvm::PICLevel::Level
Level
Definition:CodeGen.h:36
llvm::PIELevel::Level
Level
Definition:CodeGen.h:40
llvm::lltok::Error
@ Error
Definition:LLToken.h:21
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
llvm::dump
void dump(const SparseBitVector< ElementSize > &LHS, raw_ostream &out)
Definition:SparseBitVector.h:877
llvm::FramePointerKind
FramePointerKind
Definition:CodeGen.h:90
llvm::operator*
APInt operator*(APInt a, uint64_t RHS)
Definition:APInt.h:2204
llvm::make_range
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
Definition:iterator_range.h:77
llvm::UWTableKind
UWTableKind
Definition:CodeGen.h:120
llvm::unwrap
Attribute unwrap(LLVMAttributeRef Attr)
Definition:Attributes.h:335
llvm::operator<<
raw_ostream & operator<<(raw_ostream &OS, const APFixedPoint &FX)
Definition:APFixedPoint.h:303
llvm::collectUsedGlobalVariables
GlobalVariable * collectUsedGlobalVariables(const Module &M, SmallVectorImpl< GlobalValue * > &Vec, bool CompilerUsed)
Given "llvm.used" or "llvm.compiler.used" as a global name, collect the initializer elements of that ...
Definition:Module.cpp:865
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition:Alignment.h:39
llvm::DWARFExpression::Operation::Description
Description of the encoding of one expression Op.
Definition:DWARFExpression.h:66
llvm::Module::ModuleFlagEntry
Definition:Module.h:161
llvm::Module::ModuleFlagEntry::Val
Metadata * Val
Definition:Module.h:164
llvm::Module::ModuleFlagEntry::Key
MDString * Key
Definition:Module.h:163
llvm::Module::ModuleFlagEntry::Behavior
ModFlagBehavior Behavior
Definition:Module.h:162
llvm::Module::ModuleFlagEntry::ModuleFlagEntry
ModuleFlagEntry(ModFlagBehavior B, MDString *K, Metadata *V)
Definition:Module.h:166

Generated on Thu Jul 17 2025 10:05:44 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp