* 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
+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.
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;
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;
+
\f
/* 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
{
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;
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
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;
-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
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
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--;)
{
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))