annotate lab4/test/cse.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 (* Basic test of CSE *)
mike@0 2
mike@0 3 proc p(x, y: integer);
mike@0 4 begin
mike@0 5 print_num((x-y)*(x-y)+x); newline()
mike@0 6 end;
mike@0 7
mike@0 8 begin
mike@0 9 p(9, 5)
mike@0 10 end.
mike@0 11
mike@0 12 (*<<
mike@0 13 25
mike@0 14 >>*)
mike@0 15
mike@0 16 (*[[
mike@0 17 @ picoPascal compiler output
mike@0 18 .include "fixup.s"
mike@0 19 .global pmain
mike@0 20
mike@0 21 @ proc p(x, y: integer);
mike@0 22 .text
mike@0 23 _p:
mike@0 24 mov ip, sp
mike@0 25 stmfd sp!, {r0-r1}
mike@0 26 stmfd sp!, {r4-r10, fp, ip, lr}
mike@0 27 mov fp, sp
mike@0 28 @ print_num((x-y)*(x-y)+x); newline()
mike@0 29 ldr r4, [fp, #40]
mike@0 30 ldr r0, [fp, #44]
mike@0 31 sub r5, r4, r0
mike@0 32 mul r0, r5, r5
mike@0 33 add r0, r0, r4
mike@0 34 bl print_num
mike@0 35 bl newline
mike@0 36 ldmfd fp, {r4-r10, fp, sp, pc}
mike@0 37 .ltorg
mike@0 38
mike@0 39 pmain:
mike@0 40 mov ip, sp
mike@0 41 stmfd sp!, {r4-r10, fp, ip, lr}
mike@0 42 mov fp, sp
mike@0 43 @ p(9, 5)
mike@0 44 mov r1, #5
mike@0 45 mov r0, #9
mike@0 46 bl _p
mike@0 47 ldmfd fp, {r4-r10, fp, sp, pc}
mike@0 48 .ltorg
mike@0 49
mike@0 50 @ End
mike@0 51 ]]*)