aboutsummaryrefslogtreecommitdiff
path: root/gcc/calls.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2000-05-27 15:21:17 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2000-05-27 11:21:17 -0400
commit8d5e6e2527f07e6cfda3b62f1fd826006931d551 (patch)
treee4055b6cf63a0bcf4381fb7092adf5db521626a7 /gcc/calls.c
parent0777f60c79e32b504c03b6a703d6833ca6bc91c5 (diff)
downloadgcc-8d5e6e2527f07e6cfda3b62f1fd826006931d551.zip
gcc-8d5e6e2527f07e6cfda3b62f1fd826006931d551.tar.gz
gcc-8d5e6e2527f07e6cfda3b62f1fd826006931d551.tar.bz2
tree.h (TREE_CODE_LENGTH): New macro.
* tree.h (TREE_CODE_LENGTH): New macro. * c-common.c (c_find_base_decl): Use it. * expr.c (safe_from_p): Likewise. * print-tree.c (print_node): Likewise. * tree.c (make_node, copy_node, get_identifier): Likewie. (first_rtl_op, contains_placeholder_p, substitute_in_expr): Likewise. (build, build_nt, build_parse_node, simple_cst_equal): Likewise. * fold-const.c (make_range): Likewise. (fold): Likewise; also use first_rtl_op. * c-iterate.c (collect_iterators): Use first_rtl_op. * calls.c (calls_function_1): Likewise; also rename TYPE to CLASS. Use IS_EXPR_CODE_CLASS. (preexpand_calls): Likewise. * ggc-common.c (ggc_mark_trees): Rework to use first_rtl_op and TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): If no operands, no unused value. * ch/lang.c (deep_const_expr): Use first_rtl_op. * ch/satisfy.c (satisfy): Use TREE_CODE_LENGTH. * cp/method.c (mangle_expression): Use TREE_CODE_LENGTH. * cp/tree.c (break_out_calls, build_min_nt): Use TREE_CODE_LENGTH. (built_min, cp_tree_equal): Likewise. From-SVN: r34203
Diffstat (limited to 'gcc/calls.c')
-rw-r--r--gcc/calls.c42
1 files changed, 14 insertions, 28 deletions
diff --git a/gcc/calls.c b/gcc/calls.c
index 1c2c2ea..08ab00d 100644
--- a/gcc/calls.c
+++ b/gcc/calls.c
@@ -238,12 +238,15 @@ calls_function (exp, which)
int which;
{
int val;
+
calls_function_save_exprs = 0;
val = calls_function_1 (exp, which);
calls_function_save_exprs = 0;
return val;
}
+/* Recursive function to do the work of above function. */
+
static int
calls_function_1 (exp, which)
tree exp;
@@ -251,8 +254,8 @@ calls_function_1 (exp, which)
{
register int i;
enum tree_code code = TREE_CODE (exp);
- int type = TREE_CODE_CLASS (code);
- int length = tree_code_length[(int) code];
+ int class = TREE_CODE_CLASS (code);
+ int length = first_rtl_op (code);
/* If this code is language-specific, we don't know what it will do. */
if ((int) code >= NUM_TREE_CODES)
@@ -265,16 +268,12 @@ calls_function_1 (exp, which)
return 1;
else if (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR
&& (TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
- == FUNCTION_DECL))
- {
- tree fndecl = TREE_OPERAND (TREE_OPERAND (exp, 0), 0);
- int flags = special_function_p (fndecl, 0);
- if (flags & ECF_MAY_BE_ALLOCA)
- return 1;
- }
+ == FUNCTION_DECL)
+ && (special_function_p (TREE_OPERAND (TREE_OPERAND (exp, 0), 0),
+ 0)
+ & ECF_MAY_BE_ALLOCA))
+ return 1;
- /* Third operand is RTL. */
- length = 2;
break;
case SAVE_EXPR:
@@ -290,14 +289,12 @@ calls_function_1 (exp, which)
case BLOCK:
{
register tree local;
+ register tree subblock;
for (local = BLOCK_VARS (exp); local; local = TREE_CHAIN (local))
if (DECL_INITIAL (local) != 0
&& calls_function_1 (DECL_INITIAL (local), which))
return 1;
- }
- {
- register tree subblock;
for (subblock = BLOCK_SUBBLOCKS (exp);
subblock;
@@ -306,30 +303,19 @@ calls_function_1 (exp, which)
return 1;
}
return 0;
+
case TREE_LIST:
for (; exp != 0; exp = TREE_CHAIN (exp))
if (calls_function_1 (TREE_VALUE (exp), which))
return 1;
return 0;
- case METHOD_CALL_EXPR:
- length = 3;
- break;
-
- case WITH_CLEANUP_EXPR:
- length = 1;
- break;
-
- case RTL_EXPR:
- return 0;
-
default:
break;
}
- /* Only expressions and references can contain calls. */
- if (type != 'e' && type != '<' && type != '1' && type != '2' && type != 'r'
- && type != 'b')
+ /* Only expressions, references, and blocks can contain calls. */
+ if (! IS_EXPR_CODE_CLASS (class) && class != 'r' && class != 'b')
return 0;
for (i = 0; i < length; i++)