summaryrefslogtreecommitdiff
path: root/src/isail.ml
diff options
context:
space:
mode:
authorAlasdair Armstrong2019-06-04 16:37:48 +0100
committerAlasdair Armstrong2019-06-04 16:37:48 +0100
commit6d3a6edcd616621eb40420cfb16a34762a32c5c1 (patch)
treed3a753af05b4a3d40a5ce0c6eb7711770105caba /src/isail.ml
parente24587857d1e61b428d784c699a683984c00ce36 (diff)
parent239e13dc149af80f979ea95a3c9b42220481a0a1 (diff)
Merge branch 'sail2' into separate_bv
Diffstat (limited to 'src/isail.ml')
-rw-r--r--src/isail.ml23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/isail.ml b/src/isail.ml
index 094ad3df..9e9b6236 100644
--- a/src/isail.ml
+++ b/src/isail.ml
@@ -266,6 +266,10 @@ let help =
| ":compile" ->
sprintf ":compile %s - Compile AST to a specified target, valid targets are lem, coq, ocaml, c, and ir (intermediate representation)"
(color yellow "<target>")
+ | ":slice" ->
+ ":slice - Slice AST to the definitions which the functions given by :slice_roots depend on, up to the functions given by :slice_cuts"
+ | ":thin_slice" ->
+ ":thin_slice - Slice AST to the function definitions given with :slice_roots"
| "" ->
sprintf "Type %s for a list of commands, and %s %s for information about a specific command"
(color green ":commands") (color green ":help") (color yellow "<command>")
@@ -425,7 +429,7 @@ let handle_input' input =
| Arg.Bad message | Arg.Help message -> print_endline message
end;
| ":spec" ->
- let ast, env = Specialize.(specialize' 1 int_specialization !Interactive.ast !Interactive.env) in
+ let ast, env = Specialize.(specialize_passes 1 int_specialization !Interactive.env !Interactive.ast) in
Interactive.ast := ast;
Interactive.env := env;
interactive_state := initial_state !Interactive.ast !Interactive.env Value.primops
@@ -540,7 +544,22 @@ let handle_input' input =
let roots = !slice_roots |> IdSet.elements |> List.map (fun id -> Function id) |> SliceNodeSet.of_list in
let cuts = !slice_cuts |> IdSet.elements |> List.map (fun id -> Function id) |> SliceNodeSet.of_list in
let g = G.prune roots cuts g in
- Interactive.ast := Slice.filter_ast !slice_cuts g !Interactive.ast
+ Interactive.ast := Slice.filter_ast cuts g !Interactive.ast
+ | ":thin_slice" ->
+ let open Slice in
+ let module SliceNodeSet = Set.Make(Slice.Node) in
+ let module SliceNodeMap = Map.Make(Slice.Node) in
+ let module G = Graph.Make(Slice.Node) in
+ let g = Slice.graph_of_ast !Interactive.ast in
+ let roots = !slice_roots |> IdSet.elements |> List.map (fun id -> Function id) |> SliceNodeSet.of_list in
+ let keep = function
+ | (Function id,_) when IdSet.mem id (!slice_roots) -> None
+ | (Function id,_) -> Some (Function id)
+ | _ -> None
+ in
+ let cuts = SliceNodeMap.bindings g |> Util.map_filter keep |> SliceNodeSet.of_list in
+ let g = G.prune roots cuts g in
+ Interactive.ast := Slice.filter_ast cuts g !Interactive.ast
| ":list_rewrites" ->
let print_rewrite (name, rw) =
print_endline (name ^ " " ^ Util.(String.concat " " (describe_rewrite rw) |> yellow |> clear))