pub trait ControlFlowGraph {
// Required methods
fn block_start(&self, block_id: BlockId) -> CodeOffset;
fn block_end(&self, block_id: BlockId) -> CodeOffset;
fn successors(&self, block_id: BlockId) -> &Vec<BlockId> ⓘ;
fn instr_indexes(
&self,
block_id: BlockId
) -> Box<dyn Iterator<Item = CodeOffset>>;
fn blocks(&self) -> Vec<BlockId> ⓘ;
fn num_blocks(&self) -> u16;
fn entry_block_id(&self) -> BlockId;
}
Expand description
A trait that specifies the basic requirements for a CFG
Required Methods§
sourcefn block_start(&self, block_id: BlockId) -> CodeOffset
fn block_start(&self, block_id: BlockId) -> CodeOffset
Start index of the block ID in the bytecode vector
sourcefn block_end(&self, block_id: BlockId) -> CodeOffset
fn block_end(&self, block_id: BlockId) -> CodeOffset
End index of the block ID in the bytecode vector
sourcefn successors(&self, block_id: BlockId) -> &Vec<BlockId> ⓘ
fn successors(&self, block_id: BlockId) -> &Vec<BlockId> ⓘ
Successors of the block ID in the bytecode vector
sourcefn instr_indexes(
&self,
block_id: BlockId
) -> Box<dyn Iterator<Item = CodeOffset>>
fn instr_indexes( &self, block_id: BlockId ) -> Box<dyn Iterator<Item = CodeOffset>>
Iterator over the indexes of instructions in this block
sourcefn num_blocks(&self) -> u16
fn num_blocks(&self) -> u16
Return the number of blocks (vertices) in the control flow graph
sourcefn entry_block_id(&self) -> BlockId
fn entry_block_id(&self) -> BlockId
Return the id of the entry block for this control-flow graph Note: even a CFG with no instructions has an (empty) entry block.