Basic Blocks
Useful for collecting information for optimization
Basic Block : Sequence of consecutive statements where flow of control enters at the beginning and leaves at the end. No branching permitted at an intermediate statement.
Partition Into Basic Blocks
Input : A sequence of three address statements
Output : A list of basic blocks
- Mark leaders
- First statement is a leader
- Any statement which is target of a goto is a leader
- Any statement that follows a goto statement is leader
- For each leader all the statement following it up to the next leader or the end of the program make a basic block.
|