summaryrefslogtreecommitdiff
path: root/compiler/Contexts.ml
diff options
context:
space:
mode:
authorSon Ho2023-08-18 10:27:55 +0200
committerSon Ho2023-08-18 10:27:55 +0200
commit26c25bf375742cf4d5a0ab160b9646e90c067f18 (patch)
tree2b9363b5fe9fca6d1bdf154ea5fb4f21bc706e2a /compiler/Contexts.ml
parent316c386bcdbb66accdd65a311ca978b6d4606695 (diff)
Update following the introduction of ConstantExpr
Diffstat (limited to 'compiler/Contexts.ml')
-rw-r--r--compiler/Contexts.ml9
1 files changed, 9 insertions, 0 deletions
diff --git a/compiler/Contexts.ml b/compiler/Contexts.ml
index 2ca5653d..14b5d559 100644
--- a/compiler/Contexts.ml
+++ b/compiler/Contexts.ml
@@ -263,6 +263,10 @@ type eval_ctx = {
region_groups : RegionGroupId.id list;
type_vars : type_var list;
const_generic_vars : const_generic_var list;
+ const_generic_vars_map : typed_value Types.ConstGenericVarId.Map.t;
+ (** The map from const generic vars to their values. Those values
+ can be symbolic values or concrete values (in the latter case:
+ if we run in interpreter mode) *)
env : env;
ended_regions : RegionId.Set.t;
}
@@ -312,6 +316,11 @@ let env_lookup_var_value (env : env) (vid : VarId.id) : typed_value =
let ctx_lookup_var_value (ctx : eval_ctx) (vid : VarId.id) : typed_value =
env_lookup_var_value ctx.env vid
+(** Retrieve a const generic value in an evaluation context *)
+let ctx_lookup_const_generic_value (ctx : eval_ctx) (vid : ConstGenericVarId.id)
+ : typed_value =
+ Types.ConstGenericVarId.Map.find vid ctx.const_generic_vars_map
+
(** Update a variable's value in the current frame.
This is a helper function: it can break invariants and doesn't perform