summaryrefslogtreecommitdiff
path: root/compiler/PureUtils.ml
diff options
context:
space:
mode:
authorSon Ho2022-12-17 10:27:12 +0100
committerSon HO2023-02-03 11:21:46 +0100
commit66638a2a96c7639553a340917b87e26d94265c5e (patch)
treea0219df7582ca17784135345924790dc26a7e315 /compiler/PureUtils.ml
parent07621dcf488eef1c4a4ab797c21cc34ab474d225 (diff)
Fix various issues with the generation of code for the loops
Diffstat (limited to '')
-rw-r--r--compiler/PureUtils.ml15
1 files changed, 15 insertions, 0 deletions
diff --git a/compiler/PureUtils.ml b/compiler/PureUtils.ml
index b5c9b686..e1421f5a 100644
--- a/compiler/PureUtils.ml
+++ b/compiler/PureUtils.ml
@@ -7,6 +7,9 @@ let log = Logging.pure_utils_log
type regular_fun_id = A.fun_id * T.RegionGroupId.id option
[@@deriving show, ord]
+(** We use this type as a key for lookups *)
+type fun_loop_id = A.FunDeclId.id * LoopId.id option [@@deriving show, ord]
+
module RegularFunIdOrderedType = struct
type t = regular_fun_id
@@ -30,6 +33,18 @@ end
module FunOrOpIdMap = Collections.MakeMap (FunOrOpIdOrderedType)
module FunOrOpIdSet = Collections.MakeSet (FunOrOpIdOrderedType)
+module FunLoopIdOrderedType = struct
+ type t = fun_loop_id
+
+ let compare = compare_fun_loop_id
+ let to_string = show_fun_loop_id
+ let pp_t = pp_fun_loop_id
+ let show_t = show_fun_loop_id
+end
+
+module FunLoopIdMap = Collections.MakeMap (FunLoopIdOrderedType)
+module FunLoopIdSet = Collections.MakeSet (FunLoopIdOrderedType)
+
let dest_arrow_ty (ty : ty) : ty * ty =
match ty with
| Arrow (arg_ty, ret_ty) -> (arg_ty, ret_ty)