]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/ocaml/contrib/asmcomp/hppa/scheduling.ml
Inital import
[l4.git] / l4 / pkg / ocaml / contrib / asmcomp / hppa / scheduling.ml
1 (***********************************************************************)
2 (*                                                                     *)
3 (*                           Objective Caml                            *)
4 (*                                                                     *)
5 (*            Xavier Leroy, projet Cristal, INRIA Rocquencourt         *)
6 (*                                                                     *)
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.               *)
10 (*                                                                     *)
11 (***********************************************************************)
12
13 (* $Id: scheduling.ml 2553 1999-11-17 18:59:06Z xleroy $ *)
14
15 (* Instruction scheduling for the HPPA *)
16
17 open Arch
18 open Mach
19
20 class scheduler = object (self)
21
22 inherit Schedgen.scheduler_generic
23
24 (* Latencies (in cycles). Roughly based on the ``Mustang'' chips. *)
25
26 method oper_latency = function
27     Ireload -> 2
28   | Iload(_, _) -> 2
29   | Iconst_float _ -> 2                 (* turned into a load *)
30   | Iintop Imul -> 2                    (* ends up with a load *)
31   | Iaddf | Isubf | Imulf -> 3
32   | Idivf -> 12
33   | _ -> 1
34
35 (* Issue cycles.  Rough approximations. *)
36
37 method oper_issue_cycles = function
38     Iconst_float _ -> 3
39   | Iconst_symbol _ -> 2
40   | Iload(_, Ibased(_, _)) -> 2
41   | Istore(_, Ibased(_, _)) -> 2
42   | Ialloc _ -> 5
43   | Iintop Imul -> 10
44   | Iintop Ilsl -> 3
45   | Iintop Ilsr -> 2
46   | Iintop Iasr -> 3
47   | Iintop(Icomp _) -> 2
48   | Iintop(Icheckbound) -> 2
49   | Iintop_imm(Idiv, _) -> 4
50   | Iintop_imm(Imod, _) -> 5
51   | Iintop_imm(Icomp _, _) -> 2
52   | Iintop_imm(Icheckbound, _) -> 2
53   | Ifloatofint -> 4
54   | Iintoffloat -> 4
55   | _ -> 1
56
57 end
58
59 let fundecl f = (new scheduler)#schedule_fundecl f