* 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
* 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,
+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.
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));
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. */
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;
}
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)
/* 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)
+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
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
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);
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. */
+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.
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 ();
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;
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;
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. */
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));