|
|
@ -71,7 +71,6 @@ module T0 = struct
|
|
|
|
| Label of {parent: string; name: string}
|
|
|
|
| Label of {parent: string; name: string}
|
|
|
|
| App of {op: t; arg: t}
|
|
|
|
| App of {op: t; arg: t}
|
|
|
|
(* pointer and memory constants and operations *)
|
|
|
|
(* pointer and memory constants and operations *)
|
|
|
|
| Null
|
|
|
|
|
|
|
|
| Splat
|
|
|
|
| Splat
|
|
|
|
| Memory
|
|
|
|
| Memory
|
|
|
|
| Concat
|
|
|
|
| Concat
|
|
|
@ -161,7 +160,7 @@ module T = struct
|
|
|
|
| Var {name; id} -> pf "%%%s_%d" name id
|
|
|
|
| Var {name; id} -> pf "%%%s_%d" name id
|
|
|
|
| Nondet {msg} -> pf "nondet \"%s\"" msg
|
|
|
|
| Nondet {msg} -> pf "nondet \"%s\"" msg
|
|
|
|
| Label {name} -> pf "%s" name
|
|
|
|
| Label {name} -> pf "%s" name
|
|
|
|
| Null -> pf "null"
|
|
|
|
| Integer {data; typ= Pointer _} when Z.equal Z.zero data -> pf "null"
|
|
|
|
| Splat -> pf "^"
|
|
|
|
| Splat -> pf "^"
|
|
|
|
| Memory -> pf "⟨_,_⟩"
|
|
|
|
| Memory -> pf "⟨_,_⟩"
|
|
|
|
| App {op= App {op= Memory; arg= siz}; arg= bytes} ->
|
|
|
|
| App {op= App {op= Memory; arg= siz}; arg= bytes} ->
|
|
|
@ -262,8 +261,7 @@ let invariant ?(partial = false) e =
|
|
|
|
| Integer {data; typ= Integer {bits}} ->
|
|
|
|
| Integer {data; typ= Integer {bits}} ->
|
|
|
|
assert_arity 0 ;
|
|
|
|
assert_arity 0 ;
|
|
|
|
assert (Z.numbits data <= bits)
|
|
|
|
assert (Z.numbits data <= bits)
|
|
|
|
| Var _ | Nondet _ | Label _ | Null | Integer _ | Float _ ->
|
|
|
|
| Var _ | Nondet _ | Label _ | Integer _ | Float _ -> assert_arity 0
|
|
|
|
assert_arity 0
|
|
|
|
|
|
|
|
| Convert {dst; src} ->
|
|
|
|
| Convert {dst; src} ->
|
|
|
|
( match args with
|
|
|
|
( match args with
|
|
|
|
| [Integer {typ}] -> assert (Typ.equal src typ)
|
|
|
|
| [Integer {typ}] -> assert (Typ.equal src typ)
|
|
|
@ -441,8 +439,8 @@ let fv e = fold_vars e ~f:Set.add ~init:Var.Set.empty
|
|
|
|
let var x = x
|
|
|
|
let var x = x
|
|
|
|
let nondet msg = Nondet {msg} |> check invariant
|
|
|
|
let nondet msg = Nondet {msg} |> check invariant
|
|
|
|
let label ~parent ~name = Label {parent; name} |> check invariant
|
|
|
|
let label ~parent ~name = Label {parent; name} |> check invariant
|
|
|
|
let null = Null |> check invariant
|
|
|
|
|
|
|
|
let integer data typ = Integer {data; typ} |> check invariant
|
|
|
|
let integer data typ = Integer {data; typ} |> check invariant
|
|
|
|
|
|
|
|
let null = integer Z.zero Typ.ptr
|
|
|
|
let bool b = integer (Z.of_bool b) Typ.bool
|
|
|
|
let bool b = integer (Z.of_bool b) Typ.bool
|
|
|
|
let float data = Float {data} |> check invariant
|
|
|
|
let float data = Float {data} |> check invariant
|
|
|
|
|
|
|
|
|
|
|
@ -846,7 +844,7 @@ let update ~rcd ~elt ~idx = app3 Update rcd elt idx
|
|
|
|
|
|
|
|
|
|
|
|
let struct_rec key =
|
|
|
|
let struct_rec key =
|
|
|
|
let memo_id = Hashtbl.create key in
|
|
|
|
let memo_id = Hashtbl.create key in
|
|
|
|
let dummy = Null in
|
|
|
|
let dummy = null in
|
|
|
|
Staged.stage
|
|
|
|
Staged.stage
|
|
|
|
@@ fun ~id elt_thks ->
|
|
|
|
@@ fun ~id elt_thks ->
|
|
|
|
match Hashtbl.find memo_id id with
|
|
|
|
match Hashtbl.find memo_id id with
|
|
|
|