Skip to content

Commit

Permalink
move to only def-id passes
Browse files Browse the repository at this point in the history
this temporary disables `inline`
  • Loading branch information
nikomatsakis committed May 2, 2017
1 parent 668886a commit f23a7bc
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
16 changes: 10 additions & 6 deletions src/librustc/mir/transform.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub fn default_name<T: ?Sized>() -> Cow<'static, str> {
pub trait PassHook {
fn on_mir_pass<'a, 'tcx>(&self,
tcx: TyCtxt<'a, 'tcx, 'tcx>,
pass: &Pass,
pass_name: &str,
pass_num: usize,
is_after: bool);
}
Expand Down Expand Up @@ -173,7 +173,7 @@ pub struct Passes {

#[derive(Clone)]
struct PassSet {
passes: Vec<Rc<Pass>>,
passes: Vec<Rc<DefIdPass>>,
}

/// The number of "pass sets" that we have:
Expand Down Expand Up @@ -208,19 +208,23 @@ impl<'a, 'tcx> Passes {
// NB: passes are numbered from 1, since "construction" is zero.
for (pass, pass_num) in set.passes.iter().zip(start_num + 1..) {
for hook in &self.pass_hooks {
hook.on_mir_pass(tcx, &**pass, pass_num, false);
hook.on_mir_pass(tcx, &pass.name(), pass_num, false);
}

time(tcx.sess.time_passes(), &*pass.name(), || pass.run_pass(tcx));
time(tcx.sess.time_passes(), &*pass.name(), || {
for &def_id in tcx.mir_keys(LOCAL_CRATE).iter() {
pass.run_pass(tcx, def_id);
}
});

for hook in &self.pass_hooks {
hook.on_mir_pass(tcx, &**pass, pass_num, true);
hook.on_mir_pass(tcx, &pass.name(), pass_num, true);
}
}
}

/// Pushes a built-in pass.
pub fn push_pass<T: Pass + 'static>(&mut self, set: usize, pass: T) {
pub fn push_pass<T: DefIdPass + 'static>(&mut self, set: usize, pass: T) {
self.sets[set].passes.push(Rc::new(pass));
}

Expand Down
2 changes: 1 addition & 1 deletion src/librustc_driver/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -929,7 +929,7 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
passes.push_pass(MIR_OPTIMIZED, mir::transform::simplify::SimplifyCfg::new("elaborate-drops"));

// No lifetime analysis based on borrowing can be done from here on out.
passes.push_pass(MIR_OPTIMIZED, mir::transform::inline::Inline);
// passes.push_pass(MIR_OPTIMIZED, mir::transform::inline::Inline); // TODO re-enable
passes.push_pass(MIR_OPTIMIZED, mir::transform::instcombine::InstCombine);
passes.push_pass(MIR_OPTIMIZED, mir::transform::deaggregator::Deaggregator);
passes.push_pass(MIR_OPTIMIZED, mir::transform::copy_prop::CopyPropagation);
Expand Down
4 changes: 2 additions & 2 deletions src/librustc_mir/transform/dump_mir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ impl PassHook for DumpMir {
fn on_mir_pass<'a, 'tcx>(
&self,
tcx: TyCtxt<'a, 'tcx, 'tcx>,
pass: &Pass,
pass_name: &str,
pass_num: usize,
is_after: bool)
{
Expand All @@ -66,7 +66,7 @@ impl PassHook for DumpMir {
mir_util::dump_mir(
tcx,
pass_num,
&*pass.name(),
&pass_name,
&Disambiguator { is_after },
source,
&mir
Expand Down

0 comments on commit f23a7bc

Please sign in to comment.