1997-07-24 04:49:12 -07:00
|
|
|
(***********************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* Objective Caml *)
|
|
|
|
(* *)
|
|
|
|
(* Xavier Leroy, projet Cristal, INRIA Rocquencourt *)
|
|
|
|
(* *)
|
|
|
|
(* Copyright 1996 Institut National de Recherche en Informatique et *)
|
|
|
|
(* Automatique. Distributed only by permission. *)
|
|
|
|
(* *)
|
|
|
|
(***********************************************************************)
|
|
|
|
|
|
|
|
(* $Id$ *)
|
|
|
|
|
1997-07-29 18:12:19 -07:00
|
|
|
open Arch
|
1997-07-27 08:08:39 -07:00
|
|
|
open Mach
|
1997-07-24 04:49:12 -07:00
|
|
|
|
1997-07-27 08:08:39 -07:00
|
|
|
(* The Digital Unix assembler does scheduling better than us.
|
|
|
|
However, the Linux-Alpha assembler does not do scheduling, so we do
|
|
|
|
a feeble attempt here. *)
|
1997-07-24 04:49:12 -07:00
|
|
|
|
1998-06-25 06:14:07 -07:00
|
|
|
class scheduler = object (self)
|
1997-07-27 08:08:39 -07:00
|
|
|
|
1998-06-24 12:22:26 -07:00
|
|
|
inherit Schedgen.scheduler_generic as super
|
1997-07-27 08:08:39 -07:00
|
|
|
|
|
|
|
(* Latencies (in cycles). Based on the 21064, with some poetic license. *)
|
|
|
|
|
|
|
|
method oper_latency = function
|
|
|
|
Ireload -> 3
|
|
|
|
| Iload(_, _) -> 3
|
|
|
|
| Iconst_symbol _ -> 3 (* turned into a load *)
|
1997-07-29 18:12:19 -07:00
|
|
|
| Iconst_float _ -> 3 (* ends up in a load *)
|
1997-07-27 08:08:39 -07:00
|
|
|
| Iintop(Imul) -> 23
|
|
|
|
| Iintop_imm(Imul, _) -> 23
|
|
|
|
| Iaddf -> 6
|
|
|
|
| Isubf -> 6
|
|
|
|
| Imulf -> 6
|
|
|
|
| Idivf -> 63
|
|
|
|
| _ -> 2
|
|
|
|
(* Most arithmetic instructions can be executed back-to-back in 1 cycle.
|
|
|
|
However, some combinations (arith; load or arith; store) require 2
|
|
|
|
cycles. Also, by claiming 2 cycles instead of 1, we might favor
|
|
|
|
dual issue. *)
|
|
|
|
|
|
|
|
(* Issue cycles. Rough approximations. *)
|
|
|
|
|
|
|
|
method oper_issue_cycles = function
|
1997-07-29 18:12:19 -07:00
|
|
|
Iconst_float _ -> 4 (* load from $gp, then load *)
|
|
|
|
| Ialloc _ -> 4
|
1997-07-27 08:08:39 -07:00
|
|
|
| Iintop(Icheckbound) -> 2
|
|
|
|
| Iintop_imm(Idiv, _) -> 3
|
|
|
|
| Iintop_imm(Imod, _) -> 5
|
|
|
|
| Iintop_imm(Icheckbound, _) -> 2
|
|
|
|
| Ifloatofint -> 10
|
|
|
|
| Iintoffloat -> 10
|
|
|
|
| _ -> 1
|
|
|
|
|
|
|
|
(* Say that reloadgp is not part of a basic block (prevents moving it
|
|
|
|
past an operation that uses $gp) *)
|
|
|
|
|
|
|
|
method oper_in_basic_block = function
|
|
|
|
Ispecific(Ireloadgp _) -> false
|
|
|
|
| op -> super#oper_in_basic_block op
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
let fundecl =
|
1997-07-29 18:12:19 -07:00
|
|
|
if digital_asm
|
1997-07-27 08:08:39 -07:00
|
|
|
then (fun f -> f)
|
1998-06-24 12:22:26 -07:00
|
|
|
else (new scheduler)#schedule_fundecl
|