Commit 5062dbd5 by Jason Merrill Committed by Jason Merrill

tree.c (build_target_expr_with_type): If we already have a TARGET_EXPR, just return it.

        * tree.c (build_target_expr_with_type): If we already have a
        TARGET_EXPR, just return it.

        * optimize.c (initialize_inlined_parameters): Don't generate an
        EXPR_STMT if we can just use DECL_INITIAL.
        * decl.c (emit_local_var): Only make the initialization a
        full-expression if stmts_are_full_exprs_p.

From-SVN: r33595
parent cde28f0d
2000-05-01 Jason Merrill <jason@casey.cygnus.com>
* tree.c (build_target_expr_with_type): If we already have a
TARGET_EXPR, just return it.
* optimize.c (initialize_inlined_parameters): Don't generate an
EXPR_STMT if we can just use DECL_INITIAL.
* decl.c (emit_local_var): Only make the initialization a
full-expression if stmts_are_full_exprs_p.
2000-05-01 Mark Mitchell <mark@codesourcery.com> 2000-05-01 Mark Mitchell <mark@codesourcery.com>
* cp-tree.h (same_type_ignoring_top_level_qualifiers_p): New * cp-tree.h (same_type_ignoring_top_level_qualifiers_p): New
......
...@@ -7871,9 +7871,13 @@ emit_local_var (decl) ...@@ -7871,9 +7871,13 @@ emit_local_var (decl)
} }
/* Actually do the initialization. */ /* Actually do the initialization. */
expand_start_target_temps (); if (stmts_are_full_exprs_p)
expand_start_target_temps ();
expand_decl_init (decl); expand_decl_init (decl);
expand_end_target_temps ();
if (stmts_are_full_exprs_p)
expand_end_target_temps ();
} }
/* Finish processing of a declaration; /* Finish processing of a declaration;
......
...@@ -429,21 +429,30 @@ initialize_inlined_parameters (id, args, fn) ...@@ -429,21 +429,30 @@ initialize_inlined_parameters (id, args, fn)
splay_tree_insert (id->decl_map, splay_tree_insert (id->decl_map,
(splay_tree_key) p, (splay_tree_key) p,
(splay_tree_value) var); (splay_tree_value) var);
/* Declare this new variable. */
init_stmt = build_min_nt (DECL_STMT, var);
TREE_CHAIN (init_stmt) = init_stmts;
init_stmts = init_stmt;
/* Initialize this VAR_DECL from the equivalent argument. If /* Initialize this VAR_DECL from the equivalent argument. If
the argument is an object, created via a constructor or copy, the argument is an object, created via a constructor or copy,
this will not result in an extra copy: the TARGET_EXPR this will not result in an extra copy: the TARGET_EXPR
representing the argument will be bound to VAR, and the representing the argument will be bound to VAR, and the
object will be constructed in VAR. */ object will be constructed in VAR. */
init_stmt = build_min_nt (EXPR_STMT, if (! TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (p)))
build (INIT_EXPR, TREE_TYPE (p), DECL_INITIAL (var) = value;
var, value)); else
/* Declare this new variable. Note that we do this *after* the {
initialization because we are going to reverse all the init_stmt = build_min_nt (EXPR_STMT,
initialization statements below. */ build (INIT_EXPR, TREE_TYPE (p),
TREE_CHAIN (init_stmt) = build_min_nt (DECL_STMT, var); var, value));
/* Add this initialization to the list. */ /* Add this initialization to the list. Note that we want the
TREE_CHAIN (TREE_CHAIN (init_stmt)) = init_stmts; declaration *after* the initialization because we are going
init_stmts = init_stmt; to reverse all the initialization statements below. */
TREE_CHAIN (init_stmt) = init_stmts;
init_stmts = init_stmt;
}
} }
/* The initialization statements have been built up in reverse /* The initialization statements have been built up in reverse
......
...@@ -294,6 +294,9 @@ build_target_expr_with_type (init, type) ...@@ -294,6 +294,9 @@ build_target_expr_with_type (init, type)
tree slot; tree slot;
tree rval; tree rval;
if (TREE_CODE (init) == TARGET_EXPR)
return init;
slot = build (VAR_DECL, type); slot = build (VAR_DECL, type);
DECL_ARTIFICIAL (slot) = 1; DECL_ARTIFICIAL (slot) = 1;
DECL_CONTEXT (slot) = current_function_decl; DECL_CONTEXT (slot) = current_function_decl;
......
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