Home | History | Annotate | Download | only in IR

Lines Matching defs:Module

1 //===-- Module.cpp - Implement the Module class ---------------------------===//
10 // This file implements the Module class for the IR library.
14 #include "llvm/IR/Module.h"
37 template class llvm::SymbolTableListTraits<Function, Module>;
38 template class llvm::SymbolTableListTraits<GlobalVariable, Module>;
39 template class llvm::SymbolTableListTraits<GlobalAlias, Module>;
42 // Primitive Module methods.
45 Module::Module(StringRef MID, LLVMContext& C)
52 Module::~Module() {
64 Module::Endianness Module::getEndianness() const {
66 Module::Endianness ret = AnyEndianness;
85 Module::PointerSize Module::getPointerSize() const {
87 Module::PointerSize ret = AnyPointerSize;
108 /// getNamedValue - Return the first global value in the module with
111 GlobalValue *Module::getNamedValue(StringRef Name) const {
117 unsigned Module::getMDKindID(StringRef Name) const {
124 void Module::getMDKindNames(SmallVectorImpl<StringRef> &Result) const {
130 // Methods for easy access to the functions in the module.
133 // getOrInsertFunction - Look up the specified function in the module symbol
138 Constant *Module::getOrInsertFunction(StringRef Name,
171 Constant *Module::getOrInsertFunction(StringRef Name,
176 // getOrInsertFunction - Look up the specified function in the module symbol
181 Constant *Module::getOrInsertFunction(StringRef Name,
200 Constant *Module::getOrInsertFunction(StringRef Name,
218 // getFunction - Look up the specified function in the module symbol table.
221 Function *Module::getFunction(StringRef Name) const {
226 // Methods for easy access to the global variables in the module.
229 /// getGlobalVariable - Look up the specified global variable in the module
236 GlobalVariable *Module::getGlobalVariable(StringRef Name, bool AllowLocal) {
244 /// getOrInsertGlobal - Look up the specified global in the module symbol table.
250 Constant *Module::getOrInsertGlobal(StringRef Name, Type *Ty) {
271 // Methods for easy access to the global variables in the module.
274 // getNamedAlias - Look up the specified global in the module symbol table.
277 GlobalAlias *Module::getNamedAlias(StringRef Name) const {
281 /// getNamedMetadata - Return the first NamedMDNode in the module with the
284 NamedMDNode *Module::getNamedMetadata(const Twine &Name) const {
290 /// getOrInsertNamedMetadata - Return the first named MDNode in the module
293 NamedMDNode *Module::getOrInsertNamedMetadata(StringRef Name) {
304 /// eraseNamedMetadata - Remove the given NamedMDNode from this module and
306 void Module::eraseNamedMetadata(NamedMDNode *NMD) {
311 /// getModuleFlagsMetadata - Returns the module flags in the provided vector.
312 void Module::
327 /// Return the corresponding value if Key appears in module flags, otherwise
329 Value *Module::getModuleFlag(StringRef Key) const {
330 SmallVector<Module::ModuleFlagEntry, 8> ModuleFlags;
340 /// getModuleFlagsMetadata - Returns the NamedMDNode in the module that
341 /// represents module-level flags. This method returns null if there are no
342 /// module-level flags.
343 NamedMDNode *Module::getModuleFlagsMetadata() const {
344 return getNamedMetadata("llvm.module.flags");
347 /// getOrInsertModuleFlagsMetadata - Returns the NamedMDNode in the module that
348 /// represents module-level flags. If module-level flags aren't found, it
350 NamedMDNode *Module::getOrInsertModuleFlagsMetadata() {
351 return getOrInsertNamedMetadata("llvm.module.flags");
354 /// addModuleFlag - Add a module-level flag to the module-level flags
355 /// metadata. It will create the module-level flags named metadata if it doesn't
357 void Module::addModuleFlag(ModFlagBehavior Behavior, StringRef Key,
365 void Module::addModuleFlag(ModFlagBehavior Behavior, StringRef Key,
370 void Module::addModuleFlag(MDNode *Node) {
372 "Invalid number of operands for module flag!");
375 "Invalid operand types for module flag!");
380 // Methods to control the materialization of GlobalValues in the Module.
382 void Module::setMaterializer(GVMaterializer *GVM) {
384 "Module already has a GVMaterializer. Call MaterializeAllPermanently"
389 bool Module::isMaterializable(const GlobalValue *GV) const {
395 bool Module::isDematerializable(const GlobalValue *GV) const {
401 bool Module::Materialize(GlobalValue *GV, std::string *ErrInfo) {
407 void Module::Dematerialize(GlobalValue *GV) {
412 bool Module::MaterializeAll(std::string *ErrInfo) {
418 bool Module::MaterializeAllPermanently(std::string *ErrInfo) {
426 // Other module related stuff.
432 // whole module at a time, even though there may be circular references... first
437 void Module::dropAllReferences() {
438 for(Module::iterator I = begin(), E = end(); I != E; ++I)
441 for(Module::global_iterator I = global_begin(), E = global_end(); I != E; ++I)
444 for(Module::alias_iterator I = alias_begin(), E = alias_end(); I != E; ++I)