[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
let exec_intrinsic ~skip_throw r i es q =
Exec.intrinsic ~skip_throw q (Option.map ~f:X.reg r) (X.func i)
(List.map ~f:X.term es)
Exec.intrinsic ~skip_throw q (Option.map ~f:X.reg r)
(Llair.Function.name i) (List.map ~f:X.term es)
|> Option.map ~f:(Option.map ~f:simplify)
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 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 ->
let name =
let n = Var.name intrinsic in
match String.index n '.' with None -> n | Some i -> String.take i n
match String.index intrinsic '.' with
| None -> intrinsic
| Some i -> String.take i intrinsic
in
let skip pre = Some (Some pre) in
( match (areturn, name, actuals) with
@ -820,7 +821,7 @@ let intrinsic ~skip_throw :
| None -> ()
| Some _ ->
[%Trace.info
"@[<2>exec intrinsic@ @[%a%a(@[%a@])@] from@ @[{ %a@ }@]@]"
"@[<2>exec intrinsic@ @[%a%s(@[%a@])@] from@ @[{ %a@ }@]@]"
(Option.pp "%a := " Var.pp)
areturn Var.pp intrinsic (List.pp ",@ " Term.pp)
(List.rev actuals) Sh.pp pre]
areturn intrinsic (List.pp ",@ " Term.pp) (List.rev actuals) Sh.pp
pre]

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

Loading…
Cancel
Save