LLVM  10.0.0svn
Typedefs | Functions
ThinLTO Cache Control

// endgoup LLVMCTLTOThese entry points control the ThinLTO cache. More...

Collaboration diagram for ThinLTO Cache Control:

Typedefs

typedef struct LLVMOpaqueLTOInput * lto_input_t
 Opaque reference to an LTO input file. More...
 

Functions

void thinlto_codegen_set_cache_dir (thinlto_code_gen_t cg, const char *cache_dir)
 Sets the path to a directory to use as a cache storage for incremental build. More...
 
void thinlto_codegen_set_cache_pruning_interval (thinlto_code_gen_t cg, int interval)
 Sets the cache pruning interval (in seconds). More...
 
void thinlto_codegen_set_final_cache_size_relative_to_available_space (thinlto_code_gen_t cg, unsigned percentage)
 Sets the maximum cache size that can be persistent across build, in terms of percentage of the available space on the disk. More...
 
void thinlto_codegen_set_cache_entry_expiration (thinlto_code_gen_t cg, unsigned expiration)
 Sets the expiration (in seconds) for an entry in the cache. More...
 
void thinlto_codegen_set_cache_size_bytes (thinlto_code_gen_t cg, unsigned max_size_bytes)
 Sets the maximum size of the cache directory (in bytes). More...
 
void thinlto_codegen_set_cache_size_megabytes (thinlto_code_gen_t cg, unsigned max_size_megabytes)
 Same as thinlto_codegen_set_cache_size_bytes, except the maximum size is in megabytes (2^20 bytes). More...
 
void thinlto_codegen_set_cache_size_files (thinlto_code_gen_t cg, unsigned max_size_files)
 Sets the maximum number of files in the cache directory. More...
 
lto_input_t lto_input_create (const void *buffer, size_t buffer_size, const char *path)
 Creates an LTO input file from a buffer. More...
 
void lto_input_dispose (lto_input_t input)
 Frees all memory internally allocated by the LTO input file. More...
 
unsigned lto_input_get_num_dependent_libraries (lto_input_t input)
 Returns the number of dependent library specifiers for the given LTO input file. More...
 
const charlto_input_get_dependent_library (lto_input_t input, size_t index, size_t *size)
 Returns the ith dependent library specifier for the given LTO input file. More...
 

Detailed Description

// endgoup LLVMCTLTO

These entry points control the ThinLTO cache.

The cache is intended to support incremental builds, and thus needs to be persistent across builds. The client enables the cache by supplying a path to an existing directory. The code generator will use this to store objects files that may be reused during a subsequent build. To avoid filling the disk space, a few knobs are provided:

Typedef Documentation

◆ lto_input_t

typedef struct LLVMOpaqueLTOInput* lto_input_t

Opaque reference to an LTO input file.

Definition at line 850 of file lto.h.

Function Documentation

◆ lto_input_create()

lto_input_t lto_input_create ( const void *  buffer,
size_t  buffer_size,
const char path 
)

Creates an LTO input file from a buffer.

The path argument is used for diagnotics as this function otherwise does not know which file the given buffer is associated with.

Since
LTO_API_VERSION=24

◆ lto_input_dispose()

void lto_input_dispose ( lto_input_t  input)

Frees all memory internally allocated by the LTO input file.

Upon return the lto_module_t is no longer valid.

Since
LTO_API_VERSION=24

◆ lto_input_get_dependent_library()

const char* lto_input_get_dependent_library ( lto_input_t  input,
size_t  index,
size_t size 
)

Returns the ith dependent library specifier for the given LTO input file.

The returned string is not null-terminated.

Since
LTO_API_VERSION=24

◆ lto_input_get_num_dependent_libraries()

unsigned lto_input_get_num_dependent_libraries ( lto_input_t  input)

Returns the number of dependent library specifiers for the given LTO input file.

Since
LTO_API_VERSION=24

◆ thinlto_codegen_set_cache_dir()

void thinlto_codegen_set_cache_dir ( thinlto_code_gen_t  cg,
const char cache_dir 
)

Sets the path to a directory to use as a cache storage for incremental build.

Setting this activates caching.

Since
LTO_API_VERSION=18

◆ thinlto_codegen_set_cache_entry_expiration()

void thinlto_codegen_set_cache_entry_expiration ( thinlto_code_gen_t  cg,
unsigned  expiration 
)

Sets the expiration (in seconds) for an entry in the cache.

An unspecified default value will be applied. A value of 0 will be ignored.

Since
LTO_API_VERSION=18

◆ thinlto_codegen_set_cache_pruning_interval()

void thinlto_codegen_set_cache_pruning_interval ( thinlto_code_gen_t  cg,
int  interval 
)

Sets the cache pruning interval (in seconds).

A negative value disables the pruning. An unspecified default value will be applied, and a value of 0 will force prunning to occur.

Since
LTO_API_VERSION=18

◆ thinlto_codegen_set_cache_size_bytes()

void thinlto_codegen_set_cache_size_bytes ( thinlto_code_gen_t  cg,
unsigned  max_size_bytes 
)

Sets the maximum size of the cache directory (in bytes).

A value over the amount of available space on the disk will be reduced to the amount of available space. An unspecified default value will be applied. A value of 0 will be ignored.

Since
LTO_API_VERSION=22

◆ thinlto_codegen_set_cache_size_files()

void thinlto_codegen_set_cache_size_files ( thinlto_code_gen_t  cg,
unsigned  max_size_files 
)

Sets the maximum number of files in the cache directory.

An unspecified default value will be applied. A value of 0 will be ignored.

Since
LTO_API_VERSION=22

◆ thinlto_codegen_set_cache_size_megabytes()

void thinlto_codegen_set_cache_size_megabytes ( thinlto_code_gen_t  cg,
unsigned  max_size_megabytes 
)

Same as thinlto_codegen_set_cache_size_bytes, except the maximum size is in megabytes (2^20 bytes).

Since
LTO_API_VERSION=23

◆ thinlto_codegen_set_final_cache_size_relative_to_available_space()

void thinlto_codegen_set_final_cache_size_relative_to_available_space ( thinlto_code_gen_t  cg,
unsigned  percentage 
)

Sets the maximum cache size that can be persistent across build, in terms of percentage of the available space on the disk.

Set to 100 to indicate no limit, 50 to indicate that the cache size will not be left over half the available space. A value over 100 will be reduced to 100, a value of 0 will be ignored. An unspecified default value will be applied.

The formula looks like: AvailableSpace = FreeSpace + ExistingCacheSize NewCacheSize = AvailableSpace * P/100

Since
LTO_API_VERSION=18