annotate ppc/test/memkill.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
0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
1 proc f(): integer;
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
2 var x, y: integer;
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
3 begin
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
4 x := 3;
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
5 y := x + 1;
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
6 g();
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
7 return x + 1
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
8 end;
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
9
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
10 proc g(); begin end;
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
11
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
12 begin
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
13 print_num(f()); newline()
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
14 end.
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
15
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
16 (*<<
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
17 4
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
18 >>*)
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
19
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
20 (*[[
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
21 MODULE Main 0 0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
22 IMPORT Lib 0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
23 ENDHDR
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
24
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
25 PROC _f 8 0 0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
26 ! x := 3;
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
27 CONST 3
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
28 STLW -4
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
29 ! y := x + 1;
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
30 LDLW -4
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
31 CONST 1
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
32 PLUS
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
33 STLW -8
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
34 ! g();
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
35 CONST 0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
36 GLOBAL _g
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
37 PCALL 0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
38 ! return x + 1
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
39 LDLW -4
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
40 CONST 1
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
41 PLUS
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
42 RETURNW
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
43 END
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
44
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
45 PROC _g 0 0 0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
46 ! proc g(); begin end;
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
47 RETURN
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
48 END
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
49
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
50 PROC MAIN 0 0 0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
51 ! print_num(f()); newline()
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
52 CONST 0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
53 GLOBAL _f
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
54 PCALLW 0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
55 CONST 0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
56 GLOBAL lib.print_num
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
57 PCALL 1
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
58 CONST 0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
59 GLOBAL lib.newline
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
60 PCALL 0
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
61 RETURN
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
62 END
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
63
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
64 ! End
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
65 ]]*)