Rename CodegenContext::create_diag_handler
as CodegenContext::create_dcx
.
This commit is contained in:
parent
dea752e53d
commit
7c656bc05b
@ -183,7 +183,7 @@ pub(crate) fn run_fat(
|
|||||||
modules: Vec<FatLtoInput<GccCodegenBackend>>,
|
modules: Vec<FatLtoInput<GccCodegenBackend>>,
|
||||||
cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
|
cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
|
||||||
) -> Result<LtoModuleCodegen<GccCodegenBackend>, FatalError> {
|
) -> Result<LtoModuleCodegen<GccCodegenBackend>, FatalError> {
|
||||||
let diag_handler = cgcx.create_diag_handler();
|
let diag_handler = cgcx.create_dcx();
|
||||||
let lto_data = prepare_lto(cgcx, &diag_handler)?;
|
let lto_data = prepare_lto(cgcx, &diag_handler)?;
|
||||||
/*let symbols_below_threshold =
|
/*let symbols_below_threshold =
|
||||||
lto_data.symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::<Vec<_>>();*/
|
lto_data.symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::<Vec<_>>();*/
|
||||||
|
@ -200,7 +200,7 @@ pub(crate) fn run_fat(
|
|||||||
modules: Vec<FatLtoInput<LlvmCodegenBackend>>,
|
modules: Vec<FatLtoInput<LlvmCodegenBackend>>,
|
||||||
cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
|
cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
|
||||||
) -> Result<LtoModuleCodegen<LlvmCodegenBackend>, FatalError> {
|
) -> Result<LtoModuleCodegen<LlvmCodegenBackend>, FatalError> {
|
||||||
let diag_handler = cgcx.create_diag_handler();
|
let diag_handler = cgcx.create_dcx();
|
||||||
let (symbols_below_threshold, upstream_modules) = prepare_lto(cgcx, &diag_handler)?;
|
let (symbols_below_threshold, upstream_modules) = prepare_lto(cgcx, &diag_handler)?;
|
||||||
let symbols_below_threshold =
|
let symbols_below_threshold =
|
||||||
symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::<Vec<_>>();
|
symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::<Vec<_>>();
|
||||||
@ -222,7 +222,7 @@ pub(crate) fn run_thin(
|
|||||||
modules: Vec<(String, ThinBuffer)>,
|
modules: Vec<(String, ThinBuffer)>,
|
||||||
cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
|
cached_modules: Vec<(SerializedModule<ModuleBuffer>, WorkProduct)>,
|
||||||
) -> Result<(Vec<LtoModuleCodegen<LlvmCodegenBackend>>, Vec<WorkProduct>), FatalError> {
|
) -> Result<(Vec<LtoModuleCodegen<LlvmCodegenBackend>>, Vec<WorkProduct>), FatalError> {
|
||||||
let diag_handler = cgcx.create_diag_handler();
|
let diag_handler = cgcx.create_dcx();
|
||||||
let (symbols_below_threshold, upstream_modules) = prepare_lto(cgcx, &diag_handler)?;
|
let (symbols_below_threshold, upstream_modules) = prepare_lto(cgcx, &diag_handler)?;
|
||||||
let symbols_below_threshold =
|
let symbols_below_threshold =
|
||||||
symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::<Vec<_>>();
|
symbols_below_threshold.iter().map(|c| c.as_ptr()).collect::<Vec<_>>();
|
||||||
@ -721,7 +721,7 @@ pub unsafe fn optimize_thin_module(
|
|||||||
thin_module: ThinModule<LlvmCodegenBackend>,
|
thin_module: ThinModule<LlvmCodegenBackend>,
|
||||||
cgcx: &CodegenContext<LlvmCodegenBackend>,
|
cgcx: &CodegenContext<LlvmCodegenBackend>,
|
||||||
) -> Result<ModuleCodegen<ModuleLlvm>, FatalError> {
|
) -> Result<ModuleCodegen<ModuleLlvm>, FatalError> {
|
||||||
let diag_handler = cgcx.create_diag_handler();
|
let diag_handler = cgcx.create_dcx();
|
||||||
|
|
||||||
let module_name = &thin_module.shared.module_names[thin_module.idx];
|
let module_name = &thin_module.shared.module_names[thin_module.idx];
|
||||||
let tm_factory_config = TargetMachineFactoryConfig::new(cgcx, module_name.to_str().unwrap());
|
let tm_factory_config = TargetMachineFactoryConfig::new(cgcx, module_name.to_str().unwrap());
|
||||||
|
@ -231,7 +231,7 @@ impl WriteBackendMethods for LlvmCodegenBackend {
|
|||||||
cgcx: &CodegenContext<Self>,
|
cgcx: &CodegenContext<Self>,
|
||||||
module: &mut ModuleCodegen<Self::Module>,
|
module: &mut ModuleCodegen<Self::Module>,
|
||||||
) -> Result<(), FatalError> {
|
) -> Result<(), FatalError> {
|
||||||
let diag_handler = cgcx.create_diag_handler();
|
let diag_handler = cgcx.create_dcx();
|
||||||
back::lto::run_pass_manager(cgcx, &diag_handler, module, false)
|
back::lto::run_pass_manager(cgcx, &diag_handler, module, false)
|
||||||
}
|
}
|
||||||
unsafe fn optimize_thin(
|
unsafe fn optimize_thin(
|
||||||
|
@ -359,7 +359,7 @@ pub struct CodegenContext<B: WriteBackendMethods> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<B: WriteBackendMethods> CodegenContext<B> {
|
impl<B: WriteBackendMethods> CodegenContext<B> {
|
||||||
pub fn create_diag_handler(&self) -> DiagCtxt {
|
pub fn create_dcx(&self) -> DiagCtxt {
|
||||||
DiagCtxt::with_emitter(Box::new(self.diag_emitter.clone()))
|
DiagCtxt::with_emitter(Box::new(self.diag_emitter.clone()))
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -825,7 +825,7 @@ fn execute_optimize_work_item<B: ExtraBackendMethods>(
|
|||||||
module: ModuleCodegen<B::Module>,
|
module: ModuleCodegen<B::Module>,
|
||||||
module_config: &ModuleConfig,
|
module_config: &ModuleConfig,
|
||||||
) -> Result<WorkItemResult<B>, FatalError> {
|
) -> Result<WorkItemResult<B>, FatalError> {
|
||||||
let diag_handler = cgcx.create_diag_handler();
|
let diag_handler = cgcx.create_dcx();
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
B::optimize(cgcx, &diag_handler, &module, module_config)?;
|
B::optimize(cgcx, &diag_handler, &module, module_config)?;
|
||||||
@ -891,11 +891,7 @@ fn execute_copy_from_cache_work_item<B: ExtraBackendMethods>(
|
|||||||
match link_or_copy(&source_file, &output_path) {
|
match link_or_copy(&source_file, &output_path) {
|
||||||
Ok(_) => Some(output_path),
|
Ok(_) => Some(output_path),
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
cgcx.create_diag_handler().emit_err(errors::CopyPathBuf {
|
cgcx.create_dcx().emit_err(errors::CopyPathBuf { source_file, output_path, error });
|
||||||
source_file,
|
|
||||||
output_path,
|
|
||||||
error,
|
|
||||||
});
|
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -939,7 +935,7 @@ fn finish_intra_module_work<B: ExtraBackendMethods>(
|
|||||||
module: ModuleCodegen<B::Module>,
|
module: ModuleCodegen<B::Module>,
|
||||||
module_config: &ModuleConfig,
|
module_config: &ModuleConfig,
|
||||||
) -> Result<WorkItemResult<B>, FatalError> {
|
) -> Result<WorkItemResult<B>, FatalError> {
|
||||||
let diag_handler = cgcx.create_diag_handler();
|
let diag_handler = cgcx.create_dcx();
|
||||||
|
|
||||||
if !cgcx.opts.unstable_opts.combine_cgu
|
if !cgcx.opts.unstable_opts.combine_cgu
|
||||||
|| module.kind == ModuleKind::Metadata
|
|| module.kind == ModuleKind::Metadata
|
||||||
@ -1595,7 +1591,7 @@ fn start_executing_work<B: ExtraBackendMethods>(
|
|||||||
let needs_link = mem::take(&mut needs_link);
|
let needs_link = mem::take(&mut needs_link);
|
||||||
if !needs_link.is_empty() {
|
if !needs_link.is_empty() {
|
||||||
assert!(compiled_modules.is_empty());
|
assert!(compiled_modules.is_empty());
|
||||||
let diag_handler = cgcx.create_diag_handler();
|
let diag_handler = cgcx.create_dcx();
|
||||||
let module = B::run_link(&cgcx, &diag_handler, needs_link).map_err(|_| ())?;
|
let module = B::run_link(&cgcx, &diag_handler, needs_link).map_err(|_| ())?;
|
||||||
let module = unsafe {
|
let module = unsafe {
|
||||||
B::codegen(&cgcx, &diag_handler, module, cgcx.config(ModuleKind::Regular))
|
B::codegen(&cgcx, &diag_handler, module, cgcx.config(ModuleKind::Regular))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user