Struct disassemble::ControlFlowGraph [] [src]

pub struct ControlFlowGraph<'f> {
    pub graph: Graph<BasicBlock<'f>, BasicBlockEdge>,
    pub entry_block: Option<NodeIndex>,
    pub block_finder: BTreeMap<Address, NodeIndex>,
}

A control flow graph.

Fields

graph

The Graph that stores the actual ControlFlowGraph

entry_block

The NodeIndex for the entry BasicBlock for this function.

block_finder

Map an address to the corresponding basic block.

Methods

impl<'f> ControlFlowGraph<'f>

fn new(instructions: &'f [Box<Instruction>]) -> Self

Build the ControlFlowGraph from the instructions.

This is conducted in a 2 step process:

  • First, each instruction is examined to identify block boundaries.
  • Then, we go through each instruction again, looking for the previously identified block boundaries and build the edges.

This two step process prevents us from having to construct and then subsequently split blocks as we find backward edges.