diff options
author | 2002-03-19 11:56:51 +0000 | |
---|---|---|
committer | 2002-03-19 11:56:51 +0000 | |
commit | c699d7be29c7749a135830876f4cbbaf5c63e8a2 (patch) | |
tree | 02b390ccf055a907920e9d936058678dcea73d4e | |
parent | KNF whitespace (diff) | |
download | wireguard-openbsd-c699d7be29c7749a135830876f4cbbaf5c63e8a2.tar.xz wireguard-openbsd-c699d7be29c7749a135830876f4cbbaf5c63e8a2.zip |
tweak gcc inliner. More weight for leaf functions. Less depth for other
inlining. Speeds up compilation of heavily inlined code, such as most
C++ code, and loses almost no runtime speed.
ok art, miod, millert, niklas.
-rw-r--r-- | gnu/egcs/gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gnu/egcs/gcc/integrate.c | 18 | ||||
-rw-r--r-- | gnu/egcs/gcc/toplev.c | 1 |
3 files changed, 21 insertions, 6 deletions
diff --git a/gnu/egcs/gcc/ChangeLog b/gnu/egcs/gcc/ChangeLog index 2ba79675b20..44d3887d4c6 100644 --- a/gnu/egcs/gcc/ChangeLog +++ b/gnu/egcs/gcc/ChangeLog @@ -1,3 +1,11 @@ +2001-08-23 Kurt Garloff <kurt@garloff.de> + + * integrate.c (function_cannot_inline_p): Reduce max size for + inlining from 10000 to 240, twice this value (i.e. 480) for leaf + functions. Round up in INTEGRATE_THRESHOLD. + * toplev.c (rest_of_compilation): Set current_function_is_leaf + for function_cannot_inline_p + 2001-01-25 Bernd Schmidt <bernds@redhat.co.uk> * version.c: Bump. diff --git a/gnu/egcs/gcc/integrate.c b/gnu/egcs/gcc/integrate.c index 4165611e480..2db5b308ac8 100644 --- a/gnu/egcs/gcc/integrate.c +++ b/gnu/egcs/gcc/integrate.c @@ -53,10 +53,10 @@ extern struct obstack *function_maybepermanent_obstack; This is overridden on RISC machines. */ #ifndef INTEGRATE_THRESHOLD /* Inlining small functions might save more space then not inlining at - all. Assume 1 instruction for the call and 1.5 insns per argument. */ + all. Assume 2 instruction for the call/ret and 1.5 insns per argument. */ #define INTEGRATE_THRESHOLD(DECL) \ (optimize_size \ - ? (1 + (3 * list_length (DECL_ARGUMENTS (DECL))) / 2) \ + ? (2 + (1 + 3 * list_length (DECL_ARGUMENTS (DECL))) / 2) \ : (8 * (8 + list_length (DECL_ARGUMENTS (DECL))))) #endif @@ -91,10 +91,12 @@ static tree copy_and_set_decl_abstract_origin PROTO((tree)); 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. */ + The default value of 240 is much lower than before and + matches better with the 3.0.1 numbers. + We allow double the size for leaf functions. + */ -int inline_max_insns = 10000; +int inline_max_insns = 240; /* Returns the Ith entry in the label_map contained in MAP. If the @@ -158,6 +160,10 @@ function_cannot_inline_p (fndecl) if (current_function_cannot_inline) return current_function_cannot_inline; + /* Prefer leaf functions */ + if (current_function_is_leaf) + max_insns *= 2; + /* If its not even close, don't even look. */ if (get_max_uid () > 3 * max_insns) return N_("function too large to be inline"); @@ -232,7 +238,7 @@ function_cannot_inline_p (fndecl) result = DECL_RTL (DECL_RESULT (fndecl)); if (result && GET_CODE (result) == PARALLEL) return N_("inline functions not supported for this return value type"); - + return 0; } diff --git a/gnu/egcs/gcc/toplev.c b/gnu/egcs/gcc/toplev.c index 5f8913fa3e5..7b7f6a87fcb 100644 --- a/gnu/egcs/gcc/toplev.c +++ b/gnu/egcs/gcc/toplev.c @@ -3620,6 +3620,7 @@ rest_of_compilation (decl) if (DECL_INLINE (decl) || flag_inline_functions) TIMEVAR (integration_time, { + current_function_is_leaf = leaf_function_p (); lose = function_cannot_inline_p (decl); if (lose || ! optimize) { |