comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:bfdcc3820b32
1 (* ppc/mach.ml *)
2 (* Copyright (c) 2017 J. M. Spivey *)
3
4 (* |metrics| -- target representation of data object *)
5 type metrics =
6 { r_size: int; (* Size of object *)
7 r_align: int } (* Address must be multiple of this *)
8
9 let int_rep = { r_size = 4; r_align = 4 }
10 let char_rep = { r_size = 1; r_align = 1 }
11 let bool_rep = { r_size = 1; r_align = 1 }
12 let void_rep = { r_size = 0; r_align = 1 }
13 let addr_rep = { r_size = 4; r_align = 4 }
14 let proc_rep = { r_size = 8; r_align = 4 }
15 let param_rep = { r_size = 4; r_align = 4 }
16 let max_align = 4
17
18 (*
19 Frame layout:
20
21 arg n
22 ...
23 +16 arg 1
24 +12 static link }
25 context pointer }
26 return address }
27 bp: dynamic link }
28 local 1
29 ...
30 local m
31 *)
32
33 let param_base = 16
34 let local_base = 0
35 let stat_link = 12