From f34d5cca62ba2f7d6f7d01645092e52061812f84 Mon Sep 17 00:00:00 2001 From: Cyril SIX Date: Fri, 17 Jan 2020 16:57:38 +0100 Subject: Set up the groundbase for doing the duplication --- backend/Duplicateaux.ml | 18 ++++++++++++++---- 1 file 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 -- cgit