diff options
author | Cyril SIX <cyril.six@kalray.eu> | 2020-12-01 16:53:44 +0100 |
---|---|---|
committer | Cyril SIX <cyril.six@kalray.eu> | 2020-12-01 16:53:44 +0100 |
commit | 73729e86f09b81e397fe40b31fdc8b0bdf3c164e (patch) | |
tree | ab0a1647aa2079216ebff4331b40391676c6acf0 /backend/Duplicateaux.ml | |
parent | 035a1a9f4b636206acbae4506c5fc4ef322de0c1 (diff) | |
download | compcert-kvx-73729e86f09b81e397fe40b31fdc8b0bdf3c164e.tar.gz compcert-kvx-73729e86f09b81e397fe40b31fdc8b0bdf3c164e.zip |
Duplicateaux: Generalization of look_ahead
Diffstat (limited to 'backend/Duplicateaux.ml')
-rw-r--r-- | backend/Duplicateaux.ml | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/backend/Duplicateaux.ml b/backend/Duplicateaux.ml index 8436863a..a9dca583 100644 --- a/backend/Duplicateaux.ml +++ b/backend/Duplicateaux.ml @@ -115,16 +115,18 @@ let ptree_printbool pt = (* Looks ahead (until a branch) to see if a node further down verifies * the given predicate *) -let rec look_ahead code node is_loop_header predicate = +let rec look_ahead_gen (successors: RTL.instruction -> P.t list) code node is_loop_header predicate = if (predicate node) then true - else match (rtl_successors @@ get_some @@ PTree.get node code) with + else match (successors @@ get_some @@ PTree.get node code) with | [n] -> if (predicate n) then true else ( if (get_some @@ PTree.get n is_loop_header) then false - else look_ahead code n is_loop_header predicate + else look_ahead_gen successors code n is_loop_header predicate ) | _ -> false +let look_ahead = look_ahead_gen rtl_successors + (** * Heuristics mostly based on the paper Branch Prediction for Free *) |