view 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
line wrap: on
line source
(* Local array *)

proc P();
  var i: integer; x: integer; a: array 10 of integer;
begin
  i := 0;
  x := a[i]
end;

begin
  P()
end.

(*[[
@ picoPascal compiler output
	.include "fixup.s"
	.global pmain

@ proc P();
	.text
_P:
	mov ip, sp
	stmfd sp!, {r4-r10, fp, ip, lr}
	mov fp, sp
	sub sp, sp, #40
@   i := 0;
	mov r4, #0
@   x := a[i]
	add r0, fp, #-40
	lsl r1, r4, #2
	add r0, r0, r1
	ldr r5, [r0]
	ldmfd fp, {r4-r10, fp, sp, pc}
	.ltorg

pmain:
	mov ip, sp
	stmfd sp!, {r4-r10, fp, ip, lr}
	mov fp, sp
@   P()
	bl _P
	ldmfd fp, {r4-r10, fp, sp, pc}
	.ltorg

@ End
]]*)