1 (***********************************************************************)
5 (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
7 (* Copyright 1996 Institut National de Recherche en Informatique et *)
8 (* en Automatique. All rights reserved. This file is distributed *)
9 (* under the terms of the Q Public License version 1.0. *)
11 (***********************************************************************)
13 (* $Id: arch.ml 5303 2002-11-29 15:03:08Z xleroy $ *)
15 (* Specific operations for the Sparc processor *)
20 (* SPARC V8 adds multiply and divide.
21 SPARC V9 adds double precision float operations, conditional
22 move, and more instructions that are only useful in 64 bit mode.
23 Sun calls 32 bit V9 "V8+". *)
24 type arch_version = SPARC_V7 | SPARC_V8 | SPARC_V9
26 let arch_version = ref SPARC_V7
28 let command_line_options =
29 [ "-march=v8", Arg.Unit (fun () -> arch_version := SPARC_V8),
30 " Generate code for SPARC V8 processors";
31 "-march=v9", Arg.Unit (fun () -> arch_version := SPARC_V9),
32 " Generate code for SPARC V9 processors" ]
34 type specific_operation = unit (* None worth mentioning *)
36 (* Addressing modes *)
38 type addressing_mode =
39 Ibased of string * int (* symbol + displ *)
40 | Iindexed of int (* reg + displ *)
42 (* Sizes, endianness *)
50 (* Operations on addressing modes *)
52 let identity_addressing = Iindexed 0
54 let offset_addressing addr delta =
56 Ibased(s, n) -> Ibased(s, n + delta)
57 | Iindexed n -> Iindexed(n + delta)
59 let num_args_addressing = function
63 (* Printing operations and addressing modes *)
65 let print_addressing printreg addr ppf arg =
68 let idx = if n <> 0 then Printf.sprintf " + %i" n else "" in
69 fprintf ppf "\"%s\"%s" s idx
71 let idx = if n <> 0 then Printf.sprintf " + %i" n else "" in
72 fprintf ppf "%a%s" printreg arg.(0) idx
74 let print_specific_operation printreg op ppf arg =
75 Misc.fatal_error "Arch_sparc.print_specific_operation"