From cad8a0149fed43752b8c99480e77f433169f4e3e Mon Sep 17 00:00:00 2001 From: Adrien Guatto Date: Mon, 23 Jan 2012 13:36:24 +0100 Subject: [PATCH] Option to perform type inference on all types --- compiler/main/heptc.ml | 3 ++- compiler/minils/analysis/interference.ml | 9 +++++---- compiler/minils/transformations/schedule_interf.ml | 5 ++++- compiler/utilities/global/compiler_options.ml | 3 ++- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/compiler/main/heptc.ml b/compiler/main/heptc.ml index 9bad16e..1bfe132 100644 --- a/compiler/main/heptc.ml +++ b/compiler/main/heptc.ml @@ -129,7 +129,8 @@ let main () = "-only-memalloc", Arg.Set do_mem_alloc, doc_memalloc_only; "-only-linear", Arg.Set do_linear_typing, doc_linear_only; "-old-scheduler", Arg.Set use_old_scheduler, doc_interf_scheduler; - "-O", Arg.Unit do_optim, doc_optim + "-O", Arg.Unit do_optim, doc_optim; + "-mall", Arg.Set interf_all, doc_interf_all; ] compile errmsg; with diff --git a/compiler/minils/analysis/interference.ml b/compiler/minils/analysis/interference.ml index 93639c3..1a9c168 100644 --- a/compiler/minils/analysis/interference.ml +++ b/compiler/minils/analysis/interference.ml @@ -142,13 +142,14 @@ module World = struct Signature.field_assoc f fields let is_optimized_ty ty = - match Modules.unalias_type ty with - | Tarray _ -> true - | Tid n -> + !Compiler_options.interf_all || + match Modules.unalias_type ty with + | Tarray _ -> true + | Tid n -> (match Modules.find_type n with | Signature.Tstruct _ -> true | _ -> false) - | _ -> false + | _ -> false let is_optimized iv = is_optimized_ty (ivar_type iv) diff --git a/compiler/minils/transformations/schedule_interf.ml b/compiler/minils/transformations/schedule_interf.ml index 5f69381..582508f 100644 --- a/compiler/minils/transformations/schedule_interf.ml +++ b/compiler/minils/transformations/schedule_interf.ml @@ -140,6 +140,9 @@ let node _ () f = f, () let program p = + let mall = !Compiler_options.interf_all in + (* Compiler_options.interf_all := false; *) let funs = { Mls_mapfold.defaults with Mls_mapfold.node_dec = node } in let p, () = Mls_mapfold.program_it funs () p in - p + Compiler_options.interf_all := mall; + p diff --git a/compiler/utilities/global/compiler_options.ml b/compiler/utilities/global/compiler_options.ml index a077957..115ace8 100644 --- a/compiler/utilities/global/compiler_options.ml +++ b/compiler/utilities/global/compiler_options.ml @@ -134,7 +134,7 @@ let check_options () = if !do_linear_typing then err "Unable to activate linear typing with strict SSA activated." ) - +let interf_all = ref false let doc_verbose = "\t\t\tSet verbose mode" and doc_version = "\t\tThe version of the compiler" @@ -170,3 +170,4 @@ and doc_memalloc_only = "\tEnable memory allocation" and doc_linear_only = "\t\tEnable linear annotations" and doc_interf_scheduler = "\tUse the old scheduler" and doc_optim = "\t\t\tOptimize with deadcode, tomato, itfusion and memalloc" +and doc_interf_all = "\t\tPerform memory allocation on all types"