diff options
author | Richard Kenner <kenner@vlsi1.ultra.nyu.edu> | 2000-04-12 13:10:42 +0000 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 2000-04-12 09:10:42 -0400 |
commit | 58de89e74911baebdd1d0ce10cba6a8be8ff71ee (patch) | |
tree | 0743b530b7eaeeb9262ddf9790c3a1c21d7683f6 /gcc/tree.c | |
parent | c3c6393606e01880684fb037538eac0ffd1f4337 (diff) | |
download | gcc-58de89e74911baebdd1d0ce10cba6a8be8ff71ee.zip gcc-58de89e74911baebdd1d0ce10cba6a8be8ff71ee.tar.gz gcc-58de89e74911baebdd1d0ce10cba6a8be8ff71ee.tar.bz2 |
* tree.c (unsave_expr_now_r, unsafe_for_reeval): Properly do TREE_LIST.
From-SVN: r33104
Diffstat (limited to 'gcc/tree.c')
-rw-r--r-- | gcc/tree.c | 52 |
1 files changed, 23 insertions, 29 deletions
@@ -2649,27 +2649,22 @@ unsave_expr_now_r (expr) unsave_expr_1 (expr); code = TREE_CODE (expr); - if (code == CALL_EXPR - && TREE_OPERAND (expr, 1) - && TREE_CODE (TREE_OPERAND (expr, 1)) == TREE_LIST) - { - tree exp = TREE_OPERAND (expr, 1); - while (exp) - { - unsave_expr_now_r (TREE_VALUE (exp)); - exp = TREE_CHAIN (exp); - } - } - switch (TREE_CODE_CLASS (code)) { case 'c': /* a constant */ case 't': /* a type node */ - case 'x': /* something random, like an identifier or an ERROR_MARK. */ case 'd': /* A decl node */ case 'b': /* A block node */ break; + case 'x': /* miscellaneous: e.g., identifier, TREE_LIST or ERROR_MARK. */ + if (code == TREE_LIST) + { + unsave_expr_now_r (TREE_VALUE (expr)); + unsave_expr_now_r (TREE_CHAIN (expr)); + } + break; + case 'e': /* an expression */ case 'r': /* a reference */ case 's': /* an expression with side effects */ @@ -2724,8 +2719,10 @@ int unsafe_for_reeval (expr) tree expr; { + int unsafeness = 0; enum tree_code code; - register int i, tmp, unsafeness; + int i, tmp; + tree exp; int first_rtl; if (expr == NULL_TREE) @@ -2733,7 +2730,6 @@ unsafe_for_reeval (expr) code = TREE_CODE (expr); first_rtl = first_rtl_op (code); - unsafeness = 0; switch (code) { @@ -2741,20 +2737,18 @@ unsafe_for_reeval (expr) case RTL_EXPR: return 2; - case CALL_EXPR: - if (TREE_OPERAND (expr, 1) - && TREE_CODE (TREE_OPERAND (expr, 1)) == TREE_LIST) + case TREE_LIST: + for (exp = expr; exp != 0; exp = TREE_CHAIN (exp)) { - tree exp = TREE_OPERAND (expr, 1); - while (exp) - { - tmp = unsafe_for_reeval (TREE_VALUE (exp)); - if (tmp > 1) - return tmp; - exp = TREE_CHAIN (exp); - } + tmp = unsafe_for_reeval (TREE_VALUE (exp)); + unsafeness = MAX (tmp, unsafeness); } - return 1; + + return unsafeness; + + case CALL_EXPR: + tmp = unsafe_for_reeval (TREE_OPERAND (expr, 1)); + return MAX (tmp, 1); case TARGET_EXPR: unsafeness = 1; @@ -2783,9 +2777,9 @@ unsafe_for_reeval (expr) for (i = first_rtl - 1; i >= 0; i--) { tmp = unsafe_for_reeval (TREE_OPERAND (expr, i)); - if (tmp > unsafeness) - unsafeness = tmp; + unsafeness = MAX (tmp, unsafeness); } + return unsafeness; default: |