1 //===-- llvm/Module.h - C++ class to represent a VM module ------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
11 /// Module.h This file contains the declarations for the Module class.
13 //===----------------------------------------------------------------------===//
15 #ifndef LLVM_IR_MODULE_H
16 #define LLVM_IR_MODULE_H
18 #include "llvm/ADT/iterator_range.h"
19 #include "llvm/IR/Comdat.h"
20 #include "llvm/IR/DataLayout.h"
21 #include "llvm/IR/Function.h"
22 #include "llvm/IR/GlobalAlias.h"
23 #include "llvm/IR/GlobalVariable.h"
24 #include "llvm/IR/Metadata.h"
25 #include "llvm/Support/CBindingWrapping.h"
26 #include "llvm/Support/CodeGen.h"
27 #include "llvm/Support/DataTypes.h"
28 #include <system_error>
34 class RandomNumberGenerator;
37 template<> struct ilist_traits<Function>
38 : public SymbolTableListTraits<Function, Module> {
40 // createSentinel is used to get hold of the node that marks the end of the
41 // list... (same trick used here as in ilist_traits<Instruction>)
42 Function *createSentinel() const {
43 return static_cast<Function*>(&Sentinel);
45 static void destroySentinel(Function*) {}
47 Function *provideInitialHead() const { return createSentinel(); }
48 Function *ensureHead(Function*) const { return createSentinel(); }
49 static void noteHead(Function*, Function*) {}
52 mutable ilist_node<Function> Sentinel;
55 template<> struct ilist_traits<GlobalVariable>
56 : public SymbolTableListTraits<GlobalVariable, Module> {
57 // createSentinel is used to create a node that marks the end of the list.
58 GlobalVariable *createSentinel() const {
59 return static_cast<GlobalVariable*>(&Sentinel);
61 static void destroySentinel(GlobalVariable*) {}
63 GlobalVariable *provideInitialHead() const { return createSentinel(); }
64 GlobalVariable *ensureHead(GlobalVariable*) const { return createSentinel(); }
65 static void noteHead(GlobalVariable*, GlobalVariable*) {}
67 mutable ilist_node<GlobalVariable> Sentinel;
70 template<> struct ilist_traits<GlobalAlias>
71 : public SymbolTableListTraits<GlobalAlias, Module> {
72 // createSentinel is used to create a node that marks the end of the list.
73 GlobalAlias *createSentinel() const {
74 return static_cast<GlobalAlias*>(&Sentinel);
76 static void destroySentinel(GlobalAlias*) {}
78 GlobalAlias *provideInitialHead() const { return createSentinel(); }
79 GlobalAlias *ensureHead(GlobalAlias*) const { return createSentinel(); }
80 static void noteHead(GlobalAlias*, GlobalAlias*) {}
82 mutable ilist_node<GlobalAlias> Sentinel;
85 template<> struct ilist_traits<NamedMDNode>
86 : public ilist_default_traits<NamedMDNode> {
87 // createSentinel is used to get hold of a node that marks the end of
89 NamedMDNode *createSentinel() const {
90 return static_cast<NamedMDNode*>(&Sentinel);
92 static void destroySentinel(NamedMDNode*) {}
94 NamedMDNode *provideInitialHead() const { return createSentinel(); }
95 NamedMDNode *ensureHead(NamedMDNode*) const { return createSentinel(); }
96 static void noteHead(NamedMDNode*, NamedMDNode*) {}
97 void addNodeToList(NamedMDNode *) {}
98 void removeNodeFromList(NamedMDNode *) {}
100 mutable ilist_node<NamedMDNode> Sentinel;
103 /// A Module instance is used to store all the information related to an
104 /// LLVM module. Modules are the top level container of all other LLVM
105 /// Intermediate Representation (IR) objects. Each module directly contains a
106 /// list of globals variables, a list of functions, a list of libraries (or
107 /// other modules) this module depends on, a symbol table, and various data
108 /// about the target's characteristics.
110 /// A module maintains a GlobalValRefMap object that is used to hold all
111 /// constant references to global variables in the module. When a global
112 /// variable is destroyed, it should have no entries in the GlobalValueRefMap.
113 /// @brief The main container class for the LLVM Intermediate Representation.
115 /// @name Types And Enumerations
118 /// The type for the list of global variables.
119 typedef iplist<GlobalVariable> GlobalListType;
120 /// The type for the list of functions.
121 typedef iplist<Function> FunctionListType;
122 /// The type for the list of aliases.
123 typedef iplist<GlobalAlias> AliasListType;
124 /// The type for the list of named metadata.
125 typedef ilist<NamedMDNode> NamedMDListType;
126 /// The type of the comdat "symbol" table.
127 typedef StringMap<Comdat> ComdatSymTabType;
129 /// The Global Variable iterator.
130 typedef GlobalListType::iterator global_iterator;
131 /// The Global Variable constant iterator.
132 typedef GlobalListType::const_iterator const_global_iterator;
134 /// The Function iterators.
135 typedef FunctionListType::iterator iterator;
136 /// The Function constant iterator
137 typedef FunctionListType::const_iterator const_iterator;
139 /// The Function reverse iterator.
140 typedef FunctionListType::reverse_iterator reverse_iterator;
141 /// The Function constant reverse iterator.
142 typedef FunctionListType::const_reverse_iterator const_reverse_iterator;
144 /// The Global Alias iterators.
145 typedef AliasListType::iterator alias_iterator;
146 /// The Global Alias constant iterator
147 typedef AliasListType::const_iterator const_alias_iterator;
149 /// The named metadata iterators.
150 typedef NamedMDListType::iterator named_metadata_iterator;
151 /// The named metadata constant iterators.
152 typedef NamedMDListType::const_iterator const_named_metadata_iterator;
154 /// This enumeration defines the supported behaviors of module flags.
155 enum ModFlagBehavior {
156 /// Emits an error if two values disagree, otherwise the resulting value is
157 /// that of the operands.
160 /// Emits a warning if two values disagree. The result value will be the
161 /// operand for the flag from the first module being linked.
164 /// Adds a requirement that another module flag be present and have a
165 /// specified value after linking is performed. The value must be a metadata
166 /// pair, where the first element of the pair is the ID of the module flag
167 /// to be restricted, and the second element of the pair is the value the
168 /// module flag should be restricted to. This behavior can be used to
169 /// restrict the allowable results (via triggering of an error) of linking
170 /// IDs with the **Override** behavior.
173 /// Uses the specified value, regardless of the behavior or value of the
174 /// other module. If both modules specify **Override**, but the values
175 /// differ, an error will be emitted.
178 /// Appends the two values, which are required to be metadata nodes.
181 /// Appends the two values, which are required to be metadata
182 /// nodes. However, duplicate entries in the second list are dropped
183 /// during the append operation.
187 ModFlagBehaviorFirstVal = Error,
188 ModFlagBehaviorLastVal = AppendUnique
191 /// Checks if Metadata represents a valid ModFlagBehavior, and stores the
192 /// converted result in MFB.
193 static bool isValidModFlagBehavior(Metadata *MD, ModFlagBehavior &MFB);
195 struct ModuleFlagEntry {
196 ModFlagBehavior Behavior;
199 ModuleFlagEntry(ModFlagBehavior B, MDString *K, Metadata *V)
200 : Behavior(B), Key(K), Val(V) {}
204 /// @name Member Variables
207 LLVMContext &Context; ///< The LLVMContext from which types and
208 ///< constants are allocated.
209 GlobalListType GlobalList; ///< The Global Variables in the module
210 FunctionListType FunctionList; ///< The Functions in the module
211 AliasListType AliasList; ///< The Aliases in the module
212 NamedMDListType NamedMDList; ///< The named metadata in the module
213 std::string GlobalScopeAsm; ///< Inline Asm at global scope.
214 ValueSymbolTable *ValSymTab; ///< Symbol table for values
215 ComdatSymTabType ComdatSymTab; ///< Symbol table for COMDATs
216 std::unique_ptr<GVMaterializer>
217 Materializer; ///< Used to materialize GlobalValues
218 std::string ModuleID; ///< Human readable identifier for the module
219 std::string TargetTriple; ///< Platform target triple Module compiled on
220 ///< Format: (arch)(sub)-(vendor)-(sys0-(abi)
221 void *NamedMDSymTab; ///< NamedMDNode names.
223 // We need to keep the string because the C API expects us to own the string
225 // Since we have it, we also use an empty string to represent a module without
226 // a DataLayout. If it has a DataLayout, these variables are in sync and the
227 // string is just a cache of getDataLayout()->getStringRepresentation().
228 std::string DataLayoutStr;
231 friend class Constant;
234 /// @name Constructors
237 /// The Module constructor. Note that there is no default constructor. You
238 /// must provide a name for the module upon construction.
239 explicit Module(StringRef ModuleID, LLVMContext& C);
240 /// The module destructor. This will dropAllReferences.
244 /// @name Module Level Accessors
247 /// Get the module identifier which is, essentially, the name of the module.
248 /// @returns the module identifier as a string
249 const std::string &getModuleIdentifier() const { return ModuleID; }
251 /// Get the data layout string for the module's target platform. This is
252 /// equivalent to getDataLayout()->getStringRepresentation().
253 const std::string &getDataLayoutStr() const { return DataLayoutStr; }
255 /// Get the data layout for the module's target platform.
256 const DataLayout *getDataLayout() const;
258 /// Get the target triple which is a string describing the target host.
259 /// @returns a string containing the target triple.
260 const std::string &getTargetTriple() const { return TargetTriple; }
262 /// Get the global data context.
263 /// @returns LLVMContext - a container for LLVM's global information
264 LLVMContext &getContext() const { return Context; }
266 /// Get any module-scope inline assembly blocks.
267 /// @returns a string containing the module-scope inline assembly blocks.
268 const std::string &getModuleInlineAsm() const { return GlobalScopeAsm; }
270 /// Get a RandomNumberGenerator salted for use with this module. The
271 /// RNG can be seeded via -rng-seed=<uint64> and is salted with the
272 /// ModuleID and the provided pass salt. The returned RNG should not
273 /// be shared across threads or passes.
275 /// A unique RNG per pass ensures a reproducible random stream even
276 /// when other randomness consuming passes are added or removed. In
277 /// addition, the random stream will be reproducible across LLVM
278 /// versions when the pass does not change.
279 RandomNumberGenerator *createRNG(const Pass* P) const;
282 /// @name Module Level Mutators
285 /// Set the module identifier.
286 void setModuleIdentifier(StringRef ID) { ModuleID = ID; }
288 /// Set the data layout
289 void setDataLayout(StringRef Desc);
290 void setDataLayout(const DataLayout *Other);
292 /// Set the target triple.
293 void setTargetTriple(StringRef T) { TargetTriple = T; }
295 /// Set the module-scope inline assembly blocks.
296 void setModuleInlineAsm(StringRef Asm) {
297 GlobalScopeAsm = Asm;
298 if (!GlobalScopeAsm.empty() &&
299 GlobalScopeAsm[GlobalScopeAsm.size()-1] != '\n')
300 GlobalScopeAsm += '\n';
303 /// Append to the module-scope inline assembly blocks, automatically inserting
304 /// a separating newline if necessary.
305 void appendModuleInlineAsm(StringRef Asm) {
306 GlobalScopeAsm += Asm;
307 if (!GlobalScopeAsm.empty() &&
308 GlobalScopeAsm[GlobalScopeAsm.size()-1] != '\n')
309 GlobalScopeAsm += '\n';
313 /// @name Generic Value Accessors
316 /// Return the global value in the module with the specified name, of
317 /// arbitrary type. This method returns null if a global with the specified
318 /// name is not found.
319 GlobalValue *getNamedValue(StringRef Name) const;
321 /// Return a unique non-zero ID for the specified metadata kind. This ID is
322 /// uniqued across modules in the current LLVMContext.
323 unsigned getMDKindID(StringRef Name) const;
325 /// Populate client supplied SmallVector with the name for custom metadata IDs
326 /// registered in this LLVMContext.
327 void getMDKindNames(SmallVectorImpl<StringRef> &Result) const;
329 /// Return the type with the specified name, or null if there is none by that
331 StructType *getTypeByName(StringRef Name) const;
333 std::vector<StructType *> getIdentifiedStructTypes() const;
336 /// @name Function Accessors
339 /// Look up the specified function in the module symbol table. Four
341 /// 1. If it does not exist, add a prototype for the function and return it.
342 /// 2. If it exists, and has a local linkage, the existing function is
343 /// renamed and a new one is inserted.
344 /// 3. Otherwise, if the existing function has the correct prototype, return
345 /// the existing function.
346 /// 4. Finally, the function exists but has the wrong prototype: return the
347 /// function with a constantexpr cast to the right prototype.
348 Constant *getOrInsertFunction(StringRef Name, FunctionType *T,
349 AttributeSet AttributeList);
351 Constant *getOrInsertFunction(StringRef Name, FunctionType *T);
353 /// Look up the specified function in the module symbol table. If it does not
354 /// exist, add a prototype for the function and return it. This function
355 /// guarantees to return a constant of pointer to the specified function type
356 /// or a ConstantExpr BitCast of that type if the named function has a
357 /// different type. This version of the method takes a null terminated list of
358 /// function arguments, which makes it easier for clients to use.
359 Constant *getOrInsertFunction(StringRef Name,
360 AttributeSet AttributeList,
361 Type *RetTy, ...) LLVM_END_WITH_NULL;
363 /// Same as above, but without the attributes.
364 Constant *getOrInsertFunction(StringRef Name, Type *RetTy, ...)
367 /// Look up the specified function in the module symbol table. If it does not
368 /// exist, return null.
369 Function *getFunction(StringRef Name) const;
372 /// @name Global Variable Accessors
375 /// Look up the specified global variable in the module symbol table. If it
376 /// does not exist, return null. If AllowInternal is set to true, this
377 /// function will return types that have InternalLinkage. By default, these
378 /// types are not returned.
379 GlobalVariable *getGlobalVariable(StringRef Name) const {
380 return getGlobalVariable(Name, false);
383 GlobalVariable *getGlobalVariable(StringRef Name, bool AllowInternal) const {
384 return const_cast<Module *>(this)->getGlobalVariable(Name, AllowInternal);
387 GlobalVariable *getGlobalVariable(StringRef Name, bool AllowInternal = false);
389 /// Return the global variable in the module with the specified name, of
390 /// arbitrary type. This method returns null if a global with the specified
391 /// name is not found.
392 GlobalVariable *getNamedGlobal(StringRef Name) {
393 return getGlobalVariable(Name, true);
395 const GlobalVariable *getNamedGlobal(StringRef Name) const {
396 return const_cast<Module *>(this)->getNamedGlobal(Name);
399 /// Look up the specified global in the module symbol table.
400 /// 1. If it does not exist, add a declaration of the global and return it.
401 /// 2. Else, the global exists but has the wrong type: return the function
402 /// with a constantexpr cast to the right type.
403 /// 3. Finally, if the existing global is the correct declaration, return
404 /// the existing global.
405 Constant *getOrInsertGlobal(StringRef Name, Type *Ty);
408 /// @name Global Alias Accessors
411 /// Return the global alias in the module with the specified name, of
412 /// arbitrary type. This method returns null if a global with the specified
413 /// name is not found.
414 GlobalAlias *getNamedAlias(StringRef Name) const;
417 /// @name Named Metadata Accessors
420 /// Return the first NamedMDNode in the module with the specified name. This
421 /// method returns null if a NamedMDNode with the specified name is not found.
422 NamedMDNode *getNamedMetadata(const Twine &Name) const;
424 /// Return the named MDNode in the module with the specified name. This method
425 /// returns a new NamedMDNode if a NamedMDNode with the specified name is not
427 NamedMDNode *getOrInsertNamedMetadata(StringRef Name);
429 /// Remove the given NamedMDNode from this module and delete it.
430 void eraseNamedMetadata(NamedMDNode *NMD);
433 /// @name Comdat Accessors
436 /// Return the Comdat in the module with the specified name. It is created
437 /// if it didn't already exist.
438 Comdat *getOrInsertComdat(StringRef Name);
441 /// @name Module Flags Accessors
444 /// Returns the module flags in the provided vector.
445 void getModuleFlagsMetadata(SmallVectorImpl<ModuleFlagEntry> &Flags) const;
447 /// Return the corresponding value if Key appears in module flags, otherwise
449 Metadata *getModuleFlag(StringRef Key) const;
451 /// Returns the NamedMDNode in the module that represents module-level flags.
452 /// This method returns null if there are no module-level flags.
453 NamedMDNode *getModuleFlagsMetadata() const;
455 /// Returns the NamedMDNode in the module that represents module-level flags.
456 /// If module-level flags aren't found, it creates the named metadata that
458 NamedMDNode *getOrInsertModuleFlagsMetadata();
460 /// Add a module-level flag to the module-level flags metadata. It will create
461 /// the module-level flags named metadata if it doesn't already exist.
462 void addModuleFlag(ModFlagBehavior Behavior, StringRef Key, Metadata *Val);
463 void addModuleFlag(ModFlagBehavior Behavior, StringRef Key, Constant *Val);
464 void addModuleFlag(ModFlagBehavior Behavior, StringRef Key, uint32_t Val);
465 void addModuleFlag(MDNode *Node);
468 /// @name Materialization
471 /// Sets the GVMaterializer to GVM. This module must not yet have a
472 /// Materializer. To reset the materializer for a module that already has one,
473 /// call MaterializeAllPermanently first. Destroying this module will destroy
474 /// its materializer without materializing any more GlobalValues. Without
475 /// destroying the Module, there is no way to detach or destroy a materializer
476 /// without materializing all the GVs it controls, to avoid leaving orphan
477 /// unmaterialized GVs.
478 void setMaterializer(GVMaterializer *GVM);
479 /// Retrieves the GVMaterializer, if any, for this Module.
480 GVMaterializer *getMaterializer() const { return Materializer.get(); }
482 /// Returns true if this GV was loaded from this Module's GVMaterializer and
483 /// the GVMaterializer knows how to dematerialize the GV.
484 bool isDematerializable(const GlobalValue *GV) const;
486 /// Make sure the GlobalValue is fully read. If the module is corrupt, this
487 /// returns true and fills in the optional string with information about the
488 /// problem. If successful, this returns false.
489 std::error_code materialize(GlobalValue *GV);
490 /// If the GlobalValue is read in, and if the GVMaterializer supports it,
491 /// release the memory for the function, and set it up to be materialized
492 /// lazily. If !isDematerializable(), this method is a no-op.
493 void Dematerialize(GlobalValue *GV);
495 /// Make sure all GlobalValues in this Module are fully read.
496 std::error_code materializeAll();
498 /// Make sure all GlobalValues in this Module are fully read and clear the
499 /// Materializer. If the module is corrupt, this DOES NOT clear the old
501 std::error_code materializeAllPermanently();
504 /// @name Direct access to the globals list, functions list, and symbol table
507 /// Get the Module's list of global variables (constant).
508 const GlobalListType &getGlobalList() const { return GlobalList; }
509 /// Get the Module's list of global variables.
510 GlobalListType &getGlobalList() { return GlobalList; }
511 static iplist<GlobalVariable> Module::*getSublistAccess(GlobalVariable*) {
512 return &Module::GlobalList;
514 /// Get the Module's list of functions (constant).
515 const FunctionListType &getFunctionList() const { return FunctionList; }
516 /// Get the Module's list of functions.
517 FunctionListType &getFunctionList() { return FunctionList; }
518 static iplist<Function> Module::*getSublistAccess(Function*) {
519 return &Module::FunctionList;
521 /// Get the Module's list of aliases (constant).
522 const AliasListType &getAliasList() const { return AliasList; }
523 /// Get the Module's list of aliases.
524 AliasListType &getAliasList() { return AliasList; }
525 static iplist<GlobalAlias> Module::*getSublistAccess(GlobalAlias*) {
526 return &Module::AliasList;
528 /// Get the Module's list of named metadata (constant).
529 const NamedMDListType &getNamedMDList() const { return NamedMDList; }
530 /// Get the Module's list of named metadata.
531 NamedMDListType &getNamedMDList() { return NamedMDList; }
532 static ilist<NamedMDNode> Module::*getSublistAccess(NamedMDNode*) {
533 return &Module::NamedMDList;
535 /// Get the symbol table of global variable and function identifiers
536 const ValueSymbolTable &getValueSymbolTable() const { return *ValSymTab; }
537 /// Get the Module's symbol table of global variable and function identifiers.
538 ValueSymbolTable &getValueSymbolTable() { return *ValSymTab; }
539 /// Get the Module's symbol table for COMDATs (constant).
540 const ComdatSymTabType &getComdatSymbolTable() const { return ComdatSymTab; }
541 /// Get the Module's symbol table for COMDATs.
542 ComdatSymTabType &getComdatSymbolTable() { return ComdatSymTab; }
545 /// @name Global Variable Iteration
548 global_iterator global_begin() { return GlobalList.begin(); }
549 const_global_iterator global_begin() const { return GlobalList.begin(); }
550 global_iterator global_end () { return GlobalList.end(); }
551 const_global_iterator global_end () const { return GlobalList.end(); }
552 bool global_empty() const { return GlobalList.empty(); }
554 iterator_range<global_iterator> globals() {
555 return iterator_range<global_iterator>(global_begin(), global_end());
557 iterator_range<const_global_iterator> globals() const {
558 return iterator_range<const_global_iterator>(global_begin(), global_end());
562 /// @name Function Iteration
565 iterator begin() { return FunctionList.begin(); }
566 const_iterator begin() const { return FunctionList.begin(); }
567 iterator end () { return FunctionList.end(); }
568 const_iterator end () const { return FunctionList.end(); }
569 reverse_iterator rbegin() { return FunctionList.rbegin(); }
570 const_reverse_iterator rbegin() const{ return FunctionList.rbegin(); }
571 reverse_iterator rend() { return FunctionList.rend(); }
572 const_reverse_iterator rend() const { return FunctionList.rend(); }
573 size_t size() const { return FunctionList.size(); }
574 bool empty() const { return FunctionList.empty(); }
576 iterator_range<iterator> functions() {
577 return iterator_range<iterator>(begin(), end());
579 iterator_range<const_iterator> functions() const {
580 return iterator_range<const_iterator>(begin(), end());
584 /// @name Alias Iteration
587 alias_iterator alias_begin() { return AliasList.begin(); }
588 const_alias_iterator alias_begin() const { return AliasList.begin(); }
589 alias_iterator alias_end () { return AliasList.end(); }
590 const_alias_iterator alias_end () const { return AliasList.end(); }
591 size_t alias_size () const { return AliasList.size(); }
592 bool alias_empty() const { return AliasList.empty(); }
594 iterator_range<alias_iterator> aliases() {
595 return iterator_range<alias_iterator>(alias_begin(), alias_end());
597 iterator_range<const_alias_iterator> aliases() const {
598 return iterator_range<const_alias_iterator>(alias_begin(), alias_end());
602 /// @name Named Metadata Iteration
605 named_metadata_iterator named_metadata_begin() { return NamedMDList.begin(); }
606 const_named_metadata_iterator named_metadata_begin() const {
607 return NamedMDList.begin();
610 named_metadata_iterator named_metadata_end() { return NamedMDList.end(); }
611 const_named_metadata_iterator named_metadata_end() const {
612 return NamedMDList.end();
615 size_t named_metadata_size() const { return NamedMDList.size(); }
616 bool named_metadata_empty() const { return NamedMDList.empty(); }
618 iterator_range<named_metadata_iterator> named_metadata() {
619 return iterator_range<named_metadata_iterator>(named_metadata_begin(),
620 named_metadata_end());
622 iterator_range<const_named_metadata_iterator> named_metadata() const {
623 return iterator_range<const_named_metadata_iterator>(named_metadata_begin(),
624 named_metadata_end());
628 /// @name Utility functions for printing and dumping Module objects
631 /// Print the module to an output stream with an optional
632 /// AssemblyAnnotationWriter.
633 void print(raw_ostream &OS, AssemblyAnnotationWriter *AAW) const;
635 /// Dump the module to stderr (for debugging).
638 /// This function causes all the subinstructions to "let go" of all references
639 /// that they are maintaining. This allows one to 'delete' a whole class at
640 /// a time, even though there may be circular references... first all
641 /// references are dropped, and all use counts go to zero. Then everything
642 /// is delete'd for real. Note that no operations are valid on an object
643 /// that has "dropped all references", except operator delete.
644 void dropAllReferences();
647 /// @name Utility functions for querying Debug information.
650 /// \brief Returns the Dwarf Version by checking module flags.
651 unsigned getDwarfVersion() const;
654 /// @name Utility functions for querying and setting PIC level
657 /// \brief Returns the PIC level (small or large model)
658 PICLevel::Level getPICLevel() const;
660 /// \brief Set the PIC level (small or large model)
661 void setPICLevel(PICLevel::Level PL);
665 /// An raw_ostream inserter for modules.
666 inline raw_ostream &operator<<(raw_ostream &O, const Module &M) {
671 // Create wrappers for C Binding types (see CBindingWrapping.h).
672 DEFINE_SIMPLE_CONVERSION_FUNCTIONS(Module, LLVMModuleRef)
674 /* LLVMModuleProviderRef exists for historical reasons, but now just holds a
677 inline Module *unwrap(LLVMModuleProviderRef MP) {
678 return reinterpret_cast<Module*>(MP);
681 } // End llvm namespace