summaryrefslogtreecommitdiff
path: root/gcc/tree-nested.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-31 21:05:22 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2010-08-31 21:05:22 +0000
commitfee106ed89c52617e2135074886d79ba5dca89ea (patch)
treee6c48d895113d40a0dd1251fb99c06c246c3b901 /gcc/tree-nested.c
parent4cf1a89b51e490377452536f845b214b9528cc69 (diff)
downloadgcc-fee106ed89c52617e2135074886d79ba5dca89ea.tar.gz
* tree-nested.c (convert_all_function_calls): Iterate until after the
sum of static chains in the nest doesn't change. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@163698 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-nested.c')
-rw-r--r--gcc/tree-nested.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/gcc/tree-nested.c b/gcc/tree-nested.c
index 81ae38f6f3a..b811ec500df 100644
--- a/gcc/tree-nested.c
+++ b/gcc/tree-nested.c
@@ -2070,9 +2070,8 @@ convert_gimple_call (gimple_stmt_iterator *gsi, bool *handled_ops_p,
static void
convert_all_function_calls (struct nesting_info *root)
{
+ unsigned int chain_count = 0, old_chain_count, iter_count;
struct nesting_info *n;
- int iter_count;
- bool any_changed;
/* First, optimistically clear static_chain for all decls that haven't
used the static chain already for variable access. */
@@ -2088,6 +2087,7 @@ convert_all_function_calls (struct nesting_info *root)
}
else
DECL_STATIC_CHAIN (decl) = 1;
+ chain_count += DECL_STATIC_CHAIN (decl);
}
/* Walk the functions and perform transformations. Note that these
@@ -2100,7 +2100,8 @@ convert_all_function_calls (struct nesting_info *root)
iter_count = 0;
do
{
- any_changed = false;
+ old_chain_count = chain_count;
+ chain_count = 0;
iter_count++;
if (dump_file && (dump_flags & TDF_DETAILS))
@@ -2109,22 +2110,16 @@ convert_all_function_calls (struct nesting_info *root)
FOR_EACH_NEST_INFO (n, root)
{
tree decl = n->context;
- bool old_static_chain = DECL_STATIC_CHAIN (decl);
-
walk_function (convert_tramp_reference_stmt,
convert_tramp_reference_op, n);
walk_function (convert_gimple_call, NULL, n);
-
- /* If a call to another function created the use of a chain
- within this function, we'll have to continue iteration. */
- if (!old_static_chain && DECL_STATIC_CHAIN (decl))
- any_changed = true;
+ chain_count += DECL_STATIC_CHAIN (decl);
}
}
- while (any_changed);
+ while (chain_count != old_chain_count);
if (dump_file && (dump_flags & TDF_DETAILS))
- fprintf (dump_file, "convert_all_function_calls iterations: %d\n\n",
+ fprintf (dump_file, "convert_all_function_calls iterations: %u\n\n",
iter_count);
}