synth-cfg 0.11.15

Control flow graph representation for the Synth compiler
Documentation

Control Flow Graph (CFG) for WebAssembly Functions

This crate provides CFG construction and analysis for WebAssembly functions, enabling proper branch target resolution and optimization.

Key Concepts

  • Basic Block: A maximal sequence of instructions with single entry and exit
  • CFG Edge: Control flow from one basic block to another
  • Dominance: Block A dominates B if all paths to B go through A
  • Loop: A strongly connected component in the CFG

Usage

use synth_cfg::{CfgBuilder, BasicBlock};

let mut builder = CfgBuilder::new();
builder.add_instruction(/* ... */);
let cfg = builder.build();