aboutsummaryrefslogtreecommitdiffstats
path: root/driver
diff options
context:
space:
mode:
authorBernhard Schommer <bschommer@users.noreply.github.com>2017-12-07 12:14:08 +0100
committerGitHub <noreply@github.com>2017-12-07 12:14:08 +0100
commit3bb0c75456a0dcab079e7614c3bbd3ba971e4519 (patch)
tree1dac031c6b94aafb7e28f63857dbdbe2f4870066 /driver
parent90b76a0842b7f080893dd70a7c0c6bc878f4056b (diff)
downloadcompcert-3bb0c75456a0dcab079e7614c3bbd3ba971e4519.tar.gz
compcert-3bb0c75456a0dcab079e7614c3bbd3ba971e4519.zip
Inlining of static functions which are only called once. (#37)
New inlining heuristic for static functions. Static functions that are only called once can always be inlined, since they can be removed safely after inlining and no call prologue, epilogue, as well as register saving and needs to be generated.
Diffstat (limited to 'driver')
-rw-r--r--driver/Clflags.ml1
-rw-r--r--driver/Driver.ml5
2 files changed, 5 insertions, 1 deletions
diff --git a/driver/Clflags.ml b/driver/Clflags.ml
index 2d92e09b..a886ee9b 100644
--- a/driver/Clflags.ml
+++ b/driver/Clflags.ml
@@ -34,6 +34,7 @@ let option_finline_asm = ref false
let option_mthumb = ref (Configuration.model = "armv7m")
let option_Osize = ref false
let option_finline = ref true
+let option_finline_functions_called_once = ref true
let option_dprepro = ref false
let option_dparse = ref false
let option_dcmedium = ref false
diff --git a/driver/Driver.ml b/driver/Driver.ml
index 124bc587..0e01dbb5 100644
--- a/driver/Driver.ml
+++ b/driver/Driver.ml
@@ -268,6 +268,8 @@ Processing options:
-fcse Perform common subexpression elimination [on]
-fredundancy Perform redundancy elimination [on]
-finline Perform inlining of functions [on]
+ -finline-functions-called-once Integrate functions only required by their
+ single caller [on]
Code generation options: (use -fno-<opt> to turn off -f<opt>)
-ffpu Use FP registers for some integer operations [on]
-fsmall-data <n> Set maximal size <n> for allocation in small data area
@@ -337,7 +339,7 @@ let language_support_options = [
]
let optimization_options = [
- option_ftailcalls; option_fconstprop; option_fcse; option_fredundancy
+ option_ftailcalls; option_fconstprop; option_fcse; option_fredundancy; option_finline_functions_called_once;
]
let set_all opts () = List.iter (fun r -> r := true) opts
@@ -458,6 +460,7 @@ let cmdline_actions =
@ f_opt "cse" option_fcse
@ f_opt "redundancy" option_fredundancy
@ f_opt "inline" option_finline
+ @ f_opt "inline-functions-called-once" option_finline_functions_called_once
(* Code generation options *)
@ f_opt "fpu" option_ffpu
@ f_opt "sse" option_ffpu (* backward compatibility *)