diff options
author | Shuxin Yang <shuxin.llvm@gmail.com> | 2013-08-12 18:29:43 +0000 |
---|---|---|
committer | Shuxin Yang <shuxin.llvm@gmail.com> | 2013-08-12 18:29:43 +0000 |
commit | 67d135ae40b121a138e334a175d0e02dbb54eeca (patch) | |
tree | 8e7ef892ab3d66802b5f53af56ba6a36a5911742 /tools/lto/lto.cpp | |
parent | 353476cbbb80881a754a90abc13851a884a4e26c (diff) | |
download | llvm-67d135ae40b121a138e334a175d0e02dbb54eeca.tar.gz llvm-67d135ae40b121a138e334a175d0e02dbb54eeca.tar.bz2 llvm-67d135ae40b121a138e334a175d0e02dbb54eeca.tar.xz |
Misc enhancements to LTO:
1. Add some helper classes for partitions. They are designed in a
way such that the top-level LTO driver will not see much difference
with or without partitioning.
2. Introduce work-dir. Now all intermediate files generated during
LTO phases will be saved under work-dir. User can specify the workdir
via -lto-workdir=/path/to/dir. By default the work-dir will be
erased before linker exit. To keep the workdir, do -lto-keep, or -lto-keep=1.
TODO: Erase the workdir, if the linker exit prematurely.
We are currently not able to remove directory on signal. The support
routines simply ignore directory.
3. Add one new API lto_codegen_get_files_need_remove().
Linker and LTO plugin will communicate via this API about which files
(including directories) need to removed before linker exit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@188188 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools/lto/lto.cpp')
-rw-r--r-- | tools/lto/lto.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/lto/lto.cpp b/tools/lto/lto.cpp index db7147c2bc..c7009d69e1 100644 --- a/tools/lto/lto.cpp +++ b/tools/lto/lto.cpp @@ -207,6 +207,19 @@ bool lto_codegen_compile_to_file(lto_code_gen_t cg, const char **name) { return !cg->compile_to_file(name, sLastErrorString); } +/// Get intermediate files that need to be removed before linker exit. Upon +/// return, the paths of the files need to be removed is written to "paths". The +/// paths are separated by a single '\0', and the last path is ended by double +/// '\0's. A file could be a directory; in this case, the entire directory needs +/// to be removed recursively. +/// +/// It is only necessary to call this function after \p lto_codegen_compile was +/// successfully called. +void +lto_codegen_get_files_need_remove(lto_code_gen_t cg, const char **paths) { + *paths = cg->getFilesNeedToRemove(); +} + /// lto_codegen_debug_options - Used to pass extra options to the code /// generator. void lto_codegen_debug_options(lto_code_gen_t cg, const char *opt) { |