annotate ppc/test/regkill.p @ 0:bfdcc3820b32

Basis
author Mike Spivey <mike@cs.ox.ac.uk>
date Thu, 05 Oct 2017 08:04:15 +0100
parents
children
rev   line source
mike@0 1 var x: integer;
mike@0 2
mike@0 3 proc p();
mike@0 4 var y, z: integer;
mike@0 5 begin
mike@0 6 y := 1;
mike@0 7 z := y + 1;
mike@0 8 z := 3;
mike@0 9 z := y + 1;
mike@0 10 x := z
mike@0 11 end;
mike@0 12
mike@0 13 begin
mike@0 14 p();
mike@0 15 print_num(x);
mike@0 16 newline()
mike@0 17 end.
mike@0 18
mike@0 19 (*<<
mike@0 20 2
mike@0 21 >>*)
mike@0 22
mike@0 23 (*[[
mike@0 24 MODULE Main 0 0
mike@0 25 IMPORT Lib 0
mike@0 26 ENDHDR
mike@0 27
mike@0 28 PROC _p 8 0 0
mike@0 29 ! y := 1;
mike@0 30 CONST 1
mike@0 31 STLW -4
mike@0 32 ! z := y + 1;
mike@0 33 LDLW -4
mike@0 34 CONST 1
mike@0 35 PLUS
mike@0 36 STLW -8
mike@0 37 ! z := 3;
mike@0 38 CONST 3
mike@0 39 STLW -8
mike@0 40 ! z := y + 1;
mike@0 41 LDLW -4
mike@0 42 CONST 1
mike@0 43 PLUS
mike@0 44 STLW -8
mike@0 45 ! x := z
mike@0 46 LDLW -8
mike@0 47 STGW _x
mike@0 48 RETURN
mike@0 49 END
mike@0 50
mike@0 51 PROC MAIN 0 0 0
mike@0 52 ! p();
mike@0 53 CONST 0
mike@0 54 GLOBAL _p
mike@0 55 PCALL 0
mike@0 56 ! print_num(x);
mike@0 57 LDGW _x
mike@0 58 CONST 0
mike@0 59 GLOBAL lib.print_num
mike@0 60 PCALL 1
mike@0 61 ! newline()
mike@0 62 CONST 0
mike@0 63 GLOBAL lib.newline
mike@0 64 PCALL 0
mike@0 65 RETURN
mike@0 66 END
mike@0 67
mike@0 68 GLOVAR _x 4
mike@0 69 ! End
mike@0 70 ]]*)