Commit 7dbca013 by Daniel Berlin Committed by Daniel Berlin

ipa-reference.c (check_operand): Allow FUNCTION_DECL.

2006-01-18  Daniel Berlin  <dberlin@dberlin.org>

	* ipa-reference.c (check_operand):  Allow FUNCTION_DECL.
	(look_for_address_of): Ditto.
	(ipa_init): Walk the function decls.
	(static_execute): Don't set readonly on FUNCTION_DECL's.

From-SVN: r109932
parent db08384a
2006-01-18 Daniel Berlin <dberlin@dberlin.org>
* ipa-reference.c (check_operand): Allow FUNCTION_DECL.
(look_for_address_of): Ditto.
(ipa_init): Walk the function decls.
(static_execute): Don't set readonly on FUNCTION_DECL's.
2006-01-18 Roger Sayle <roger@eyesopen.com> 2006-01-18 Roger Sayle <roger@eyesopen.com>
* config/i386/i386.md (shift spliter): Fix a a typo in the splitter * config/i386/i386.md (shift spliter): Fix a a typo in the splitter
......
...@@ -286,7 +286,7 @@ check_operand (ipa_reference_local_vars_info_t local, ...@@ -286,7 +286,7 @@ check_operand (ipa_reference_local_vars_info_t local,
{ {
if (!t) return; if (!t) return;
if ((TREE_CODE (t) == VAR_DECL) if ((TREE_CODE (t) == VAR_DECL || TREE_CODE (t) == FUNCTION_DECL)
&& (has_proper_scope_for_analysis (t))) && (has_proper_scope_for_analysis (t)))
{ {
if (checking_write) if (checking_write)
...@@ -343,7 +343,7 @@ look_for_address_of (tree t) ...@@ -343,7 +343,7 @@ look_for_address_of (tree t)
if (TREE_CODE (t) == ADDR_EXPR) if (TREE_CODE (t) == ADDR_EXPR)
{ {
tree x = get_base_var (t); tree x = get_base_var (t);
if (TREE_CODE (x) == VAR_DECL) if (TREE_CODE (x) == VAR_DECL || TREE_CODE (x) == FUNCTION_DECL)
if (has_proper_scope_for_analysis (x)) if (has_proper_scope_for_analysis (x))
bitmap_set_bit (module_statics_escape, DECL_UID (x)); bitmap_set_bit (module_statics_escape, DECL_UID (x));
} }
...@@ -741,6 +741,7 @@ merge_callee_local_info (struct cgraph_node *target, ...@@ -741,6 +741,7 @@ merge_callee_local_info (struct cgraph_node *target,
static void static void
ipa_init (void) ipa_init (void)
{ {
struct cgraph_node *node;
memory_identifier_string = build_string(7, "memory"); memory_identifier_string = build_string(7, "memory");
reference_vars_to_consider = reference_vars_to_consider =
...@@ -751,6 +752,10 @@ ipa_init (void) ...@@ -751,6 +752,10 @@ ipa_init (void)
module_statics_written = BITMAP_ALLOC (&ipa_obstack); module_statics_written = BITMAP_ALLOC (&ipa_obstack);
all_module_statics = BITMAP_ALLOC (&ipa_obstack); all_module_statics = BITMAP_ALLOC (&ipa_obstack);
/* This will add NODE->DECL to the splay trees. */
for (node = cgraph_nodes; node; node = node->next)
has_proper_scope_for_analysis (node->decl);
/* There are some shared nodes, in particular the initializers on /* There are some shared nodes, in particular the initializers on
static declarations. We do not need to scan them more than once static declarations. We do not need to scan them more than once
since all we would be interested in are the addressof since all we would be interested in are the addressof
...@@ -964,6 +969,11 @@ static_execute (void) ...@@ -964,6 +969,11 @@ static_execute (void)
{ {
tree var = get_static_decl (index); tree var = get_static_decl (index);
/* Readonly on a function decl is very different from the
variable. */
if (TREE_CODE (var) == FUNCTION_DECL)
continue;
/* Ignore variables in named sections - changing TREE_READONLY /* Ignore variables in named sections - changing TREE_READONLY
changes the section flags, potentially causing conflicts with changes the section flags, potentially causing conflicts with
other variables in the same named section. */ other variables in the same named section. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment