Contents    Page-10    Prev    Next    Page+10    Index   

Finding Basic Blocks

Basic blocks are easily found by a compiler while processing a program.

A leader is the first statement of a basic block:

  1. the first statement of a program

  2. any statement that has a label or is the target of a branch

  3. any statement following a branch

A basic block is a leader and successive statements up to the next leader.

Note that branch statements themselves do not appear in basic blocks, although the computation of the condition part of a conditional branch will be included.

In a graph representation of a program, basic blocks are the nodes of the graph, and branches are the arcs between nodes.