
Basic Blocks, Flow Graphs and Loops
The leader rules and the partition of three-address code into basic blocks, flow-graph edges for fall-through and jumps, dominators, back edges and natural loops, worked on a ten-line loop that is drawn as a flow graph. Two solved past questions count blocks and the largest block, and the traps about jump lines versus jump targets. Every leader, edge and loop comes from a script.
![Flow graph of six basic blocks: B1 i = 1, s = 0; B2 if i greater than n goto B6; B3 t1 = 4 * i, t2 = a[t1], if t2 less than 0 goto B5; B4 s = s + t2; B5 i = i + 1, goto B2; B6 return s. Edges B1-B2, B2-B3, B2-B6, B3-B4, B3-B5, B4-B5 and the back edge B5-B2.](https://bywjbbkinjqiyalvzqfd.supabase.co/storage/v1/object/public/sheet-media/CD/CD-17/diagrams/CD-17.d01.webp)

