|
|
@ -1289,6 +1289,8 @@ let size_of t =
|
|
|
|
(** Transform *)
|
|
|
|
(** Transform *)
|
|
|
|
|
|
|
|
|
|
|
|
let map e ~f =
|
|
|
|
let map e ~f =
|
|
|
|
|
|
|
|
let map_ : (t -> t) -> t -> t =
|
|
|
|
|
|
|
|
fun map_ e ->
|
|
|
|
let map_bin mk ~f x y =
|
|
|
|
let map_bin mk ~f x y =
|
|
|
|
let x' = f x in
|
|
|
|
let x' = f x in
|
|
|
|
let y' = f y in
|
|
|
|
let y' = f y in
|
|
|
@ -1309,13 +1311,16 @@ let map e ~f =
|
|
|
|
| Splat {byt; siz} -> map_bin simp_splat ~f byt siz
|
|
|
|
| Splat {byt; siz} -> map_bin simp_splat ~f byt siz
|
|
|
|
| Memory {siz; arr} -> map_bin simp_memory ~f siz arr
|
|
|
|
| Memory {siz; arr} -> map_bin simp_memory ~f siz arr
|
|
|
|
| Concat {args} -> map_vector simp_concat ~f args
|
|
|
|
| Concat {args} -> map_vector simp_concat ~f args
|
|
|
|
|
|
|
|
| Struct_rec {elts= args} -> Struct_rec {elts= Vector.map args ~f:map_}
|
|
|
|
| _ -> e
|
|
|
|
| _ -> e
|
|
|
|
|
|
|
|
in
|
|
|
|
|
|
|
|
fix map_ (fun e -> e) e
|
|
|
|
|
|
|
|
|
|
|
|
let rename e sub =
|
|
|
|
let rename e sub =
|
|
|
|
let rec rename_ e sub =
|
|
|
|
let rec rename_ e sub =
|
|
|
|
match e with
|
|
|
|
match e with
|
|
|
|
| Var _ -> Var.Subst.apply sub e
|
|
|
|
| Var _ -> Var.Subst.apply sub e
|
|
|
|
| _ -> map e ~f:(fun f -> rename_ f sub)
|
|
|
|
| _ -> map ~f:(fun f -> rename_ f sub) e
|
|
|
|
in
|
|
|
|
in
|
|
|
|
rename_ e sub |> check (invariant ~partial:true)
|
|
|
|
rename_ e sub |> check (invariant ~partial:true)
|
|
|
|
|
|
|
|
|
|
|
|