Remove output_filenames from CodegenCx
This commit is contained in:
parent
9ead1c10aa
commit
23110bdf76
4 changed files with 18 additions and 5 deletions
|
|
@ -12,6 +12,7 @@ use rustc_middle::ty::TypeVisitableExt;
|
|||
use rustc_middle::ty::adjustment::PointerCoercion;
|
||||
use rustc_middle::ty::layout::{FnAbiOf, HasTypingEnv};
|
||||
use rustc_middle::ty::print::with_no_trimmed_paths;
|
||||
use rustc_session::config::OutputFilenames;
|
||||
|
||||
use crate::constant::ConstantCx;
|
||||
use crate::debuginfo::{FunctionDebugContext, TypeDebugContext};
|
||||
|
|
@ -138,6 +139,7 @@ pub(crate) fn codegen_fn<'tcx>(
|
|||
pub(crate) fn compile_fn(
|
||||
cx: &mut crate::CodegenCx,
|
||||
profiler: &SelfProfilerRef,
|
||||
output_filenames: &OutputFilenames,
|
||||
cached_context: &mut Context,
|
||||
module: &mut dyn Module,
|
||||
codegened_func: CodegenedFunction,
|
||||
|
|
@ -215,7 +217,7 @@ pub(crate) fn compile_fn(
|
|||
if cx.should_write_ir {
|
||||
// Write optimized function to file for debugging
|
||||
crate::pretty_clif::write_clif_file(
|
||||
&cx.output_filenames,
|
||||
output_filenames,
|
||||
&codegened_func.symbol_name,
|
||||
"opt",
|
||||
module.isa(),
|
||||
|
|
@ -225,7 +227,7 @@ pub(crate) fn compile_fn(
|
|||
|
||||
if let Some(disasm) = &context.compiled_code().unwrap().vcode {
|
||||
crate::pretty_clif::write_ir_file(
|
||||
&cx.output_filenames,
|
||||
output_filenames,
|
||||
&format!("{}.vcode", codegened_func.symbol_name),
|
||||
|file| file.write_all(disasm.as_bytes()),
|
||||
)
|
||||
|
|
|
|||
|
|
@ -594,6 +594,7 @@ fn module_codegen(
|
|||
|
||||
let profiler = tcx.prof.clone();
|
||||
let invocation_temp = tcx.sess.invocation_temp.clone();
|
||||
let output_filenames = tcx.output_filenames(()).clone();
|
||||
|
||||
OngoingModuleCodegen::Async(std::thread::spawn(move || {
|
||||
profiler.clone().generic_activity_with_arg("compile functions", &*cgu_name).run(|| {
|
||||
|
|
@ -606,6 +607,7 @@ fn module_codegen(
|
|||
crate::base::compile_fn(
|
||||
&mut cx,
|
||||
&profiler,
|
||||
&output_filenames,
|
||||
&mut cached_context,
|
||||
&mut module,
|
||||
codegened_func,
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ use rustc_codegen_ssa::CrateInfo;
|
|||
use rustc_middle::middle::codegen_fn_attrs::CodegenFnAttrFlags;
|
||||
use rustc_middle::mir::mono::MonoItem;
|
||||
use rustc_session::Session;
|
||||
use rustc_session::config::OutputFilenames;
|
||||
use rustc_span::sym;
|
||||
|
||||
use crate::CodegenCx;
|
||||
|
|
@ -41,6 +42,7 @@ pub(crate) fn run_jit(tcx: TyCtxt<'_>, jit_args: Vec<String>) -> ! {
|
|||
tcx.dcx().fatal("can't jit non-executable crate");
|
||||
}
|
||||
|
||||
let output_filenames = tcx.output_filenames(());
|
||||
let (mut jit_module, mut cx) = create_jit_module(tcx);
|
||||
let mut cached_context = Context::new();
|
||||
|
||||
|
|
@ -60,6 +62,7 @@ pub(crate) fn run_jit(tcx: TyCtxt<'_>, jit_args: Vec<String>) -> ! {
|
|||
MonoItem::Fn(inst) => {
|
||||
codegen_and_compile_fn(
|
||||
tcx,
|
||||
&output_filenames,
|
||||
&mut cx,
|
||||
&mut cached_context,
|
||||
&mut jit_module,
|
||||
|
|
@ -122,6 +125,7 @@ pub(crate) fn run_jit(tcx: TyCtxt<'_>, jit_args: Vec<String>) -> ! {
|
|||
|
||||
fn codegen_and_compile_fn<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
output_filenames: &OutputFilenames,
|
||||
cx: &mut crate::CodegenCx,
|
||||
cached_context: &mut Context,
|
||||
module: &mut dyn Module,
|
||||
|
|
@ -149,7 +153,14 @@ fn codegen_and_compile_fn<'tcx>(
|
|||
module,
|
||||
instance,
|
||||
);
|
||||
crate::base::compile_fn(cx, &tcx.prof, cached_context, module, codegened_func);
|
||||
crate::base::compile_fn(
|
||||
cx,
|
||||
&tcx.prof,
|
||||
output_filenames,
|
||||
cached_context,
|
||||
module,
|
||||
codegened_func,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -125,7 +125,6 @@ impl<F: Fn() -> String> Drop for PrintOnPanic<F> {
|
|||
/// The codegen context holds any information shared between the codegen of individual functions
|
||||
/// inside a single codegen unit with the exception of the Cranelift [`Module`](cranelift_module::Module).
|
||||
struct CodegenCx {
|
||||
output_filenames: Arc<OutputFilenames>,
|
||||
should_write_ir: bool,
|
||||
global_asm: String,
|
||||
debug_context: Option<DebugContext>,
|
||||
|
|
@ -142,7 +141,6 @@ impl CodegenCx {
|
|||
None
|
||||
};
|
||||
CodegenCx {
|
||||
output_filenames: tcx.output_filenames(()).clone(),
|
||||
should_write_ir: crate::pretty_clif::should_write_ir(tcx),
|
||||
global_asm: String::new(),
|
||||
debug_context,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue