diff options
Diffstat (limited to 'lib/Module')
-rw-r--r-- | lib/Module/KModule.cpp | 4 | ||||
-rw-r--r-- | lib/Module/Optimize.cpp | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/lib/Module/KModule.cpp b/lib/Module/KModule.cpp index 01165e94..57346a31 100644 --- a/lib/Module/KModule.cpp +++ b/lib/Module/KModule.cpp @@ -132,7 +132,7 @@ KModule::~KModule() { /***/ namespace llvm { -extern void Optimize(Module*); +extern void Optimize(Module *, const std::string &EntryPoint); } // what a hack @@ -308,7 +308,7 @@ void KModule::prepare(const Interpreter::ModuleOptions &opts, pm.run(*module); if (opts.Optimize) - Optimize(module); + Optimize(module, opts.EntryPoint); #if LLVM_VERSION_CODE < LLVM_VERSION(3, 3) // Force importing functions required by intrinsic lowering. Kind of // unfortunate clutter when we don't need them but we won't know diff --git a/lib/Module/Optimize.cpp b/lib/Module/Optimize.cpp index ce43cd96..3d9c8cc1 100644 --- a/lib/Module/Optimize.cpp +++ b/lib/Module/Optimize.cpp @@ -163,7 +163,7 @@ static void AddStandardCompilePasses(PassManager &PM) { /// Optimize - Perform link time optimizations. This will run the scalar /// optimizations, any loaded plugin-optimization modules, and then the /// inter-procedural optimizations if applicable. -void Optimize(Module* M) { +void Optimize(Module *M, const std::string &EntryPoint) { // Instantiate the pass manager to organize the passes. PassManager Passes; @@ -192,7 +192,8 @@ void Optimize(Module* M) { // internal. if (!DisableInternalize) { #if LLVM_VERSION_CODE >= LLVM_VERSION(3, 2) - ModulePass *pass = createInternalizePass(std::vector<const char *>(1, "main")); + ModulePass *pass = createInternalizePass( + std::vector<const char *>(1, EntryPoint.c_str())); #else ModulePass *pass = createInternalizePass(true); #endif |