diff options
author | Justus Fasse <justus.fasse@etu.univ-grenoble-alpes.fr> | 2021-07-29 13:20:13 +0200 |
---|---|---|
committer | Justus Fasse <justus.fasse@etu.univ-grenoble-alpes.fr> | 2021-07-29 13:22:35 +0200 |
commit | 3fea40407102f7400b6a8ff25891f63a1e01b9ff (patch) | |
tree | 5e2287870ab3f15abb122185a387270467f02cb8 | |
parent | f8f6a8d482b72f181792dd0194297a6c89670b0f (diff) | |
download | compcert-kvx-3fea40407102f7400b6a8ff25891f63a1e01b9ff.tar.gz compcert-kvx-3fea40407102f7400b6a8ff25891f63a1e01b9ff.zip |
Turn a tree of deps into a tree of uses
-rw-r--r-- | scheduling/MyRTLpathScheduleraux.ml | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/scheduling/MyRTLpathScheduleraux.ml b/scheduling/MyRTLpathScheduleraux.ml index 183bb840..ebcbfe16 100644 --- a/scheduling/MyRTLpathScheduleraux.ml +++ b/scheduling/MyRTLpathScheduleraux.ml @@ -713,6 +713,26 @@ let merge_append _ x y = match x, y with | Some x, None | None, Some x -> Some x | Some x, Some y -> Some (x @ y) +(* Turns a tree of dependencies (pc -> [pcs; that; depend; on pc]) into a tree of uses by + * "inverting" tree. + * Now, each pc has the pcs associated to it that depend on it, according to the original + * tree. *) +let uses_of_deps p_ptree = + PTree.fold + (fun acc p vs -> + let acc = HashedSet.PSet.fold + (fun acc v -> + let old = ptree_get_or_default acc v HashedSet.PSet.empty in + let upd = HashedSet.PSet.add p old in + PTree.set v upd acc) + vs + acc + in + acc + ) + p_ptree + PTree.empty + (* Returns for every side-exit pc, a list of instructions that should be executed beforehand *) let downschedule_compensation_code sb code pm live_renames ~next_free_pc ~next_free_reg = (* TODO: Right now we are copying the instructions even if there are duplicates per |