[LTO API] add lto_codegen_set_module to set the destination module.

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 to
speed up debugging code generation passes and ld64 stuff after code generation.

llvm linking a single bitcode file via lto_codegen_add_module will generate a
different bitcode file from the single input. With the newly-added
lto_codegen_set_module, we can make sure the destination module is the same as
the input.

lto_codegen_set_module will transfer the ownship of the module to code
generator.

rdar://19024554


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230290 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Manman Ren
2015-02-24 00:45:56 +00:00
parent 989a0200c2
commit bd26e6a006
9 changed files with 94 additions and 5 deletions

View File

@ -40,7 +40,7 @@ typedef bool lto_bool_t;
* @{
*/
#define LTO_API_VERSION 12
#define LTO_API_VERSION 13
/**
* \since prior to LTO_API_VERSION=3
@ -395,6 +395,17 @@ lto_codegen_dispose(lto_code_gen_t);
extern lto_bool_t
lto_codegen_add_module(lto_code_gen_t cg, lto_module_t mod);
/**
* Sets the object module for code generation. This will transfer the ownship of
* the module to code generator.
*
* \c cg and \c mod must both be in the same context.
*
* \since prior to LTO_API_VERSION=13
*/
extern void
lto_codegen_set_module(lto_code_gen_t cg, lto_module_t mod);
/**
* Sets if debug info should be generated.
* Returns true on error (check lto_get_error_message() for details).