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