comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:bfdcc3820b32
1 var x: integer;
2
3 proc p();
4 var y, z: integer;
5 begin
6 y := 1;
7 z := y + 1;
8 z := 3;
9 z := y + 1;
10 x := z
11 end;
12
13 begin
14 p();
15 print_num(x);
16 newline()
17 end.
18
19 (*<<
20 2
21 >>*)
22
23 (*[[
24 MODULE Main 0 0
25 IMPORT Lib 0
26 ENDHDR
27
28 PROC _p 8 0 0
29 ! y := 1;
30 CONST 1
31 STLW -4
32 ! z := y + 1;
33 LDLW -4
34 CONST 1
35 PLUS
36 STLW -8
37 ! z := 3;
38 CONST 3
39 STLW -8
40 ! z := y + 1;
41 LDLW -4
42 CONST 1
43 PLUS
44 STLW -8
45 ! x := z
46 LDLW -8
47 STGW _x
48 RETURN
49 END
50
51 PROC MAIN 0 0 0
52 ! p();
53 CONST 0
54 GLOBAL _p
55 PCALL 0
56 ! print_num(x);
57 LDGW _x
58 CONST 0
59 GLOBAL lib.print_num
60 PCALL 1
61 ! newline()
62 CONST 0
63 GLOBAL lib.newline
64 PCALL 0
65 RETURN
66 END
67
68 GLOVAR _x 4
69 ! End
70 ]]*)