aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>1999-04-26 01:35:15 +0200
committerJeff Law <law@gcc.gnu.org>1999-04-25 17:35:15 -0600
commitf9e814f10036123463e12b12065d9576f80f6e23 (patch)
tree64e64338a1d4d6f1bf4e9f41d6b2be1787684e88
parent947255ed5a4ad0beaaf47901c3b0ecc74892359f (diff)
downloadgcc-f9e814f10036123463e12b12065d9576f80f6e23.zip
gcc-f9e814f10036123463e12b12065d9576f80f6e23.tar.gz
gcc-f9e814f10036123463e12b12065d9576f80f6e23.tar.bz2
flags.h (inline_max_insns): Declare.
* flags.h (inline_max_insns): Declare. * integrate.c (inline_max_insns): New variable. (function_cannot_inline_p): Use it. * toplev.c (main): Add the flag -finline-limit-n. (display_help): Document -finline-limit-n. * invoke.texi: Document -finline-limit-n From-SVN: r26629
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/flags.h4
-rw-r--r--gcc/integrate.c25
-rw-r--r--gcc/invoke.texi19
-rw-r--r--gcc/toplev.c4
5 files changed, 57 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 8a4eb26..2f05463 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+Mon Apr 26 00:28:25 1999 Theodore Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
+
+ * flags.h (inline_max_insns): Declare.
+ * integrate.c (inline_max_insns): New variable.
+ (function_cannot_inline_p): Use it.
+ * toplev.c (main): Add the flag -finline-limit-n.
+ (display_help): Document -finline-limit-n.
+ * invoke.texi: Document -finline-limit-n
+
Sun Apr 25 23:03:32 1999 Richard Henderson <rth@cygnus.com>
* stmt.c (expand_asm_operands): Reload in-out reg-only memory operands.
diff --git a/gcc/flags.h b/gcc/flags.h
index e73c3fd..2c0ed40 100644
--- a/gcc/flags.h
+++ b/gcc/flags.h
@@ -507,6 +507,10 @@ extern int current_function_is_thunk;
extern int g_switch_value;
extern int g_switch_set;
+/* Value of the -finline-limit flag. */
+
+extern int inline_max_insns;
+
/* Nonzero if we dump in VCG format, not plain text. */
extern int dump_for_graph;
diff --git a/gcc/integrate.c b/gcc/integrate.c
index 76f7144..33a96c4 100644
--- a/gcc/integrate.c
+++ b/gcc/integrate.c
@@ -86,6 +86,16 @@ static void process_reg_param PROTO((struct inline_remap *, rtx,
void set_decl_abstract_flags PROTO((tree, int));
static tree copy_and_set_decl_abstract_origin PROTO((tree));
+
+/* The maximum number of instructions accepted for inlining a
+ function. Increasing values mean more agressive inlining.
+ This affects currently only functions explicitly marked as
+ inline (or methods defined within the class definition for C++).
+ The default value of 10000 is arbitrary but high to match the
+ previously unlimited gcc capabilities. */
+
+int inline_max_insns = 10000;
+
/* Returns the Ith entry in the label_map contained in MAP. If the
Ith entry has not yet been set, return a fresh label. This function
@@ -116,7 +126,16 @@ function_cannot_inline_p (fndecl)
{
register rtx insn;
tree last = tree_last (TYPE_ARG_TYPES (TREE_TYPE (fndecl)));
- int max_insns = INTEGRATE_THRESHOLD (fndecl);
+
+ /* For functions marked as inline increase the maximum size to
+ inline_max_insns (-finline-limit-<n>). For regular functions
+ use the limit given by INTEGRATE_THRESHOLD. */
+
+ int max_insns = (DECL_INLINE (fndecl))
+ ? (inline_max_insns
+ + 8 * list_length (DECL_ARGUMENTS (fndecl)))
+ : INTEGRATE_THRESHOLD (fndecl);
+
register int ninsns = 0;
register tree parms;
rtx result;
@@ -136,7 +155,7 @@ function_cannot_inline_p (fndecl)
return current_function_cannot_inline;
/* If its not even close, don't even look. */
- if (!DECL_INLINE (fndecl) && get_max_uid () > 3 * max_insns)
+ if (get_max_uid () > 3 * max_insns)
return N_("function too large to be inline");
#if 0
@@ -170,7 +189,7 @@ function_cannot_inline_p (fndecl)
return N_("function with transparent unit parameter cannot be inline");
}
- if (!DECL_INLINE (fndecl) && get_max_uid () > max_insns)
+ if (get_max_uid () > max_insns)
{
for (ninsns = 0, insn = get_first_nonparm_insn ();
insn && ninsns < max_insns;
diff --git a/gcc/invoke.texi b/gcc/invoke.texi
index 5cf365a..1ca77e5 100644
--- a/gcc/invoke.texi
+++ b/gcc/invoke.texi
@@ -154,7 +154,7 @@ in the following sections.
-fdelayed-branch -fexpensive-optimizations
-ffast-math -ffloat-store -fforce-addr -fforce-mem
-fdata-sections -ffunction-sections -fgcse
--finline-functions -fkeep-inline-functions
+-finline-functions -finline-limit-@var{n} -fkeep-inline-functions
-fno-default-inline -fno-defer-pop -fno-function-cse
-fno-inline -fno-peephole -fomit-frame-pointer -fregmove
-frerun-cse-after-loop -frerun-loop-opt -fschedule-insns
@@ -2302,6 +2302,23 @@ If all calls to a given function are integrated, and the function is
declared @code{static}, then the function is normally not output as
assembler code in its own right.
+@item -finline-limit-@var{n}
+By default, gcc limits the size of functions that can be inlined. This flag
+allows the control of this limit for functions that are explicitly marked as
+inline (ie marked with the inline keyword or defined within the class
+definition in c++). @var{n} is the size of functions that can be inlined in
+number of pseudo instructions (not counting parameter handling). The default
+value of n is 10000. Increasing this value can result in more inlined code at
+the cost of compilation time and memory consumption. Decreasing usually makes
+the compilation faster and less code will be inlined (which presumably
+means slower programs). This option is particularly useful for programs that
+use inlining heavily such as those based on recursive templates with c++.
+
+@emph{Note:} pseudo instruction represents, in this particular context, an
+abstract measurement of function's size. In no way, it represents a count
+of assembly instructions and as such its exact meaning might change from one
+release to an another.
+
@item -fkeep-inline-functions
Even if all calls to a given function are integrated, and the function
is declared @code{static}, nevertheless output a separate run-time
diff --git a/gcc/toplev.c b/gcc/toplev.c
index f0e84f4..f5e534c 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -4488,6 +4488,7 @@ display_help ()
printf (" -ffixed-<register> Mark <register> as being unavailable to the compiler\n");
printf (" -fcall-used-<register> Mark <register> as being corrupted by function calls\n");
printf (" -fcall-saved-<register> Mark <register> as being preserved across functions\n");
+ printf (" -finline-limit-<number> Limits the size of inlined functions to <number>\n");
for (i = NUM_ELEM (f_options); i--;)
{
@@ -5062,6 +5063,9 @@ main (argc, argv)
if (found)
;
+ else if (!strncmp (p, "inline-limit-", 13))
+ inline_max_insns =
+ read_integral_parameter (p + 13, p - 2, inline_max_insns);
#ifdef HAIFA
#ifdef INSN_SCHEDULING
else if (!strncmp (p, "sched-verbose-",14))