Add copyright notices and new function String.chomp
[ocaml.git] / asmcomp / mips / selection.ml
blob4dbaa86ea857ae6521192cab1d2d86ac3305c72a
1 (***********************************************************************)
2 (* *)
3 (* Objective Caml *)
4 (* *)
5 (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
6 (* *)
7 (* Copyright 1997 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. *)
10 (* *)
11 (***********************************************************************)
13 (* $Id$ *)
15 (* Instruction selection for the Mips processor *)
17 open Misc
18 open Cmm
19 open Reg
20 open Arch
21 open Mach
23 class selector = object
25 inherit Selectgen.selector_generic
27 method is_immediate (n : int) = true
29 method select_addressing = function
30 Cconst_symbol s ->
31 (Ibased(s, 0), Ctuple [])
32 | Cop(Cadda, [Cconst_symbol s; Cconst_int n]) ->
33 (Ibased(s, n), Ctuple [])
34 | Cop(Cadda, [arg; Cconst_int n]) ->
35 (Iindexed n, arg)
36 | Cop(Cadda, [arg1; Cop(Caddi, [arg2; Cconst_int n])]) ->
37 (Iindexed n, Cop(Cadda, [arg1; arg2]))
38 | arg ->
39 (Iindexed 0, arg)
41 end
43 let fundecl f = (new selector)#emit_fundecl f