From ea6807fdaeaa2e46e1c7471c91056fdc4736cc2f Mon Sep 17 00:00:00 2001 From: Xavier Leroy Date: Fri, 5 Jul 2019 15:38:45 +0200 Subject: Rename option `-ffavor-branchless` into `-Obranchless` Easier to type, and consistent with `-Os` (optimize for smaller code / optimize for fewer conditional branches). --- backend/Selectionaux.ml | 6 +++--- driver/Clflags.ml | 2 +- driver/Driver.ml | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/backend/Selectionaux.ml b/backend/Selectionaux.ml index de8127c6..4ca7dd21 100644 --- a/backend/Selectionaux.ml +++ b/backend/Selectionaux.ml @@ -80,10 +80,10 @@ let fast_cmove ty = assert false (* The if-conversion heuristic depend on the - -fif-conversion and -ffavor-branchless flags. + -fif-conversion and -Obranchless flags. With [-fno-if-conversion] or [-0O], if-conversion is turned off entirely. -With [-ffavor-branchless], if-conversion is performed whenever semantically +With [-Obranchless], if-conversion is performed whenever semantically correct, regardless of how much it could cost. Otherwise (and by default), optimization is performed when it seems beneficial. @@ -106,7 +106,7 @@ instructions from the first branch. let if_conversion_heuristic cond ifso ifnot ty = if not !Clflags.option_fifconversion then false else - if !Clflags.option_ffavor_branchless then true else + if !Clflags.option_Obranchless then true else if not (fast_cmove ty) then false else let c1 = cost_expr ifso and c2 = cost_expr ifnot in c1 + c2 <= 24 && abs (c1 - c2) <= 8 diff --git a/driver/Clflags.ml b/driver/Clflags.ml index d27871ef..2db9399f 100644 --- a/driver/Clflags.ml +++ b/driver/Clflags.ml @@ -28,7 +28,7 @@ let option_fconstprop = ref true let option_fcse = ref true let option_fredundancy = ref true let option_fifconversion = ref true -let option_ffavor_branchless = ref false +let option_Obranchless = ref false let option_falignfunctions = ref (None: int option) let option_falignbranchtargets = ref 0 let option_faligncondbranchs = ref 0 diff --git a/driver/Driver.ml b/driver/Driver.ml index 84392ef6..88be8933 100644 --- a/driver/Driver.ml +++ b/driver/Driver.ml @@ -187,6 +187,8 @@ Processing options: -O0 Do not optimize the compiled code -O1 -O2 -O3 Synonymous for -O -Os Optimize for code size in preference to code speed + -Obranchless Optimize to avoid conditional branches; try to generate + branch-free instruction sequences as much as possible -ftailcalls Optimize function calls in tail position [on] -fconst-prop Perform global constant propagation [on] -ffloat-const-prop Control constant propagation of floats @@ -197,8 +199,6 @@ Processing options: -finline-functions-called-once Integrate functions only required by their single caller [on] -fif-conversion Perform if-conversion (generation of conditional moves) [on] - -ffavor-branchless Favor the generation of branch-free instruction sequences, - even when possibly more costly than the default [off] Code generation options: (use -fno- to turn off -f) -ffpu Use FP registers for some integer operations [on] -fsmall-data Set maximal size for allocation in small data area @@ -303,10 +303,10 @@ let cmdline_actions = Exact "-O", Unit (set_all optimization_options); _Regexp "-O[123]$", Unit (set_all optimization_options); Exact "-Os", Set option_Osize; + Exact "-Obranchless", Set option_Obranchless; 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); - Exact "-ffavor-branchless", Set option_ffavor_branchless; Exact "-falign-functions", Integer(fun n -> check_align n; option_falignfunctions := Some n); Exact "-falign-branch-targets", Integer(fun n -> check_align n; option_falignbranchtargets := n); Exact "-falign-cond-branches", Integer(fun n -> check_align n; option_faligncondbranchs := n);] @ -- cgit