From f6ad93e7cbbb3e43b045ae3313e556ea70e54c8f Mon Sep 17 00:00:00 2001 From: Alasdair Armstrong Date: Fri, 3 May 2019 17:28:30 +0100 Subject: 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. --- src/specialize.ml | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'src/specialize.ml') 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 -- cgit v1.2.3