//! Hook into libgraphviz for rendering dataflow graphs for MIR.
use rustc::hir::def_id::DefId;
-use rustc::mir::{BasicBlock, Mir};
+use rustc::mir::{BasicBlock, Body};
use std::fs;
use std::io;
pub trait MirWithFlowState<'tcx> {
type BD: BitDenotation<'tcx>;
fn def_id(&self) -> DefId;
- fn mir(&self) -> &Mir<'tcx>;
+ fn mir(&self) -> &Body<'tcx>;
fn flow_state(&self) -> &DataflowState<'tcx, Self::BD>;
}
{
type BD = BD;
fn def_id(&self) -> DefId { self.def_id }
- fn mir(&self) -> &Mir<'tcx> { self.flow_state.mir() }
+ fn mir(&self) -> &Body<'tcx> { self.flow_state.mir() }
fn flow_state(&self) -> &DataflowState<'tcx, Self::BD> { &self.flow_state.flow_state }
}
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub struct Edge { source: BasicBlock, index: usize }
-fn outgoing(mir: &Mir<'_>, bb: BasicBlock) -> Vec<Edge> {
+fn outgoing(mir: &Body<'_>, bb: BasicBlock) -> Vec<Edge> {
(0..mir[bb].terminator().successors().count())
.map(|index| Edge { source: bb, index: index}).collect()
}
n: &Node,
w: &mut W,
block: BasicBlock,
- mir: &Mir<'_>) -> io::Result<()> {
+ mir: &Body<'_>) -> io::Result<()> {
// Header rows
const HDRS: [&str; 4] = ["ENTRY", "MIR", "BLOCK GENS", "BLOCK KILLS"];
const HDR_FMT: &str = "bgcolor=\"grey\"";
n: &Node,
w: &mut W,
block: BasicBlock,
- mir: &Mir<'_>)
+ mir: &Body<'_>)
-> io::Result<()> {
let i = n.index();
n: &Node,
w: &mut W,
block: BasicBlock,
- mir: &Mir<'_>)
+ mir: &Body<'_>)
-> io::Result<()> {
let i = n.index();