diff options
author | nicolas.nardino <nicolas.nardino@ens-lyon.fr> | 2021-06-04 16:56:32 +0200 |
---|---|---|
committer | nicolas.nardino <nicolas.nardino@ens-lyon.fr> | 2021-06-04 16:56:32 +0200 |
commit | 98a7a04258f2cf6caf9f18925cbeeae2f5b17be4 (patch) | |
tree | 715086c49904a41e11d0e02ff5a3b90eefce080f /scheduling | |
parent | 7ae1fb0faea68ce5cfe04a232e49659247c244e9 (diff) | |
download | compcert-kvx-98a7a04258f2cf6caf9f18925cbeeae2f5b17be4.tar.gz compcert-kvx-98a7a04258f2cf6caf9f18925cbeeae2f5b17be4.zip |
computing live regs at sb entry from its live output regs
Diffstat (limited to 'scheduling')
-rw-r--r-- | scheduling/RTLpathScheduleraux.ml | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/scheduling/RTLpathScheduleraux.ml b/scheduling/RTLpathScheduleraux.ml index 55f1a078..30da5d5d 100644 --- a/scheduling/RTLpathScheduleraux.ml +++ b/scheduling/RTLpathScheduleraux.ml @@ -73,8 +73,26 @@ let get_superblocks code entry pm typing = end (* PLACEHOLDER *) -let get_live_regs_entry (sb : superblock) = - Registers.Regset.empty +let get_live_regs_entry (sb : superblock) code = + let seqa = Array.map (fun i -> + (match PTree.get i code with + | Some ii -> ii + | None -> failwith "RTLpathScheduleraux.get_live_regs_entry" + ), + (match PTree.get i sb.liveins with + | Some s -> s + | None -> Regset.empty)) + sb.instructions in + Array.fold_right (fun (ins, liveins) regset -> + match ins with + | Inop l -> regset + | Iop (op, args, dest, succ) -> + Registers.Regset.add dest + (List.fold_left (fun set reg -> + Registers.Regset.remove reg set) + regset args) + | _ -> regset (* PLACEHOLDER *) + ) seqa Registers.Regset.empty (* TODO David *) @@ -95,7 +113,7 @@ let schedule_superblock sb code = match predicted_successor ii with | Some _ -> 0 | None -> 1 in - let live_regs_entry = get_live_regs_entry sb in + let live_regs_entry = get_live_regs_entry sb code in match PrepassSchedulingOracle.schedule_sequence (Array.map (fun i -> (match PTree.get i code with |