annotate lab4/test/locarray.p @ 1:b5139af1a420 tip basis

Fixed permissions on compile scripts
author Mike Spivey <mike@cs.ox.ac.uk>
date Fri, 13 Oct 2017 17:27:58 +0100
parents bfdcc3820b32
children
rev   line source
mike@0 1 (* Local array *)
mike@0 2
mike@0 3 proc P();
mike@0 4 var i: integer; x: integer; a: array 10 of integer;
mike@0 5 begin
mike@0 6 i := 0;
mike@0 7 x := a[i]
mike@0 8 end;
mike@0 9
mike@0 10 begin
mike@0 11 P()
mike@0 12 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 P();
mike@0 20 .text
mike@0 21 _P:
mike@0 22 mov ip, sp
mike@0 23 stmfd sp!, {r4-r10, fp, ip, lr}
mike@0 24 mov fp, sp
mike@0 25 sub sp, sp, #40
mike@0 26 @ i := 0;
mike@0 27 mov r4, #0
mike@0 28 @ x := a[i]
mike@0 29 add r0, fp, #-40
mike@0 30 lsl r1, r4, #2
mike@0 31 add r0, r0, r1
mike@0 32 ldr r5, [r0]
mike@0 33 ldmfd fp, {r4-r10, fp, sp, pc}
mike@0 34 .ltorg
mike@0 35
mike@0 36 pmain:
mike@0 37 mov ip, sp
mike@0 38 stmfd sp!, {r4-r10, fp, ip, lr}
mike@0 39 mov fp, sp
mike@0 40 @ P()
mike@0 41 bl _P
mike@0 42 ldmfd fp, {r4-r10, fp, sp, pc}
mike@0 43 .ltorg
mike@0 44
mike@0 45 @ End
mike@0 46 ]]*)