1 (***********************************************************************)
5 (* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
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. *)
11 (***********************************************************************)
13 (* $Id: selection.ml 2553 1999-11-17 18:59:06Z xleroy $ *)
15 (* Instruction selection for the Mips processor *)
23 class selector = object
25 inherit Selectgen.selector_generic
27 method is_immediate (n : int) = true
29 method select_addressing = function
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]) ->
36 | Cop(Cadda, [arg1; Cop(Caddi, [arg2; Cconst_int n])]) ->
37 (Iindexed n, Cop(Cadda, [arg1; arg2]))
43 let fundecl f = (new selector)#emit_fundecl f