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 7430 2006-05-31 08:16:34Z xleroy $ *)
15 (* Specific operations for the PowerPC processor *)
20 (* Machine-specific command-line options *)
22 let command_line_options = []
24 (* Specific operations *)
26 type specific_operation =
27 Imultaddf (* multiply and add *)
28 | Imultsubf (* multiply and subtract *)
29 | Ialloc_far of int (* allocation in large functions *)
31 (* Addressing modes *)
33 type addressing_mode =
34 Ibased of string * int (* symbol + displ *)
35 | Iindexed of int (* reg + displ *)
36 | Iindexed2 (* reg + reg *)
38 (* Sizes, endianness *)
43 match Config.model with "ppc64" -> true | _ -> false
45 let size_addr = if ppc64 then 8 else 4
46 let size_int = size_addr
49 (* Operations on addressing modes *)
51 let identity_addressing = Iindexed 0
53 let offset_addressing addr delta =
55 Ibased(s, n) -> Ibased(s, n + delta)
56 | Iindexed n -> Iindexed(n + delta)
57 | Iindexed2 -> assert false
59 let num_args_addressing = function
64 (* Printing operations and addressing modes *)
66 let print_addressing printreg addr ppf arg =
69 let idx = if n <> 0 then Printf.sprintf " + %i" n else "" in
70 fprintf ppf "\"%s\"%s" s idx
72 let idx = if n <> 0 then Printf.sprintf " + %i" n else "" in
73 fprintf ppf "%a%s" printreg arg.(0) idx
75 fprintf ppf "%a + %a" printreg arg.(0) printreg arg.(1)
77 let print_specific_operation printreg op ppf arg =
80 fprintf ppf "%a *f %a +f %a"
81 printreg arg.(0) printreg arg.(1) printreg arg.(2)
83 fprintf ppf "%a *f %a -f %a"
84 printreg arg.(0) printreg arg.(1) printreg arg.(2)
86 fprintf ppf "alloc_far %d" n