llvm.org GIT mirror llvm / 44b800f
[LTO API] add lto_codegen_set_should_internalize. When debugging LTO issues with ld64, we use -save-temps to save the merged optimized bitcode file, then invoke ld64 again on the single bitcode file. The saved bitcode file is already internalized, so we can call lto_codegen_set_should_internalize and skip running internalization again. rdar://20227235 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@235211 91177308-0d34-0410-b5e6-96231b3b80d8 Manman Ren 4 years ago
5 changed file(s) with 22 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
7777 void setCpu(const char *mCpu) { MCpu = mCpu; }
7878 void setAttr(const char *mAttr) { MAttr = mAttr; }
7979 void setOptLevel(unsigned optLevel) { OptLevel = optLevel; }
80
81 void setShouldInternalize(bool Value) { ShouldInternalize = Value; }
8082
8183 void addMustPreserveSymbol(const char *sym) { MustPreserveSymbols[sym] = 1; }
8284
173175 lto_diagnostic_handler_t DiagHandler;
174176 void *DiagContext;
175177 LTOModule *OwnedModule;
178 bool ShouldInternalize;
176179 };
177180 }
178181 #endif
3939 * @{
4040 */
4141
42 #define LTO_API_VERSION 13
42 #define LTO_API_VERSION 14
4343
4444 /**
4545 * \since prior to LTO_API_VERSION=3
547547 extern void
548548 lto_initialize_disassembler(void);
549549
550 /**
551 * Sets if we should run internalize pass during optimization and code
552 * generation.
553 *
554 * \since prior to LTO_API_VERSION=14
555 */
556 extern void
557 lto_codegen_set_should_internalize(lto_code_gen_t cg,
558 lto_bool_t ShouldInternalize);
559
550560 #ifdef __cplusplus
551561 }
552562 #endif
8181 DiagHandler = nullptr;
8282 DiagContext = nullptr;
8383 OwnedModule = nullptr;
84 ShouldInternalize = true;
8485
8586 initializeLTOPasses();
8687 }
463464 }
464465
465466 void LTOCodeGenerator::applyScopeRestrictions() {
466 if (ScopeRestrictionsDone)
467 if (ScopeRestrictionsDone || !ShouldInternalize)
467468 return;
468469 Module *mergedModule = IRLinker.getModule();
469470
332332 }
333333
334334 unsigned int lto_api_version() { return LTO_API_VERSION; }
335
336 void lto_codegen_set_should_internalize(lto_code_gen_t cg,
337 bool ShouldInternalize) {
338 unwrap(cg)->setShouldInternalize(ShouldInternalize);
339 }
4040 lto_codegen_compile_to_file
4141 lto_codegen_optimize
4242 lto_codegen_compile_optimized
43 lto_codegen_set_should_internalize
4344 LLVMCreateDisasm
4445 LLVMCreateDisasmCPU
4546 LLVMDisasmDispose