diff options
author | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2020-03-15 09:57:03 +0100 |
---|---|---|
committer | David Monniaux <david.monniaux@univ-grenoble-alpes.fr> | 2020-03-15 09:57:03 +0100 |
commit | 6803d06880b0ecda94d70549b61998db84160e5b (patch) | |
tree | 3bb1bdc8b4d93e39f75e47ef94f763bd9abd05aa | |
parent | 5e045a7b8c6b834dfec782ecdadae3145a16212e (diff) | |
parent | d0326db1105704e02e2b40facc2a85a267a2b9b5 (diff) | |
download | compcert-kvx-6803d06880b0ecda94d70549b61998db84160e5b.tar.gz compcert-kvx-6803d06880b0ecda94d70549b61998db84160e5b.zip |
Merge remote-tracking branch 'origin/mppa-work' into mppa-cse3
-rw-r--r-- | backend/Inliningaux.ml | 9 | ||||
-rw-r--r-- | driver/Clflags.ml | 1 | ||||
-rw-r--r-- | driver/Driver.ml | 2 |
3 files changed, 9 insertions, 3 deletions
diff --git a/backend/Inliningaux.ml b/backend/Inliningaux.ml index d58704ca..cf308962 100644 --- a/backend/Inliningaux.ml +++ b/backend/Inliningaux.ml @@ -17,7 +17,8 @@ open Maps open Op open Ordered open! RTL - +open Camlcoq + module PSet = Make(OrderedPositive) type inlining_info = { @@ -83,13 +84,15 @@ let static_called_once id io = else false -(* To be considered: heuristics based on size of function? *) +(* D. Monniaux: attempt at heuristic based on size *) +let small_enough (f : coq_function) = + P.to_int (RTL.max_pc_function f) <= !Clflags.option_inline_auto_threshold let should_inline (io: inlining_info) (id: ident) (f: coq_function) = if !Clflags.option_finline then begin match C2C.atom_inline id with | C2C.Inline -> true | C2C.Noinline -> false - | C2C.No_specifier -> static_called_once id io + | C2C.No_specifier -> static_called_once id io || small_enough f end else false diff --git a/driver/Clflags.ml b/driver/Clflags.ml index a8594be4..901aaa59 100644 --- a/driver/Clflags.ml +++ b/driver/Clflags.ml @@ -83,3 +83,4 @@ let option_faddx = ref false let option_fcoalesce_mem = ref true let option_fforward_moves = ref true let option_all_loads_nontrap = ref false +let option_inline_auto_threshold = ref 0 diff --git a/driver/Driver.ml b/driver/Driver.ml index 133bac0a..5ae31a1f 100644 --- a/driver/Driver.ml +++ b/driver/Driver.ml @@ -190,6 +190,7 @@ Processing options: -Os Optimize for code size in preference to code speed -Obranchless Optimize to generate fewer conditional branches; try to produce branch-free instruction sequences as much as possible + -finline-auto-threshold n Inline functions under size n -ftailcalls Optimize function calls in tail position [on] -fconst-prop Perform global constant propagation [on] -ffloat-const-prop <n> Control constant propagation of floats @@ -324,6 +325,7 @@ let cmdline_actions = _Regexp "-O[123]$", Unit (set_all optimization_options); Exact "-Os", Set option_Osize; Exact "-Obranchless", Set option_Obranchless; + Exact "-finline-auto-threshold", Integer (fun n -> option_inline_auto_threshold := n); Exact "-fsmall-data", Integer(fun n -> option_small_data := n); Exact "-fsmall-const", Integer(fun n -> option_small_const := n); Exact "-ffloat-const-prop", Integer(fun n -> option_ffloatconstprop := n); |