2016-02-18 07:11:59 -08:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* OCaml *)
|
|
|
|
(* *)
|
|
|
|
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
|
|
|
|
(* *)
|
|
|
|
(* Copyright 1996 Institut National de Recherche en Informatique et *)
|
|
|
|
(* en Automatique. *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. This file is distributed under the terms of *)
|
|
|
|
(* the GNU Lesser General Public License version 2.1, with the *)
|
|
|
|
(* special exception on linking described in the file LICENSE. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
1995-08-09 08:06:35 -07:00
|
|
|
|
1995-06-15 01:17:29 -07:00
|
|
|
(* Specific operations for the Sparc processor *)
|
|
|
|
|
2000-04-21 01:13:22 -07:00
|
|
|
open Format
|
1995-06-15 01:17:29 -07:00
|
|
|
|
2002-11-29 07:03:08 -08:00
|
|
|
(* SPARC V8 adds multiply and divide.
|
|
|
|
SPARC V9 adds double precision float operations, conditional
|
|
|
|
move, and more instructions that are only useful in 64 bit mode.
|
|
|
|
Sun calls 32 bit V9 "V8+". *)
|
|
|
|
type arch_version = SPARC_V7 | SPARC_V8 | SPARC_V9
|
|
|
|
|
|
|
|
let arch_version = ref SPARC_V7
|
|
|
|
|
|
|
|
let command_line_options =
|
|
|
|
[ "-march=v8", Arg.Unit (fun () -> arch_version := SPARC_V8),
|
|
|
|
" Generate code for SPARC V8 processors";
|
|
|
|
"-march=v9", Arg.Unit (fun () -> arch_version := SPARC_V9),
|
|
|
|
" Generate code for SPARC V9 processors" ]
|
|
|
|
|
1995-06-15 01:17:29 -07:00
|
|
|
type specific_operation = unit (* None worth mentioning *)
|
|
|
|
|
2016-07-29 07:07:10 -07:00
|
|
|
let spacetime_node_hole_pointer_is_live_before _specific_op = false
|
|
|
|
|
1995-06-15 01:17:29 -07:00
|
|
|
(* 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
|
|
|
|
|
2012-11-09 08:15:29 -08:00
|
|
|
let allow_unaligned_access = false
|
|
|
|
|
2012-02-24 02:13:02 -08:00
|
|
|
(* Behavior of division *)
|
|
|
|
|
|
|
|
let division_crashes_on_overflow = false
|
|
|
|
|
1995-06-15 01:17:29 -07:00
|
|
|
(* 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
|
2016-03-09 02:40:16 -08:00
|
|
|
Ibased _ -> 0
|
|
|
|
| Iindexed _ -> 1
|
1995-06-15 01:17:29 -07:00
|
|
|
|
|
|
|
(* 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) ->
|
|
|
|
let idx = if n <> 0 then Printf.sprintf " + %i" n else "" in
|
|
|
|
fprintf ppf "\"%s\"%s" s idx
|
1995-06-15 01:17:29 -07:00
|
|
|
| Iindexed n ->
|
2000-04-21 01:13:22 -07:00
|
|
|
let idx = if n <> 0 then Printf.sprintf " + %i" n else "" in
|
|
|
|
fprintf ppf "%a%s" printreg arg.(0) idx
|
1995-06-15 01:17:29 -07:00
|
|
|
|
2016-03-09 02:40:16 -08:00
|
|
|
let print_specific_operation _printreg _op _ppf _arg =
|
1995-06-15 01:17:29 -07:00
|
|
|
Misc.fatal_error "Arch_sparc.print_specific_operation"
|