Check out my first novel, midnight's simulacra!
Compiler Design: Difference between revisions
From dankwiki
mNo edit summary |
|||
Line 1: | Line 1: | ||
==Control Flow Analysis== | ==Control Flow Analysis== | ||
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. A basic block is the | Subsequent instructions with no branches make up segments of ''linear code''. 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. A basic block is the maximum segment of linear code associated with each leader -- it ends with either the program's last instruction or the first branch following a leader. A basic block a ''flows'' to b if and only if: | ||
* either b immediately follows a, and a does not end in an unconditional branch, | * either b immediately follows a, and a does not end in an unconditional branch, | ||
* or a ends in a branch, of which b is a potential target. | * or a ends in a branch, of which b is a potential target. |