summaryrefslogtreecommitdiff
path: root/compiler/SymbolicToPure.ml
diff options
context:
space:
mode:
authorSon Ho2023-12-22 19:09:16 +0100
committerSon Ho2023-12-22 19:09:16 +0100
commit3688596f27a1ba461f48e88446b8812ec73f1a2f (patch)
tree54c620f0370e20cdcdcf4b8e889a2f306addb429 /compiler/SymbolicToPure.ml
parent632e2ddc0c5ed0c785b37fdc41394336e467f623 (diff)
Add an option to split the fwd/back functions and fix a minor issue
Diffstat (limited to 'compiler/SymbolicToPure.ml')
-rw-r--r--compiler/SymbolicToPure.ml19
1 files changed, 12 insertions, 7 deletions
diff --git a/compiler/SymbolicToPure.ml b/compiler/SymbolicToPure.ml
index 41922cb5..4674b61c 100644
--- a/compiler/SymbolicToPure.ml
+++ b/compiler/SymbolicToPure.ml
@@ -1076,16 +1076,20 @@ let translate_fun_sig_with_regions_hierarchy_to_decomposed
let inputs_no_state =
List.map (fun ty -> (Some "ret", ty)) inputs_no_state
in
- (* We consider the backward function as stateful and potentially failing
+ (* In case we merge the forward/backward functions:
+ we consider the backward function as stateful and potentially failing
**only if it has inputs** (for the "potentially failing": if it has
not inputs, we directly evaluate it in the body of the forward function).
*)
let back_effect_info =
- {
- back_effect_info with
- stateful = back_effect_info.stateful && inputs_no_state <> [];
- can_fail = back_effect_info.can_fail && inputs_no_state <> [];
- }
+ if !Config.return_back_funs then
+ let b = inputs_no_state <> [] in
+ {
+ back_effect_info with
+ stateful = back_effect_info.stateful && b;
+ can_fail = back_effect_info.can_fail && b;
+ }
+ else back_effect_info
in
let state =
if back_effect_info.stateful then [ (None, mk_state_ty) ] else []
@@ -1093,7 +1097,8 @@ let translate_fun_sig_with_regions_hierarchy_to_decomposed
let inputs = inputs_no_state @ state in
let output_names, outputs = compute_back_outputs_for_gid gid in
let filter =
- !Config.simplify_merged_fwd_backs && inputs = [] && outputs = []
+ !Config.simplify_merged_fwd_backs
+ && !Config.return_back_funs && inputs = [] && outputs = []
in
let info =
{