ult); if result then write(out_file,a.op2,result); end if; -- float operand when LTR => write(out_file,a.real_const,result); -- string operand when LTS | LEL | ELB | DEP => put_string; -- special when LCE => write(out_file,a.op1,result); put_string; when a_code'val(251) => for i in 1..a.str_length loop write(out_file,a.str_const(i),result); put(a.str_const(i)); end loop; new_line; when others => null; -- no code for 0 operand codes end case; if not result then raise disk_error; end if; end output; pragma recursion(on); procedure optimize is begin loop if t.code = LGA or else t.code = LIT or else t.code = LAD or else t.code = DDW or else t.code = LLA then if z.code = t.code and then t.op1 = z.op1 and then t.op2 = z.op2 then -- reduce (load load) to (load DUP) z.code := DUP; num_opts := num_opts + 1; elsif y.code = SWP then if z.code = LGA or else z.code = LIT or else z.code = DUP then -- reduce (load load SWP) to (load load) if z.code /= DUP then -- only swap if z is not duplicating t already, then just throw swap away declare temp : intermediate_code; begin temp := t; t := z; -- swap z and t z := temp; end; end if; y := x; -- throw away SWP code x := get_code; num_opts := num_opts + 1; else -- no optimizations possible exit; end if; elsif z.code = INW and then x.code = INW and then t.code = y.code and then t.op1 = y.op1 -- if LGW, make sure second operand matches as well... and then (t.code /= LGA or else t.op2 = y.op2) then -- reduce (load/INW/load/INW) to (load/INW DUP) y.code := DUP; x := get_code; num_opts := num_opts + 1; elsif t.code = LIT then if z.code = LIT then case y.code