Commit 64dc53f3 by Mark Mitchell Committed by Mark Mitchell

function.c (free_temps_for_rtl_expr): Don't free slots that have been pushed into a higher level.

	* function.c (free_temps_for_rtl_expr): Don't free slots
	that have been pushed into a higher level.

	* expr.c (cplus_expand_expr, case STMT_EXPR): Don't set
	RTL_EXPR_HAS_NO_SCOPE after all.

From-SVN: r32355
parent 7b45d84d
2000-03-06 Mark Mitchell <mark@codesourcery.com>
* function.c (free_temps_for_rtl_expr): Don't free slots
that have been pushed into a higher level.
Revert this patch:
2000-03-05 Mark Mitchell <mark@codesourcery.com>
2000-03-05 Mark Mitchell <mark@codesourcery.com> 2000-03-05 Mark Mitchell <mark@codesourcery.com>
* basic-block.h (ALLOCA_REG_SET): Remove. * basic-block.h (ALLOCA_REG_SET): Remove.
......
2000-03-06 Mark Mitchell <mark@codesourcery.com>
* expr.c (cplus_expand_expr, case STMT_EXPR): Don't set
RTL_EXPR_HAS_NO_SCOPE after all.
2000-03-05 Mark Mitchell <mark@codesourcery.com> 2000-03-05 Mark Mitchell <mark@codesourcery.com>
* expr.c (cplus_expand_expr, case STMT_EXPR): Use * expr.c (cplus_expand_expr, case STMT_EXPR): Use
......
...@@ -148,7 +148,6 @@ cplus_expand_expr (exp, target, tmode, modifier) ...@@ -148,7 +148,6 @@ cplus_expand_expr (exp, target, tmode, modifier)
tree rtl_expr = expand_start_stmt_expr (); tree rtl_expr = expand_start_stmt_expr ();
expand_stmt (STMT_EXPR_STMT (exp)); expand_stmt (STMT_EXPR_STMT (exp));
expand_end_stmt_expr (rtl_expr); expand_end_stmt_expr (rtl_expr);
RTL_EXPR_HAS_NO_SCOPE (rtl_expr) = 1;
return expand_expr (rtl_expr, target, tmode, modifier); return expand_expr (rtl_expr, target, tmode, modifier);
} }
break; break;
......
...@@ -6306,13 +6306,8 @@ expand_expr (exp, target, tmode, modifier) ...@@ -6306,13 +6306,8 @@ expand_expr (exp, target, tmode, modifier)
emit_insns (RTL_EXPR_SEQUENCE (exp)); emit_insns (RTL_EXPR_SEQUENCE (exp));
RTL_EXPR_SEQUENCE (exp) = const0_rtx; RTL_EXPR_SEQUENCE (exp) = const0_rtx;
} }
if (RTL_EXPR_HAS_NO_SCOPE (exp)) preserve_rtl_expr_result (RTL_EXPR_RTL (exp));
preserve_rtl_expr_temps (exp); free_temps_for_rtl_expr (exp);
else
{
preserve_rtl_expr_result (RTL_EXPR_RTL (exp));
free_temps_for_rtl_expr (exp);
}
return RTL_EXPR_RTL (exp); return RTL_EXPR_RTL (exp);
case CONSTRUCTOR: case CONSTRUCTOR:
......
...@@ -293,7 +293,6 @@ static void mark_function_chain PARAMS ((void *)); ...@@ -293,7 +293,6 @@ static void mark_function_chain PARAMS ((void *));
static void prepare_function_start PARAMS ((void)); static void prepare_function_start PARAMS ((void));
static void do_clobber_return_reg PARAMS ((rtx, void *)); static void do_clobber_return_reg PARAMS ((rtx, void *));
static void do_use_return_reg PARAMS ((rtx, void *)); static void do_use_return_reg PARAMS ((rtx, void *));
static void preserve_rtl_expr_temp PARAMS ((struct temp_slot *));
/* Pointer to chain of `struct function' for containing functions. */ /* Pointer to chain of `struct function' for containing functions. */
struct function *outer_function_chain; struct function *outer_function_chain;
...@@ -1130,36 +1129,6 @@ preserve_temp_slots (x) ...@@ -1130,36 +1129,6 @@ preserve_temp_slots (x)
p->level--; p->level--;
} }
/* Preserve the temporary slot given by P (originally created during
the building of an RTL_EXPR) at least as long as things in our
current scope. */
static void
preserve_rtl_expr_temp (p)
struct temp_slot *p;
{
/* Set the slot level to that of the currently prevailing scope. */
p->level = MIN (p->level, temp_slot_level);
/* This slot is no longer associated with the RTL_EXPR from which it
originated. */
p->rtl_expr = NULL_TREE;
}
/* Preserve the temporary slots created during the building of the
RTL_EXPR given by T at least as long as things in our current
scope. */
void
preserve_rtl_expr_temps (t)
tree t;
{
struct temp_slot *p;
for (p = temp_slots; p; p = p->next)
if (p->in_use && p->rtl_expr == t)
preserve_rtl_expr_temp (p);
}
/* X is the result of an RTL_EXPR. If it is a temporary slot associated /* X is the result of an RTL_EXPR. If it is a temporary slot associated
with that RTL_EXPR, promote it into a temporary slot at the present with that RTL_EXPR, promote it into a temporary slot at the present
level so it will not be freed when we free slots made in the level so it will not be freed when we free slots made in the
...@@ -1179,8 +1148,11 @@ preserve_rtl_expr_result (x) ...@@ -1179,8 +1148,11 @@ preserve_rtl_expr_result (x)
/* If we can find a match, move it to our level unless it is already at /* If we can find a match, move it to our level unless it is already at
an upper level. */ an upper level. */
p = find_temp_slot_from_address (XEXP (x, 0)); p = find_temp_slot_from_address (XEXP (x, 0));
if (p) if (p != 0)
preserve_rtl_expr_temp (p); {
p->level = MIN (p->level, temp_slot_level);
p->rtl_expr = 0;
}
return; return;
} }
...@@ -1215,7 +1187,16 @@ free_temps_for_rtl_expr (t) ...@@ -1215,7 +1187,16 @@ free_temps_for_rtl_expr (t)
for (p = temp_slots; p; p = p->next) for (p = temp_slots; p; p = p->next)
if (p->rtl_expr == t) if (p->rtl_expr == t)
p->in_use = 0; {
/* If this slot is below the current TEMP_SLOT_LEVEL, then it
needs to be preserved. This can happen if a temporary in
the RTL_EXPR was addressed; preserve_temp_slots will move
the temporary into a higher level. */
if (temp_slot_level <= p->level)
p->in_use = 0;
else
p->rtl_expr = NULL_TREE;
}
combine_temp_slots (); combine_temp_slots ();
} }
......
...@@ -689,11 +689,10 @@ DEFTREECODE (UNSAVE_EXPR, "unsave_expr", 'e', 1) ...@@ -689,11 +689,10 @@ DEFTREECODE (UNSAVE_EXPR, "unsave_expr", 'e', 1)
/* Represents something whose RTL has already been expanded as a /* Represents something whose RTL has already been expanded as a
sequence which should be emitted when this expression is expanded. sequence which should be emitted when this expression is expanded.
The first operand is the RTL to emit. It is the first of a chain The first operand is the RTL to emit. It is the first of a chain
of insns. The second is the RTL expression for the result. If of insns. The second is the RTL expression for the result. Any
RTL_EXPR_HAS_NO_SCOPE does not hold for this expression, then all temporaries created during the building of the RTL_EXPR can be
temporaries created within this RTL_EXPR (except for the reused once the RTL_EXPR has been expanded, with the exception of
RTL_EXPR_RTL) are out-of-scope after the RTL_EXPR is expanded. (In the RTL_EXPR_RTL. */
other words, their stack slots may be reused.) */
DEFTREECODE (RTL_EXPR, "rtl_expr", 'e', 2) DEFTREECODE (RTL_EXPR, "rtl_expr", 'e', 2)
/* & in C. Value is the address at which the operand's value resides. /* & in C. Value is the address at which the operand's value resides.
......
...@@ -749,10 +749,6 @@ struct tree_vec ...@@ -749,10 +749,6 @@ struct tree_vec
/* In a RTL_EXPR node. */ /* In a RTL_EXPR node. */
#define RTL_EXPR_SEQUENCE(NODE) (*(struct rtx_def **) &EXPR_CHECK (NODE)->exp.operands[0]) #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]) #define RTL_EXPR_RTL(NODE) (*(struct rtx_def **) &EXPR_CHECK (NODE)->exp.operands[1])
/* Nonzero if the RTL_EXPR does not define a scope, i.e., if
temporaries defined during its scope should persist even after the
RTL_EXPR has been expanded. */
#define RTL_EXPR_HAS_NO_SCOPE(NODE) TREE_ASM_WRITTEN (NODE)
/* In a CALL_EXPR node. */ /* In a CALL_EXPR node. */
#define CALL_EXPR_RTL(NODE) (*(struct rtx_def **) &EXPR_CHECK (NODE)->exp.operands[2]) #define CALL_EXPR_RTL(NODE) (*(struct rtx_def **) &EXPR_CHECK (NODE)->exp.operands[2])
......
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