annotate lab4/mach.ml @ 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 (* lab4/mach.ml *)
mike@0 2 (* Copyright (c) 2017 J. M. Spivey *)
mike@0 3
mike@0 4 (* |metrics| -- target representation of data object *)
mike@0 5 type metrics =
mike@0 6 { r_size: int; (* Size of object *)
mike@0 7 r_align: int } (* Address must be multiple of this *)
mike@0 8
mike@0 9 let int_rep = { r_size = 4; r_align = 4 }
mike@0 10 let char_rep = { r_size = 1; r_align = 1 }
mike@0 11 let bool_rep = { r_size = 1; r_align = 1 }
mike@0 12 let void_rep = { r_size = 0; r_align = 1 }
mike@0 13 let addr_rep = { r_size = 4; r_align = 4 }
mike@0 14 let proc_rep = { r_size = 8; r_align = 4 }
mike@0 15 let param_rep = { r_size = 4; r_align = 4 }
mike@0 16 let max_align = 4
mike@0 17
mike@0 18 (*
mike@0 19 Frame layout:
mike@0 20
mike@0 21 arg n \
mike@0 22 ... > Stored by caller
mike@0 23 arg 4 /
mike@0 24 arg 3 \
mike@0 25 > Saved by prolog
mike@0 26 +40 arg 0 /
mike@0 27 ----------------
mike@0 28 +36 return address
mike@0 29 +32 saved sp
mike@0 30 +28 dynamic link
mike@0 31 +24 static link
mike@0 32 +20 saved r9
mike@0 33 ...
mike@0 34 +4 saved r5
mike@0 35 fp: saved r4
mike@0 36 ----------------
mike@0 37 -4 local 1
mike@0 38 ...
mike@0 39 local m
mike@0 40 ----------------
mike@0 41 outgoing arg a
mike@0 42 ...
mike@0 43 +4 outgoing arg 5
mike@0 44 sp: outgoing arg 4
mike@0 45 *)
mike@0 46
mike@0 47 let param_base = 40
mike@0 48 let local_base = 0
mike@0 49 let stat_link = 24
mike@0 50 let nregvars = 3
mike@0 51 let share_globals = true
mike@0 52
mike@0 53 let comment = "@ "