Debian Codegraph @

lib/mlrisc-lib/MLRISC/scheduling/clusterBBScheduler.sml

raw
1 (*
2 * Simple minded basic block scheduling
3 *)
4 functor ClusterBasicBlockScheduler
5 (structure Flowgraph : FLOWGRAPH
6 structure BBSched : BASIC_BLOCK_SCHEDULER
7 sharing Flowgraph.I = BBSched.I
8 val cpu : string ref
9 ) : CLUSTER_OPTIMIZATION =
10 struct
11
12 structure F = Flowgraph
13 type flowgraph = F.cluster
14
15 val name = "Basic Block Scheduling"
16
17 fun run(cluster as F.CLUSTER{blocks, annotations, ...}) =
18 if #contains MLRiscAnnotations.NO_OPTIMIZATION (!annotations)
19 then cluster
20 else
21 let val schedule = BBSched.schedule {cpu= !cpu}
22 fun sched(F.BBLOCK{annotations, insns, ...}) =
23 if #contains MLRiscAnnotations.NO_OPTIMIZATION (!annotations)
24 then ()
25 else insns := schedule(! insns)
26 | sched _ = ()
27 in app sched blocks;
28 cluster
29 end
30 end