Compare commits

...

3 Commits

Author SHA1 Message Date
Oliver Tappe
288e868d9b [taken from gcc-2.95.3-7-suse]
save/restore warnings during the use of __extension__


git-svn-id: file:///srv/svn/repos/haiku/trunk/buildtools@9583 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-28 18:19:43 +00:00
Oliver Tappe
a20bf576e7 [taken from gcc-2.95.3-7-suse]
fix a bug with double-colon not being accepted when it should be


git-svn-id: file:///srv/svn/repos/haiku/trunk/buildtools@9582 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-28 18:19:24 +00:00
Oliver Tappe
a7498ab1d3 [taken from gcc-2.95.3-7-suse]
2001-08-23  Kurt Garloff  <kurt@garloff.de>
	* integrate.c (function_cannot_inline_p): Reduce max size for
	inlining from 10000 to 2000, double this value (i.e. 4000) for
	leaf functions. Fine tune INTEGRATE_THRESHOLD for -Os.
	* toplev.c (rest_of_compilation): Set current_function_is_leaf
	for function_cannot_inline_p


git-svn-id: file:///srv/svn/repos/haiku/trunk/buildtools@9581 a95241bf-73f2-0310-859d-f6bbb57e9c96
2004-10-28 18:19:07 +00:00
7 changed files with 58 additions and 18 deletions

View File

@@ -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 2000, double this value (i.e. 4000) for
leaf functions. Fine tune INTEGRATE_THRESHOLD for -Os.
* toplev.c (rest_of_compilation): Set current_function_is_leaf
for function_cannot_inline_p
Fri Mar 16 12:46:19 GMT 2001 Bernd Schmidt (bernds@redhat.com)
* gcc-2.95.3 Released.

View File

@@ -205,6 +205,8 @@ end ifc
%type <ttype> parmlist_or_identifiers parmlist_or_identifiers_1
%type <ttype> identifiers_or_typenames
%type <itype> extension
%type <itype> setspecs
%type <ends_in_label> lineno_stmt_or_label lineno_stmt_or_labels stmt_or_label
@@ -247,6 +249,15 @@ static tree declspec_stack;
/* 1 if we explained undeclared var errors. */
static int undeclared_variable_notice;
/* For __extension__, save/restore the warning flags which are
controlled by __extension__. */
#define SAVE_WARN_FLAGS() (pedantic | (warn_pointer_arith << 1))
#define RESTORE_WARN_FLAGS(val) \
do { \
pedantic = val & 1; \
warn_pointer_arith = (val >> 1) & 1; \
} while (0)
ifobjc
/* Objective-C specific information */
@@ -307,7 +318,7 @@ end ifobjc
else
error ("argument of `asm' is not a constant string"); }
| extension extdef
{ pedantic = $<itype>1; }
{ RESTORE_WARN_FLAGS ($1); }
;
datadef:
@@ -448,7 +459,7 @@ unary_expr:
/* __extension__ turns off -pedantic for following primary. */
| extension cast_expr %prec UNARY
{ $$ = $2;
pedantic = $<itype>1; }
RESTORE_WARN_FLAGS ($1); }
| unop cast_expr %prec UNARY
{ $$ = build_unary_op ($1, $2, 0);
overflow_warning ($$); }
@@ -1015,7 +1026,7 @@ decl:
| declmods ';'
{ pedwarn ("empty declaration"); }
| extension decl
{ pedantic = $<itype>1; }
{ RESTORE_WARN_FLAGS ($1); }
;
/* Declspecs which contain at least one type specifier or typedef name.
@@ -1614,7 +1625,7 @@ component_decl:
{ $$ = NULL_TREE; }
| extension component_decl
{ $$ = $2;
pedantic = $<itype>1; }
RESTORE_WARN_FLAGS ($1); }
;
components:
@@ -2426,8 +2437,9 @@ identifiers_or_typenames:
extension:
EXTENSION
{ $<itype>$ = pedantic;
pedantic = 0; }
{ $$ = SAVE_WARN_FLAGS();
pedantic = 0;
warn_pointer_arith = 0; }
;
ifobjc

View File

@@ -3354,10 +3354,18 @@ simple_stmt:
/* This is the case with input operands as well. */
| asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':' asm_operands ')' ';'
{ finish_asm_stmt ($2, $4, $6, $8, NULL_TREE); }
| asm_keyword maybe_cv_qualifier '(' string SCOPE asm_operands ')' ';'
{ finish_asm_stmt ($2, $4, NULL_TREE, $6, NULL_TREE); }
/* This is the case with clobbered registers as well. */
| asm_keyword maybe_cv_qualifier '(' string ':' asm_operands ':'
asm_operands ':' asm_clobbers ')' ';'
{ finish_asm_stmt ($2, $4, $6, $8, $10); }
| asm_keyword maybe_cv_qualifier '(' string SCOPE asm_operands ':'
asm_clobbers ')' ';'
{ finish_asm_stmt ($2, $4, NULL_TREE, $6, $8); }
| asm_keyword maybe_cv_qualifier '(' string ':' asm_operands SCOPE
asm_clobbers ')' ';'
{ finish_asm_stmt ($2, $4, $6, NULL_TREE, $8); }
| GOTO '*' expr ';'
{
if (pedantic)

View File

@@ -2928,7 +2928,8 @@ macros to replace them with the customary keywords. It looks like this:
@end example
@findex __extension__
@samp{-pedantic} causes warnings for many GNU C extensions. You can
@samp{-pedantic} and other options cause warnings for many
GNU C extensions. You can
prevent such warnings within one expression by writing
@code{__extension__} before the expression. @code{__extension__} has no
effect aside from this.

View File

@@ -53,11 +53,11 @@ 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 3 instructions for the call/ret and 4 insns per argument. */
#define INTEGRATE_THRESHOLD(DECL) \
(optimize_size \
? (1 + (3 * list_length (DECL_ARGUMENTS (DECL))) / 2) \
: (8 * (8 + list_length (DECL_ARGUMENTS (DECL)))))
? ( 3 + ( 4 * list_length (DECL_ARGUMENTS (DECL)))) \
: (64 + ( 8 * list_length (DECL_ARGUMENTS (DECL)))))
#endif
static rtx initialize_for_inline PROTO((tree, int, int, int, int));
@@ -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 2000 is much lower than before and
matches a bit better with the 3.0.1 numbers.
We allow double the size for leaf functions.
*/
int inline_max_insns = 10000;
int inline_max_insns = 2000;
/* Returns the Ith entry in the label_map contained in MAP. If the
@@ -154,6 +156,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");

View File

@@ -2351,11 +2351,15 @@ 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++.
value of n is 2000 . Increasing this value (to e.g. 5000) can result in more
inlined code at the cost of compilation time and memory consumption and will
result in larger excutables. Too much inlining can decrease performance
again because of the limited size of your CPU's instruction cache.
Decreasing (e.g. to 250) usually makes the compilation faster and less code
will be inlined (which presumably means smaller executables but slower
programs). This option is particularly useful for programs that use
inlining heavily such as those based on recursive templates with c++.
Note that functions at the leaf of the call tree get a bonus.
@emph{Note:} pseudo instruction represents, in this particular context, an
abstract measurement of function's size. In no way, it represents a count

View File

@@ -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)
{