view ppc/mach.mli @ 4:9f5c8e19f204 tip basis

Oops: fix for lab0
author Mike Spivey <>
date Mon, 15 Oct 2018 21:58:03 +0100
parents 5dd13b8deb54
line wrap: on
line source
(* ppc/mach.mli *)
(* Copyright (c) 2017 J. M. Spivey *)

This module contains a number of constants that define the layout of
data in the target machine.  The |metrics| records |int_rep|, etc.,
define the representation of the primitive types of picoPascal;
|param_rep| defines the representation of procedure parameters, and
|proc_rep| defines the representation of closures.

|addr_size| is the size of an address in the target machine,
|param_size| is the size of a parameter, and |max_align| is the
maximum alignment constraint of any primitive type.  Arrays and
records are always aligned to a multiple of |max_align|, so that all
their elements will be correctly aligned.  |frame_head level| is the
size of the fixed part of a procedure frame for static level

(* |metrics| -- target representation of data object *)
type metrics = 
  { r_size: int;                (* Size of object *)
    r_align: int }              (* Address must be multiple of this *)

val int_rep : metrics           (* Integer type *)
val char_rep : metrics          (* Char type *)
val bool_rep : metrics          (* Boolean type *)
val void_rep : metrics          (* Void type *)
val addr_rep : metrics          (* All addresses *)
val proc_rep : metrics          (* Closures *)
val param_rep : metrics         (* Procedure parameters *)
val max_align : int

val param_base : int            (* +ve offset of first param from fp *)
val local_base : int            (* -ve offset of bottom of frame head *)
val stat_link : int             (* Offset of static link *)