aboutsummaryrefslogtreecommitdiffstats
path: root/driver/Clflags.ml
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@college-de-france.fr>2019-05-31 19:15:19 +0200
committerXavier Leroy <xavierleroy@users.noreply.github.com>2019-06-06 10:58:13 +0200
commit8e3a73448c5ddfa4be3871d7f4fd80281a7549f4 (patch)
tree1d2faaa30db1d4c8d7e236f7ddfbd145d778e6e3 /driver/Clflags.ml
parent0025c4db576dbc174946b7adb83d4e0b81ce4b5f (diff)
downloadcompcert-8e3a73448c5ddfa4be3871d7f4fd80281a7549f4.tar.gz
compcert-8e3a73448c5ddfa4be3871d7f4fd80281a7549f4.zip
If-conversion optimization
Extends the instruction selection pass with an if-conversion optimization: some if/then/else statements are converted into "select" operations, which in turn can be compiled down to branchless instruction sequences if the target architecture supports them. The statements that are converted are of the form if (cond) { x = a1; } else { x = a2; } if (cond) { x = a1; } if (cond) { /*skip*/; } else { x = a2; } where a1, a2 are "safe" expressions, containing no operations that can fail at run-time, such as memory loads or integer divisions. A heuristic in backend/Selectionaux.ml controls when the optimization occurs, depending on command-line flags and the complexity of the "then" and "else" branches.
Diffstat (limited to 'driver/Clflags.ml')
-rw-r--r--driver/Clflags.ml2
1 files changed, 2 insertions, 0 deletions
diff --git a/driver/Clflags.ml b/driver/Clflags.ml
index fc12863d..d27871ef 100644
--- a/driver/Clflags.ml
+++ b/driver/Clflags.ml
@@ -27,6 +27,8 @@ let option_ftailcalls = ref true
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_falignfunctions = ref (None: int option)
let option_falignbranchtargets = ref 0
let option_faligncondbranchs = ref 0