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