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-06-15 01:17:29 -07:00
|
|
|
(* Specific operations for the Alpha processor *)
|
|
|
|
|
2000-04-21 01:13:22 -07:00
|
|
|
open Format
|
1995-06-15 01:17:29 -07:00
|
|
|
|
|
|
|
(* Addressing modes *)
|
|
|
|
|
|
|
|
type addressing_mode =
|
|
|
|
Ibased of string * int (* symbol + displ *)
|
|
|
|
| Iindexed of int (* reg + displ *)
|
|
|
|
|
1995-07-02 09:41:48 -07:00
|
|
|
(* Specific operations *)
|
|
|
|
|
|
|
|
type specific_operation =
|
|
|
|
Iadd4 | Iadd8 | Isub4 | Isub8 (* Scaled adds and subs *)
|
1997-07-26 05:21:24 -07:00
|
|
|
| Ireloadgp of bool (* The ldgp instruction *)
|
2000-02-04 07:08:29 -08:00
|
|
|
| Itrunc32 (* Truncate 64-bit int to 32 bit *)
|
1995-07-02 09:41:48 -07:00
|
|
|
|
1995-06-15 01:17:29 -07:00
|
|
|
(* Sizes, endianness *)
|
|
|
|
|
|
|
|
let big_endian = false
|
|
|
|
|
|
|
|
let size_addr = 8
|
|
|
|
let size_int = 8
|
|
|
|
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 *)
|
|
|
|
|
2000-04-21 01:13:22 -07:00
|
|
|
let print_addressing printreg addr ppf arg =
|
1995-06-15 01:17:29 -07:00
|
|
|
match addr with
|
2000-04-21 01:13:22 -07:00
|
|
|
| Ibased(s, n) ->
|
|
|
|
fprintf ppf "\"%s\"%s" s
|
|
|
|
(if n <> 0 then Printf.sprintf " + %i" n else "")
|
1995-06-15 01:17:29 -07:00
|
|
|
| Iindexed n ->
|
2000-04-21 01:13:22 -07:00
|
|
|
fprintf ppf "%a%s" printreg arg.(0)
|
|
|
|
(if n <> 0 then Printf.sprintf " + %i" n else "")
|
1995-06-15 01:17:29 -07:00
|
|
|
|
2000-04-21 01:13:22 -07:00
|
|
|
let print_specific_operation printreg op ppf arg =
|
1995-06-15 01:17:29 -07:00
|
|
|
match op with
|
2000-04-21 01:13:22 -07:00
|
|
|
| Iadd4 -> fprintf ppf "%a * 4 + %a" printreg arg.(0) printreg arg.(1)
|
|
|
|
| Iadd8 -> fprintf ppf "%a * 8 + %a" printreg arg.(0) printreg arg.(1)
|
|
|
|
| Isub4 -> fprintf ppf "%a * 4 - %a" printreg arg.(0) printreg arg.(1)
|
|
|
|
| Isub8 -> fprintf ppf "%a * 8 - %a" printreg arg.(0) printreg arg.(1)
|
|
|
|
| Ireloadgp _ -> fprintf ppf "ldgp"
|
|
|
|
| Itrunc32 -> fprintf ppf "truncate32 %a" printreg arg.(0)
|
1997-07-27 08:08:39 -07:00
|
|
|
|
|
|
|
(* Distinguish between the Digital assembler and other assemblers (e.g. gas) *)
|
|
|
|
|
|
|
|
let digital_asm =
|
|
|
|
match Config.system with
|
|
|
|
"digital" -> true
|
|
|
|
| _ -> false
|