Remove unnecessary parts of run_fat_lto signature
Fat LTO merges into one module, so only return one module.
This commit is contained in:
parent
bdbee6311b
commit
bc2db43b9e
4 changed files with 12 additions and 19 deletions
|
@ -144,22 +144,15 @@ fn prepare_lto(cgcx: &CodegenContext<LlvmCodegenBackend>,
|
||||||
/// for further optimization.
|
/// for further optimization.
|
||||||
pub(crate) fn run_fat(cgcx: &CodegenContext<LlvmCodegenBackend>,
|
pub(crate) fn run_fat(cgcx: &CodegenContext<LlvmCodegenBackend>,
|
||||||
modules: Vec<ModuleCodegen<ModuleLlvm>>,
|
modules: Vec<ModuleCodegen<ModuleLlvm>>,
|
||||||
_cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
|
|
||||||
timeline: &mut Timeline)
|
timeline: &mut Timeline)
|
||||||
-> Result<(Vec<LtoModuleCodegen<LlvmCodegenBackend>>, Vec<WorkProduct>), FatalError>
|
-> Result<LtoModuleCodegen<LlvmCodegenBackend>, FatalError>
|
||||||
{
|
{
|
||||||
let diag_handler = cgcx.create_diag_handler();
|
let diag_handler = cgcx.create_diag_handler();
|
||||||
let (symbol_white_list, upstream_modules) = prepare_lto(cgcx, timeline, &diag_handler)?;
|
let (symbol_white_list, upstream_modules) = prepare_lto(cgcx, timeline, &diag_handler)?;
|
||||||
let symbol_white_list = symbol_white_list.iter()
|
let symbol_white_list = symbol_white_list.iter()
|
||||||
.map(|c| c.as_ptr())
|
.map(|c| c.as_ptr())
|
||||||
.collect::<Vec<_>>();
|
.collect::<Vec<_>>();
|
||||||
let opt_jobs = fat_lto(cgcx,
|
fat_lto(cgcx, &diag_handler, modules, upstream_modules, &symbol_white_list, timeline)
|
||||||
&diag_handler,
|
|
||||||
modules,
|
|
||||||
upstream_modules,
|
|
||||||
&symbol_white_list,
|
|
||||||
timeline);
|
|
||||||
opt_jobs.map(|opt_jobs| (opt_jobs, vec![]))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Performs thin LTO by performing necessary global analysis and returning two
|
/// Performs thin LTO by performing necessary global analysis and returning two
|
||||||
|
@ -195,7 +188,7 @@ fn fat_lto(cgcx: &CodegenContext<LlvmCodegenBackend>,
|
||||||
mut serialized_modules: Vec<(SerializedModule<ModuleBuffer>, CString)>,
|
mut serialized_modules: Vec<(SerializedModule<ModuleBuffer>, CString)>,
|
||||||
symbol_white_list: &[*const libc::c_char],
|
symbol_white_list: &[*const libc::c_char],
|
||||||
timeline: &mut Timeline)
|
timeline: &mut Timeline)
|
||||||
-> Result<Vec<LtoModuleCodegen<LlvmCodegenBackend>>, FatalError>
|
-> Result<LtoModuleCodegen<LlvmCodegenBackend>, FatalError>
|
||||||
{
|
{
|
||||||
info!("going for a fat lto");
|
info!("going for a fat lto");
|
||||||
|
|
||||||
|
@ -284,10 +277,10 @@ fn fat_lto(cgcx: &CodegenContext<LlvmCodegenBackend>,
|
||||||
timeline.record("passes");
|
timeline.record("passes");
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(vec![LtoModuleCodegen::Fat {
|
Ok(LtoModuleCodegen::Fat {
|
||||||
module: Some(module),
|
module: Some(module),
|
||||||
_serialized_bitcode: serialized_bitcode,
|
_serialized_bitcode: serialized_bitcode,
|
||||||
}])
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Linker<'a>(&'a mut llvm::Linker<'a>);
|
struct Linker<'a>(&'a mut llvm::Linker<'a>);
|
||||||
|
|
|
@ -179,10 +179,9 @@ impl WriteBackendMethods for LlvmCodegenBackend {
|
||||||
fn run_fat_lto(
|
fn run_fat_lto(
|
||||||
cgcx: &CodegenContext<Self>,
|
cgcx: &CodegenContext<Self>,
|
||||||
modules: Vec<ModuleCodegen<Self::Module>>,
|
modules: Vec<ModuleCodegen<Self::Module>>,
|
||||||
cached_modules: Vec<(SerializedModule<Self::ModuleBuffer>, WorkProduct)>,
|
|
||||||
timeline: &mut Timeline
|
timeline: &mut Timeline
|
||||||
) -> Result<(Vec<LtoModuleCodegen<Self>>, Vec<WorkProduct>), FatalError> {
|
) -> Result<LtoModuleCodegen<Self>, FatalError> {
|
||||||
back::lto::run_fat(cgcx, modules, cached_modules, timeline)
|
back::lto::run_fat(cgcx, modules, timeline)
|
||||||
}
|
}
|
||||||
fn run_thin_lto(
|
fn run_thin_lto(
|
||||||
cgcx: &CodegenContext<Self>,
|
cgcx: &CodegenContext<Self>,
|
||||||
|
|
|
@ -264,8 +264,10 @@ fn generate_lto_work<B: ExtraBackendMethods>(
|
||||||
|
|
||||||
let (lto_modules, copy_jobs) = if !needs_fat_lto.is_empty() {
|
let (lto_modules, copy_jobs) = if !needs_fat_lto.is_empty() {
|
||||||
assert!(needs_thin_lto.is_empty());
|
assert!(needs_thin_lto.is_empty());
|
||||||
B::run_fat_lto(cgcx, needs_fat_lto, import_only_modules, &mut timeline)
|
assert!(import_only_modules.is_empty());
|
||||||
.unwrap_or_else(|e| e.raise())
|
let lto_module = B::run_fat_lto(cgcx, needs_fat_lto, &mut timeline)
|
||||||
|
.unwrap_or_else(|e| e.raise());
|
||||||
|
(vec![lto_module], vec![])
|
||||||
} else {
|
} else {
|
||||||
assert!(needs_fat_lto.is_empty());
|
assert!(needs_fat_lto.is_empty());
|
||||||
B::run_thin_lto(cgcx, needs_thin_lto, import_only_modules, &mut timeline)
|
B::run_thin_lto(cgcx, needs_thin_lto, import_only_modules, &mut timeline)
|
||||||
|
|
|
@ -29,9 +29,8 @@ pub trait WriteBackendMethods: 'static + Sized + Clone {
|
||||||
fn run_fat_lto(
|
fn run_fat_lto(
|
||||||
cgcx: &CodegenContext<Self>,
|
cgcx: &CodegenContext<Self>,
|
||||||
modules: Vec<ModuleCodegen<Self::Module>>,
|
modules: Vec<ModuleCodegen<Self::Module>>,
|
||||||
cached_modules: Vec<(SerializedModule<Self::ModuleBuffer>, WorkProduct)>,
|
|
||||||
timeline: &mut Timeline,
|
timeline: &mut Timeline,
|
||||||
) -> Result<(Vec<LtoModuleCodegen<Self>>, Vec<WorkProduct>), FatalError>;
|
) -> Result<LtoModuleCodegen<Self>, FatalError>;
|
||||||
/// Performs thin LTO by performing necessary global analysis and returning two
|
/// Performs thin LTO by performing necessary global analysis and returning two
|
||||||
/// lists, one of the modules that need optimization and another for modules that
|
/// lists, one of the modules that need optimization and another for modules that
|
||||||
/// can simply be copied over from the incr. comp. cache.
|
/// can simply be copied over from the incr. comp. cache.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue