LLVM 20.0.0git
Functions
ThinLTO Cache Control

// endgoup LLVMCTLTO More...

Collaboration diagram for ThinLTO Cache Control:

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.
 
void thinlto_codegen_set_cache_pruning_interval (thinlto_code_gen_t cg, int interval)
 Sets the cache pruning interval (in seconds).
 
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.
 
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.
 
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).
 
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).
 
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.
 

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:

Function Documentation

◆ 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