aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyril SIX <cyril.six@kalray.eu>2020-01-17 16:57:38 +0100
committerCyril SIX <cyril.six@kalray.eu>2020-01-17 16:57:38 +0100
commitf34d5cca62ba2f7d6f7d01645092e52061812f84 (patch)
tree75fbf85be77058f504f20ba720851aec832b8aaa
parente836ec02384a11e2aa87567e828d69776dd453ee (diff)
downloadcompcert-kvx-f34d5cca62ba2f7d6f7d01645092e52061812f84.tar.gz
compcert-kvx-f34d5cca62ba2f7d6f7d01645092e52061812f84.zip
Set up the groundbase for doing the duplication
-rw-r--r--backend/Duplicateaux.ml18
1 files changed, 14 insertions, 4 deletions
diff --git a/backend/Duplicateaux.ml b/backend/Duplicateaux.ml
index ec99027a..54929251 100644
--- a/backend/Duplicateaux.ml
+++ b/backend/Duplicateaux.ml
@@ -440,12 +440,22 @@ let rec make_identity_ptree_rec = function
let make_identity_ptree f = make_identity_ptree_rec (PTree.elements f.fn_code)
+(* FIXME - For now, identity *)
+let tail_duplicate code ptree trace = (code, ptree)
+
+let rec superblockify_traces code ptree = function
+ | [] -> (code, ptree)
+ | trace :: traces ->
+ let new_code, new_ptree = tail_duplicate code ptree trace
+ in superblockify_traces new_code new_ptree traces
+
(* For now, identity function *)
let duplicate_aux f =
- let pTreeId = make_identity_ptree f in
let entrypoint = fn_entrypoint f in
- let traces = select_traces (to_ttl_code (fn_code f) entrypoint) entrypoint
- in begin
+ let traces = select_traces (to_ttl_code (fn_code f) entrypoint) entrypoint in
+ let pTreeId = make_identity_ptree f in
+ let (new_code, pTreeId) = superblockify_traces (fn_code f) pTreeId traces in
+ begin
print_traces traces;
- (((fn_code f), (fn_entrypoint f)), pTreeId)
+ ((new_code, (fn_entrypoint f)), pTreeId)
end