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