comparison lab4/mach.mli @ 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 (* lab4/mach.mli *)
2 (* Copyright (c) 2017 J. M. Spivey *)
3
4 (*
5 This module contains a number of constants that define the layout of
6 data in the target machine. The |metrics| records |int_rep|, etc.,
7 define the representation of the primitive types of picoPascal;
8 |param_rep| defines the representation of procedure parameters, and
9 |proc_rep| defines the representation of closures.
10
11 |addr_size| is the size of an address in the target machine,
12 |param_size| is the size of a parameter, and |max_align| is the
13 maximum alignment constraint of any primitive type. Arrays and
14 records are always aligned to a multiple of |max_align|, so that all
15 their elements will be correctly aligned. |frame_head level| is the
16 size of the fixed part of a procedure frame for static level
17 |level|.
18 *)
19
20 (* |metrics| -- target representation of data object *)
21 type metrics =
22 { r_size: int; (* Size of object *)
23 r_align: int } (* Address must be multiple of this *)
24
25 val int_rep : metrics (* Integer type *)
26 val char_rep : metrics (* Char type *)
27 val bool_rep : metrics (* Boolean type *)
28 val void_rep : metrics (* Void type *)
29 val addr_rep : metrics (* All addresses *)
30 val proc_rep : metrics (* Closures *)
31 val param_rep : metrics (* Procedure parameters *)
32 val max_align : int
33
34 val param_base : int (* +ve offset of first param from fp *)
35 val local_base : int (* -ve offset of bottom of frame head *)
36 val stat_link : int (* Offset of static link *)
37 val nregvars : int (* Number of register variables *)
38 val share_globals : bool (* Whether to use CSE on <GLOBAL x> *)
39
40 val comment : string (* Comment prefix for assembler *)