tree.c (build_clobber): New.

* tree.c (build_clobber): New.

	* tree.h: Declare it.
	* gimplify.c (gimplify_bind_expr, gimplify_target_expr): Use it.

From-SVN: r259770
This commit is contained in:
Jason Merrill 2018-04-30 11:20:46 -04:00 committed by Jason Merrill
parent 7761dfbee1
commit 94b2a1e543
6 changed files with 24 additions and 7 deletions

View File

@ -1,3 +1,9 @@
2018-04-30 Jason Merrill <jason@redhat.com>
* tree.c (build_clobber): New.
* tree.h: Declare it.
* gimplify.c (gimplify_bind_expr, gimplify_target_expr): Use it.
2018-04-30 David Malcolm <dmalcolm@redhat.com>
* diagnostic-show-locus.c (layout::layout): Update for

View File

@ -1,3 +1,7 @@
2018-04-30 Jason Merrill <jason@redhat.com>
* decl.c (build_clobber_this): Use build_clobber.
2018-04-27 Jakub Jelinek <jakub@redhat.com>
PR c++/85553

View File

@ -14874,8 +14874,7 @@ build_clobber_this ()
if (!vbases)
ctype = CLASSTYPE_AS_BASE (ctype);
tree clobber = build_constructor (ctype, NULL);
TREE_THIS_VOLATILE (clobber) = true;
tree clobber = build_clobber (ctype);
tree thisref = current_class_ref;
if (ctype != current_class_type)

View File

@ -1379,9 +1379,8 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p)
&& !is_gimple_reg (t)
&& flag_stack_reuse != SR_NONE)
{
tree clobber = build_constructor (TREE_TYPE (t), NULL);
tree clobber = build_clobber (TREE_TYPE (t));
gimple *clobber_stmt;
TREE_THIS_VOLATILE (clobber) = 1;
clobber_stmt = gimple_build_assign (t, clobber);
gimple_set_location (clobber_stmt, end_locus);
gimplify_seq_add_stmt (&cleanup, clobber_stmt);
@ -6603,9 +6602,7 @@ gimplify_target_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p)
{
if (flag_stack_reuse == SR_ALL)
{
tree clobber = build_constructor (TREE_TYPE (temp),
NULL);
TREE_THIS_VOLATILE (clobber) = true;
tree clobber = build_clobber (TREE_TYPE (temp));
clobber = build2 (MODIFY_EXPR, TREE_TYPE (temp), temp, clobber);
gimple_push_cleanup (temp, clobber, false, pre_p, true);
}

View File

@ -2059,6 +2059,16 @@ build_constructor_va (tree type, int nelts, ...)
return build_constructor (type, v);
}
/* Return a node of type TYPE for which TREE_CLOBBER_P is true. */
tree
build_clobber (tree type)
{
tree clobber = build_constructor (type, NULL);
TREE_THIS_VOLATILE (clobber) = true;
return clobber;
}
/* Return a new FIXED_CST node whose type is TYPE and value is F. */
tree

View File

@ -4173,6 +4173,7 @@ extern tree build_constructor (tree, vec<constructor_elt, va_gc> *);
extern tree build_constructor_single (tree, tree, tree);
extern tree build_constructor_from_list (tree, tree);
extern tree build_constructor_va (tree, int, ...);
extern tree build_clobber (tree);
extern tree build_real_from_int_cst (tree, const_tree);
extern tree build_complex (tree, tree, tree);
extern tree build_complex_inf (tree, bool);