fn write_basic_block(tcx: TyCtxt,
                     block: BasicBlock,
                     mir: &Mir,
                     w: &mut Write,
                     annotations: &FnvHashMap<Location, Vec<Annotation>>)
                     -> io::Result<()> {
    let data = &mir[block];

    // Basic block label at the top.
    writeln!(w, "{}{:?}: {{", INDENT, block)?;

    // List of statements in the middle.
    let mut current_location = Location { block: block, statement_index: 0 };
    for statement in &data.statements {
        if let Some(ref annotations) = annotations.get(&current_location) {
            for annotation in annotations.iter() {
                match *annotation {
                    Annotation::EnterScope(id) =>
                        writeln!(w, "{0}{0}// Enter Scope({1})",
                                 INDENT, id.index())?,
                    Annotation::ExitScope(id) =>
                        writeln!(w, "{0}{0}// Exit Scope({1})",
                                 INDENT, id.index())?,
                }
            }
        }

        let indented_mir = format!("{0}{0}{1:?};", INDENT, statement);
        writeln!(w, "{0:1$} // {2}",
                 indented_mir,
                 ALIGN,
                 comment(tcx, statement.source_info))?;

        current_location.statement_index += 1;
    }

    // Terminator at the bottom.
    let indented_terminator = format!("{0}{0}{1:?};", INDENT, data.terminator().kind);
    writeln!(w, "{0:1$} // {2}",
             indented_terminator,
             ALIGN,
             comment(tcx, data.terminator().source_info))?;

    writeln!(w, "{}}}", INDENT)
}
/// Write out a human-readable textual representation for the given basic block.
Write out a human-readable textual representation for the given basic block.
Write out a human - readable textual representation for the given basic block .
fn write_basic_block(tcx: TyCtxt,
                     block: BasicBlock,
                     mir: &Mir,
                     w: &mut Write,
                     annotations: &FnvHashMap<Location, Vec<Annotation>>)
                     -> io::Result<()> {
    let data = &mir[block];
    // Basic block label at the top.
    writeln!(w, "{}{:?}: {{", INDENT, block)?;
    // List of statements in the middle.
    let mut current_location = Location { block: block, statement_index: 0 };
    for statement in &data.statements {
        if let Some(ref annotations) = annotations.get(&current_location) {
            for annotation in annotations.iter() {
                match *annotation {
                    Annotation::EnterScope(id) =>
                        writeln!(w, "{0}{0}// Enter Scope({1})",
                                 INDENT, id.index())?,
                    Annotation::ExitScope(id) =>
                        writeln!(w, "{0}{0}// Exit Scope({1})",
                                 INDENT, id.index())?,
                }
            }
        }
        let indented_mir = format!("{0}{0}{1:?};", INDENT, statement);
        writeln!(w, "{0:1$} // {2}",
                 indented_mir,
                 ALIGN,
                 comment(tcx, statement.source_info))?;
        current_location.statement_index += 1;
    }
    // Terminator at the bottom.
    let indented_terminator = format!("{0}{0}{1:?};", INDENT, data.terminator().kind);
    writeln!(w, "{0:1$} // {2}",
             indented_terminator,
             ALIGN,
             comment(tcx, data.terminator().source_info))?;
    writeln!(w, "{}}}", INDENT)
}
fn write_basic_block ( tcx : TyCtxt , block : BasicBlock , mir : & Mir , w : & mut Write , annotations : & FnvHashMap < Location , Vec < Annotation > > ) -> io :: Result < ( ) > { let data = & mir [ block ] ; // Basic block label at the top. writeln ! ( w " " INDENT block ) ? ; // List of statements in the middle. let mut current_location = Location { block : block , statement_index : 0 } ; for statement in & data . statements { if let Some ( ref annotations ) = annotations . get ( & current_location ) { for annotation in annotations . iter ( ) { match * annotation { Annotation :: EnterScope ( id ) => writeln ! ( w " " INDENT id index ( ) ) ? , Annotation :: ExitScope ( id ) => writeln ! ( w " " INDENT id index ( ) ) ? , } } } let indented_mir = format ! ( " " INDENT statement ) ; writeln ! ( w " " indented_mir ALIGN comment ( tcx statement source_info ) ) ? ; current_location . statement_index += 1 ; } // Terminator at the bottom. let indented_terminator = format ! ( " " INDENT data terminator ( ) kind ) ; writeln ! ( w " " indented_terminator ALIGN comment ( tcx data terminator ( ) source_info ) ) ? ; writeln ! ( w " " INDENT ) }
Write out a human-readable textual representation for the given basic block.
Write out a human - readable textual representation for the given basic block .
tcx
TyCtxt
block
BasicBlock
mir
&Mir
w
&mut Write
annotations
&FnvHashMap<Location, Vec<Annotation>>
tcx
TyCtxt
block
BasicBlock
mir
&Mir
w
&mut Write
annotations
&FnvHashMap<Location, Vec<Annotation>>