about summary refs log tree commit diff
path: root/src/librustc_mir/transform/inline.rs
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2017-04-25 18:23:33 -0400
committerNiko Matsakis <niko@alum.mit.edu>2017-05-02 14:01:01 -0400
commit46b342fbc03664566d65e1b3248f89cbef93ef4c (patch)
tree7240a1ab4273707acd552117d45621eee0adff18 /src/librustc_mir/transform/inline.rs
parent11b6b0663ae0a89eea913f44aa1eb859b0ef0d3a (diff)
downloadrust-46b342fbc03664566d65e1b3248f89cbef93ef4c.tar.gz
rust-46b342fbc03664566d65e1b3248f89cbef93ef4c.zip
simplify the MirPass traits and passes dramatically
Overall goal: reduce the amount of context a mir pass needs so that it
resembles a query.

- The hooks are no longer "threaded down" to the pass, but rather run
  automatically from the top-level (we also thread down the current pass
  number, so that the files are sorted better).
  - The hook now receives a *single* callback, rather than a callback per-MIR.
- The traits are no longer lifetime parameters, which moved to the
  methods -- given that we required
  `for<'tcx>` objecs, there wasn't much point to that.
- Several passes now store a `String` instead of a `&'l str` (again, no
  point).
Diffstat (limited to 'src/librustc_mir/transform/inline.rs')
-rw-r--r--src/librustc_mir/transform/inline.rs18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/librustc_mir/transform/inline.rs b/src/librustc_mir/transform/inline.rs
index b11a3c805f9..b0a067063dd 100644
--- a/src/librustc_mir/transform/inline.rs
+++ b/src/librustc_mir/transform/inline.rs
@@ -10,7 +10,7 @@
 
 //! Inlining pass for MIR functions
 
-use rustc::hir::def_id::{DefId, LOCAL_CRATE};
+use rustc::hir::def_id::DefId;
 
 use rustc_data_structures::bitvec::BitVector;
 use rustc_data_structures::indexed_vec::{Idx, IndexVec};
@@ -18,7 +18,7 @@ use rustc_data_structures::graph;
 
 use rustc::dep_graph::DepNode;
 use rustc::mir::*;
-use rustc::mir::transform::{self, MirMapPass, MirPassHook, MirSource, Pass};
+use rustc::mir::transform::{MirSource, Pass};
 use rustc::mir::visit::*;
 use rustc::traits;
 use rustc::ty::{self, Ty, TyCtxt};
@@ -42,12 +42,8 @@ const UNKNOWN_SIZE_COST: usize = 10;
 
 pub struct Inline;
 
-impl<'tcx> MirMapPass<'tcx> for Inline {
-    fn run_pass<'a>(
-        &self,
-        tcx: TyCtxt<'a, 'tcx, 'tcx>,
-        hooks: &mut [Box<for<'s> MirPassHook<'s>>]) {
-
+impl Pass for Inline {
+    fn run_pass<'a, 'tcx>(&self, tcx: TyCtxt<'a, 'tcx, 'tcx>) {
         if tcx.sess.opts.debugging_opts.mir_opt_level < 2 { return; }
 
         let _ignore = tcx.dep_graph.in_ignore();
@@ -58,18 +54,12 @@ impl<'tcx> MirMapPass<'tcx> for Inline {
             tcx: tcx,
         };
 
-        transform::run_hooks(tcx, hooks, self, false);
-
         for scc in callgraph.scc_iter() {
             inliner.inline_scc(&callgraph, &scc);
         }
-
-        transform::run_hooks(tcx, hooks, self, true);
     }
 }
 
-impl<'tcx> Pass for Inline { }
-
 struct Inliner<'a, 'tcx: 'a> {
     tcx: TyCtxt<'a, 'tcx, 'tcx>,
 }