track MIR through the dep-graph

Per the discussion on #34765, we make one `DepNode::Mir` variant and use
it to represent both the MIR tracking map as well as passes that operate
on MIR. We also track loads of cached MIR (which naturally comes from
metadata).

Note that the "HAIR" pass adds a read of TypeckItemBody because it uses
a myriad of tables that are not individually tracked.
This commit is contained in:
Niko Matsakis 2016-08-08 18:42:06 -04:00
parent 88b2e9a66d
commit 8fdc72f830
14 changed files with 127 additions and 56 deletions

View file

@ -956,20 +956,24 @@ fn print_with_analysis<'tcx, 'a: 'tcx>(sess: &'a Session,
PpmMir | PpmMirCFG => {
if let Some(mir_map) = mir_map {
if let Some(nodeid) = nodeid {
let mir = mir_map.map.get(&nodeid).unwrap_or_else(|| {
sess.fatal(&format!("no MIR map entry for node {}", nodeid))
});
let def_id = tcx.map.local_def_id(nodeid);
match ppm {
PpmMir => write_mir_pretty(tcx, iter::once((&nodeid, mir)), &mut out),
PpmMir => write_mir_pretty(tcx, iter::once(def_id), &mir_map, &mut out),
PpmMirCFG => {
write_mir_graphviz(tcx, iter::once((&nodeid, mir)), &mut out)
write_mir_graphviz(tcx, iter::once(def_id), &mir_map, &mut out)
}
_ => unreachable!(),
}?;
} else {
match ppm {
PpmMir => write_mir_pretty(tcx, mir_map.map.iter(), &mut out),
PpmMirCFG => write_mir_graphviz(tcx, mir_map.map.iter(), &mut out),
PpmMir => write_mir_pretty(tcx,
mir_map.map.keys().into_iter(),
&mir_map,
&mut out),
PpmMirCFG => write_mir_graphviz(tcx,
mir_map.map.keys().into_iter(),
&mir_map,
&mut out),
_ => unreachable!(),
}?;
}