You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.6 KiB
66 lines
2.6 KiB
8 years ago
|
(*
|
||
|
* Copyright (c) 2016 - present Facebook, Inc.
|
||
|
* All rights reserved.
|
||
|
*
|
||
|
* This source code is licensed under the BSD style license found in the
|
||
|
* LICENSE file in the root directory of this source tree. An additional grant
|
||
|
* of patent rights can be found in the PATENTS file in the same directory.
|
||
|
*)
|
||
|
|
||
8 years ago
|
open! IStd
|
||
|
|
||
8 years ago
|
type 'a state = { pre: 'a; post: 'a; visit_count: int; }
|
||
|
|
||
|
(** type of an intraprocedural abstract interpreter *)
|
||
|
module type S = sig
|
||
8 years ago
|
module TransferFunctions : TransferFunctions.SIL
|
||
8 years ago
|
|
||
8 years ago
|
module InvariantMap : Caml.Map.S with type key = TransferFunctions.CFG.id
|
||
8 years ago
|
|
||
|
(** invariant map from node id -> state representing postcondition for node id *)
|
||
|
type invariant_map = TransferFunctions.Domain.astate state InvariantMap.t
|
||
|
|
||
8 years ago
|
(** compute and return the postcondition for the given procedure starting from [initial]. If
|
||
|
[debug] is true, print html debugging output. *)
|
||
8 years ago
|
val compute_post :
|
||
8 years ago
|
?debug:bool ->
|
||
8 years ago
|
TransferFunctions.extras ProcData.t ->
|
||
|
initial:TransferFunctions.Domain.astate ->
|
||
|
TransferFunctions.Domain.astate option
|
||
|
|
||
8 years ago
|
(** compute and return invariant map for the given CFG/procedure starting from [initial]. if
|
||
|
[debug] is true, print html debugging output. *)
|
||
8 years ago
|
val exec_cfg :
|
||
|
TransferFunctions.CFG.t ->
|
||
|
TransferFunctions.extras ProcData.t ->
|
||
|
initial:TransferFunctions.Domain.astate ->
|
||
8 years ago
|
debug:bool ->
|
||
8 years ago
|
invariant_map
|
||
|
|
||
|
(** compute and return invariant map for the given procedure starting from [initial] *)
|
||
|
val exec_pdesc :
|
||
|
TransferFunctions.extras ProcData.t -> initial:TransferFunctions.Domain.astate -> invariant_map
|
||
8 years ago
|
|
||
|
(** extract the postcondition for a node id from the given invariant map *)
|
||
|
val extract_post : InvariantMap.key -> 'a state InvariantMap.t -> 'a option
|
||
|
|
||
|
(** extract the precondition for a node id from the given invariant map *)
|
||
|
val extract_pre : InvariantMap.key -> 'a state InvariantMap.t -> 'a option
|
||
|
|
||
|
(** extract the state for a node id from the given invariant map *)
|
||
|
val extract_state : InvariantMap.key -> 'a InvariantMap.t -> 'a option
|
||
|
end
|
||
|
|
||
|
(** create an intraprocedural abstract interpreter from a scheduler and transfer functions *)
|
||
|
module MakeNoCFG
|
||
|
(Scheduler : Scheduler.S)
|
||
8 years ago
|
(TransferFunctions : TransferFunctions.SIL with module CFG = Scheduler.CFG) :
|
||
8 years ago
|
S with module TransferFunctions = TransferFunctions
|
||
|
|
||
|
(** create an intraprocedural abstract interpreter from a CFG and functors for creating a scheduler/
|
||
|
transfer functions from a CFG *)
|
||
|
module Make
|
||
|
(CFG : ProcCfg.S)
|
||
8 years ago
|
(MakeTransferFunctions : TransferFunctions.MakeSIL) :
|
||
8 years ago
|
S with module TransferFunctions = MakeTransferFunctions(CFG)
|