diff options
author | Cyril SIX <cyril.six@kalray.eu> | 2019-05-03 11:50:24 +0200 |
---|---|---|
committer | Cyril SIX <cyril.six@kalray.eu> | 2019-05-03 11:51:56 +0200 |
commit | b6d91977d837c40f243498ae900c5d1abc32f0f2 (patch) | |
tree | ed68ad783148511bda8e782781788282d3e07195 /mppa_k1c/PostpassSchedulingOracle.ml | |
parent | ad8f16390a68b0cf8e4da39d2ae5d1ad30026803 (diff) | |
download | compcert-kvx-b6d91977d837c40f243498ae900c5d1abc32f0f2.tar.gz compcert-kvx-b6d91977d837c40f243498ae900c5d1abc32f0f2.zip |
[FIX #101] PostpassSchedulingOracle:separate_opaque was not computing correctly
Diffstat (limited to 'mppa_k1c/PostpassSchedulingOracle.ml')
-rw-r--r-- | mppa_k1c/PostpassSchedulingOracle.ml | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/mppa_k1c/PostpassSchedulingOracle.ml b/mppa_k1c/PostpassSchedulingOracle.ml index a4dc3614..327e6c4b 100644 --- a/mppa_k1c/PostpassSchedulingOracle.ml +++ b/mppa_k1c/PostpassSchedulingOracle.ml @@ -823,19 +823,25 @@ let is_opaque = function | PBasic (Pallocframe _) | PBasic (Pfreeframe _) | PControl (PExpand (Pbuiltin _)) -> true | _ -> false +(* Returns : (accumulated instructions, remaining instructions, opaque instruction if found) *) let rec biggest_wo_opaque = function - | [] -> ([], []) - | [i] -> ([i], []) - | i1 :: i2 :: li -> if is_opaque i2 || is_opaque i1 then ([i1], i2::li) - else let big, rem = biggest_wo_opaque li in (i1 :: i2 :: big, rem) + | [] -> ([], [], None) + | i :: li -> if is_opaque i then ([], li, Some i) + else let big, rem, opaque = biggest_wo_opaque li in (i :: big, rem, opaque);; let separate_opaque bb = let instrs = bb_to_instrs bb - in let rec f hd = function - | [] -> [] - | li -> - let sub_li, li = biggest_wo_opaque li - in (bundlize sub_li hd) :: (f [] li) + in let rec f hd li = + match li with + | [] -> [] + | li -> let big, rem, opaque = biggest_wo_opaque li in + match opaque with + | Some i -> + (match big with + | [] -> (bundlize [i] hd) :: (f [] rem) + | big -> (bundlize big hd) :: (bundlize [i] []) :: (f [] rem) + ) + | None -> (bundlize big hd) :: (f [] rem) in f bb.header instrs let smart_schedule bb = |