c-common.h (STMT_EXPR_NO_SCOPE): New macro.

* c-common.h (STMT_EXPR_NO_SCOPE): New macro.
	* c-common.c (c_expand_expr): Respect STMT_EXPR_NO_SCOPE.
	* tree.h (expand_start_stmt_expr): Update prototype.
	* stmt.c (expand_start_stmt_expr): Add has_scope parameter.
	* tree-inline.c (expand_call_inline): Set STMT_EXPR_NO_SCOPE
	on the STMT_EXPR created for the inline function.

	* trans.c (tree_transform): Add has_scope argument to
	expand_start_stmt_expr.

	* com.c (ffecom_expr_power_integer): Add has_scope argument to
	call to expand_start_stmt_expr.

	* init.c (begin_init_stmts): Remove commented out code.
	(finish_init_stmts): Set STMT_EXPR_NO_SCOPE.
	* semantics.c (begin_gobal_stmt_expr): Adjust call to
	expand_start_stmt_expr.

From-SVN: r52395
This commit is contained in:
Mark Mitchell 2002-04-17 01:47:36 +00:00 committed by Mark Mitchell
parent f0871dfe8f
commit b2123dc0d8
13 changed files with 60 additions and 15 deletions

View File

@ -90,6 +90,15 @@
* config/alpha/gnu.h: New file for it.
* config/gnu.h (TARGET_MEM_FUNCTIONS): #undef before #define.
2002-04-16 Mark Mitchell <mark@codesourcery.com>
* c-common.h (STMT_EXPR_NO_SCOPE): New macro.
* c-common.c (c_expand_expr): Respect STMT_EXPR_NO_SCOPE.
* tree.h (expand_start_stmt_expr): Update prototype.
* stmt.c (expand_start_stmt_expr): Add has_scope parameter.
* tree-inline.c (expand_call_inline): Set STMT_EXPR_NO_SCOPE
on the STMT_EXPR created for the inline function.
2002-04-15 Richard Henderson <rth@redhat.com>
* config/alpha/linux.h, config/arm/linux-elf.h, config/i370/linux.h,

View File

@ -1,3 +1,8 @@
2002-04-16 Mark Mitchell <mark@codesourcery.com>
* trans.c (tree_transform): Add has_scope argument to
expand_start_stmt_expr.
2002-04-04 Neil Booth <neil@daikokuya.demon.co.uk>
* gigi.h (truthvalue_conversion): Rename.

View File

@ -1770,7 +1770,7 @@ tree_transform (gnat_node)
we need to make sure it gets executed after the LHS. */
gnu_lhs = gnat_to_gnu (Left_Opnd (gnat_node));
clear_last_expr ();
gnu_rhs_side = expand_start_stmt_expr ();
gnu_rhs_side = expand_start_stmt_expr (/*has_scope=*/1);
gnu_rhs = gnat_to_gnu (Right_Opnd (gnat_node));
expand_end_stmt_expr (gnu_rhs_side);
gnu_result_type = get_unpadded_type (Etype (gnat_node));

View File

@ -3666,7 +3666,7 @@ c_expand_expr (exp, target, tmode, modifier)
out-of-scope after the first EXPR_STMT from within the
STMT_EXPR. */
push_temp_slots ();
rtl_expr = expand_start_stmt_expr ();
rtl_expr = expand_start_stmt_expr (!STMT_EXPR_NO_SCOPE (exp));
/* If we want the result of this expression, find the last
EXPR_STMT in the COMPOUND_STMT and mark it as addressable. */
@ -3703,6 +3703,12 @@ c_expand_expr (exp, target, tmode, modifier)
preserve_temp_slots (result);
}
/* If the statment-expression does not have a scope, then the
new temporaries we created within it must live beyond the
statement-expression. */
if (STMT_EXPR_NO_SCOPE (exp))
preserve_temp_slots (NULL_RTX);
pop_temp_slots ();
return result;
}

View File

@ -33,6 +33,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
DECL_PRETTY_FUNCTION_P (in VAR_DECL)
NEW_FOR_SCOPE_P (in FOR_STMT)
ASM_INPUT_P (in ASM_STMT)
STMT_EXPR_NO_SCOPE (in STMT_EXPR)
1: C_DECLARED_LABEL_FLAG (in LABEL_DECL)
STMT_IS_FULL_EXPR_P (in _STMT)
2: STMT_LINENO_FOR_FN_P (in _STMT)
@ -654,6 +655,10 @@ extern tree strip_array_types PARAMS ((tree));
/* STMT_EXPR accessor. */
#define STMT_EXPR_STMT(NODE) TREE_OPERAND (STMT_EXPR_CHECK (NODE), 0)
/* Nonzero if this statement-expression does not have an associated scope. */
#define STMT_EXPR_NO_SCOPE(NODE) \
TREE_LANG_FLAG_0 (STMT_EXPR_CHECK (NODE))
/* LABEL_STMT accessor. This gives access to the label associated with
the given label statement. */
#define LABEL_STMT_LABEL(NODE) TREE_OPERAND (LABEL_STMT_CHECK (NODE), 0)

View File

@ -1,3 +1,10 @@
2002-04-16 Mark Mitchell <mark@codesourcery.com>
* init.c (begin_init_stmts): Remove commented out code.
(finish_init_stmts): Set STMT_EXPR_NO_SCOPE.
* semantics.c (begin_gobal_stmt_expr): Adjust call to
expand_start_stmt_expr.
2002-04-15 Mark Mitchell <mark@codesourcery.com>
* decl.c (register_dtor_fn): Pass the address of dso_handle, not

View File

@ -77,10 +77,6 @@ begin_init_stmts (stmt_expr_p, compound_stmt_p)
if (building_stmt_tree ())
*compound_stmt_p = begin_compound_stmt (/*has_no_scope=*/1);
/*
else
*compound_stmt_p = genrtl_begin_compound_stmt (has_no_scope=1);
*/
}
/* Finish out the statement-expression begun by the previous call to
@ -96,7 +92,10 @@ finish_init_stmts (stmt_expr, compound_stmt)
finish_compound_stmt (/*has_no_scope=*/1, compound_stmt);
if (building_stmt_tree ())
stmt_expr = finish_stmt_expr (stmt_expr);
{
stmt_expr = finish_stmt_expr (stmt_expr);
STMT_EXPR_NO_SCOPE (stmt_expr) = true;
}
else
stmt_expr = finish_global_stmt_expr (stmt_expr);

View File

@ -1186,7 +1186,7 @@ begin_global_stmt_expr ()
keep_next_level (1);
return (last_tree != NULL_TREE) ? last_tree : expand_start_stmt_expr();
return last_tree ? last_tree : expand_start_stmt_expr(/*has_scope=*/1);
}
/* Finish the STMT_EXPR last begun with begin_global_stmt_expr. */

View File

@ -1,3 +1,8 @@
Tue Apr 16 14:55:47 2002 Mark Mitchell <mark@codesourcery.com>
* com.c (ffecom_expr_power_integer): Add has_scope argument to
call to expand_start_stmt_expr.
Mon Apr 15 10:59:14 2002 Mark Mitchell <mark@codesourcery.com>
* g77.texi: Remove Chill reference.

View File

@ -5603,7 +5603,7 @@ ffecom_expr_power_integer_ (ffebld expr)
basetypeof_l_is_int
= build_int_2 ((TREE_CODE (ltype) == INTEGER_TYPE), 0);
se = expand_start_stmt_expr ();
se = expand_start_stmt_expr (/*has_scope=*/1);
ffecom_start_compstmt ();

View File

@ -2405,12 +2405,16 @@ clear_last_expr ()
last_expr_type = 0;
}
/* Begin a statement which will return a value.
Return the RTL_EXPR for this statement expr.
The caller must save that value and pass it to expand_end_stmt_expr. */
/* Begin a statement-expression, i.e., a series of statements which
may return a value. Return the RTL_EXPR for this statement expr.
The caller must save that value and pass it to
expand_end_stmt_expr. If HAS_SCOPE is nonzero, temporaries created
in the statement-expression are deallocated at the end of the
expression. */
tree
expand_start_stmt_expr ()
expand_start_stmt_expr (has_scope)
int has_scope;
{
tree t;
@ -2418,7 +2422,10 @@ expand_start_stmt_expr ()
so that rtl_expr_chain doesn't become garbage. */
t = make_node (RTL_EXPR);
do_pending_stack_adjust ();
start_sequence_for_rtl_expr (t);
if (has_scope)
start_sequence_for_rtl_expr (t);
else
start_sequence ();
NO_DEFER_POP;
expr_stmts_for_value++;
last_expr_value = NULL_RTX;

View File

@ -854,6 +854,8 @@ expand_call_inline (tp, walk_subtrees, data)
type of the statement expression is the return type of the
function call. */
expr = build1 (STMT_EXPR, TREE_TYPE (TREE_TYPE (fn)), NULL_TREE);
/* There is no scope associated with the statement-expression. */
STMT_EXPR_NO_SCOPE (expr) = 1;
/* Local declarations will be replaced by their equivalents in this
map. */

View File

@ -2700,7 +2700,7 @@ extern tree lhd_unsave_expr_now PARAMS ((tree));
extern int in_control_zone_p PARAMS ((void));
extern void expand_fixups PARAMS ((rtx));
extern tree expand_start_stmt_expr PARAMS ((void));
extern tree expand_start_stmt_expr PARAMS ((int));
extern tree expand_end_stmt_expr PARAMS ((tree));
extern void expand_expr_stmt PARAMS ((tree));
extern void expand_expr_stmt_value PARAMS ((tree, int, int));