diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2018-12-03 20:45:03 +0100 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2018-12-04 16:10:24 +0100 |
| commit | bdbee6311b5a317630fb46c7c46d50b14e18da24 (patch) | |
| tree | 89b9c9b88953086ae80151740407a6b080fa4b3d /src/librustc_codegen_ssa | |
| parent | a17de6980ac3289e2929da86f1e7259e83eef125 (diff) | |
| download | rust-bdbee6311b5a317630fb46c7c46d50b14e18da24.tar.gz rust-bdbee6311b5a317630fb46c7c46d50b14e18da24.zip | |
Separate out methods for running thin and fat LTO
Diffstat (limited to 'src/librustc_codegen_ssa')
| -rw-r--r-- | src/librustc_codegen_ssa/back/write.rs | 4 | ||||
| -rw-r--r-- | src/librustc_codegen_ssa/traits/write.rs | 18 |
2 files changed, 14 insertions, 8 deletions
diff --git a/src/librustc_codegen_ssa/back/write.rs b/src/librustc_codegen_ssa/back/write.rs index aaaaf169f15..5e89265d56f 100644 --- a/src/librustc_codegen_ssa/back/write.rs +++ b/src/librustc_codegen_ssa/back/write.rs @@ -264,11 +264,11 @@ fn generate_lto_work<B: ExtraBackendMethods>( let (lto_modules, copy_jobs) = if !needs_fat_lto.is_empty() { assert!(needs_thin_lto.is_empty()); - B::run_lto(cgcx, needs_fat_lto, import_only_modules, &mut timeline) + B::run_fat_lto(cgcx, needs_fat_lto, import_only_modules, &mut timeline) .unwrap_or_else(|e| e.raise()) } else { assert!(needs_fat_lto.is_empty()); - B::run_lto(cgcx, needs_thin_lto, import_only_modules, &mut timeline) + B::run_thin_lto(cgcx, needs_thin_lto, import_only_modules, &mut timeline) .unwrap_or_else(|e| e.raise()) }; diff --git a/src/librustc_codegen_ssa/traits/write.rs b/src/librustc_codegen_ssa/traits/write.rs index 72522e19af2..5bc44dfeeb3 100644 --- a/src/librustc_codegen_ssa/traits/write.rs +++ b/src/librustc_codegen_ssa/traits/write.rs @@ -24,12 +24,18 @@ pub trait WriteBackendMethods: 'static + Sized + Clone { type ThinData: Send + Sync; type ThinBuffer: ThinBufferMethods; - /// Performs LTO, which in the case of full LTO means merging all modules into - /// a single one and returning it for further optimizing. For ThinLTO, it will - /// do the global analysis necessary and return two lists, one of the modules - /// the need optimization and another for modules that can simply be copied over - /// from the incr. comp. cache. - fn run_lto( + /// Performs fat LTO by merging all modules into a single one and returning it + /// for further optimization. + fn run_fat_lto( + cgcx: &CodegenContext<Self>, + modules: Vec<ModuleCodegen<Self::Module>>, + cached_modules: Vec<(SerializedModule<Self::ModuleBuffer>, WorkProduct)>, + timeline: &mut Timeline, + ) -> Result<(Vec<LtoModuleCodegen<Self>>, Vec<WorkProduct>), FatalError>; + /// Performs thin LTO by performing necessary global analysis and returning two + /// lists, one of the modules that need optimization and another for modules that + /// can simply be copied over from the incr. comp. cache. + fn run_thin_lto( cgcx: &CodegenContext<Self>, modules: Vec<ModuleCodegen<Self::Module>>, cached_modules: Vec<(SerializedModule<Self::ModuleBuffer>, WorkProduct)>, |
