LLVM  3.7.0
Functions
LinkModules.cpp File Reference
#include "llvm/Linker/Linker.h"
#include "llvm-c/Linker.h"
#include "llvm/ADT/Hashing.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/Triple.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/DiagnosticInfo.h"
#include "llvm/IR/DiagnosticPrinter.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/TypeFinder.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/Utils/Cloning.h"
#include <cctype>
#include <tuple>
Include dependency graph for LinkModules.cpp:

Go to the source code of this file.

Functions

static void forceRenaming (GlobalValue *GV, StringRef Name)
 The LLVM SymbolTable class autorenames globals that conflict in the symbol table. More...
 
static void copyGVAttributes (GlobalValue *DestGV, const GlobalValue *SrcGV)
 copy additional attributes (those not needed to construct a GlobalValue) from the SrcGV to the DestGV. More...
 
static bool isLessConstraining (GlobalValue::VisibilityTypes a, GlobalValue::VisibilityTypes b)
 
static GlobalVariablecopyGlobalVariableProto (TypeMapTy &TypeMap, Module &DstM, const GlobalVariable *SGVar)
 Loop through the global variables in the src module and merge them into the dest module. More...
 
static FunctioncopyFunctionProto (TypeMapTy &TypeMap, Module &DstM, const Function *SF)
 Link the function in the source module into the destination module if needed, setting up mapping information. More...
 
static GlobalAliascopyGlobalAliasProto (TypeMapTy &TypeMap, Module &DstM, const GlobalAlias *SGA)
 Set up prototypes for any aliases that come over from the source module. More...
 
static GlobalValuecopyGlobalValueProto (TypeMapTy &TypeMap, Module &DstM, const GlobalValue *SGV)
 
static void upgradeGlobalArray (GlobalVariable *GV)
 
static void getArrayElements (const Constant *C, SmallVectorImpl< Constant * > &Dest)
 
static bool triplesMatch (const Triple &T0, const Triple &T1)
 
static std::string mergeTriples (const Triple &SrcTriple, const Triple &DstTriple)
 
LLVMBool LLVMLinkModules (LLVMModuleRef Dest, LLVMModuleRef Src, LLVMLinkerMode Unused, char **OutMessages)
 

Function Documentation

static Function* copyFunctionProto ( TypeMapTy &  TypeMap,
Module DstM,
const Function SF 
)
static

Link the function in the source module into the destination module if needed, setting up mapping information.

Definition at line 571 of file LinkModules.cpp.

References llvm::Function::getFunctionType(), llvm::GlobalValue::getLinkage(), and llvm::Value::getName().

Referenced by copyGlobalValueProto().

static GlobalAlias* copyGlobalAliasProto ( TypeMapTy &  TypeMap,
Module DstM,
const GlobalAlias SGA 
)
static

Set up prototypes for any aliases that come over from the source module.

Definition at line 580 of file LinkModules.cpp.

References llvm::GlobalValue::getLinkage(), llvm::Value::getName(), and llvm::GlobalValue::getType().

Referenced by copyGlobalValueProto().

static GlobalValue* copyGlobalValueProto ( TypeMapTy &  TypeMap,
Module DstM,
const GlobalValue SGV 
)
static
static GlobalVariable* copyGlobalVariableProto ( TypeMapTy &  TypeMap,
Module DstM,
const GlobalVariable SGVar 
)
static
static void copyGVAttributes ( GlobalValue DestGV,
const GlobalValue SrcGV 
)
static

copy additional attributes (those not needed to construct a GlobalValue) from the SrcGV to the DestGV.

Definition at line 535 of file LinkModules.cpp.

References llvm::GlobalValue::copyAttributesFrom(), forceRenaming(), and llvm::Value::getName().

Referenced by copyGlobalValueProto().

static void forceRenaming ( GlobalValue GV,
StringRef  Name 
)
static

The LLVM SymbolTable class autorenames globals that conflict in the symbol table.

This is good for all clients except for us. Go through the trouble to force this back.

Definition at line 515 of file LinkModules.cpp.

References llvm::Value::getName(), llvm::Module::getNamedValue(), llvm::GlobalValue::getParent(), llvm::GlobalValue::hasLocalLinkage(), llvm::Value::setName(), and llvm::Value::takeName().

Referenced by copyGVAttributes().

static void getArrayElements ( const Constant C,
SmallVectorImpl< Constant * > &  Dest 
)
static
static bool isLessConstraining ( GlobalValue::VisibilityTypes  a,
GlobalValue::VisibilityTypes  b 
)
static

Definition at line 540 of file LinkModules.cpp.

LLVMBool LLVMLinkModules ( LLVMModuleRef  Dest,
LLVMModuleRef  Src,
LLVMLinkerMode  Unused,
char **  OutMessages 
)
static std::string mergeTriples ( const Triple SrcTriple,
const Triple DstTriple 
)
static
static bool triplesMatch ( const Triple T0,
const Triple T1 
)
static
static void upgradeGlobalArray ( GlobalVariable GV)
static