1995-08-09 08:06:35 -07:00
|
|
|
(***********************************************************************)
|
|
|
|
(* *)
|
2011-07-27 07:17:02 -07:00
|
|
|
(* OCaml *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* *)
|
|
|
|
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
|
|
|
|
(* *)
|
1996-04-30 07:53:58 -07:00
|
|
|
(* Copyright 1996 Institut National de Recherche en Informatique et *)
|
1999-11-17 10:59:06 -08:00
|
|
|
(* en Automatique. All rights reserved. This file is distributed *)
|
|
|
|
(* under the terms of the Q Public License version 1.0. *)
|
1995-08-09 08:06:35 -07:00
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
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 =
|
2013-11-18 23:01:54 -08:00
|
|
|
Iadd | Isub | Imul | Imulh | Idiv | Imod
|
1995-06-15 01:17:29 -07:00
|
|
|
| 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
|
1995-11-28 06:25:57 -08:00
|
|
|
| Ifloattest of Cmm.comparison * bool
|
1995-07-17 09:10:15 -07:00
|
|
|
| Ioddtest
|
|
|
|
| Ieventest
|
1995-06-15 01:17:29 -07:00
|
|
|
|
|
|
|
type operation =
|
|
|
|
Imove
|
|
|
|
| Ispill
|
|
|
|
| Ireload
|
2000-02-21 11:38:09 -08:00
|
|
|
| Iconst_int of nativeint
|
2014-04-25 01:41:13 -07:00
|
|
|
| Iconst_float of float
|
1995-07-02 09:41:48 -07:00
|
|
|
| Iconst_symbol of string
|
2014-03-17 07:34:00 -07:00
|
|
|
| Iconst_blockheader of nativeint
|
1995-06-15 01:17:29 -07:00
|
|
|
| Icall_ind
|
|
|
|
| Icall_imm of string
|
|
|
|
| Itailcall_ind
|
|
|
|
| Itailcall_imm of string
|
2014-04-26 03:40:22 -07:00
|
|
|
| Iextcall of string * bool (* false = noalloc, true = alloc *)
|
1995-06-15 01:17:29 -07:00
|
|
|
| Istackoffset of int
|
|
|
|
| Iload of Cmm.memory_chunk * Arch.addressing_mode
|
2014-04-26 03:40:22 -07:00
|
|
|
| Istore of Cmm.memory_chunk * Arch.addressing_mode * bool
|
|
|
|
(* false = initialization, true = assignment *)
|
1995-06-15 01:17:29 -07:00
|
|
|
| Ialloc of int
|
|
|
|
| Iintop of integer_operation
|
|
|
|
| Iintop_imm of integer_operation * int
|
1996-03-07 05:45:17 -08:00
|
|
|
| Inegf | Iabsf | Iaddf | Isubf | Imulf | Idivf
|
1995-06-15 01:17:29 -07:00
|
|
|
| Ifloatofint | Iintoffloat
|
|
|
|
| Ispecific of Arch.specific_operation
|
|
|
|
|
|
|
|
type instruction =
|
|
|
|
{ desc: instruction_desc;
|
|
|
|
next: instruction;
|
|
|
|
arg: Reg.t array;
|
|
|
|
res: Reg.t array;
|
2007-01-29 04:11:18 -08:00
|
|
|
dbg: Debuginfo.t;
|
1995-06-15 01:17:29 -07:00
|
|
|
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
|
2000-08-11 12:50:59 -07:00
|
|
|
| Icatch of int * instruction * instruction
|
2010-01-22 04:48:24 -08:00
|
|
|
| Iexit of int
|
1995-06-15 01:17:29 -07:00
|
|
|
| Itrywith of instruction * instruction
|
2013-10-14 07:33:27 -07:00
|
|
|
| Iraise of Lambda.raise_kind
|
1995-06-15 01:17:29 -07:00
|
|
|
|
|
|
|
type fundecl =
|
|
|
|
{ fun_name: string;
|
|
|
|
fun_args: Reg.t array;
|
1995-07-02 09:41:48 -07:00
|
|
|
fun_body: instruction;
|
2012-02-21 09:41:02 -08:00
|
|
|
fun_fast: bool;
|
|
|
|
fun_dbg : Debuginfo.t }
|
1995-06-15 01:17:29 -07:00
|
|
|
|
|
|
|
val dummy_instr: instruction
|
|
|
|
val end_instr: unit -> instruction
|
2010-01-22 04:48:24 -08:00
|
|
|
val instr_cons:
|
1995-06-15 01:17:29 -07:00
|
|
|
instruction_desc -> Reg.t array -> Reg.t array -> instruction ->
|
|
|
|
instruction
|
2010-01-22 04:48:24 -08:00
|
|
|
val instr_cons_debug:
|
2007-01-29 04:11:18 -08:00
|
|
|
instruction_desc -> Reg.t array -> Reg.t array -> Debuginfo.t ->
|
1995-07-02 09:41:48 -07:00
|
|
|
instruction -> instruction
|
1995-06-15 01:17:29 -07:00
|
|
|
val instr_iter: (instruction -> unit) -> instruction -> unit
|