annotate ppc/mach.ml @ 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 (* ppc/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 ...
mike@0 23 +16 arg 1
mike@0 24 +12 static link }
mike@0 25 context pointer }
mike@0 26 return address }
mike@0 27 bp: dynamic link }
mike@0 28 local 1
mike@0 29 ...
mike@0 30 local m
mike@0 31 *)
mike@0 32
mike@0 33 let param_base = 16
mike@0 34 let local_base = 0
mike@0 35 let stat_link = 12