summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlasdair Armstrong2019-05-31 17:12:08 +0100
committerAlasdair Armstrong2019-05-31 17:12:31 +0100
commit76566b02aadadaf4741cb23cce7fa9bb573b6f26 (patch)
tree6df221755964712722c4de6e6cfbf73a4edb911e /src
parent308207df86f824501efec740532f45e617da1a2e (diff)
Change specialization interface slightly
Diffstat (limited to 'src')
-rw-r--r--src/isail.ml2
-rw-r--r--src/sail.ml10
-rw-r--r--src/specialize.ml6
-rw-r--r--src/specialize.mli4
4 files changed, 11 insertions, 11 deletions
diff --git a/src/isail.ml b/src/isail.ml
index 8df34b13..9e9b6236 100644
--- a/src/isail.ml
+++ b/src/isail.ml
@@ -429,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
diff --git a/src/sail.ml b/src/sail.ml
index 19a87f6a..19db5289 100644
--- a/src/sail.ml
+++ b/src/sail.ml
@@ -450,10 +450,10 @@ let target name out_name ast type_envs =
close_out f
| Some "c" ->
- let ast_c, type_envs = Specialize.(specialize typ_ord_specialization ast type_envs) in
+ let ast_c, type_envs = Specialize.(specialize typ_ord_specialization type_envs ast) in
let ast_c, type_envs =
if !opt_specialize_c then
- Specialize.(specialize' 2 int_specialization ast_c type_envs)
+ Specialize.(specialize_passes 2 int_specialization type_envs ast_c)
else
ast_c, type_envs
in
@@ -464,7 +464,7 @@ let target name out_name ast type_envs =
if close then close_out output_chan else ()
| Some "ir" ->
- let ast_c, type_envs = Specialize.(specialize typ_ord_specialization ast type_envs) in
+ let ast_c, type_envs = Specialize.(specialize typ_ord_specialization type_envs ast) in
(* let ast_c, type_envs = Specialize.(specialize' 2 int_specialization_with_externs ast_c type_envs) in *)
let close, output_chan =
match !opt_file_out with
@@ -483,8 +483,8 @@ let target name out_name ast type_envs =
let open Ast_util in
let props = Property.find_properties ast in
Bindings.bindings props |> List.map fst |> IdSet.of_list |> Specialize.add_initial_calls;
- let ast_smt, type_envs = Specialize.(specialize typ_ord_specialization ast type_envs) in
- let ast_smt, type_envs = Specialize.(specialize' 2 int_specialization_with_externs ast_smt type_envs) in
+ let ast_smt, type_envs = Specialize.(specialize typ_ord_specialization type_envs ast) in
+ let ast_smt, type_envs = Specialize.(specialize_passes 2 int_specialization_with_externs type_envs ast_smt) in
let name_file =
match !opt_file_out with
| Some f -> fun str -> f ^ "_" ^ str ^ ".smt2"
diff --git a/src/specialize.ml b/src/specialize.ml
index a601974e..815514d1 100644
--- a/src/specialize.ml
+++ b/src/specialize.ml
@@ -586,7 +586,7 @@ let specialize_ids spec ids ast =
Profile.finish "specialization pass" t;
ast, env
-let rec specialize' n spec ast env =
+let rec specialize_passes n spec env ast =
if n = 0 then
ast, env
else
@@ -595,6 +595,6 @@ let rec specialize' n spec ast env =
ast, env
else
let ast, env = specialize_ids spec ids ast in
- specialize' (n - 1) spec ast env
+ specialize_passes (n - 1) spec env ast
-let specialize = specialize' (-1)
+let specialize = specialize_passes (-1)
diff --git a/src/specialize.mli b/src/specialize.mli
index 0a64112c..ddfb0c67 100644
--- a/src/specialize.mli
+++ b/src/specialize.mli
@@ -81,11 +81,11 @@ val add_initial_calls : IdSet.t -> unit
AST with [Type_check.initial_env]. The env parameter is the
environment to return if there is no polymorphism to remove, in
which case specialize returns the AST unmodified. *)
-val specialize : specialization -> tannot defs -> Env.t -> tannot defs * Env.t
+val specialize : specialization -> Env.t -> tannot defs -> tannot defs * Env.t
(** specialize' n performs at most n specialization passes. Useful for
int_specialization which is not guaranteed to terminate. *)
-val specialize' : int -> specialization -> tannot defs -> Env.t -> tannot defs * Env.t
+val specialize_passes : int -> specialization -> Env.t -> tannot defs -> tannot defs * Env.t
(** return all instantiations of a function id, with the
instantiations filtered according to the specialization. *)