aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2003-11-02 09:59:54 +0000
committerrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2003-11-02 09:59:54 +0000
commitb5639c6598b6054b0c87d4b992477ca5583eb2e0 (patch)
treeb4d96397accc0aa6bf0c29ebfade508e27f0a528 /gcc/tree-inline.c
parentb27854eb18ea94560f3ffc5d78e79977c57e0ac4 (diff)
* tree-inline.c (walk_tree): Tail recursion optimized for
COMPOUND_EXPRs. * tree-eh.c (collect_finally_tree): Ditto. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/tree-ssa-20020619-branch@73198 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 2e880f7ecee..32901c0c026 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -1887,9 +1887,19 @@ walk_tree (tree *tp, walk_tree_fn func, void *data, void *htab_)
--len;
/* Go through the subtrees. We need to do this in forward order so
that the scope of a FOR_EXPR is handled properly. */
- for (i = 0; i < len; ++i)
+ for (i = 0; i < len - 1; ++i)
WALK_SUBTREE (TREE_OPERAND (*tp, i));
+ if (len)
+ {
+ /* The common case is that we may tail recurse here. */
+ if (code != BIND_EXPR
+ && !TREE_CHAIN (*tp))
+ WALK_SUBTREE_TAIL (TREE_OPERAND (*tp, len - 1));
+ else
+ WALK_SUBTREE (TREE_OPERAND (*tp, len - 1));
+ }
+
if (code == BIND_EXPR)
{
tree decl;