aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/optimize.c
diff options
context:
space:
mode:
authorJason Merrill <jason@casey.cygnus.com>2000-05-01 23:51:37 +0000
committerJason Merrill <jason@gcc.gnu.org>2000-05-01 19:51:37 -0400
commit5062dbd5ae2d18db9d6e715b38ee2e0a724fcdcc (patch)
tree9b1f92405a1082371ff58eb6be57788162dc16bc /gcc/cp/optimize.c
parentcde28f0da4631eda8559c98fa329febb0f1d17fd (diff)
downloadgcc-5062dbd5ae2d18db9d6e715b38ee2e0a724fcdcc.zip
gcc-5062dbd5ae2d18db9d6e715b38ee2e0a724fcdcc.tar.gz
gcc-5062dbd5ae2d18db9d6e715b38ee2e0a724fcdcc.tar.bz2
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
Diffstat (limited to 'gcc/cp/optimize.c')
-rw-r--r--gcc/cp/optimize.c29
1 files changed, 19 insertions, 10 deletions
diff --git a/gcc/cp/optimize.c b/gcc/cp/optimize.c
index 691969d..1158f39 100644
--- a/gcc/cp/optimize.c
+++ b/gcc/cp/optimize.c
@@ -429,21 +429,30 @@ initialize_inlined_parameters (id, args, fn)
splay_tree_insert (id->decl_map,
(splay_tree_key) p,
(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
the argument is an object, created via a constructor or copy,
this will not result in an extra copy: the TARGET_EXPR
representing the argument will be bound to VAR, and the
object will be constructed in VAR. */
- init_stmt = build_min_nt (EXPR_STMT,
- build (INIT_EXPR, TREE_TYPE (p),
- var, value));
- /* Declare this new variable. Note that we do this *after* the
- initialization because we are going to reverse all the
- initialization statements below. */
- TREE_CHAIN (init_stmt) = build_min_nt (DECL_STMT, var);
- /* Add this initialization to the list. */
- TREE_CHAIN (TREE_CHAIN (init_stmt)) = init_stmts;
- init_stmts = init_stmt;
+ if (! TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (p)))
+ DECL_INITIAL (var) = value;
+ else
+ {
+ init_stmt = build_min_nt (EXPR_STMT,
+ build (INIT_EXPR, TREE_TYPE (p),
+ var, value));
+ /* Add this initialization to the list. Note that we want the
+ declaration *after* the initialization because we are going
+ 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