Commit be00f578 by Jason Merrill Committed by Jason Merrill

gimplify.c (gimplify_expr): Don't build a statement list if no gimplification was necessary.

        * gimplify.c (gimplify_expr): Don't build a statement list
        if no gimplification was necessary.

From-SVN: r82429
parent ca09cd34
2004-05-29 Jason Merrill <jason@redhat.com>
* gimplify.c (gimplify_expr): Don't build a statement list
if no gimplification was necessary.
2004-05-29 Joseph S. Myers <jsm@polyomino.org.uk> 2004-05-29 Joseph S. Myers <jsm@polyomino.org.uk>
* pretty-print.c (pp_base_format_text): Support %< instead of %` * pretty-print.c (pp_base_format_text): Support %< instead of %`
......
...@@ -202,6 +202,9 @@ append_to_statement_list_1 (tree t, tree *list_p, bool side_effects) ...@@ -202,6 +202,9 @@ append_to_statement_list_1 (tree t, tree *list_p, bool side_effects)
tree list = *list_p; tree list = *list_p;
tree_stmt_iterator i; tree_stmt_iterator i;
if (!side_effects)
return;
if (!list) if (!list)
{ {
if (t && TREE_CODE (t) == STATEMENT_LIST) if (t && TREE_CODE (t) == STATEMENT_LIST)
...@@ -212,9 +215,6 @@ append_to_statement_list_1 (tree t, tree *list_p, bool side_effects) ...@@ -212,9 +215,6 @@ append_to_statement_list_1 (tree t, tree *list_p, bool side_effects)
*list_p = list = alloc_stmt_list (); *list_p = list = alloc_stmt_list ();
} }
if (!side_effects)
return;
i = tsi_last (list); i = tsi_last (list);
tsi_link_after (&i, t, TSI_CONTINUE_LINKING); tsi_link_after (&i, t, TSI_CONTINUE_LINKING);
} }
...@@ -3023,7 +3023,7 @@ gimplify_target_expr (tree *expr_p, tree *pre_p, tree *post_p) ...@@ -3023,7 +3023,7 @@ gimplify_target_expr (tree *expr_p, tree *pre_p, tree *post_p)
/* Gimplification of expression trees. */ /* Gimplification of expression trees. */
/* Gimplify an expression which appears at statement context; usually, this /* Gimplify an expression which appears at statement context; usually, this
means replacing it with a suitably gimple COMPOUND_EXPR. */ means replacing it with a suitably gimple STATEMENT_LIST. */
void void
gimplify_stmt (tree *stmt_p) gimplify_stmt (tree *stmt_p)
...@@ -3042,7 +3042,7 @@ gimplify_to_stmt_list (tree *stmt_p) ...@@ -3042,7 +3042,7 @@ gimplify_to_stmt_list (tree *stmt_p)
if (TREE_CODE (*stmt_p) != STATEMENT_LIST) if (TREE_CODE (*stmt_p) != STATEMENT_LIST)
{ {
tree t = *stmt_p; tree t = *stmt_p;
*stmt_p = NULL; *stmt_p = alloc_stmt_list ();
append_to_statement_list (t, stmt_p); append_to_statement_list (t, stmt_p);
} }
} }
...@@ -3526,10 +3526,13 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p, ...@@ -3526,10 +3526,13 @@ gimplify_expr (tree *expr_p, tree *pre_p, tree *post_p,
gimplified form. */ gimplified form. */
if (is_statement) if (is_statement)
{ {
append_to_statement_list (*expr_p, &internal_pre); if (internal_pre || internal_post)
append_to_statement_list (internal_post, &internal_pre); {
annotate_all_with_locus (&internal_pre, input_location); append_to_statement_list (*expr_p, &internal_pre);
*expr_p = internal_pre; append_to_statement_list (internal_post, &internal_pre);
annotate_all_with_locus (&internal_pre, input_location);
*expr_p = internal_pre;
}
goto out; goto out;
} }
...@@ -3725,7 +3728,7 @@ gimplify_body (tree *body_p, tree fndecl) ...@@ -3725,7 +3728,7 @@ gimplify_body (tree *body_p, tree fndecl)
tree b = build (BIND_EXPR, void_type_node, NULL_TREE, tree b = build (BIND_EXPR, void_type_node, NULL_TREE,
NULL_TREE, NULL_TREE); NULL_TREE, NULL_TREE);
TREE_SIDE_EFFECTS (b) = 1; TREE_SIDE_EFFECTS (b) = 1;
append_to_statement_list (body, &BIND_EXPR_BODY (b)); append_to_statement_list_force (body, &BIND_EXPR_BODY (b));
body = b; body = b;
} }
*body_p = body; *body_p = body;
......
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