1995-08-09 08:06:35 -07:00
|
|
|
(***********************************************************************)
|
|
|
|
(* *)
|
1996-04-30 07:53:58 -07:00
|
|
|
(* Objective Caml *)
|
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
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
|
|
|
(* $Id$ *)
|
|
|
|
|
1995-07-12 07:25:41 -07:00
|
|
|
(* Specific operations for the Mips processor *)
|
|
|
|
|
|
|
|
open Misc
|
1999-11-08 09:06:33 -08:00
|
|
|
open Formatmsg
|
1995-07-12 07:25:41 -07:00
|
|
|
|
|
|
|
(* Addressing modes *)
|
|
|
|
|
|
|
|
type addressing_mode =
|
|
|
|
Ibased of string * int (* symbol + displ *)
|
|
|
|
| Iindexed of int (* reg + displ *)
|
|
|
|
|
|
|
|
(* Specific operations *)
|
|
|
|
|
|
|
|
type specific_operation = unit (* none *)
|
|
|
|
|
|
|
|
(* Sizes, endianness *)
|
|
|
|
|
1997-02-03 06:41:42 -08:00
|
|
|
let big_endian =
|
|
|
|
match Config.system with
|
|
|
|
"ultrix" -> false
|
|
|
|
| "irix" -> true
|
|
|
|
| _ -> fatal_error "Arch_mips.big_endian"
|
1995-07-12 07:25:41 -07:00
|
|
|
|
|
|
|
let size_addr = 4
|
|
|
|
let size_int = 4
|
|
|
|
let size_float = 8
|
|
|
|
|
|
|
|
(* Operations on addressing modes *)
|
|
|
|
|
|
|
|
let identity_addressing = Iindexed 0
|
|
|
|
|
|
|
|
let offset_addressing addr delta =
|
|
|
|
match addr with
|
|
|
|
Ibased(s, n) -> Ibased(s, n + delta)
|
|
|
|
| Iindexed n -> Iindexed(n + delta)
|
|
|
|
|
|
|
|
let num_args_addressing = function
|
|
|
|
Ibased(s, n) -> 0
|
|
|
|
| Iindexed n -> 1
|
|
|
|
|
|
|
|
(* Printing operations and addressing modes *)
|
|
|
|
|
|
|
|
let print_addressing printreg addr arg =
|
|
|
|
match addr with
|
|
|
|
Ibased(s, n) ->
|
2000-02-08 12:00:06 -08:00
|
|
|
printf "\"%s\"" s;
|
|
|
|
if n <> 0 then printf " + %i" n
|
1995-07-12 07:25:41 -07:00
|
|
|
| Iindexed n ->
|
|
|
|
printreg arg.(0);
|
2000-02-08 12:00:06 -08:00
|
|
|
if n <> 0 then printf " + %i" n
|
1995-07-12 07:25:41 -07:00
|
|
|
|
|
|
|
let print_specific_operation printreg op arg =
|
|
|
|
fatal_error "Arch_mips.print_specific_operation"
|