diff options
author | Ekaterina Romanova <katya_romanova@playstation.sony.com> | 2018-03-02 03:51:27 +0000 |
---|---|---|
committer | Ekaterina Romanova <katya_romanova@playstation.sony.com> | 2018-03-02 03:51:27 +0000 |
commit | 76899c61ced16664d1f7db46749e3df99abb4911 (patch) | |
tree | 84cf140ec41c3d02987d840448a1be05a21f55b0 /tools | |
parent | 738d9f9859222296cf88624109dcc52ffd040588 (diff) |
[ThinLTO] Added a couple of C LTO API interfaces to control the cache policy.
- thinlto_codegen_set_cache_size_bytes to control the absolute size of cache directory.
- thinlto_codegen_set_cache_size_files the size and amount of files in cache directory.
These functions have been supported in C++ LTO API for a long time, but were absent in C LTO API.
Differential Revision: https://reviews.llvm.org/D42446
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@326537 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/llvm-lto/llvm-lto.cpp | 10 | ||||
-rw-r--r-- | tools/lto/lto.cpp | 10 | ||||
-rw-r--r-- | tools/lto/lto.exports | 6 |
3 files changed, 24 insertions, 2 deletions
diff --git a/tools/llvm-lto/llvm-lto.cpp b/tools/llvm-lto/llvm-lto.cpp index 9e5458f4ad9..87c998c9032 100644 --- a/tools/llvm-lto/llvm-lto.cpp +++ b/tools/llvm-lto/llvm-lto.cpp @@ -160,6 +160,14 @@ static cl::opt<int> ThinLTOCachePruningInterval("thinlto-cache-pruning-interval", cl::init(1200), cl::desc("Set ThinLTO cache pruning interval.")); +static cl::opt<int> + ThinLTOCacheMaxSizeBytes("thinlto-cache-max-size-bytes", + cl::desc("Set ThinLTO cache pruning directory maximum size in bytes.")); + +static cl::opt<int> + ThinLTOCacheMaxSizeFiles("thinlto-cache-max-size-files", cl::init(1000000), + cl::desc("Set ThinLTO cache pruning directory maximum number of files.")); + static cl::opt<std::string> ThinLTOSaveTempsPrefix( "thinlto-save-temps", cl::desc("Save ThinLTO temp files using filenames created by adding " @@ -475,6 +483,8 @@ public: ThinGenerator.setTargetOptions(Options); ThinGenerator.setCacheDir(ThinLTOCacheDir); ThinGenerator.setCachePruningInterval(ThinLTOCachePruningInterval); + ThinGenerator.setCacheMaxSizeFiles(ThinLTOCacheMaxSizeFiles); + ThinGenerator.setCacheMaxSizeBytes(ThinLTOCacheMaxSizeBytes); ThinGenerator.setFreestanding(EnableFreestanding); // Add all the exported symbols to the table of symbols to preserve. diff --git a/tools/lto/lto.cpp b/tools/lto/lto.cpp index e6843986dbe..997c16e0fee 100644 --- a/tools/lto/lto.cpp +++ b/tools/lto/lto.cpp @@ -586,6 +586,16 @@ void thinlto_codegen_set_final_cache_size_relative_to_available_space( return unwrap(cg)->setMaxCacheSizeRelativeToAvailableSpace(Percentage); } +void thinlto_codegen_set_cache_size_bytes( + thinlto_code_gen_t cg, unsigned MaxSizeBytes) { + return unwrap(cg)->setCacheMaxSizeBytes(MaxSizeBytes); +} + +void thinlto_codegen_set_cache_size_files( + thinlto_code_gen_t cg, unsigned MaxSizeFiles) { + return unwrap(cg)->setCacheMaxSizeFiles(MaxSizeFiles); +} + void thinlto_codegen_set_savetemps_dir(thinlto_code_gen_t cg, const char *save_temps_dir) { return unwrap(cg)->setSaveTempsDir(save_temps_dir); diff --git a/tools/lto/lto.exports b/tools/lto/lto.exports index 2e09026ae50..abde3894cb2 100644 --- a/tools/lto/lto.exports +++ b/tools/lto/lto.exports @@ -56,15 +56,17 @@ thinlto_codegen_set_pic_model thinlto_codegen_set_cache_dir thinlto_codegen_set_cache_pruning_interval thinlto_codegen_set_cache_entry_expiration +thinlto_codegen_set_final_cache_size_relative_to_available_space +thinlto_codegen_set_cache_size_bytes +thinlto_codegen_set_cache_size_files thinlto_codegen_set_savetemps_dir thinlto_codegen_set_cpu thinlto_debug_options lto_module_is_thinlto thinlto_codegen_add_must_preserve_symbol thinlto_codegen_add_cross_referenced_symbol -thinlto_codegen_set_final_cache_size_relative_to_available_space thinlto_codegen_set_codegen_only thinlto_codegen_disable_codegen thinlto_module_get_num_object_files thinlto_module_get_object_file -thinlto_set_generated_objects_dir
\ No newline at end of file +thinlto_set_generated_objects_dir |