aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Stallman <rms@gnu.org>1993-06-26 02:37:19 +0000
committerRichard Stallman <rms@gnu.org>1993-06-26 02:37:19 +0000
commit1c8d7aef51dc9e36853a5b14b3f8ce25d0cd952a (patch)
tree4b199812c54f6fbed15472dd20d3d71c47a2ad33
parent4d06f1a21804905f8f73a2d339c1296628599d07 (diff)
downloadgcc-1c8d7aef51dc9e36853a5b14b3f8ce25d0cd952a.zip
gcc-1c8d7aef51dc9e36853a5b14b3f8ce25d0cd952a.tar.gz
gcc-1c8d7aef51dc9e36853a5b14b3f8ce25d0cd952a.tar.bz2
(calls_function): Don't scan a single save_expr twice.
(calls_function_1): New subroutine for the actual recursion. From-SVN: r4737
-rw-r--r--gcc/calls.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/gcc/calls.c b/gcc/calls.c
index dc867ae..052cbb2 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -132,11 +132,25 @@ static void store_one_arg PROTO ((struct arg_data *, rtx, int, int,
arguments on the stack, but that is too difficult to compute, so we just
assume any function call might require the stack. */
+static tree calls_function_save_exprs;
+
static int
calls_function (exp, which)
tree exp;
int which;
{
+ int val;
+ calls_function_save_exprs = 0;
+ val = calls_function_1 (exp, which);
+ calls_function_save_exprs = 0;
+ return val;
+}
+
+static int
+calls_function_1 (exp, which)
+ tree exp;
+ int which;
+{
register int i;
int type = TREE_CODE_CLASS (TREE_CODE (exp));
int length = tree_code_length[(int) TREE_CODE (exp)];
@@ -167,7 +181,12 @@ calls_function (exp, which)
case SAVE_EXPR:
if (SAVE_EXPR_RTL (exp) != 0)
return 0;
- break;
+ if (value_member (exp, calls_function_save_exprs))
+ return 0;
+ calls_function_save_exprs = tree_cons (NULL_TREE, exp,
+ calls_function_save_exprs);
+ return (TREE_OPERAND (exp, 0) != 0
+ && calls_function_1 (TREE_OPERAND (exp, 0), which));
case BLOCK:
{
@@ -175,7 +194,7 @@ calls_function (exp, which)
for (local = BLOCK_VARS (exp); local; local = TREE_CHAIN (local))
if (DECL_INITIAL (local) != 0
- && calls_function (DECL_INITIAL (local), which))
+ && calls_function_1 (DECL_INITIAL (local), which))
return 1;
}
{
@@ -184,7 +203,7 @@ calls_function (exp, which)
for (subblock = BLOCK_SUBBLOCKS (exp);
subblock;
subblock = TREE_CHAIN (subblock))
- if (calls_function (subblock, which))
+ if (calls_function_1 (subblock, which))
return 1;
}
return 0;
@@ -203,7 +222,7 @@ calls_function (exp, which)
for (i = 0; i < length; i++)
if (TREE_OPERAND (exp, i) != 0
- && calls_function (TREE_OPERAND (exp, i), which))
+ && calls_function_1 (TREE_OPERAND (exp, i), which))
return 1;
return 0;