@ -443,7 +443,7 @@ module Func = struct
let find functions name = Map . find functions name
let find functions name = Map . find functions name
let mk ~ ( name : Global . t ) ~ params ~ entry ~ cfg =
let mk ~ ( name : Global . t ) ~ params ~ freturn ~ fthrow ~ entry ~ cfg =
let locals =
let locals =
let locals_cmnd locals cmnd =
let locals_cmnd locals cmnd =
Vector . fold_right ~ f : Inst . union_locals cmnd ~ init : locals
Vector . fold_right ~ f : Inst . union_locals cmnd ~ init : locals
@ -454,15 +454,6 @@ module Func = struct
let init = locals_block Var . Set . empty entry in
let init = locals_block Var . Set . empty entry in
Vector . fold ~ f : locals_block cfg ~ init
Vector . fold ~ f : locals_block cfg ~ init
in
in
let wrt = Set . add_list params locals in
let freturn , wrt =
match name . typ with
| Pointer { elt = Function { return = Some _ ; _ } } ->
let freturn , wrt = Var . fresh " freturn " ~ wrt in
( Some freturn , wrt )
| _ -> ( None , wrt )
in
let fthrow , _ = Var . fresh " fthrow " ~ wrt in
let func = { name ; params ; freturn ; fthrow ; locals ; entry ; cfg } in
let func = { name ; params ; freturn ; fthrow ; locals ; entry ; cfg } in
let resolve_parent_and_jumps block =
let resolve_parent_and_jumps block =
block . parent <- func ;
block . parent <- func ;
@ -484,12 +475,12 @@ module Func = struct
Vector . iter cfg ~ f : resolve_parent_and_jumps ;
Vector . iter cfg ~ f : resolve_parent_and_jumps ;
func | > check invariant
func | > check invariant
let mk_undefined ~ name ~ params =
let mk_undefined ~ name ~ params ~freturn ~ fthrow =
let entry =
let entry =
Block . mk ~ lbl : " " ~ cmnd : Vector . empty ~ term : Term . unreachable
Block . mk ~ lbl : " " ~ cmnd : Vector . empty ~ term : Term . unreachable
in
in
let cfg = Vector . empty in
let cfg = Vector . empty in
mk ~ name ~ entry ~ params ~ cfg
mk ~ name ~ entry ~ params ~ freturn ~ fthrow ~ cfg
end
end
(* * Derived meta-data *)
(* * Derived meta-data *)