mirror of
git://gcc.gnu.org/git/gcc.git
synced 2024-12-18 03:38:56 +08:00
optimize.c (copy_body_r): Use STRIP_TYPE_NOPS when copying variables.
* optimize.c (copy_body_r): Use STRIP_TYPE_NOPS when copying variables. (initialize_inlined_parameters): Try to avoid creating new VAR_DECLs. From-SVN: r33505
This commit is contained in:
parent
26026d3803
commit
27c58e25f7
@ -1,3 +1,10 @@
|
||||
2000-04-27 Mark Mitchell <mark@codesourcery.com>
|
||||
|
||||
* optimize.c (copy_body_r): Use STRIP_TYPE_NOPS when copying
|
||||
variables.
|
||||
(initialize_inlined_parameters): Try to avoid creating new
|
||||
VAR_DECLs.
|
||||
|
||||
2000-04-27 Alex Samuel <samuel@codesourcery.com>
|
||||
|
||||
* lex.c (my_get_run_time): Remove.
|
||||
|
@ -306,6 +306,7 @@ copy_body_r (tp, walk_subtrees, data)
|
||||
new_decl = remap_decl (*tp, id);
|
||||
my_friendly_assert (new_decl != NULL_TREE, 19991203);
|
||||
/* Replace this variable with the copy. */
|
||||
STRIP_TYPE_NOPS (new_decl);
|
||||
*tp = new_decl;
|
||||
}
|
||||
else if (nonstatic_local_decl_p (*tp)
|
||||
@ -384,6 +385,37 @@ initialize_inlined_parameters (id, args, fn)
|
||||
{
|
||||
tree init_stmt;
|
||||
tree var;
|
||||
tree value;
|
||||
|
||||
/* Find the initializer. */
|
||||
value = TREE_VALUE (a);
|
||||
/* If the parameter is never assigned to, we may not need to
|
||||
create a new variable here at all. Instead, we may be able
|
||||
to just use the argument value. */
|
||||
if (TREE_READONLY (p) && !TREE_SIDE_EFFECTS (value))
|
||||
{
|
||||
/* Simplify the value, if possible. */
|
||||
value = fold (decl_constant_value (value));
|
||||
|
||||
/* We can't risk substituting complex expressions. They
|
||||
might contain variables that will be assigned to later.
|
||||
Theoretically, we could check the expression to see if
|
||||
all of the variables that determine its value are
|
||||
read-only, but we don't bother. */
|
||||
if (TREE_CONSTANT (value) || TREE_READONLY_DECL_P (value))
|
||||
{
|
||||
/* If this is a declaration, wrap it a NOP_EXPR so that
|
||||
we don't try to put the VALUE on the list of
|
||||
BLOCK_VARS. */
|
||||
if (DECL_P (value))
|
||||
value = build1 (NOP_EXPR, TREE_TYPE (value), value);
|
||||
|
||||
splay_tree_insert (id->decl_map,
|
||||
(splay_tree_key) p,
|
||||
(splay_tree_value) value);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* Make an equivalent VAR_DECL. */
|
||||
var = copy_decl_for_inlining (p, fn, VARRAY_TREE (id->fns, 0));
|
||||
@ -400,7 +432,7 @@ initialize_inlined_parameters (id, args, fn)
|
||||
object will be constructed in VAR. */
|
||||
init_stmt = build_min_nt (EXPR_STMT,
|
||||
build (INIT_EXPR, TREE_TYPE (p),
|
||||
var, TREE_VALUE (a)));
|
||||
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. */
|
||||
|
Loading…
Reference in New Issue
Block a user