class SyntaxTree::YARV::ControlFlowGraph::Compiler
def find_basic_block_starts
* fallen through to from a branch
* the target of a branch
* the start of an instruction sequence
they're either:
Finds the indices of the instructions that start a basic block because
def find_basic_block_starts block_starts = Set.new([0]) insns.each do |index, insn| branch_targets = insn.branch_targets if branch_targets.any? branch_targets.each do |branch_target| block_starts.add(labels[branch_target]) end block_starts.add(index + insn.length) if insn.falls_through? end end block_starts.to_a.sort end