ocaml/asmcomp/arch_hppa.ml

67 lines
2.1 KiB
OCaml
Raw Normal View History

(***********************************************************************)
(* *)
(* Objective Caml *)
(* *)
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
(* *)
(* Copyright 1996 Institut National de Recherche en Informatique et *)
(* Automatique. Distributed only by permission. *)
(* *)
(***********************************************************************)
(* $Id$ *)
(* Specific operations for the HP PA-RISC processor *)
open Format
type specific_operation =
Ishift1add
| Ishift2add
| Ishift3add
(* Addressing modes *)
type addressing_mode =
Ibased of string * int (* symbol + displ *)
| Iindexed of int (* reg + displ *)
(* Sizes, endianness *)
let big_endian = true
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) ->
print_string "\""; print_string s; print_string "\"";
if n <> 0 then begin print_string " + "; print_int n end
| Iindexed n ->
printreg arg.(0);
if n <> 0 then begin print_string " + "; print_int n end
let print_specific_operation printreg op arg =
match op with
Ishift1add -> printreg arg.(0); print_string " << 1 + "; printreg arg.(1)
| Ishift2add -> printreg arg.(0); print_string " << 2 + "; printreg arg.(1)
| Ishift3add -> printreg arg.(0); print_string " << 3 + "; printreg arg.(1)