+2004-09-12 Richard Henderson <rth@redhat.com>
+
+ PR c++/16254
+ * fold-const.c (fold) <case CLEANUP_POINT_EXPR>: Remove.
+ * tree.c, tree.h (has_cleanups): Remove.
+
2004-09-12 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
* tree-ssa-loop-manip.c (split_loop_exit_edge): Handle non-ssaname
+2004-09-12 Richard Henderson <rth@redhat.com>
+
+ PR c++/16254
+ * semantics.c (maybe_cleanup_point_expr): Don't call fold.
+ * typeck.c (condition_conversion): Likewise.
+
2004-09-11 Richard Henderson <rth@redhat.com>
PR c++/17404
maybe_cleanup_point_expr (tree expr)
{
if (!processing_template_decl && stmts_are_full_exprs_p ())
- expr = fold (build1 (CLEANUP_POINT_EXPR, TREE_TYPE (expr), expr));
+ expr = build1 (CLEANUP_POINT_EXPR, TREE_TYPE (expr), expr);
return expr;
}
if (processing_template_decl)
return expr;
t = perform_implicit_conversion (boolean_type_node, expr);
- t = fold (build1 (CLEANUP_POINT_EXPR, boolean_type_node, t));
+ t = build1 (CLEANUP_POINT_EXPR, boolean_type_node, t);
return t;
}
TREE_OPERAND (arg0, 1)))));
return t;
- case CLEANUP_POINT_EXPR:
- /* Pull arithmetic ops out of the CLEANUP_POINT_EXPR where
- appropriate. */
- if (! has_cleanups (arg0))
- return TREE_OPERAND (t, 0);
-
- {
- enum tree_code code0 = TREE_CODE (arg0);
- int kind0 = TREE_CODE_CLASS (code0);
-
- if (kind0 == '1' || code0 == TRUTH_NOT_EXPR)
- {
- tree arg00 = TREE_OPERAND (arg0, 0);
- return fold (build1 (code0, type,
- fold (build1 (CLEANUP_POINT_EXPR,
- TREE_TYPE (arg00), arg00))));
- }
-
- if (kind0 == '<' || kind0 == '2'
- || code0 == TRUTH_ANDIF_EXPR || code0 == TRUTH_ORIF_EXPR
- || code0 == TRUTH_AND_EXPR || code0 == TRUTH_OR_EXPR
- || code0 == TRUTH_XOR_EXPR)
- {
- tree arg00 = TREE_OPERAND (arg0, 0);
- tree arg01 = TREE_OPERAND (arg0, 1);
-
- if (TREE_CONSTANT (arg00)
- || ((code0 == TRUTH_ANDIF_EXPR || code0 == TRUTH_ORIF_EXPR)
- && ! has_cleanups (arg00)))
- return fold (build2 (code0, type, arg00,
- fold (build1 (CLEANUP_POINT_EXPR,
- TREE_TYPE (arg01), arg01))));
-
- if (TREE_CONSTANT (arg01))
- return fold (build2 (code0, type,
- fold (build1 (CLEANUP_POINT_EXPR,
- TREE_TYPE (arg00), arg00)),
- arg01));
- }
-
- return t;
- }
-
case CALL_EXPR:
/* Check for a built-in function. */
if (TREE_CODE (TREE_OPERAND (t, 0)) == ADDR_EXPR
gcc_unreachable ();
}
}
-
-/* Return 1 if EXP contains any expressions that produce cleanups for an
- outer scope to deal with. Used by fold. */
-
-int
-has_cleanups (tree exp)
-{
- int i, nops, cmp;
-
- if (! TREE_SIDE_EFFECTS (exp))
- return 0;
-
- switch (TREE_CODE (exp))
- {
- case TARGET_EXPR:
- case WITH_CLEANUP_EXPR:
- return 1;
-
- case CLEANUP_POINT_EXPR:
- return 0;
-
- case CALL_EXPR:
- for (exp = TREE_OPERAND (exp, 1); exp; exp = TREE_CHAIN (exp))
- {
- cmp = has_cleanups (TREE_VALUE (exp));
- if (cmp)
- return cmp;
- }
- return 0;
-
- case DECL_EXPR:
- return (DECL_INITIAL (DECL_EXPR_DECL (exp))
- && has_cleanups (DECL_INITIAL (DECL_EXPR_DECL (exp))));
-
- default:
- break;
- }
-
- /* This general rule works for most tree codes. All exceptions should be
- handled above. If this is a language-specific tree code, we can't
- trust what might be in the operand, so say we don't know
- the situation. */
- if ((int) TREE_CODE (exp) >= (int) LAST_AND_UNUSED_TREE_CODE)
- return -1;
-
- nops = first_rtl_op (TREE_CODE (exp));
- for (i = 0; i < nops; i++)
- if (TREE_OPERAND (exp, i) != 0)
- {
- int type = TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, i)));
- if (type == 'e' || type == '<' || type == '1' || type == '2'
- || type == 'r' || type == 's')
- {
- cmp = has_cleanups (TREE_OPERAND (exp, i));
- if (cmp)
- return cmp;
- }
- }
-
- return 0;
-}
\f
/* Given a tree EXP, a FIELD_DECL F, and a replacement value R,
return a tree with all occurrences of references to F in a
extern bool type_contains_placeholder_p (tree);
-/* Return 1 if EXP contains any expressions that produce cleanups for an
- outer scope to deal with. Used by fold. */
-
-extern int has_cleanups (tree);
-
/* Given a tree EXP, a FIELD_DECL F, and a replacement value R,
return a tree with all occurrences of references to F in a
PLACEHOLDER_EXPR replaced by R. Note that we assume here that EXP