Commit d26f8097 by Mark Mitchell Committed by Mark Mitchell

tree.h (SAVE_EXPR_PERSISTENT_P): New macro.

	* tree.h (SAVE_EXPR_PERSISTENT_P): New macro.
	* tree.c (array_type_nelts): Don't handle SAVE_EXPRs specially.
	(unsave_expr_now): Don't unsave SAVE_EXPR_PERSISTENT_P
	expressions.
	* stor-layout.c (variable_size): Set SAVE_EXPR_PERSISTENT_P on
	variable-sized array bounds.

From-SVN: r30503
parent 109cceda
Fri Nov 12 08:54:22 1999 Mark Mitchell <mark@codesourcery.com>
* tree.h (SAVE_EXPR_PERSISTENT_P): New macro.
* tree.c (array_type_nelts): Don't handle SAVE_EXPRs specially.
(unsave_expr_now): Don't unsave SAVE_EXPR_PERSISTENT_P
expressions.
* stor-layout.c (variable_size): Set SAVE_EXPR_PERSISTENT_P on
variable-sized array bounds.
Fri Nov 12 08:04:45 1999 Catherine Moore <clm@cygnus.com>
* defaults.h (ASM_OUTPUT_ALTERNATE_LABEL_NAME): Use
......
......@@ -97,6 +97,17 @@ variable_size (size)
size = save_expr (size);
/* If an array with a variable number of elements is declared, and
the elements require destruction, we will emit a cleanup for the
array. That cleanup is run both on normal exit from the block
and in the exception-handler for the block. Normally, when code
is used in both ordinary code and in an exception handler it is
`unsaved', i.e., all SAVE_EXPRs are recalculated. However, we do
not wish to do that here; the array-size is the same in both
places. */
if (TREE_CODE (size) == SAVE_EXPR)
SAVE_EXPR_PERSISTENT_P (size) = 1;
if (global_bindings_p ())
{
if (TREE_CONSTANT (size))
......
......@@ -2236,10 +2236,7 @@ int_size_in_bytes (type)
}
/* Return, as a tree node, the number of elements for TYPE (which is an
ARRAY_TYPE) minus one. This counts only elements of the top array.
Don't let any SAVE_EXPRs escape; if we are called as part of a cleanup
action, they would get unsaved. */
ARRAY_TYPE) minus one. This counts only elements of the top array. */
tree
array_type_nelts (type)
......@@ -2256,26 +2253,6 @@ array_type_nelts (type)
min = TYPE_MIN_VALUE (index_type);
max = TYPE_MAX_VALUE (index_type);
if (! TREE_CONSTANT (min))
{
STRIP_NOPS (min);
if (TREE_CODE (min) == SAVE_EXPR && SAVE_EXPR_RTL (min))
min = build (RTL_EXPR, TREE_TYPE (TYPE_MIN_VALUE (index_type)), 0,
SAVE_EXPR_RTL (min));
else
min = TYPE_MIN_VALUE (index_type);
}
if (! TREE_CONSTANT (max))
{
STRIP_NOPS (max);
if (TREE_CODE (max) == SAVE_EXPR && SAVE_EXPR_RTL (max))
max = build (RTL_EXPR, TREE_TYPE (TYPE_MAX_VALUE (index_type)), 0,
SAVE_EXPR_RTL (max));
else
max = TYPE_MAX_VALUE (index_type);
}
return (integer_zerop (min)
? max
: fold (build (MINUS_EXPR, TREE_TYPE (max), max, min)));
......@@ -2465,7 +2442,8 @@ unsave_expr_now (expr)
switch (code)
{
case SAVE_EXPR:
SAVE_EXPR_RTL (expr) = 0;
if (!SAVE_EXPR_PERSISTENT_P (expr))
SAVE_EXPR_RTL (expr) = 0;
break;
case TARGET_EXPR:
......
......@@ -717,6 +717,11 @@ struct tree_vec
#define SAVE_EXPR_CONTEXT(NODE) TREE_OPERAND(NODE, 1)
#define SAVE_EXPR_RTL(NODE) (*(struct rtx_def **) &EXPR_CHECK (NODE)->exp.operands[2])
#define SAVE_EXPR_NOPLACEHOLDER(NODE) TREE_UNSIGNED (NODE)
/* Nonzero if the SAVE_EXPRs value should be kept, even if it occurs
both in normal code and in a handler. (Normally, in a handler, all
SAVE_EXPRs are unsaved, meaning that there values are
recalculated.) */
#define SAVE_EXPR_PERSISTENT_P(NODE) TREE_ASM_WRITTEN (NODE)
/* In a RTL_EXPR node. */
#define RTL_EXPR_SEQUENCE(NODE) (*(struct rtx_def **) &EXPR_CHECK (NODE)->exp.operands[0])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment