From 2b32cb90c72d90c722d56324ca0ea9f748ebf4e1 Mon Sep 17 00:00:00 2001 From: Niko Matsakis Date: Thu, 27 Apr 2017 16:48:48 -0400 Subject: retool MIR passes completely The new setup is as follows. There is a pipeline of MIR passes that each run **per def-id** to optimize a particular function. You are intended to request MIR at whatever stage you need it. At the moment, there is only one stage you can request: - `optimized_mir(def_id)` This yields the final product. Internally, it pulls the MIR for the given def-id through a series of steps. Right now, these are still using an "interned ref-cell" but they are intended to "steal" from one another: - `mir_build` -- performs the initial construction for local MIR - `mir_pass_set` -- performs a suite of optimizations and transformations - `mir_pass` -- an individual optimization within a suite So, to construct the optimized MIR, we invoke: mir_pass_set((MIR_OPTIMIZED, def_id)) which will build up the final MIR. --- src/librustc_driver/driver.rs | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'src/librustc_driver') diff --git a/src/librustc_driver/driver.rs b/src/librustc_driver/driver.rs index 4c984559428..9b11d168e00 100644 --- a/src/librustc_driver/driver.rs +++ b/src/librustc_driver/driver.rs @@ -1005,11 +1005,6 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session, mir_stats::print_mir_stats(tcx, "PRE CLEANUP MIR STATS"); } - time(time_passes, "MIR cleanup and validation", || { - tcx.mir_passes.run_passes(tcx, MIR_CONST); - tcx.mir_passes.run_passes(tcx, MIR_VALIDATED); - }); - time(time_passes, "borrow checking", || borrowck::check_crate(tcx)); @@ -1058,20 +1053,6 @@ pub fn phase_4_translate_to_llvm<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, "resolving dependency formats", || dependency_format::calculate(&tcx.sess)); - if tcx.sess.opts.debugging_opts.mir_stats { - mir_stats::print_mir_stats(tcx, "PRE OPTIMISATION MIR STATS"); - } - - // Run the passes that transform the MIR into a more suitable form for translation to LLVM - // code. - time(time_passes, "MIR optimisations", || { - tcx.mir_passes.run_passes(tcx, MIR_OPTIMIZED); - }); - - if tcx.sess.opts.debugging_opts.mir_stats { - mir_stats::print_mir_stats(tcx, "POST OPTIMISATION MIR STATS"); - } - let translation = time(time_passes, "translation", -- cgit 1.4.1-3-g733a5