This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[middle-end, patch 4/8] Add compiler a option to turn on indirect inlining
- From: Martin Jambor <mjambor at suse dot cz>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Jan Hubicka <jh at suse dot cz>, Kenneth Zadeck <zadeck at naturalbridge dot com>, Razya Ladelsky <RAZYA at il dot ibm dot com>, Paolo Carlini <paolo dot carlini at oracle dot com>
- Date: Tue, 15 Jul 2008 21:43:51 +0200
- Subject: [middle-end, patch 4/8] Add compiler a option to turn on indirect inlining
- References: <20080715194347.569852675@virgil.suse.cz>
This patch adds an option to turn on inlining of indirect calls. The
option is also automatically on for when compiling with -O3.
I have added documentation of the new option to this patch.
2008-07-15 Martin Jambor <mjambor@suse.cz>
* doc/invoke.texi (Optimize options): Add description of
-fearly-inlining.
* common.opt (flag_indirect_inlining): New flag.
* opts.c (decode_options): Set flag_indirect_inlining when
optimize >= 3
Index: iinln/gcc/common.opt
===================================================================
--- iinln.orig/gcc/common.opt
+++ iinln/gcc/common.opt
@@ -571,6 +571,10 @@ finhibit-size-directive
Common Report Var(flag_inhibit_size_directive)
Do not generate .size directives
+findirect-inlining
+Common Report Var(flag_indirect_inlining)
+Perform indirect inlining
+
; Nonzero means that functions declared `inline' will be treated
; as `static'. Prevents generation of zillions of copies of unused
; static inline functions; instead, `inlines' are written out
Index: iinln/gcc/opts.c
===================================================================
--- iinln.orig/gcc/opts.c
+++ iinln/gcc/opts.c
@@ -944,6 +944,7 @@ decode_options (unsigned int argc, const
{
flag_predictive_commoning = 1;
flag_inline_functions = 1;
+ flag_indirect_inlining = 1;
flag_unswitch_loops = 1;
flag_gcse_after_reload = 1;
flag_tree_vectorize = 1;
Index: iinln/gcc/doc/invoke.texi
===================================================================
--- iinln.orig/gcc/doc/invoke.texi
+++ iinln/gcc/doc/invoke.texi
@@ -328,8 +328,8 @@ Objective-C and Objective-C++ Dialects}.
-fearly-inlining -fexpensive-optimizations -ffast-math @gol
-ffinite-math-only -ffloat-store -fforward-propagate @gol
-ffunction-sections -fgcse -fgcse-after-reload -fgcse-las -fgcse-lm @gol
--fgcse-sm -fif-conversion -fif-conversion2 -finline-functions @gol
--finline-functions-called-once -finline-limit=@var{n} @gol
+-fgcse-sm -fif-conversion -fif-conversion2 -findirect-inlining @gol
+-finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
-finline-small-functions -fipa-cp -fipa-marix-reorg -fipa-pta @gol
-fipa-pure-const -fipa-reference -fipa-struct-reorg @gol
-fipa-type-escape -fivopts -fkeep-inline-functions -fkeep-static-consts @gol
@@ -5221,9 +5221,10 @@ invoking @option{-O2} on programs that u
@item -O3
@opindex O3
Optimize yet more. @option{-O3} turns on all optimizations specified by
-@option{-O2} and also turns on the @option{-finline-functions},
-@option{-funswitch-loops}, @option{-fpredictive-commoning},
-@option{-fgcse-after-reload} and @option{-ftree-vectorize} options.
+@option{-O2} and also turns on the @option{-findirect-inlining},
+@option{-finline-functions}, @option{-funswitch-loops},
+@option{-fpredictive-commoning}, @option{-fgcse-after-reload} and
+@option{-ftree-vectorize} options.
@item -O0
@opindex O0
@@ -5323,6 +5324,16 @@ in this way.
Enabled at level @option{-O2}.
+@item -findirect-inlining
+@opindex findirect-inlining
+Inline also indirect calls that are discovered to be known at compile
+time thanks to previous inlining. This option has any effect only
+when inlining itself is turned on by the @option{-finline-functions}
+option (as opposed to early inlining which is not enough to make this
+work).
+
+Enabled at level @option{-O3}.
+
@item -finline-functions
@opindex finline-functions
Integrate all simple functions into their callers. The compiler
--