comparison lab4/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 (* Aliasing in CSE *)
2
3 var x: integer;
4
5 proc p();
6 var y, z: integer;
7 begin
8 y := 1;
9 z := y + 1;
10 z := 3;
11 z := y + 1;
12 x := z
13 end;
14
15 begin
16 p();
17 print_num(x);
18 newline()
19 end.
20
21 (*<<
22 2
23 >>*)
24
25 (*[[
26 @ picoPascal compiler output
27 .include "fixup.s"
28 .global pmain
29
30 @ proc p();
31 .text
32 _p:
33 mov ip, sp
34 stmfd sp!, {r4-r10, fp, ip, lr}
35 mov fp, sp
36 @ y := 1;
37 mov r4, #1
38 @ z := y + 1;
39 add r5, r4, #1
40 @ z := 3;
41 mov r5, #3
42 @ z := y + 1;
43 add r5, r4, #1
44 @ x := z
45 set r0, _x
46 str r5, [r0]
47 ldmfd fp, {r4-r10, fp, sp, pc}
48 .ltorg
49
50 pmain:
51 mov ip, sp
52 stmfd sp!, {r4-r10, fp, ip, lr}
53 mov fp, sp
54 @ p();
55 bl _p
56 @ print_num(x);
57 set r0, _x
58 ldr r0, [r0]
59 bl print_num
60 @ newline()
61 bl newline
62 ldmfd fp, {r4-r10, fp, sp, pc}
63 .ltorg
64
65 .comm _x, 4, 4
66 @ End
67 ]]*)