[prev] 34 [next]

Mapping Control Structures

Use templates, e.g.

while (Cond) { Stat1; Stat2; ... }

loop:
   MIPS code to check Cond; result in $t0
   beqz $t0, end_loop
   MIPS code for Stat1
   MIPS code for Stat2
   MIPS code for ...
   j    loop
end_loop: