[sledge] Identify intrinsics using strings instead of variables

Reviewed By: jvillard

Differential Revision: D24886574

fbshipit-source-id: 70059713f
master
Josh Berdine 4 years ago committed by Facebook GitHub Bot
parent f821ca9634
commit 0aebb07757

@ -69,8 +69,8 @@ let exec_inst inst pre =
|> Option.map ~f:simplify |> Option.map ~f:simplify
let exec_intrinsic ~skip_throw r i es q = let exec_intrinsic ~skip_throw r i es q =
Exec.intrinsic ~skip_throw q (Option.map ~f:X.reg r) (X.func i) Exec.intrinsic ~skip_throw q (Option.map ~f:X.reg r)
(List.map ~f:X.term es) (Llair.Function.name i) (List.map ~f:X.term es)
|> Option.map ~f:(Option.map ~f:simplify) |> Option.map ~f:(Option.map ~f:simplify)
let value_determined_by ctx us a = let value_determined_by ctx us a =

@ -735,11 +735,12 @@ let nondet pre = function Some reg -> kill pre reg | None -> pre
let abort _ = None let abort _ = None
let intrinsic ~skip_throw : let intrinsic ~skip_throw :
Sh.t -> Var.t option -> Var.t -> Term.t list -> Sh.t option option = Sh.t -> Var.t option -> string -> Term.t list -> Sh.t option option =
fun pre areturn intrinsic actuals -> fun pre areturn intrinsic actuals ->
let name = let name =
let n = Var.name intrinsic in match String.index intrinsic '.' with
match String.index n '.' with None -> n | Some i -> String.take i n | None -> intrinsic
| Some i -> String.take i intrinsic
in in
let skip pre = Some (Some pre) in let skip pre = Some (Some pre) in
( match (areturn, name, actuals) with ( match (areturn, name, actuals) with
@ -820,7 +821,7 @@ let intrinsic ~skip_throw :
| None -> () | None -> ()
| Some _ -> | Some _ ->
[%Trace.info [%Trace.info
"@[<2>exec intrinsic@ @[%a%a(@[%a@])@] from@ @[{ %a@ }@]@]" "@[<2>exec intrinsic@ @[%a%s(@[%a@])@] from@ @[{ %a@ }@]@]"
(Option.pp "%a := " Var.pp) (Option.pp "%a := " Var.pp)
areturn Var.pp intrinsic (List.pp ",@ " Term.pp) areturn intrinsic (List.pp ",@ " Term.pp) (List.rev actuals) Sh.pp
(List.rev actuals) Sh.pp pre] pre]

@ -26,6 +26,6 @@ val intrinsic :
skip_throw:bool skip_throw:bool
-> Sh.t -> Sh.t
-> Var.t option -> Var.t option
-> Var.t -> string
-> Term.t list -> Term.t list
-> Sh.t option option -> Sh.t option option

Loading…
Cancel
Save