Home | History | Annotate | Download | only in Linker

Lines Matching refs:Module

1 //===- lib/Linker/LinkModules.cpp - Module Linker Implementation ----------===//
10 // This file implements the LLVM module linker.
20 #include "llvm/IR/Module.h"
47 /// source module that are mapped to an opaque struct in the destination
48 /// module.
52 /// destination modules who are getting a body from the source module.
60 /// module is conceptually equivalent to the specified type in the source
61 /// module.
65 /// module from a type definition in the source module.
69 /// source module.
203 /// module from a type definition in the source module.
244 /// source module.
311 // module has something like:
314 // where T does not exist at all in the destination module.
317 // module, but that it has to be rebuilt because it refers to something that
318 // is already mapped. For example, if the destination module has:
320 // and the source module has something like
325 // pristine "%B" name from the source module.
330 // and is not required for the prettiness of the linked module, we just skip
336 // A named structure type from src module is used. Add it to the Set of
337 // identified structs in the destination module.
347 // identified structs in the destination module.
365 Module *DstM;
368 ValueMaterializerTy(TypeMapTy &TypeMap, Module *DstM,
380 Module *DstM, *SrcM;
392 GlobalVariable *NewGV; // New aggregate global in dest module.
393 Constant *DstInit; // Old initializer from dest module.
394 Constant *SrcInit; // Old initializer from src module.
399 unsigned Mode; // Mode to treat source module.
410 ModuleLinker(Module *dstM, TypeSet &Set, Module *srcM, unsigned mode)
426 /// what the result will look like in the destination module.
432 module, return the
433 /// global in the destination module that is being linked to, if any.
440 // Otherwise see if we have a match in the destination module's symtab.
444 // If we found a global with the same name in the dest module, but it has
478 Module *M = GV->getParent();
529 /// the result will look like in the destination module. In particular, it
606 /// we have two struct types 'Foo' but one got renamed when the module was
610 for (Module::global_iterator I = SrcM->global_begin(),
627 for (Module::iterator I = SrcM->begin(), E = SrcM->end(); I != E; ++I) {
632 // Incorporate types by name, scanning all the types in the source module.
633 // At this point, the destination module may have a type "%foo = { i32 }" for
634 // example. When the source module got loaded into the same LLVMContext, if
652 // Check to see if the destination module has a struct with the prefix name.
654 // Don't use it if this actually came from the source module. They're in
656 // actually used in the destination module. This can happen in situations
659 // Module A Module B
666 // When we link Module B with Module A, the '%B' in Module B is
678 // any 'opaque' types in the dest module that are now resolved.
746 /// linkGlobalProto - Loop through the global variables in the src module and
747 /// merge them into the dest module.
758 // module's definition or the destination module's definition.
790 // identical version of the symbol over in the dest module... the
813 /// linkFunctionProto - Link the function in the source module into the
814 /// destination module if needed, setting up mapping information.
835 module so we don't attempt to remap
870 /// source module.
891 // Track the alias from the source module so we don't attempt to remap it.
936 /// linkGlobalInits - Update the initializers in the Dest module now that all
939 // Loop over all of the globals in the src module, mapping them over as we go
940 for (Module::const_global_iterator I = SrcM->global_begin(),
948 // Figure out what the initializer looks like in the dest module.
997 /// linkAliasBodies - Insert all of the aliases in Src into the Dest module.
999 for (Module::alias_iterator I = SrcM->alias_begin(), E = SrcM->alias_end();
1012 /// module.
1015 for (Module::const_named_metadata_iterator I = SrcM->named_metadata_begin(),
1017 // Don't link module flags here. Do them separately.
1028 /// module.
1030 // If the source module has no module flags, we are done.
1034 // If the destination module doesn't have module flags yet, then just copy
1035 // over the source module's flags.
1044 // First build a map of the existing module flags and requirements.
1052 if (Behavior->getZExtValue() == Module::Require) {
1059 // Merge in the flags from the source module, and also collect its set of
1070 if (SrcBehaviorValue == Module::Require) {
1071 // If the destination module does not already have this requirement, add
1091 if (DstBehaviorValue == Module::Override) {
1093 if (SrcBehaviorValue == Module::Override &&
1095 HasErr |= emitError("linking module flags '" + ID->getString() +
1099 } else if (SrcBehaviorValue == Module::Override) {
1108 HasErr |= emitError("linking module flags '" + ID->getString() +
1115 case Module::Require:
1116 case Module::Override: assert(0 && "not possible"); break;
1117 case Module::Error: {
1120 HasErr |= emitError("linking module flags '" + ID->getString() +
1125 case Module::Warning: {
1128 errs() << "WARNING: linking module flags '" << ID->getString()
1133 case Module::Append: {
1148 case Module::AppendUnique: {
1172 HasErr |= emitError("linking module flags '" + Flag->getString() +
1182 assert(DstM && "Null destination module");
1183 assert(SrcM && "Null source module");
1185 // Inherit the target data from the source module if the destination module
1206 // Append the module inline asm string.
1218 // Insert all of the globals in src into the DstM module... without linking
1220 for (Module::global_iterator I = SrcM->global_begin(),
1230 for (Module::iterator I = SrcM->begin(), E = SrcM->end(); I != E; ++I)
1235 for (Module::alias_iterator I = SrcM->alias_begin(),
1243 // Update the initializers in the DstM module now that all globals that may
1247 // Link in the function bodies that are defined in the source module into
1249 for (Module::iterator SF = SrcM->begin(), E = SrcM->end(); SF != E; ++SF) {
1268 // Remap all of the named MDNodes in Src into the DstM module. We do this
1273 // Merge the module flags into the DstM module.
1320 Linker::Linker(Module *M) : Composite(M) {
1329 bool Linker::linkInModule(Module *Src, unsigned Mode, std::string *ErrorMsg) {
1344 /// Dest module modified to be the composite of the two input modules. If an
1346 /// the problem. Upon failure, the Dest module could be in a modified state,
1348 bool Linker::LinkModules(Module *Dest, Module *Src, unsigned Mode,