comparison lab4/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
comparison
equal deleted inserted replaced
-1:000000000000 0:bfdcc3820b32
1 (* All loads are killed by a procedure call *)
2
3 proc f(): integer;
4 var x, y: integer;
5 begin
6 x := 3;
7 y := x + 1;
8 g();
9 return x + 1
10 end;
11
12 proc g(); begin end;
13
14 begin
15 print_num(f()); newline()
16 end.
17
18 (*<<
19 4
20 >>*)
21
22 (*[[
23 @ picoPascal compiler output
24 .include "fixup.s"
25 .global pmain
26
27 @ proc f(): integer;
28 .text
29 _f:
30 mov ip, sp
31 stmfd sp!, {r4-r10, fp, ip, lr}
32 mov fp, sp
33 @ x := 3;
34 mov r4, #3
35 @ y := x + 1;
36 add r5, r4, #1
37 @ g();
38 bl _g
39 @ return x + 1
40 add r0, r4, #1
41 ldmfd fp, {r4-r10, fp, sp, pc}
42 .ltorg
43
44 @ proc g(); begin end;
45 _g:
46 mov ip, sp
47 stmfd sp!, {r4-r10, fp, ip, lr}
48 mov fp, sp
49 ldmfd fp, {r4-r10, fp, sp, pc}
50 .ltorg
51
52 pmain:
53 mov ip, sp
54 stmfd sp!, {r4-r10, fp, ip, lr}
55 mov fp, sp
56 @ print_num(f()); newline()
57 bl _f
58 bl print_num
59 bl newline
60 ldmfd fp, {r4-r10, fp, sp, pc}
61 .ltorg
62
63 @ End
64 ]]*)