diff options
author | Son Ho | 2022-01-28 01:38:34 +0100 |
---|---|---|
committer | Son Ho | 2022-01-28 01:38:34 +0100 |
commit | 3af881c9a5c8935e2238509d3447ec42e29b8404 (patch) | |
tree | 866dca0dce108745069c0675781fe773de792b47 | |
parent | a1d146761840e9515f6d4c6cc9f211dc303fc5c1 (diff) |
Finish the function PureMicroPasses.compute_pretty_names
Diffstat (limited to '')
-rw-r--r-- | src/PureMicroPasses.ml | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/PureMicroPasses.ml b/src/PureMicroPasses.ml index 5cd07fbe..aab19c11 100644 --- a/src/PureMicroPasses.ml +++ b/src/PureMicroPasses.ml @@ -213,8 +213,20 @@ let compute_pretty_names (def : fun_def) : fun_def = List.map (fun (v, mp) -> (update_typed_lvalue ctx v, mp)) lvs in (ctx, Let (Call (lvs, call), e)) - | Assign (lv, lmp, rv, rmp) -> raise Unimplemented - | Deconstruct (lvs, opt_variant_id, rv, rmp) -> raise Unimplemented + | Assign (lv, lmp, rv, rmp) -> + let ctx = add_left_constraint_typed_value lmp lv ctx in + let ctx = add_opt_right_constraint rmp rv ctx in + let ctx, e = update_expression e ctx in + let lv = update_typed_lvalue ctx lv in + (ctx, Let (Assign (lv, lmp, rv, rmp), e)) + | Deconstruct (lvs, opt_variant_id, rv, rmp) -> + let ctx = add_left_constraint_var_or_dummy_list ctx lvs in + let ctx = add_opt_right_constraint rmp rv ctx in + let ctx, e = update_expression e ctx in + let lvs = + List.map (fun (v, mp) -> (update_var_or_dummy ctx v, mp)) lvs + in + (ctx, Let (Deconstruct (lvs, opt_variant_id, rv, rmp), e)) (* *) and update_switch_body (scrut : typed_rvalue) (mp : mplace option) (body : switch_body) (ctx : pn_ctx) : pn_ctx * expression = |