aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>1999-11-12 16:52:08 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>1999-11-12 16:52:08 +0000
commitd26f8097a31ff6a47d4b0861677ba44a8a25efec (patch)
treeca4319d8b6458e57f5d5a32ce72a5dfb816338ac /gcc
parent109cceda875779c29ee0ed68cf8ad0d4d5d44ce5 (diff)
downloadgcc-d26f8097a31ff6a47d4b0861677ba44a8a25efec.zip
gcc-d26f8097a31ff6a47d4b0861677ba44a8a25efec.tar.gz
gcc-d26f8097a31ff6a47d4b0861677ba44a8a25efec.tar.bz2
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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/stor-layout.c11
-rw-r--r--gcc/tree.c28
-rw-r--r--gcc/tree.h5
4 files changed, 28 insertions, 25 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f1606c9..fd09377 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,12 @@
+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
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 3663293..1433e8b 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -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))
diff --git a/gcc/tree.c b/gcc/tree.c
index ea5c1bf..a96d5c3 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -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:
diff --git a/gcc/tree.h b/gcc/tree.h
index 42760c8..1aa72d7 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -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])