LLVM  4.0.0
Modules | Classes | Functions
Collaboration diagram for ThinLTO:

Modules

 ThinLTO Cache Control
 These entry points control the ThinLTO cache.
 

Classes

struct  LTOObjectBuffer
 Type to wrap a single object returned by ThinLTO. More...
 

Functions

thinlto_code_gen_t thinlto_create_codegen (void)
 Instantiates a ThinLTO code generator. More...
 
void thinlto_codegen_dispose (thinlto_code_gen_t cg)
 Frees the generator and all memory it internally allocated. More...
 
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. More...
 
void thinlto_codegen_process (thinlto_code_gen_t cg)
 Optimize and codegen all the modules added to the codegenerator using ThinLTO. More...
 
unsigned int thinlto_module_get_num_objects (thinlto_code_gen_t cg)
 Returns the number of object files produced by the ThinLTO CodeGenerator. More...
 
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. More...
 
unsigned int thinlto_module_get_num_object_files (thinlto_code_gen_t cg)
 Returns the number of object files produced by the ThinLTO CodeGenerator. More...
 
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. More...
 
lto_bool_t thinlto_codegen_set_pic_model (thinlto_code_gen_t cg, lto_codegen_model)
 Sets which PIC code model to generate. More...
 

Detailed Description

Function Documentation

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).

Since
LTO_API_VERSION=18
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.

Since
LTO_API_VERSION=18
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().

Since
LTO_API_VERSION=18
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).

Since
LTO_API_VERSION=18
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.

Since
LTO_API_VERSION=18
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.

Since
LTO_API_VERSION=21
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.

Since
LTO_API_VERSION=18
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.

Since
LTO_API_VERSION=18
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.

Since
LTO_API_VERSION=21