aboutsummaryrefslogtreecommitdiffstats
path: root/aarch64/OpWeightsAsm.ml
diff options
context:
space:
mode:
authorLéo Gourdin <leo.gourdin@univ-grenoble-alpes.fr>2020-11-04 22:40:19 +0100
committerLéo Gourdin <leo.gourdin@univ-grenoble-alpes.fr>2020-11-04 22:40:19 +0100
commit0bf4c8582574b9c7bea43547d75b87c85fdee1e1 (patch)
tree5015578705250167cf15134b34e4d0afad3e2b81 /aarch64/OpWeightsAsm.ml
parentcdb54160ff67bef3ab40e3cc85416f2c897ac82b (diff)
downloadcompcert-kvx-0bf4c8582574b9c7bea43547d75b87c85fdee1e1.tar.gz
compcert-kvx-0bf4c8582574b9c7bea43547d75b87c85fdee1e1.zip
Smart scheduler build problem and flatten solution OK
Diffstat (limited to 'aarch64/OpWeightsAsm.ml')
-rw-r--r--aarch64/OpWeightsAsm.ml141
1 files changed, 121 insertions, 20 deletions
diff --git a/aarch64/OpWeightsAsm.ml b/aarch64/OpWeightsAsm.ml
index 17869a99..c59d4695 100644
--- a/aarch64/OpWeightsAsm.ml
+++ b/aarch64/OpWeightsAsm.ml
@@ -1,19 +1,120 @@
+(* *************************************************************)
+(* *)
+(* The Compcert verified compiler *)
+(* *)
+(* David Monniaux CNRS, VERIMAG *)
+(* Léo Gourdin UGA, VERIMAG *)
+(* *)
+(* Copyright Kalray. Copyright VERIMAG. All rights reserved. *)
+(* This file is distributed under the terms of the INRIA *)
+(* Non-Commercial License Agreement. *)
+(* *)
+(* *************************************************************)
+
open Asmblock;;
-(* TODO remove? open PrepassSchedulingOracleDeps;;*)
+
+(*type called_function = (Registers.reg, AST.ident) Datatypes.sum*)
+
+type opweights =
+ {
+ pipelined_resource_bounds : int array;
+ nr_non_pipelined_units : int;
+ latency_of_op : instruction -> int -> int;
+ resources_of_op : instruction -> int -> int array;
+ (*non_pipelined_resources_of_op : Op.operation -> int -> int array;*)
+ (*latency_of_load : AST.trapping_mode -> AST.memory_chunk -> Op.addressing -> int -> int;*)
+ (*resources_of_load : AST.trapping_mode -> AST.memory_chunk -> Op.addressing -> int -> int array;*)
+ (*resources_of_store : AST.memory_chunk -> Op.addressing -> int -> int array;*)
+ (*resources_of_cond : Op.condition -> int -> int array;*)
+ (*latency_of_call : AST.signature -> called_function -> int;*)
+ (*resources_of_call : AST.signature -> called_function -> int array;*)
+ (*resources_of_builtin : AST.external_function -> int array*)
+ };;
module Cortex_A53=
struct
let resource_bounds = [| 2; 2; 1; 1 |];; (* instr ; ALU ; MAC; LSU *)
let nr_non_pipelined_units = 1;;
- let latency_of_op (i : basic) (nargs : int) =
- match i with
+ let latency_of_op (i : instruction) (nargs : int) = 1;;
+ (*match i with
| PArith _
- | PArithP _ _ -> 1 (* XXX *)
- | PArithPP
+ | PArithP _ _ _
+ | Padrp _ _ -> 1 (* XXX not sure *)
+ | Pmovz _ _ _ -> 1
+ | Pmovn _ _ _ -> 1
+ | Pfmovimms _ -> 1
+ | Pfmovimmd _ -> 1
+ | PArithPP _ _ _
+ | Pmov -> 1 (* XXX not sure *)
+ | Pmovk _ _ _ -> 1
+ | Paddadr _ _ -> 1
+ | Psbfiz _ _ _ -> 2 (* XXX Maybe 1 *)
+ | Psbfx _ _ _ -> 2
+ | Pubfiz _ _ _ -> 2 (* XXX Maybe 1 *)
+ | Pubfx _ _ _ -> 2
+ | Pfmov -> 1
+ | Pfcvtds -> 6
+ | Pfcvtsd -> 6
+ | Pfabs _ -> 6
+ | Pfneg _ -> 6
+ | Pscvtf _ _ -> 6
+ | Pucvtf _ _ -> 6
+ | Pfcvtzs _ _ -> 6
+ | Pfcvtzu _ _ -> 6
+ | Paddimm _ _ -> 1
+ | Psubimm _ _ -> 1
+ | PArithPPP _ _ _ _
+ | Pasrv _ -> 2
+ | Plslv _ -> 2
+ | Plsrv _ -> 2
+ | Prorv _ -> 2 (* XXX Does not exits in Asmblockgen?? *)
+ | Psmulh -> 4
+ | Pumulh -> 4
+ | Psdiv _ -> 50
+ | Pudiv _ -> 50
+ | Paddext _ -> 2
+ | Psubext _ -> 2
+ | Pfadd _ -> 6
+ | Pfdiv _ -> 50
+ | Pfmul _ -> 6
+ | Pfsub _ -> 6
+ | PArithRR0R _ _ _ _
+ | Padd _ _ -> 2 (* XXX Maybe 6 as used in shifts *)
+ | Psub _ _ -> 2 (* XXX Maybe 6 as used in shifts *)
+ | Pand _ _ -> 1 (* XXX Maybe 2 as used in shifts *)
+ | Pbic _ _ -> 1 (* XXX Maybe 2 as used in shifts *)
+ | Peon _ _ -> 1 (* XXX Maybe 2 as used in shifts *)
+ | Peor _ _ -> 1 (* XXX Maybe 2 as used in shifts *)
+ | Porr _ _ -> 1 (* XXX Maybe 2 as used in shifts *)
+ | Porn _ _ -> 1 (* XXX Maybe 2 as used in shifts *)
+ | PArithRR0 _ _ _
+ | Pandimm _ _ -> 1
+ | Peorimm _ _ -> 1
+ | Porrimm _ _ -> 1
+ | PArithARRRR0 _ _ _ _ _
+ | Pmadd _ -> 4
+ | Pmsub _ -> 4
+ | PArithComparisonPP _ _ _ (* XXX not sure *)
+ | Pcmpext _ -> 1
+ | Pcmnext _ -> 1
+ | Pfcmp _ -> 1
+ | PArithComparisonR0R _ _ _ (* XXX not sure *)
+ | Pcmp _ _ -> 1
+ | Pcmn _ _ -> 1
+ | Ptst _ _ -> 1
+ | PArithComparisonP _ _ _ (* XXX not sure *)
+ | Pfcmp0 _ -> 1
+ | Pcmpimm _ _ -> 1
+ | Pcmnimm _ _ -> 1
+ | Ptstimm _ _ -> 1
+ | Printf.eprintf "Error NYI OpWeightsAsm"*)
+
+
+
- let resources_of_op (op : operation) (nargs : int) =
- match op with
+ let resources_of_op (i : instruction) (nargs : int) = [| 0; 0; 0; 0 |];;
+ (*match op with
| Omove
| Ointconst _
| Olongconst _
@@ -179,9 +280,9 @@ module Cortex_A53=
| Ccompfszero _ (* r equal to 0.0 *)
| Cnotcompfszero _ (* r not equal to 0.0 *) ->
[| 1; 1; 1; 0 |]
- | _ -> [| 1; 1; 0; 0 |] );;
+ | _ -> [| 1; 1; 0; 0 |] )*);;
- let latency_of_load trap chunk (addr : addressing) (nargs : int) = 3;;
+ let latency_of_load trap chunk _ _ = 3;;
let latency_of_call _ _ = 6;;
let resources_of_load trap chunk addressing nargs = [| 1; 0; 0; 1 |];;
@@ -193,20 +294,20 @@ module Cortex_A53=
end;;
let get_opweights () : opweights =
- match !Clflags.option_mtune with
- | "cortex-a53" | "cortex-a35" | "" ->
+ (*match !Clflags.option_mtune with*)
+ (*| "cortex-a53" | "cortex-a35" | "" ->*)
{
pipelined_resource_bounds = Cortex_A53.resource_bounds;
nr_non_pipelined_units = Cortex_A53.nr_non_pipelined_units;
latency_of_op = Cortex_A53.latency_of_op;
resources_of_op = Cortex_A53.resources_of_op;
- non_pipelined_resources_of_op = Cortex_A53.non_pipelined_resources_of_op;
- latency_of_load = Cortex_A53.latency_of_load;
- resources_of_load = Cortex_A53.resources_of_load;
- resources_of_store = Cortex_A53.resources_of_store;
- resources_of_cond = Cortex_A53.resources_of_cond;
- latency_of_call = Cortex_A53.latency_of_call;
- resources_of_call = Cortex_A53.resources_of_call;
- resources_of_builtin = Cortex_A53.resources_of_builtin
+ (*non_pipelined_resources_of_op = Cortex_A53.non_pipelined_resources_of_op;*)
+ (*latency_of_load = Cortex_A53.latency_of_load;*)
+ (*resources_of_load = Cortex_A53.resources_of_load;*)
+ (*resources_of_store = Cortex_A53.resources_of_store;*)
+ (*resources_of_cond = Cortex_A53.resources_of_cond;*)
+ (*latency_of_call = Cortex_A53.latency_of_call;*)
+ (*resources_of_call = Cortex_A53.resources_of_call;*)
+ (*resources_of_builtin = Cortex_A53.resources_of_builtin*)
}
- | xxx -> failwith (Printf.sprintf "unknown -mtune: %s" xxx);;
+ (*| xxx -> failwith (Printf.sprintf "unknown -mtune: %s" xxx);;*)