32 #define DEBUG_TYPE "linkbitcode"
37 #include "llvm/Support/Compiler.h"
38 #include "llvm/Support/Debug.h"
39 #include "llvm/Support/raw_ostream.h"
40 #include "tce_config.h"
41 #include "llvm/IR/Module.h"
42 #include "llvm/Pass.h"
43 #include "llvm/Linker/Linker.h"
55 class LinkBitcode :
public FunctionPass {
58 LinkBitcode(Module& input);
59 virtual ~LinkBitcode();
62 bool doInitialization(Module &M);
63 bool doFinalization (Module &M);
66 using llvm::FunctionPass::doInitialization;
67 using llvm::FunctionPass::doFinalization;
68 bool runOnFunction(Function &F);
74 char LinkBitcode::ID = 0;
84 LinkBitcode::LinkBitcode(Module& input) :
92 LinkBitcode::~LinkBitcode() {}
99 return new LinkBitcode(input);
103 LinkBitcode::doFinalization(Module& ) {
108 LinkBitcode::doInitialization(Module& M) {
109 if (Linker::linkModules(M, std::unique_ptr<Module>(&inputModule_))) {
110 errs() <<
"Error during linking in LinkBitcodePass: " <<
"\n";
116 LinkBitcode::runOnFunction(Function&) {