Added dataflow module
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
open Cfg
|
||||
open Analysis
|
||||
open Analysis.Cfg
|
||||
|
||||
module SimpleStatements = struct
|
||||
type t =
|
||||
@ -63,7 +64,7 @@ module SimpleStatements = struct
|
||||
List.iter (fun x -> pp ppf x; Printf.printf "; ") c
|
||||
end
|
||||
|
||||
module SSCfg = Cfg.Make(SimpleStatements)
|
||||
module SSCfg = Cfg.Make(SimpleStatements)
|
||||
|
||||
let rec convert_c (prevcfg: SSCfg.t) (prg: Types.c_exp) : SSCfg.t =
|
||||
let open SimpleStatements in
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
open Analysis
|
||||
|
||||
module SimpleStatements : sig
|
||||
type t =
|
||||
| SimpleSkip
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
open Analysis
|
||||
|
||||
module RISCSimpleStatements = struct
|
||||
type register = {
|
||||
index: string
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
open Analysis
|
||||
|
||||
module RISCSimpleStatements : sig
|
||||
type register = {
|
||||
index: string
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
open Analysis
|
||||
|
||||
let globalCounterLabel = ref 0
|
||||
|
||||
let nextLabel () : string =
|
||||
|
||||
20
lib/miniImp/definedVariables.ml
Normal file
20
lib/miniImp/definedVariables.ml
Normal file
@ -0,0 +1,20 @@
|
||||
open Analysis
|
||||
|
||||
module Variable = struct
|
||||
type t = string
|
||||
let pp (ppf: out_channel) (v: t) : unit =
|
||||
Printf.fprintf ppf "%s" v
|
||||
|
||||
let pplist (ppf: out_channel) (vv: t list) : unit =
|
||||
List.iter (Printf.fprintf ppf "%s, ") vv
|
||||
end
|
||||
|
||||
module RISCCfg = CfgRISC.RISCCfg
|
||||
|
||||
module DVCfg = Dataflow.Make (CfgRISC.RISCSimpleStatements) (Variable)
|
||||
|
||||
let compute_defined_variables (cfg: RISCCfg.t) : DVCfg.t =
|
||||
DVCfg.from_cfg cfg
|
||||
|
||||
let compute_cfg (dvcfg : DVCfg.t) : RISCCfg.t =
|
||||
DVCfg.to_cfg dvcfg
|
||||
15
lib/miniImp/definedVariables.mli
Normal file
15
lib/miniImp/definedVariables.mli
Normal file
@ -0,0 +1,15 @@
|
||||
open Analysis
|
||||
|
||||
module Variable : sig
|
||||
type t
|
||||
val pp : out_channel -> t -> unit
|
||||
end
|
||||
|
||||
module RISCCfg = CfgRISC.RISCCfg
|
||||
|
||||
module DVCfg : Dataflow.C with type elt = CfgRISC.RISCSimpleStatements.t
|
||||
and type internal = Variable.t
|
||||
|
||||
val compute_defined_variables : RISCCfg.t -> DVCfg.t
|
||||
|
||||
val compute_cfg : DVCfg.t -> RISCCfg.t
|
||||
@ -12,8 +12,8 @@
|
||||
(public_name miniImp)
|
||||
(modules Lexer Parser Types Semantics
|
||||
CfgImp ReplacePowerMod
|
||||
CfgRISC
|
||||
CfgRISC DefinedVariables
|
||||
RISC RISCSemantics)
|
||||
(libraries cfg utility menhirLib))
|
||||
(libraries analysis utility menhirLib))
|
||||
|
||||
(include_subdirs qualified)
|
||||
|
||||
Reference in New Issue
Block a user