summaryrefslogtreecommitdiff
path: root/src/specialize.ml
diff options
context:
space:
mode:
authorAlasdair Armstrong2019-05-03 17:28:30 +0100
committerAlasdair Armstrong2019-05-03 17:28:30 +0100
commitf6ad93e7cbbb3e43b045ae3313e556ea70e54c8f (patch)
treec6f1bc2e499046cb7e5c22f750e0e63162f6d253 /src/specialize.ml
parentc7a3389c34eebac4fed7764f339f4cd1b2b204f7 (diff)
Jib: Fix optimizations for SMT IR changes
Fixes C backend optimizations that were disabled due to changes in the IR while working on the SMT generation. Also add a -Oaarch64_fast option that optimizes any integer within a struct to be an int64_t, which is safe for the ARM v8.5 spec and improves performance significantly (reduces Linux boot times by 4-5 minutes). Eventually this should probably be a directive that can be attached to any arbitrary struct/type. Fixes the -c_specialize option for ARM v8.5. However this only gives a very small performance improvment for a very large increase in compilation time however.
Diffstat (limited to 'src/specialize.ml')
-rw-r--r--src/specialize.ml10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/specialize.ml b/src/specialize.ml
index b2eb5314..a601974e 100644
--- a/src/specialize.ml
+++ b/src/specialize.ml
@@ -73,7 +73,7 @@ let typ_ord_specialization = {
let int_specialization = {
is_polymorphic = is_int_kopt;
- instantiation_filter = (fun _ arg -> match arg with A_aux (A_nexp _, _) -> true | _ -> false);
+ instantiation_filter = (fun _ arg -> match arg with A_aux (A_nexp (Nexp_aux (Nexp_constant _, _)), _) -> true | _ -> false);
extern_filter = (fun externs -> match Ast_util.extern_assoc "c" externs with Some _ -> true | None -> false)
}
@@ -574,8 +574,12 @@ let specialize_ids spec ids ast =
| None -> ()
end;
let ast, _ = Type_error.check Type_check.initial_env ast in
- let ast =
- List.fold_left (fun ast id -> rewrite_polymorphic_calls spec id ast) ast (IdSet.elements ids)
+ let _, ast =
+ List.fold_left
+ (fun (n, ast) id ->
+ Util.progress "Rewriting " (string_of_id id) n total;
+ (n + 1, rewrite_polymorphic_calls spec id ast))
+ (1, ast) (IdSet.elements ids)
in
let ast, env = Type_error.check Type_check.initial_env ast in
let ast = remove_unused_valspecs env ast in