Module of module types for OrderedType,ComparableType,Printable,Serializable,Discrete...
[ocaml.git] / asmcomp / reg.mli
blob5bb06f5973e3881d660f2a72a48c1ea2d260a658
1 (***********************************************************************)
2 (* *)
3 (* Objective Caml *)
4 (* *)
5 (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
6 (* *)
7 (* Copyright 1996 Institut National de Recherche en Informatique et *)
8 (* en Automatique. All rights reserved. This file is distributed *)
9 (* under the terms of the Q Public License version 1.0. *)
10 (* *)
11 (***********************************************************************)
13 (* $Id$ *)
15 (* Pseudo-registers *)
17 type t =
18 { mutable name: string; (* Name (for printing) *)
19 stamp: int; (* Unique stamp *)
20 typ: Cmm.machtype_component; (* Type of contents *)
21 mutable loc: location; (* Actual location *)
22 mutable spill: bool; (* "true" to force stack allocation *)
23 mutable interf: t list; (* Other regs live simultaneously *)
24 mutable prefer: (t * int) list; (* Preferences for other regs *)
25 mutable degree: int; (* Number of other regs live sim. *)
26 mutable spill_cost: int; (* Estimate of spilling cost *)
27 mutable visited: bool } (* For graph walks *)
29 and location =
30 Unknown
31 | Reg of int
32 | Stack of stack_location
34 and stack_location =
35 Local of int
36 | Incoming of int
37 | Outgoing of int
39 val dummy: t
40 val create: Cmm.machtype_component -> t
41 val createv: Cmm.machtype -> t array
42 val clone: t -> t
43 val at_location: Cmm.machtype_component -> location -> t
45 module Set: Set.S with type elt = t
46 module Map: Map.S with type key = t
48 val add_set_array: Set.t -> t array -> Set.t
49 val diff_set_array: Set.t -> t array -> Set.t
50 val inter_set_array: Set.t -> t array -> Set.t
51 val set_of_array: t array -> Set.t
53 val reset: unit -> unit
54 val all_registers: unit -> t list
55 val num_registers: unit -> int
56 val reinit: unit -> unit