Java Reference
In-Depth Information
while
P
if
Q
R
if
(a)
(b)
Figure 14.8: (a) Structured control flow graph; (b) Canonical
irreducible graph.
Having shown how to construct basic blocks, and having stated reasons
for avoiding their construction, we assume from this point forward that a flow
graph node corresponds to a single statement of the input language.
14.2.2 Program and Control Flow Structure
We next describe language constructs that always result in control flow graphs
with certain desirable properties. A more general treatment of this subject is
possible after interval analysis (Section 14.2.9) has been discussed.
If a procedure's loops are written using while-do and repeat-until con-
structs, then entry to any loop in a procedure occurs through exactly one node
called the header node . Control flow graphs with this property are called
reducible , and such graphs are amenable to the exhaustive and incremen-
tal interval!analysis techniques described by Burke [Bur90]. The canonical
example of an irreducible flow graph is shown in Figure 14.8(b).
If branching within a procedure is specified using only if-then-else,
while-do,andrepeat-until constructs, then the resulting control flow graphs
are structured . An example is shown in Figure 14.8(a). Structured programs
are generally associated with clear programming style, because the control
flowwithin such programs is readily apparent by inspection. Not surprisingly,
analysis and optimization for structured control flow graphs can be simpler
than for nonstructured graphs.
 
 
Search WWH ::




Custom Search