tree.h (DECL_DISREGARD_INLINE_LIMITS): New.

2007-08-28  Richard Guenther  <rguenther@suse.de>

	* tree.h (DECL_DISREGARD_INLINE_LIMITS): New.
	(struct tree_function_decl): Make function_code a bitfield.
	Add disregard_inline_limits flag.
	* cgraphunit.c (cgraph_process_new_functions): Check
	DECL_DISREGARD_INLINE_LIMITS instead of disregard_inline_limits_p.
	(cgraph_preserve_function_body_p): Likewise.
	* ipa-inline.c (compute_inline_parameters): Likewise.
	* c-decl.c (finish_function): Set DECL_DISREGARD_INLINE_LIMITS
	for GNU C extern inline functions.
	(merge_decls): Merge DECL_DISREGARD_INLINE_LIMITS.
	* tree-inline.c (disregard_inline_limits_p): Remove.
	* tree-inline.h (disregard_inline_limits_p): Likewise.
	* c-common.c (handle_always_inline_attribute): Set
	DECL_DISREGARD_INLINE_LIMITS.
	* langhooks.c (add_builtin_function): Verify the function code
	fits in the bitfield.

	cp/
	* decl.c (duplicate_decls): Merge DECL_DISREGARD_INLINE_LIMITS.

From-SVN: r127851
This commit is contained in:
Richard Guenther 2007-08-28 09:03:59 +00:00 committed by Richard Biener
parent 44d5230cc3
commit c536a6a77a
11 changed files with 66 additions and 26 deletions

View File

@ -1,3 +1,22 @@
2007-08-28 Richard Guenther <rguenther@suse.de>
* tree.h (DECL_DISREGARD_INLINE_LIMITS): New.
(struct tree_function_decl): Make function_code a bitfield.
Add disregard_inline_limits flag.
* cgraphunit.c (cgraph_process_new_functions): Check
DECL_DISREGARD_INLINE_LIMITS instead of disregard_inline_limits_p.
(cgraph_preserve_function_body_p): Likewise.
* ipa-inline.c (compute_inline_parameters): Likewise.
* c-decl.c (finish_function): Set DECL_DISREGARD_INLINE_LIMITS
for GNU C extern inline functions.
(merge_decls): Merge DECL_DISREGARD_INLINE_LIMITS.
* tree-inline.c (disregard_inline_limits_p): Remove.
* tree-inline.h (disregard_inline_limits_p): Likewise.
* c-common.c (handle_always_inline_attribute): Set
DECL_DISREGARD_INLINE_LIMITS.
* langhooks.c (add_builtin_function): Verify the function code
fits in the bitfield.
2007-08-28 Mircea Namolaru <namolaru@il.ibm.com>
Vladimir Yanovsky <yanov@il.ibm.com>
Revital Eres <eres@il.ibm.com>

View File

@ -4864,8 +4864,9 @@ handle_always_inline_attribute (tree *node, tree name,
{
if (TREE_CODE (*node) == FUNCTION_DECL)
{
/* Do nothing else, just set the attribute. We'll get at
it later with lookup_attribute. */
/* Set the attribute and mark it for disregarding inline
limits. */
DECL_DISREGARD_INLINE_LIMITS (*node) = 1;
}
else
{

View File

@ -1819,6 +1819,11 @@ merge_decls (tree newdecl, tree olddecl, tree newtype, tree oldtype)
DECL_UNINLINABLE (newdecl) = DECL_UNINLINABLE (olddecl)
= (DECL_UNINLINABLE (newdecl) || DECL_UNINLINABLE (olddecl));
DECL_DISREGARD_INLINE_LIMITS (newdecl)
= DECL_DISREGARD_INLINE_LIMITS (olddecl)
= (DECL_DISREGARD_INLINE_LIMITS (newdecl)
|| DECL_DISREGARD_INLINE_LIMITS (olddecl));
}
if (DECL_BUILT_IN (olddecl))
@ -6771,6 +6776,11 @@ finish_function (void)
/* Finalize the ELF visibility for the function. */
c_determine_visibility (fndecl);
/* For GNU C extern inline functions disregard inline limits. */
if (DECL_EXTERNAL (fndecl)
&& DECL_DECLARED_INLINE_P (fndecl))
DECL_DISREGARD_INLINE_LIMITS (fndecl) = 1;
/* Genericize before inlining. Delay genericizing nested functions
until their parent function is genericized. Since finalizing
requires GENERIC, delay that as well. */

View File

@ -381,7 +381,7 @@ cgraph_process_new_functions (void)
node->local.self_insns = estimate_num_insns (fndecl,
&eni_inlining_weights);
node->local.disregard_inline_limits
|= disregard_inline_limits_p (fndecl);
|= DECL_DISREGARD_INLINE_LIMITS (fndecl);
/* Inlining characteristics are maintained by the
cgraph_mark_inline. */
node->global.insns = node->local.self_insns;
@ -1252,7 +1252,7 @@ cgraph_preserve_function_body_p (tree decl)
struct cgraph_node *node;
if (!cgraph_global_info_ready)
return (flag_really_no_inline
? disregard_inline_limits_p (decl)
? DECL_DISREGARD_INLINE_LIMITS (decl)
: DECL_INLINE (decl));
/* Look if there is any clone around. */
for (node = cgraph_node (decl); node; node = node->next_clone)

View File

@ -1,3 +1,7 @@
2007-08-28 Richard Guenther <rguenther@suse.de>
* decl.c (duplicate_decls): Merge DECL_DISREGARD_INLINE_LIMITS.
2007-08-28 Gabriel Dos Reis <gdr@integrable-solutions.net>
* error.c (dump_expr): Handle COMPLEX_CST.

View File

@ -1954,6 +1954,11 @@ duplicate_decls (tree newdecl, tree olddecl, bool newdecl_is_friend)
DECL_UNINLINABLE (newdecl) = DECL_UNINLINABLE (olddecl)
= (DECL_UNINLINABLE (newdecl) || DECL_UNINLINABLE (olddecl));
DECL_DISREGARD_INLINE_LIMITS (newdecl)
= DECL_DISREGARD_INLINE_LIMITS (olddecl)
= (DECL_DISREGARD_INLINE_LIMITS (newdecl)
|| DECL_DISREGARD_INLINE_LIMITS (olddecl));
}
/* Preserve abstractness on cloned [cd]tors. */

View File

@ -1529,7 +1529,7 @@ compute_inline_parameters (void)
&eni_inlining_weights);
if (node->local.inlinable && !node->local.disregard_inline_limits)
node->local.disregard_inline_limits
= disregard_inline_limits_p (current_function_decl);
= DECL_DISREGARD_INLINE_LIMITS (current_function_decl);
if (flag_really_no_inline && !node->local.disregard_inline_limits)
node->local.inlinable = 0;
/* Inlining characteristics are maintained by the cgraph_mark_inline. */

View File

@ -480,6 +480,9 @@ add_builtin_function (const char *name,
TREE_PUBLIC (decl) = 1;
DECL_EXTERNAL (decl) = 1;
DECL_BUILT_IN_CLASS (decl) = cl;
DECL_FUNCTION_CODE (decl) = -1;
gcc_assert (DECL_FUNCTION_CODE (decl) >= function_code);
DECL_FUNCTION_CODE (decl) = function_code;
if (library_name)

View File

@ -1936,20 +1936,6 @@ inlinable_function_p (tree fn)
return inlinable;
}
/* Return true if we shall disregard inlining limits for the function
FN during inlining. */
bool
disregard_inline_limits_p (tree fn)
{
/* GNU extern inline functions are supposed to be cheap. */
if (DECL_DECLARED_INLINE_P (fn)
&& DECL_EXTERNAL (fn))
return true;
return lookup_attribute ("always_inline", DECL_ATTRIBUTES (fn)) != NULL_TREE;
}
/* Estimate the cost of a memory move. Use machine dependent
word size and take possible memcpy call into account. */

View File

@ -130,7 +130,6 @@ extern void insert_decl_map (copy_body_data *, tree, tree);
unsigned int optimize_inline_calls (tree);
bool tree_inlinable_function_p (tree);
bool disregard_inline_limits_p (tree);
tree copy_tree_r (tree *, int *, void *);
void clone_body (tree, tree, void *);
void save_body (tree, tree *, tree *);

View File

@ -3273,6 +3273,13 @@ struct tree_decl_non_common GTY(())
#define DECL_DECLARED_INLINE_P(NODE) \
(FUNCTION_DECL_CHECK (NODE)->function_decl.declared_inline_flag)
/* Nonzero in a FUNCTION_DECL that should be always inlined by the inliner
disregarding size and cost heuristics. This is equivalent to using
the always_inline attribute without the required diagnostics if the
function cannot be inlined. */
#define DECL_DISREGARD_INLINE_LIMITS(NODE) \
(FUNCTION_DECL_CHECK (NODE)->function_decl.disregard_inline_limits)
/* For FUNCTION_DECL, this holds a pointer to a structure ("struct function")
that describes the status of this function. */
#define DECL_STRUCT_FUNCTION(NODE) (FUNCTION_DECL_CHECK (NODE)->function_decl.f)
@ -3299,27 +3306,33 @@ struct tree_function_decl GTY(())
{
struct tree_decl_non_common common;
struct function *f;
/* In a FUNCTION_DECL for which DECL_BUILT_IN holds, this is
DECL_FUNCTION_CODE. Otherwise unused. */
enum built_in_function function_code;
DECL_FUNCTION_CODE. Otherwise unused.
??? The bitfield needs to be able to hold all target function
codes as well. */
ENUM_BITFIELD(built_in_function) function_code : 10;
ENUM_BITFIELD(built_in_class) built_in_class : 2;
unsigned static_ctor_flag : 1;
unsigned static_dtor_flag : 1;
unsigned uninlinable : 1;
unsigned possibly_inlined : 1;
unsigned novops_flag : 1;
unsigned returns_twice_flag : 1;
unsigned malloc_flag : 1;
unsigned pure_flag : 1;
unsigned declared_inline_flag : 1;
unsigned regdecl_flag : 1;
unsigned inline_flag : 1;
unsigned no_instrument_function_entry_exit : 1;
unsigned no_limit_stack : 1;
ENUM_BITFIELD(built_in_class) built_in_class : 2;
struct function *f;
unsigned no_limit_stack : 1;
unsigned disregard_inline_limits : 1;
/* 6 bits left */
};
/* For a TYPE_DECL, holds the "original" type. (TREE_TYPE has the copy.) */