summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2000-10-23 04:40:26 +0000
committerMark Mitchell <mmitchel@gcc.gnu.org>2000-10-23 04:40:26 +0000
commitf9808f81c98e92f3d590391f7924585208725c94 (patch)
treea834ffb7437cb8a679af25dbc3ccd37302b72aaf /gcc
parent0870bfd6d80b3711972ae5ce17564123727dee53 (diff)
downloadgcc-f9808f81c98e92f3d590391f7924585208725c94.tar.gz
expr.c (do_preexpand_calls): Remove.
* expr.c (do_preexpand_calls): Remove. (same_from_p): Don't use CALL_EXPR_RTL. (expand_expr): Don't call preexpand_calls, or use CALL_EXPR_RTL. (preexpand_calls): Remove. * tree.c (first_rtl_op): Remove CALL_EXPR case. (unsave_expr_1): Likewise. * tree.def (CALL_EXPR): Give it only two slots. * tree.h (CALL_EXPR_RTL): Remove. * optimize.c (copy_body_r): Don't treat CALL_EXPRs specially. From-SVN: r37012
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog11
-rw-r--r--gcc/cp/ChangeLog2
-rw-r--r--gcc/cp/optimize.c4
-rw-r--r--gcc/expr.c119
-rw-r--r--gcc/testsuite/g++.old-deja/g++.other/dtor10.C40
-rw-r--r--gcc/tree.c6
-rw-r--r--gcc/tree.def6
-rw-r--r--gcc/tree.h3
8 files changed, 60 insertions, 131 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 74d763f7a6a..8245daafde9 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,14 @@
+2000-10-22 Mark Mitchell <mark@codesourcery.com>
+
+ * expr.c (do_preexpand_calls): Remove.
+ (same_from_p): Don't use CALL_EXPR_RTL.
+ (expand_expr): Don't call preexpand_calls, or use CALL_EXPR_RTL.
+ (preexpand_calls): Remove.
+ * tree.c (first_rtl_op): Remove CALL_EXPR case.
+ (unsave_expr_1): Likewise.
+ * tree.def (CALL_EXPR): Give it only two slots.
+ * tree.h (CALL_EXPR_RTL): Remove.
+
2000-10-21 Chandrakala Chavva <cchavva@redhat.com>
* libgcc-std.ver (__addvsi3, __addvdi3, __subvsi3, __subvdi3,
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 23660c3486b..88f8c8dc75d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,7 @@
2000-10-22 Mark Mitchell <mark@codesourcery.com>
+ * optimize.c (copy_body_r): Don't treat CALL_EXPRs specially.
+
* typeck.c (c_sizeof): Return an expression of `size_t' type,
not one with TYPE_IS_SIZETYPE set.
(dubious_conversion_warnings): Remove special-case code.
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index be53216ac7c..b8f13786fc6 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -336,10 +336,6 @@ copy_body_r (tp, walk_subtrees, data)
TREE_OPERAND (*tp, 1) = TREE_OPERAND (*tp, 3);
TREE_OPERAND (*tp, 3) = NULL_TREE;
}
- /* Similarly, if we're copying a CALL_EXPR, the RTL for the
- result is no longer valid. */
- else if (TREE_CODE (*tp) == CALL_EXPR)
- CALL_EXPR_RTL (*tp) = NULL_RTX;
}
/* Keep iterating. */
diff --git a/gcc/expr.c b/gcc/expr.c
index cc3ec34e390..b030c7a0c29 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -102,11 +102,6 @@ int (*lang_safe_from_p) PARAMS ((rtx, tree));
the same indirect address eventually. */
int cse_not_expected;
-/* Nonzero to generate code for all the subroutines within an
- expression before generating the upper levels of the expression.
- Nowadays this is never zero. */
-int do_preexpand_calls = 1;
-
/* Don't check memory usage, since code is being emitted to check a memory
usage. Used when current_function_check_memory_usage is true, to avoid
infinite recursion. */
@@ -183,7 +178,6 @@ static rtx var_rtx PARAMS ((tree));
static int readonly_fields_p PARAMS ((tree));
static rtx expand_expr_unaligned PARAMS ((tree, unsigned int *));
static rtx expand_increment PARAMS ((tree, int, int));
-static void preexpand_calls PARAMS ((tree));
static void do_jump_by_parts_greater PARAMS ((tree, int, rtx, rtx));
static void do_jump_by_parts_equality PARAMS ((tree, rtx, rtx));
static void do_compare_and_jump PARAMS ((tree, enum rtx_code, enum rtx_code,
@@ -5533,16 +5527,11 @@ safe_from_p (x, exp, top_p)
break;
case CALL_EXPR:
- exp_rtl = CALL_EXPR_RTL (exp);
- if (exp_rtl == 0)
- {
- /* Assume that the call will clobber all hard registers and
- all of memory. */
- if ((GET_CODE (x) == REG && REGNO (x) < FIRST_PSEUDO_REGISTER)
- || GET_CODE (x) == MEM)
- return 0;
- }
-
+ /* Assume that the call will clobber all hard registers and
+ all of memory. */
+ if ((GET_CODE (x) == REG && REGNO (x) < FIRST_PSEUDO_REGISTER)
+ || GET_CODE (x) == MEM)
+ return 0;
break;
case RTL_EXPR:
@@ -7030,8 +7019,6 @@ expand_expr (exp, target, tmode, modifier)
rtx rlow;
rtx diff, quo, rem, addr, bit, result;
- preexpand_calls (exp);
-
/* If domain is empty, answer is no. Likewise if index is constant
and out of bounds. */
if (((TREE_CODE (set_high_bound) == INTEGER_CST
@@ -7154,11 +7141,6 @@ expand_expr (exp, target, tmode, modifier)
return expand_builtin (exp, target, subtarget, tmode, ignore);
}
- /* If this call was expanded already by preexpand_calls,
- just return the result we got. */
- if (CALL_EXPR_RTL (exp) != 0)
- return CALL_EXPR_RTL (exp);
-
return expand_call (exp, target, ignore);
case NON_LVALUE_EXPR:
@@ -7354,7 +7336,6 @@ expand_expr (exp, target, tmode, modifier)
|| mode != ptr_mode)
goto binop;
- preexpand_calls (exp);
if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1), 1))
subtarget = 0;
@@ -7453,7 +7434,6 @@ expand_expr (exp, target, tmode, modifier)
goto binop;
case MULT_EXPR:
- preexpand_calls (exp);
/* If first operand is constant, swap them.
Thus the following special case checks need only
check the second operand. */
@@ -7580,7 +7560,6 @@ expand_expr (exp, target, tmode, modifier)
case CEIL_DIV_EXPR:
case ROUND_DIV_EXPR:
case EXACT_DIV_EXPR:
- preexpand_calls (exp);
if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1), 1))
subtarget = 0;
/* Possible optimization: compute the dividend with EXPAND_SUM
@@ -7598,7 +7577,6 @@ expand_expr (exp, target, tmode, modifier)
case FLOOR_MOD_EXPR:
case CEIL_MOD_EXPR:
case ROUND_MOD_EXPR:
- preexpand_calls (exp);
if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1), 1))
subtarget = 0;
op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
@@ -7760,7 +7738,6 @@ expand_expr (exp, target, tmode, modifier)
case RSHIFT_EXPR:
case LROTATE_EXPR:
case RROTATE_EXPR:
- preexpand_calls (exp);
if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1), 1))
subtarget = 0;
op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
@@ -7782,7 +7759,6 @@ expand_expr (exp, target, tmode, modifier)
case UNGT_EXPR:
case UNGE_EXPR:
case UNEQ_EXPR:
- preexpand_calls (exp);
temp = do_store_flag (exp, target, tmode != VOIDmode ? tmode : mode, 0);
if (temp != 0)
return temp;
@@ -8280,7 +8256,6 @@ expand_expr (exp, target, tmode, modifier)
&& TREE_CODE (lhs) != PARM_DECL
&& ! (TREE_CODE (lhs) == INDIRECT_REF
&& TYPE_READONLY (TREE_TYPE (TREE_OPERAND (lhs, 0)))))
- preexpand_calls (exp);
/* Check for |= or &= of a bitfield of size one into another bitfield
of size 1. In this case, (unless we need the result of the
@@ -8608,7 +8583,6 @@ expand_expr (exp, target, tmode, modifier)
/* Here to do an ordinary binary operator, generating an instruction
from the optab already placed in `this_optab'. */
binop:
- preexpand_calls (exp);
if (! safe_from_p (subtarget, TREE_OPERAND (exp, 1), 1))
subtarget = 0;
op0 = expand_expr (TREE_OPERAND (exp, 0), subtarget, VOIDmode, 0);
@@ -9180,88 +9154,6 @@ expand_increment (exp, post, ignore)
return temp;
}
-/* Expand all function calls contained within EXP, innermost ones first.
- But don't look within expressions that have sequence points.
- For each CALL_EXPR, record the rtx for its value
- in the CALL_EXPR_RTL field. */
-
-static void
-preexpand_calls (exp)
- tree exp;
-{
- register int nops, i;
- int class = TREE_CODE_CLASS (TREE_CODE (exp));
-
- if (! do_preexpand_calls)
- return;
-
- /* Only expressions and references can contain calls. */
-
- if (! IS_EXPR_CODE_CLASS (class) && class != 'r')
- return;
-
- switch (TREE_CODE (exp))
- {
- case CALL_EXPR:
- /* Do nothing if already expanded. */
- if (CALL_EXPR_RTL (exp) != 0
- /* Do nothing if the call returns a variable-sized object. */
- || (TREE_CODE (TREE_TYPE (exp)) != VOID_TYPE
- && TREE_CODE (TYPE_SIZE (TREE_TYPE (exp))) != INTEGER_CST)
- /* Do nothing to built-in functions. */
- || (TREE_CODE (TREE_OPERAND (exp, 0)) == ADDR_EXPR
- && (TREE_CODE (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))
- == FUNCTION_DECL)
- && DECL_BUILT_IN (TREE_OPERAND (TREE_OPERAND (exp, 0), 0))))
- return;
-
- CALL_EXPR_RTL (exp) = expand_call (exp, NULL_RTX, 0);
- return;
-
- case COMPOUND_EXPR:
- case COND_EXPR:
- case TRUTH_ANDIF_EXPR:
- case TRUTH_ORIF_EXPR:
- /* If we find one of these, then we can be sure
- the adjust will be done for it (since it makes jumps).
- Do it now, so that if this is inside an argument
- of a function, we don't get the stack adjustment
- after some other args have already been pushed. */
- do_pending_stack_adjust ();
- return;
-
- case BLOCK:
- case RTL_EXPR:
- case WITH_CLEANUP_EXPR:
- case CLEANUP_POINT_EXPR:
- case TRY_CATCH_EXPR:
- return;
-
- case SAVE_EXPR:
- if (SAVE_EXPR_RTL (exp) != 0)
- return;
-
- default:
- break;
- }
-
- nops = TREE_CODE_LENGTH (TREE_CODE (exp));
- for (i = 0; i < nops; i++)
- if (TREE_OPERAND (exp, i) != 0)
- {
- if (TREE_CODE (exp) == TARGET_EXPR && i == 2)
- /* We don't need to preexpand the cleanup for a TARGET_EXPR.
- It doesn't happen before the call is made. */
- ;
- else
- {
- class = TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, i)));
- if (IS_EXPR_CODE_CLASS (class) || class == 'r')
- preexpand_calls (TREE_OPERAND (exp, i));
- }
- }
-}
-
/* At the start of a function, record that we have no previously-pushed
arguments waiting to be popped. */
@@ -10428,7 +10320,6 @@ do_store_flag (exp, target, mode, only_cheap)
return 0;
}
- preexpand_calls (exp);
if (! get_subtarget (target)
|| GET_MODE (subtarget) != operand_mode
|| ! safe_from_p (subtarget, arg1, 1))
diff --git a/gcc/testsuite/g++.old-deja/g++.other/dtor10.C b/gcc/testsuite/g++.old-deja/g++.other/dtor10.C
new file mode 100644
index 00000000000..c8f7babb064
--- /dev/null
+++ b/gcc/testsuite/g++.old-deja/g++.other/dtor10.C
@@ -0,0 +1,40 @@
+// Origin: Mark Mitchell <mark@codesourcery.com>
+
+extern "C" void abort ();
+
+int j;
+
+struct S {
+ static S* s[5];
+
+ S () { s[j++] = this; }
+ S (const S&) { s[j++] = this; }
+ ~S () {
+ for (int k = 0; k < j; ++k)
+ if (s[k] == this)
+ return;
+ abort ();
+ }
+};
+
+S* S::s[5];
+
+struct T {
+ int i;
+ S s;
+};
+
+T t;
+
+T f () {
+ return t;
+}
+
+void g (S) {
+};
+
+int main ()
+{
+ g (f ().s);
+}
+
diff --git a/gcc/tree.c b/gcc/tree.c
index f4aae664613..4bebf20d55c 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1764,8 +1764,6 @@ first_rtl_op (code)
case GOTO_SUBROUTINE_EXPR:
case RTL_EXPR:
return 0;
- case CALL_EXPR:
- return 2;
case WITH_CLEANUP_EXPR:
/* Should be defined to be 2. */
return 1;
@@ -1808,10 +1806,6 @@ unsave_expr_1 (expr)
abort ();
break;
- case CALL_EXPR:
- CALL_EXPR_RTL (expr) = 0;
- break;
-
default:
if (lang_unsave_expr_now != 0)
(*lang_unsave_expr_now) (expr);
diff --git a/gcc/tree.def b/gcc/tree.def
index 28c47d97a79..c61a5ff578b 100644
--- a/gcc/tree.def
+++ b/gcc/tree.def
@@ -454,10 +454,8 @@ DEFTREECODE (BIND_EXPR, "bind_expr", 'e', 3)
/* Function call. Operand 0 is the function.
Operand 1 is the argument list, a list of expressions
- made out of a chain of TREE_LIST nodes.
- There is no operand 2. That slot is used for the
- CALL_EXPR_RTL macro (see preexpand_calls). */
-DEFTREECODE (CALL_EXPR, "call_expr", 'e', 3)
+ made out of a chain of TREE_LIST nodes. */
+DEFTREECODE (CALL_EXPR, "call_expr", 'e', 2)
/* Call a method. Operand 0 is the method, whose type is a METHOD_TYPE.
Operand 1 is the expression for "self".
diff --git a/gcc/tree.h b/gcc/tree.h
index 9551c8f0a31..17f09a13acf 100644
--- a/gcc/tree.h
+++ b/gcc/tree.h
@@ -780,9 +780,6 @@ struct tree_vec
#define RTL_EXPR_SEQUENCE(NODE) (*(struct rtx_def **) &EXPR_CHECK (NODE)->exp.operands[0])
#define RTL_EXPR_RTL(NODE) (*(struct rtx_def **) &EXPR_CHECK (NODE)->exp.operands[1])
-/* In a CALL_EXPR node. */
-#define CALL_EXPR_RTL(NODE) (*(struct rtx_def **) &EXPR_CHECK (NODE)->exp.operands[2])
-
/* In a CONSTRUCTOR node. */
#define CONSTRUCTOR_ELTS(NODE) TREE_OPERAND (NODE, 1)