1995-08-09 08:06:35 -07:00
|
|
|
(***********************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* Caml Special Light *)
|
|
|
|
(* *)
|
|
|
|
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
|
|
|
|
(* *)
|
|
|
|
(* Copyright 1995 Institut National de Recherche en Informatique et *)
|
|
|
|
(* Automatique. Distributed only by permission. *)
|
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
|
|
|
(* $Id$ *)
|
|
|
|
|
1995-06-15 01:17:29 -07:00
|
|
|
(* Representation of machine code by sequences of pseudoinstructions *)
|
|
|
|
|
|
|
|
type integer_comparison =
|
|
|
|
Isigned of Cmm.comparison
|
|
|
|
| Iunsigned of Cmm.comparison
|
|
|
|
|
|
|
|
type integer_operation =
|
|
|
|
Iadd | Isub | Imul | Idiv | Imod
|
|
|
|
| Iand | Ior | Ixor | Ilsl | Ilsr | Iasr
|
|
|
|
| Icomp of integer_comparison
|
1995-07-10 02:48:27 -07:00
|
|
|
| Icheckbound
|
1995-06-15 01:17:29 -07:00
|
|
|
|
|
|
|
type test =
|
1995-06-15 09:08:53 -07:00
|
|
|
Itruetest
|
1995-06-15 01:17:29 -07:00
|
|
|
| Ifalsetest
|
|
|
|
| Iinttest of integer_comparison
|
|
|
|
| Iinttest_imm of integer_comparison * int
|
|
|
|
| Ifloattest of Cmm.comparison
|
1995-07-17 09:10:15 -07:00
|
|
|
| Ioddtest
|
|
|
|
| Ieventest
|
1995-06-15 01:17:29 -07:00
|
|
|
|
|
|
|
type operation =
|
|
|
|
Imove
|
|
|
|
| Ispill
|
|
|
|
| Ireload
|
1995-07-02 09:41:48 -07:00
|
|
|
| Iconst_int of int
|
|
|
|
| Iconst_float of string
|
|
|
|
| Iconst_symbol of string
|
1995-06-15 01:17:29 -07:00
|
|
|
| Icall_ind
|
|
|
|
| Icall_imm of string
|
|
|
|
| Itailcall_ind
|
|
|
|
| Itailcall_imm of string
|
1995-07-10 02:48:27 -07:00
|
|
|
| Iextcall of string * bool
|
1995-06-15 01:17:29 -07:00
|
|
|
| Istackoffset of int
|
|
|
|
| Iload of Cmm.memory_chunk * Arch.addressing_mode
|
|
|
|
| Istore of Cmm.memory_chunk * Arch.addressing_mode
|
|
|
|
| Ialloc of int
|
|
|
|
| Iintop of integer_operation
|
|
|
|
| Iintop_imm of integer_operation * int
|
|
|
|
| Iaddf | Isubf | Imulf | Idivf
|
|
|
|
| Ifloatofint | Iintoffloat
|
|
|
|
| Ispecific of Arch.specific_operation
|
|
|
|
|
|
|
|
type instruction =
|
|
|
|
{ desc: instruction_desc;
|
|
|
|
next: instruction;
|
|
|
|
arg: Reg.t array;
|
|
|
|
res: Reg.t array;
|
|
|
|
mutable live: Reg.Set.t }
|
|
|
|
|
|
|
|
and instruction_desc =
|
|
|
|
Iend
|
|
|
|
| Iop of operation
|
|
|
|
| Ireturn
|
|
|
|
| Iifthenelse of test * instruction * instruction
|
|
|
|
| Iswitch of int array * instruction array
|
|
|
|
| Iloop of instruction
|
|
|
|
| Icatch of instruction * instruction
|
|
|
|
| Iexit
|
|
|
|
| Itrywith of instruction * instruction
|
|
|
|
| Iraise
|
|
|
|
|
|
|
|
type fundecl =
|
|
|
|
{ fun_name: string;
|
|
|
|
fun_args: Reg.t array;
|
1995-07-02 09:41:48 -07:00
|
|
|
fun_body: instruction;
|
|
|
|
fun_fast: bool }
|
1995-06-15 01:17:29 -07:00
|
|
|
|
|
|
|
val dummy_instr: instruction
|
|
|
|
val end_instr: unit -> instruction
|
|
|
|
val instr_cons:
|
|
|
|
instruction_desc -> Reg.t array -> Reg.t array -> instruction ->
|
|
|
|
instruction
|
1995-07-02 09:41:48 -07:00
|
|
|
val instr_cons_live:
|
|
|
|
instruction_desc -> Reg.t array -> Reg.t array -> Reg.Set.t ->
|
|
|
|
instruction -> instruction
|
1995-06-15 01:17:29 -07:00
|
|
|
val instr_iter: (instruction -> unit) -> instruction -> unit
|
|
|
|
|