summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBrian Campbell2018-01-29 09:18:08 +0000
committerBrian Campbell2018-01-29 09:18:08 +0000
commit3adfbd69df79862bb9ac8b57f4777a30dac24ff3 (patch)
tree9dcce1ab1c12e2ce82630bd8ae4471b4ca1e0ba1 /src
parent4e4420f00984c11782445210709e665370e99358 (diff)
Turn off warnings when rechecking after mono
Diffstat (limited to 'src')
-rw-r--r--src/monomorphise.ml27
-rw-r--r--src/monomorphise.mli5
-rw-r--r--src/process_file.ml8
3 files changed, 25 insertions, 15 deletions
diff --git a/src/monomorphise.ml b/src/monomorphise.ml
index d911e537..5177a1a1 100644
--- a/src/monomorphise.ml
+++ b/src/monomorphise.ml
@@ -3123,15 +3123,23 @@ type options = {
debug_analysis : int;
rewrites : bool;
rewrite_size_parameters : bool;
- all_split_errors : bool
+ all_split_errors : bool;
+ dump_raw: bool
}
+let recheck defs =
+ let w = !Util.opt_warnings in
+ let () = Util.opt_warnings := false in
+ let r = Type_check.check (Type_check.Env.no_casts Type_check.initial_env) defs in
+ let () = Util.opt_warnings := w in
+ r
+
let monomorphise opts splits env defs =
let (defs,env) =
if opts.rewrites then
let defs = MonoRewrites.mono_rewrite defs in
(* TODO: is this necessary? *)
- Type_check.check (Type_check.Env.no_casts Type_check.initial_env) defs
+ recheck defs
else (defs,env)
in
(*let _ = Pretty_print.pp_defs stdout defs in*)
@@ -3145,9 +3153,12 @@ let monomorphise opts splits env defs =
(* TODO: currently doing this because constant propagation leaves numeric literals as
int, try to avoid this later; also use final env for DEF_spec case above, because the
type checker doesn't store the env at that point :( *)
- if opts.rewrite_size_parameters then
- let (defs,env) = Type_check.check (Type_check.Env.no_casts Type_check.initial_env) defs in
- let defs = AtomToItself.rewrite_size_parameters env defs in
- defs
- else
- defs
+ let defs = if opts.rewrite_size_parameters then
+ let (defs,env) = recheck defs in
+ let defs = AtomToItself.rewrite_size_parameters env defs in
+ defs
+ else
+ defs
+ in
+ let () = if opts.dump_raw then Pretty_print_sail.pp_defs stdout defs else () in
+ recheck defs
diff --git a/src/monomorphise.mli b/src/monomorphise.mli
index 8e0c1ede..11713511 100644
--- a/src/monomorphise.mli
+++ b/src/monomorphise.mli
@@ -53,7 +53,8 @@ type options = {
debug_analysis : int; (* Debug output level for the automatic analysis *)
rewrites : bool; (* Experimental rewrites for variable-sized operations *)
rewrite_size_parameters : bool; (* Make implicit type parameters explicit for (e.g.) lem *)
- all_split_errors : bool
+ all_split_errors : bool;
+ dump_raw: bool
}
val monomorphise :
@@ -61,4 +62,4 @@ val monomorphise :
((string * int) * string) list -> (* List of splits from the command line *)
Type_check.Env.t ->
Type_check.tannot Ast.defs ->
- Type_check.tannot Ast.defs
+ Type_check.tannot Ast.defs * Type_check.Env.t
diff --git a/src/process_file.ml b/src/process_file.ml
index cb8c8011..1ba8069f 100644
--- a/src/process_file.ml
+++ b/src/process_file.ml
@@ -196,12 +196,10 @@ let monomorphise_ast locs type_env ast =
debug_analysis = !opt_dmono_analysis;
rewrites = !opt_mono_rewrites;
rewrite_size_parameters = !Pretty_print_lem.opt_mwords;
- all_split_errors = !opt_dall_split_errors
+ all_split_errors = !opt_dall_split_errors;
+ dump_raw = !opt_ddump_raw_mono_ast
} in
- let ast = monomorphise opts locs type_env ast in
- let () = if !opt_ddump_raw_mono_ast then Pretty_print_sail.pp_defs stdout ast else () in
- let ienv = Type_check.Env.no_casts Type_check.initial_env in
- Type_check.check ienv ast
+ monomorphise opts locs type_env ast
let open_output_with_check file_name =
let (temp_file_name, o) = Filename.open_temp_file "ll_temp" "" in