Remove lto_codegen_set_whole_program_optimization. It is a work in progress,
authorRafael Espindola <rafael.espindola@gmail.com>
Mon, 16 Apr 2012 10:58:38 +0000 (10:58 +0000)
committerRafael Espindola <rafael.espindola@gmail.com>
Mon, 16 Apr 2012 10:58:38 +0000 (10:58 +0000)
so we don't want it to show up in the stable 3.1 interface.

While at it, add a comment about why LTOCodeGenerator manually creates the
internalize pass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@154807 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm-c/lto.h
tools/lto/LTOCodeGenerator.cpp
tools/lto/LTOCodeGenerator.h
tools/lto/lto.cpp
tools/lto/lto.exports

index 5d9cecbc5153b3ec5b24b1e45f7d9aa625987f1e..f43d365e3dbefb123bccd470f3d97b335daf8209 100644 (file)
@@ -250,12 +250,6 @@ extern void
 lto_codegen_set_assembler_args(lto_code_gen_t cg, const char **args,
                                int nargs);
 
-/**
- * Enables the internalize pass during LTO optimizations.
- */
-extern void
-lto_codegen_set_whole_program_optimization(lto_code_gen_t cg);
-
 /**
  * Adds to a list of all global symbols that must exist in the final
  * generated code.  If a function is not listed, it might be
index 77c06a655b18ebfc3dec6b7fa11f78a625fbbf86..6382a3f219e6ea4407893c8ce167cc23ec495983 100644 (file)
@@ -64,7 +64,7 @@ LTOCodeGenerator::LTOCodeGenerator()
   : _context(getGlobalContext()),
     _linker("LinkTimeOptimizer", "ld-temp.o", _context), _target(NULL),
     _emitDwarfDebugInfo(false), _scopeRestrictionsDone(false),
-    _runInternalizePass(false), _codeModel(LTO_CODEGEN_PIC_MODEL_DYNAMIC),
+    _codeModel(LTO_CODEGEN_PIC_MODEL_DYNAMIC),
     _nativeObjectFile(NULL) {
   InitializeAllTargets();
   InitializeAllTargetMCs();
@@ -355,8 +355,10 @@ bool LTOCodeGenerator::generateObjectFile(raw_ostream &out,
   // Add an appropriate TargetData instance for this module...
   passes.add(new TargetData(*_target->getTargetData()));
 
-  PassManagerBuilder().populateLTOPassManager(passes,
-                                              _runInternalizePass,
+  // Enabling internalize here would use its AllButMain variant. It
+  // keeps only main if it exists and does nothing for libraries. Instead
+  // we create the pass ourselves with the symbol list provided by the linker.
+  PassManagerBuilder().populateLTOPassManager(passes, /*Internalize=*/false,
                                               !DisableInline,
                                               DisableGVNLoadPRE);
 
index bac3e6efe909257bd02b64d341e9945654336430..032dc379172946c575ab1575c6d0e40ad3731d08 100644 (file)
@@ -54,8 +54,6 @@ struct LTOCodeGenerator {
   const void *compile(size_t *length, std::string &errMsg);
   void setCodeGenDebugOptions(const char *opts);
 
-  void enableInternalizePass() { _runInternalizePass = true; }
-
 private:
   bool generateObjectFile(llvm::raw_ostream &out, std::string &errMsg);
   void applyScopeRestrictions();
index addf7877c96ebd85e380c81eb78d2081d1adbd95..a7e633d14b9dc264957bc471273bda004a0a6e6f 100644 (file)
@@ -183,12 +183,6 @@ void lto_codegen_add_must_preserve_symbol(lto_code_gen_t cg,
   cg->addMustPreserveSymbol(symbol);
 }
 
-/// lto_codegen_set_whole_program_optimization - Enable the internalize pass
-/// during LTO optimizations.
-void lto_codegen_set_whole_program_optimization(lto_code_gen_t cg) {
-  cg->enableInternalizePass();
-}
-
 /// lto_codegen_write_merged_modules - Writes a new file at the specified path
 /// that contains the merged contents of all modules added so far. Returns true
 /// on error (check lto_get_error_message() for details).
index f471f1ad6a270af7aa030bd54b5178ca292c300c..b900bfb594b1e5cd14f4ce47c2c62c6d77b8382b 100644 (file)
@@ -27,7 +27,6 @@ lto_codegen_set_assembler_args
 lto_codegen_set_assembler_path
 lto_codegen_set_cpu
 lto_codegen_compile_to_file
-lto_codegen_set_whole_program_optimization
 LLVMCreateDisasm
 LLVMDisasmDispose
 LLVMDisasmInstruction