annotate lab4/test/biglocal.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 (* Large local array and large array parameter *)
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
2
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
3 proc foo(var a: array 10000 of integer);
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
4 var c: array 10000 of integer; x: integer;
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
5 begin
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
6 x := 5000;
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
7 c[5000] := 4;
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
8 a[5000] := c[x]+3
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
9 end;
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
10
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
11 var b: array 10000 of integer;
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
12 begin foo(b) end.
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
13
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
14 (*[[
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
15 @ picoPascal compiler output
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
16 .include "fixup.s"
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
17 .global pmain
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
18
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
19 @ proc foo(var a: array 10000 of integer);
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
20 .text
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
21 _foo:
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
22 mov ip, sp
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
23 stmfd sp!, {r0-r1}
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
24 stmfd sp!, {r4-r10, fp, ip, lr}
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
25 mov fp, sp
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
26 set ip, #40000
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
27 sub sp, sp, ip
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
28 @ x := 5000;
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
29 set r4, #5000
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
30 @ c[5000] := 4;
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
31 mov r0, #4
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
32 set ip, #-20000
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
33 add r1, fp, ip
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
34 str r0, [r1]
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
35 @ a[5000] := c[x]+3
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
36 set ip, #-40000
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
37 add r0, fp, ip
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
38 lsl r1, r4, #2
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
39 add r0, r0, r1
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
40 ldr r0, [r0]
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
41 add r0, r0, #3
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
42 ldr r1, [fp, #40]
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
43 set r2, #20000
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
44 add r1, r1, r2
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
45 str r0, [r1]
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
46 ldmfd fp, {r4-r10, fp, sp, pc}
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
47 .ltorg
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
48
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
49 pmain:
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
50 mov ip, sp
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
51 stmfd sp!, {r4-r10, fp, ip, lr}
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
52 mov fp, sp
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
53 @ begin foo(b) end.
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
54 set r0, _b
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
55 bl _foo
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
56 ldmfd fp, {r4-r10, fp, sp, pc}
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
57 .ltorg
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
58
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
59 .comm _b, 40000, 4
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
60 @ End
Mike Spivey <mike@cs.ox.ac.uk>
parents:
diff changeset
61 ]]*)