Use () for codegen queries.
This commit is contained in:
parent
3a869ca88c
commit
915d766307
3 changed files with 7 additions and 8 deletions
|
@ -41,7 +41,7 @@ fn emit_module(
|
||||||
|
|
||||||
unwind_context.emit(&mut product);
|
unwind_context.emit(&mut product);
|
||||||
|
|
||||||
let tmp_file = tcx.output_filenames(LOCAL_CRATE).temp_path(OutputType::Object, Some(&name));
|
let tmp_file = tcx.output_filenames(()).temp_path(OutputType::Object, Some(&name));
|
||||||
let obj = product.object.write().unwrap();
|
let obj = product.object.write().unwrap();
|
||||||
if let Err(err) = std::fs::write(&tmp_file, obj) {
|
if let Err(err) = std::fs::write(&tmp_file, obj) {
|
||||||
tcx.sess.fatal(&format!("error writing object file: {}", err));
|
tcx.sess.fatal(&format!("error writing object file: {}", err));
|
||||||
|
@ -73,7 +73,7 @@ fn reuse_workproduct_for_cgu(
|
||||||
let work_product = cgu.work_product(tcx);
|
let work_product = cgu.work_product(tcx);
|
||||||
if let Some(saved_file) = &work_product.saved_file {
|
if let Some(saved_file) = &work_product.saved_file {
|
||||||
let obj_out = tcx
|
let obj_out = tcx
|
||||||
.output_filenames(LOCAL_CRATE)
|
.output_filenames(())
|
||||||
.temp_path(OutputType::Object, Some(&cgu.name().as_str()));
|
.temp_path(OutputType::Object, Some(&cgu.name().as_str()));
|
||||||
object = Some(obj_out.clone());
|
object = Some(obj_out.clone());
|
||||||
let source_file = rustc_incremental::in_incr_comp_dir(&incr_comp_session_dir, &saved_file);
|
let source_file = rustc_incremental::in_incr_comp_dir(&incr_comp_session_dir, &saved_file);
|
||||||
|
@ -179,7 +179,7 @@ pub(crate) fn run_aot(
|
||||||
let mut work_products = FxHashMap::default();
|
let mut work_products = FxHashMap::default();
|
||||||
|
|
||||||
let cgus = if tcx.sess.opts.output_types.should_codegen() {
|
let cgus = if tcx.sess.opts.output_types.should_codegen() {
|
||||||
tcx.collect_and_partition_mono_items(LOCAL_CRATE).1
|
tcx.collect_and_partition_mono_items(()).1
|
||||||
} else {
|
} else {
|
||||||
// If only `--emit metadata` is used, we shouldn't perform any codegen.
|
// If only `--emit metadata` is used, we shouldn't perform any codegen.
|
||||||
// Also `tcx.collect_and_partition_mono_items` may panic in that case.
|
// Also `tcx.collect_and_partition_mono_items` may panic in that case.
|
||||||
|
@ -265,7 +265,7 @@ pub(crate) fn run_aot(
|
||||||
.to_string();
|
.to_string();
|
||||||
|
|
||||||
let tmp_file = tcx
|
let tmp_file = tcx
|
||||||
.output_filenames(LOCAL_CRATE)
|
.output_filenames(())
|
||||||
.temp_path(OutputType::Metadata, Some(&metadata_cgu_name));
|
.temp_path(OutputType::Metadata, Some(&metadata_cgu_name));
|
||||||
|
|
||||||
let obj = crate::backend::with_object(tcx.sess, &metadata_cgu_name, |object| {
|
let obj = crate::backend::with_object(tcx.sess, &metadata_cgu_name, |object| {
|
||||||
|
@ -342,7 +342,7 @@ fn codegen_global_asm(tcx: TyCtxt<'_>, cgu_name: &str, global_asm: &str) {
|
||||||
.join("\n");
|
.join("\n");
|
||||||
|
|
||||||
let output_object_file =
|
let output_object_file =
|
||||||
tcx.output_filenames(LOCAL_CRATE).temp_path(OutputType::Object, Some(cgu_name));
|
tcx.output_filenames(()).temp_path(OutputType::Object, Some(cgu_name));
|
||||||
|
|
||||||
// Assemble `global_asm`
|
// Assemble `global_asm`
|
||||||
let global_asm_object_file = add_file_stem_postfix(output_object_file.clone(), ".asm");
|
let global_asm_object_file = add_file_stem_postfix(output_object_file.clone(), ".asm");
|
||||||
|
|
|
@ -8,7 +8,6 @@ use std::os::raw::{c_char, c_int};
|
||||||
use cranelift_codegen::binemit::{NullStackMapSink, NullTrapSink};
|
use cranelift_codegen::binemit::{NullStackMapSink, NullTrapSink};
|
||||||
use rustc_codegen_ssa::CrateInfo;
|
use rustc_codegen_ssa::CrateInfo;
|
||||||
use rustc_middle::mir::mono::MonoItem;
|
use rustc_middle::mir::mono::MonoItem;
|
||||||
use rustc_session::config::EntryFnType;
|
|
||||||
|
|
||||||
use cranelift_jit::{JITBuilder, JITModule};
|
use cranelift_jit::{JITBuilder, JITModule};
|
||||||
|
|
||||||
|
@ -66,7 +65,7 @@ pub(crate) fn run_jit(tcx: TyCtxt<'_>, backend_config: BackendConfig) -> ! {
|
||||||
matches!(backend_config.codegen_mode, CodegenMode::JitLazy),
|
matches!(backend_config.codegen_mode, CodegenMode::JitLazy),
|
||||||
);
|
);
|
||||||
|
|
||||||
let (_, cgus) = tcx.collect_and_partition_mono_items(LOCAL_CRATE);
|
let (_, cgus) = tcx.collect_and_partition_mono_items(());
|
||||||
let mono_items = cgus
|
let mono_items = cgus
|
||||||
.iter()
|
.iter()
|
||||||
.map(|cgu| cgu.items_in_deterministic_order(tcx).into_iter())
|
.map(|cgu| cgu.items_in_deterministic_order(tcx).into_iter())
|
||||||
|
|
|
@ -214,7 +214,7 @@ pub(crate) fn write_ir_file(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let clif_output_dir = tcx.output_filenames(LOCAL_CRATE).with_extension("clif");
|
let clif_output_dir = tcx.output_filenames(()).with_extension("clif");
|
||||||
|
|
||||||
match std::fs::create_dir(&clif_output_dir) {
|
match std::fs::create_dir(&clif_output_dir) {
|
||||||
Ok(()) => {}
|
Ok(()) => {}
|
||||||
|
|
Loading…
Reference in a new issue