Project Alice
|
Modules | |
ThinLTO Cache Control | |
Classes | |
struct | LTOObjectBuffer |
// endgoup LLVMCLTO
lto_bool_t lto_module_is_thinlto | ( | lto_module_t | mod | ) |
Test if a module has support for ThinLTO linking.
void thinlto_codegen_add_cross_referenced_symbol | ( | thinlto_code_gen_t | cg, |
const char * | name, | ||
int | length | ||
) |
Adds a symbol to the list of global symbols that are cross-referenced between ThinLTO files. If the ThinLTO CodeGenerator can ensure that every references from a ThinLTO module to this symbol is optimized away, then the symbol can be discarded.
void thinlto_codegen_add_module | ( | thinlto_code_gen_t | cg, |
const char * | identifier, | ||
const char * | data, | ||
int | length | ||
) |
Add a module to a ThinLTO code generator. Identifier has to be unique among all the modules in a code generator. The data buffer stays owned by the client, and is expected to be available for the entire lifetime of the thinlto_code_gen_t it is added to.
On failure, returns NULL (check lto_get_error_message() for details).
void thinlto_codegen_add_must_preserve_symbol | ( | thinlto_code_gen_t | cg, |
const char * | name, | ||
int | length | ||
) |
Adds a symbol to the list of global symbols that must exist in the final generated code. If a function is not listed there, it might be inlined into every usage and optimized away. For every single module, the functions referenced from code outside of the ThinLTO modules need to be added here.
void thinlto_codegen_disable_codegen | ( | thinlto_code_gen_t | cg, |
lto_bool_t | disable | ||
) |
Disable CodeGen, only run the stages till codegen and stop. The output will be bitcode.
void thinlto_codegen_dispose | ( | thinlto_code_gen_t | cg | ) |
Frees the generator and all memory it internally allocated. Upon return the thinlto_code_gen_t is no longer valid.
void thinlto_codegen_process | ( | thinlto_code_gen_t | cg | ) |
Optimize and codegen all the modules added to the codegenerator using ThinLTO. Resulting objects are accessible using thinlto_module_get_object().
void thinlto_codegen_set_codegen_only | ( | thinlto_code_gen_t | cg, |
lto_bool_t | codegen_only | ||
) |
Perform CodeGen only: disable all other stages.
void thinlto_codegen_set_cpu | ( | thinlto_code_gen_t | cg, |
const char * | cpu | ||
) |
Sets the cpu to generate code for.
lto_bool_t thinlto_codegen_set_pic_model | ( | thinlto_code_gen_t | cg, |
lto_codegen_model | |||
) |
Sets which PIC code model to generate. Returns true on error (check lto_get_error_message() for details).
void thinlto_codegen_set_savetemps_dir | ( | thinlto_code_gen_t | cg, |
const char * | save_temps_dir | ||
) |
Sets the path to a directory to use as a storage for temporary bitcode files. The intention is to make the bitcode files available for debugging at various stage of the pipeline.
thinlto_code_gen_t thinlto_create_codegen | ( | void | ) |
Instantiates a ThinLTO code generator. Returns NULL on error (check lto_get_error_message() for details).
The ThinLTOCodeGenerator is not intended to be reuse for multiple compilation: the model is that the client adds modules to the generator and ask to perform the ThinLTO optimizations / codegen, and finally destroys the codegenerator.
void thinlto_debug_options | ( | const char *const * | options, |
int | number | ||
) |
Parse -mllvm style debug options.
unsigned int thinlto_module_get_num_object_files | ( | thinlto_code_gen_t | cg | ) |
Returns the number of object files produced by the ThinLTO CodeGenerator.
It usually matches the number of input files, but this is not a guarantee of the API and may change in future implementation, so the client should not assume it.
unsigned int thinlto_module_get_num_objects | ( | thinlto_code_gen_t | cg | ) |
Returns the number of object files produced by the ThinLTO CodeGenerator.
It usually matches the number of input files, but this is not a guarantee of the API and may change in future implementation, so the client should not assume it.
LTOObjectBuffer thinlto_module_get_object | ( | thinlto_code_gen_t | cg, |
unsigned int | index | ||
) |
Returns a reference to the ith object file produced by the ThinLTO CodeGenerator.
Client should use thinlto_module_get_num_objects()
to get the number of available objects.
const char * thinlto_module_get_object_file | ( | thinlto_code_gen_t | cg, |
unsigned int | index | ||
) |
Returns the path to the ith object file produced by the ThinLTO CodeGenerator.
Client should use thinlto_module_get_num_object_files()
to get the number of available objects.
void thinlto_set_generated_objects_dir | ( | thinlto_code_gen_t | cg, |
const char * | save_temps_dir | ||
) |
Set the path to a directory where to save generated object files. This path can be used by a linker to request on-disk files instead of in-memory buffers. When set, results are available through thinlto_module_get_object_file() instead of thinlto_module_get_object().