Check out my first novel, midnight's simulacra!

Compiler Design

From dankwiki
Revision as of 09:48, 9 March 2009 by Dank (talk | contribs) (Created page with '==Control Flow== * A control flow graph is a multigraph G defined by vertices corresponding to basic blocks, and edges corresponding to transitions between those basic blocks. **...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Control Flow

  • A control flow graph is a multigraph G defined by vertices corresponding to basic blocks, and edges corresponding to transitions between those basic blocks.
    • Basic block: Largest sequence of instructions that can only be entered via the first (leader) instruction, and only exited by the last instruction. The first instruction of the program is a leader, as is every target of a branch, and every instruction following a branch (including conditional branches and procedure returns) is a leader. An edge exists from block a to block b if and only if:
      • either b immediately follows a, and a does not end in an unconditional branch,
      • or a ends in a branch, and b is a target (note that an indirect branch might completely fragment the CFG!).