2004-05-13 08:41:07 +02:00
|
|
|
|
/* Scalar Replacement of Aggregates (SRA) converts some structure
|
|
|
|
|
references into scalar references, exposing them to the scalar
|
|
|
|
|
optimizers.
|
2005-01-05 00:54:26 +01:00
|
|
|
|
Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
|
2004-05-13 08:41:07 +02:00
|
|
|
|
Contributed by Diego Novillo <dnovillo@redhat.com>
|
|
|
|
|
|
|
|
|
|
This file is part of GCC.
|
2004-08-19 23:34:37 +02:00
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
|
GCC is free software; you can redistribute it and/or modify it
|
|
|
|
|
under the terms of the GNU General Public License as published by the
|
|
|
|
|
Free Software Foundation; either version 2, or (at your option) any
|
|
|
|
|
later version.
|
2004-08-19 23:34:37 +02:00
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
|
for more details.
|
2004-08-19 23:34:37 +02:00
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with GCC; see the file COPYING. If not, write to the Free
|
|
|
|
|
Software Foundation, 59 Temple Place - Suite 330, Boston, MA
|
|
|
|
|
02111-1307, USA. */
|
|
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
#include "system.h"
|
|
|
|
|
#include "coretypes.h"
|
|
|
|
|
#include "tm.h"
|
|
|
|
|
#include "errors.h"
|
|
|
|
|
#include "ggc.h"
|
|
|
|
|
#include "tree.h"
|
|
|
|
|
|
|
|
|
|
/* These RTL headers are needed for basic-block.h. */
|
|
|
|
|
#include "rtl.h"
|
|
|
|
|
#include "tm_p.h"
|
|
|
|
|
#include "hard-reg-set.h"
|
|
|
|
|
#include "basic-block.h"
|
|
|
|
|
#include "diagnostic.h"
|
|
|
|
|
#include "langhooks.h"
|
|
|
|
|
#include "tree-inline.h"
|
|
|
|
|
#include "tree-flow.h"
|
tree-gimple.c: Rename from tree-simple.c.
* tree-gimple.c: Rename from tree-simple.c.
* tree-gimple.h: Rename from tree-simple.h.
* c-gimplify.c: Rename from c-simplify.c
* Makefile.in, c-decl.c, gimple-low.c, gimplify.c,
langhooks.c, tree-alias-ander.c, tree-alias-common.c,
tree-complex.c, tree-dfa.c, tree-flow.h, tree-inline.c,
tree-into-ssa.c, tree-iterator.c, tree-mudflap.c,
tree-nested.c, tree-nomudflap.c, tree-outof-ssa.c, tree-sra.c,
tree-ssa-alias.c, tree-ssa-ccp.c, tree-ssa-copyrename.c,
tree-ssa-dce.c, tree-ssa-live.c, tree-ssa-pre.c, tree-ssa.c:
Update.
cp/ChangeLog
* cp-gimplify.c: Rename from cp-simplify.c.
* Make-lang.in, optimize.c: Update.
fortran/ChangeLog
* Make-lang.in, f95-lang.c, trans-array.c, trans-decl.c,
trans-expr.c, trans-intrinsic.c, trans-io.c, trans-stmt.c,
trans.c: Rename tree-simple.[ch] to tree-gimple.[ch].
java/ChangeLog
* Make-lang.in, expr.c, java-gimplify.c: Rename
tree-simple.[ch] to tree-gimple.[ch].
From-SVN: r81829
2004-05-14 04:29:32 +02:00
|
|
|
|
#include "tree-gimple.h"
|
2004-05-13 08:41:07 +02:00
|
|
|
|
#include "tree-dump.h"
|
|
|
|
|
#include "tree-pass.h"
|
|
|
|
|
#include "timevar.h"
|
|
|
|
|
#include "flags.h"
|
|
|
|
|
#include "bitmap.h"
|
2004-06-29 18:25:28 +02:00
|
|
|
|
#include "obstack.h"
|
|
|
|
|
#include "target.h"
|
2004-06-29 19:04:44 +02:00
|
|
|
|
/* expr.h is needed for MOVE_RATIO. */
|
|
|
|
|
#include "expr.h"
|
2004-10-27 23:02:16 +02:00
|
|
|
|
#include "params.h"
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* This object of this pass is to replace a non-addressable aggregate with a
|
|
|
|
|
set of independent variables. Most of the time, all of these variables
|
2004-08-19 23:34:37 +02:00
|
|
|
|
will be scalars. But a secondary objective is to break up larger
|
2004-06-29 18:25:28 +02:00
|
|
|
|
aggregates into smaller aggregates. In the process we may find that some
|
|
|
|
|
bits of the larger aggregate can be deleted as unreferenced.
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
This substitution is done globally. More localized substitutions would
|
|
|
|
|
be the purvey of a load-store motion pass.
|
|
|
|
|
|
|
|
|
|
The optimization proceeds in phases:
|
|
|
|
|
|
|
|
|
|
(1) Identify variables that have types that are candidates for
|
|
|
|
|
decomposition.
|
|
|
|
|
|
|
|
|
|
(2) Scan the function looking for the ways these variables are used.
|
|
|
|
|
In particular we're interested in the number of times a variable
|
|
|
|
|
(or member) is needed as a complete unit, and the number of times
|
|
|
|
|
a variable (or member) is copied.
|
|
|
|
|
|
|
|
|
|
(3) Based on the usage profile, instantiate substitution variables.
|
|
|
|
|
|
|
|
|
|
(4) Scan the function making replacements.
|
|
|
|
|
*/
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* The set of aggregate variables that are candidates for scalarization. */
|
|
|
|
|
static bitmap sra_candidates;
|
|
|
|
|
|
|
|
|
|
/* Set of scalarizable PARM_DECLs that need copy-in operations at the
|
|
|
|
|
beginning of the function. */
|
|
|
|
|
static bitmap needs_copy_in;
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Sets of bit pairs that cache type decomposition and instantiation. */
|
|
|
|
|
static bitmap sra_type_decomp_cache;
|
|
|
|
|
static bitmap sra_type_inst_cache;
|
|
|
|
|
|
|
|
|
|
/* One of these structures is created for each candidate aggregate
|
|
|
|
|
and each (accessed) member of such an aggregate. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
struct sra_elt
|
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* A tree of the elements. Used when we want to traverse everything. */
|
|
|
|
|
struct sra_elt *parent;
|
|
|
|
|
struct sra_elt *children;
|
|
|
|
|
struct sra_elt *sibling;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* If this element is a root, then this is the VAR_DECL. If this is
|
|
|
|
|
a sub-element, this is some token used to identify the reference.
|
|
|
|
|
In the case of COMPONENT_REF, this is the FIELD_DECL. In the case
|
|
|
|
|
of an ARRAY_REF, this is the (constant) index. In the case of a
|
|
|
|
|
complex number, this is a zero or one. */
|
|
|
|
|
tree element;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* The type of the element. */
|
|
|
|
|
tree type;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* A VAR_DECL, for any sub-element we've decided to replace. */
|
|
|
|
|
tree replacement;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* The number of times the element is referenced as a whole. I.e.
|
|
|
|
|
given "a.b.c", this would be incremented for C, but not for A or B. */
|
|
|
|
|
unsigned int n_uses;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* The number of times the element is copied to or from another
|
|
|
|
|
scalarizable element. */
|
|
|
|
|
unsigned int n_copies;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* True if TYPE is scalar. */
|
|
|
|
|
bool is_scalar;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* True if we saw something about this element that prevents scalarization,
|
|
|
|
|
such as non-constant indexing. */
|
|
|
|
|
bool cannot_scalarize;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* True if we've decided that structure-to-structure assignment
|
|
|
|
|
should happen via memcpy and not per-element. */
|
|
|
|
|
bool use_block_copy;
|
2004-06-10 23:41:08 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* A flag for use with/after random access traversals. */
|
|
|
|
|
bool visited;
|
|
|
|
|
};
|
2004-06-10 23:41:08 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Random access to the child of a parent is performed by hashing.
|
basic-block.h, [...]: Fix comment typos.
* basic-block.h, c-decl.c, c-parse.in, cgraphunit.c, ddg.c,
gimplify.c, lambda-code.c, optabs.c, predict.c,
tree-scalar-evolution.c, tree-sra.c, tree-ssa-loop-ch.c,
tree-ssa.c, vec.h: Fix comment typos. Follow spelling
conventions.
From-SVN: r87637
2004-09-17 11:14:12 +02:00
|
|
|
|
This prevents quadratic behavior, and allows SRA to function
|
2004-06-29 18:25:28 +02:00
|
|
|
|
reasonably on larger records. */
|
|
|
|
|
static htab_t sra_map;
|
2004-06-10 23:41:08 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* All structures are allocated out of the following obstack. */
|
|
|
|
|
static struct obstack sra_obstack;
|
2004-06-10 23:41:08 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Debugging functions. */
|
|
|
|
|
static void dump_sra_elt_name (FILE *, struct sra_elt *);
|
|
|
|
|
extern void debug_sra_elt_name (struct sra_elt *);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2005-01-27 10:28:45 +01:00
|
|
|
|
/* Forward declarations. */
|
|
|
|
|
static tree generate_element_ref (struct sra_elt *);
|
2004-06-29 18:25:28 +02:00
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
|
/* Return true if DECL is an SRA candidate. */
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
|
is_sra_candidate_decl (tree decl)
|
|
|
|
|
{
|
|
|
|
|
return DECL_P (decl) && bitmap_bit_p (sra_candidates, var_ann (decl)->uid);
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Return true if TYPE is a scalar type. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
|
|
static bool
|
2004-06-29 18:25:28 +02:00
|
|
|
|
is_sra_scalar_type (tree type)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
enum tree_code code = TREE_CODE (type);
|
|
|
|
|
return (code == INTEGER_TYPE || code == REAL_TYPE || code == VECTOR_TYPE
|
|
|
|
|
|| code == ENUMERAL_TYPE || code == BOOLEAN_TYPE
|
|
|
|
|
|| code == CHAR_TYPE || code == POINTER_TYPE || code == OFFSET_TYPE
|
|
|
|
|
|| code == REFERENCE_TYPE);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Return true if TYPE can be decomposed into a set of independent variables.
|
|
|
|
|
|
|
|
|
|
Note that this doesn't imply that all elements of TYPE can be
|
|
|
|
|
instantiated, just that if we decide to break up the type into
|
|
|
|
|
separate pieces that it can be done. */
|
2004-06-28 14:12:51 +02:00
|
|
|
|
|
|
|
|
|
static bool
|
2004-06-29 18:25:28 +02:00
|
|
|
|
type_can_be_decomposed_p (tree type)
|
2004-06-28 14:12:51 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
unsigned int cache = TYPE_UID (TYPE_MAIN_VARIANT (type)) * 2;
|
|
|
|
|
tree t;
|
2004-06-28 14:12:51 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Avoid searching the same type twice. */
|
|
|
|
|
if (bitmap_bit_p (sra_type_decomp_cache, cache+0))
|
|
|
|
|
return true;
|
|
|
|
|
if (bitmap_bit_p (sra_type_decomp_cache, cache+1))
|
|
|
|
|
return false;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-09-14 14:21:44 +02:00
|
|
|
|
/* The type must have a definite nonzero size. */
|
2004-12-22 19:43:44 +01:00
|
|
|
|
if (TYPE_SIZE (type) == NULL || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST
|
|
|
|
|
|| integer_zerop (TYPE_SIZE (type)))
|
2004-06-29 18:25:28 +02:00
|
|
|
|
goto fail;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* The type must be a non-union aggregate. */
|
|
|
|
|
switch (TREE_CODE (type))
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
case RECORD_TYPE:
|
|
|
|
|
{
|
|
|
|
|
bool saw_one_field = false;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
for (t = TYPE_FIELDS (type); t ; t = TREE_CHAIN (t))
|
|
|
|
|
if (TREE_CODE (t) == FIELD_DECL)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Reject incorrectly represented bit fields. */
|
|
|
|
|
if (DECL_BIT_FIELD (t)
|
|
|
|
|
&& (tree_low_cst (DECL_SIZE (t), 1)
|
|
|
|
|
!= TYPE_PRECISION (TREE_TYPE (t))))
|
|
|
|
|
goto fail;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
saw_one_field = true;
|
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Record types must have at least one field. */
|
|
|
|
|
if (!saw_one_field)
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
|
|
|
|
break;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
case ARRAY_TYPE:
|
|
|
|
|
/* Array types must have a fixed lower and upper bound. */
|
|
|
|
|
t = TYPE_DOMAIN (type);
|
|
|
|
|
if (t == NULL)
|
|
|
|
|
goto fail;
|
|
|
|
|
if (TYPE_MIN_VALUE (t) == NULL || !TREE_CONSTANT (TYPE_MIN_VALUE (t)))
|
|
|
|
|
goto fail;
|
|
|
|
|
if (TYPE_MAX_VALUE (t) == NULL || !TREE_CONSTANT (TYPE_MAX_VALUE (t)))
|
|
|
|
|
goto fail;
|
|
|
|
|
break;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
case COMPLEX_TYPE:
|
|
|
|
|
break;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
default:
|
|
|
|
|
goto fail;
|
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
bitmap_set_bit (sra_type_decomp_cache, cache+0);
|
|
|
|
|
return true;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
fail:
|
|
|
|
|
bitmap_set_bit (sra_type_decomp_cache, cache+1);
|
|
|
|
|
return false;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Return true if DECL can be decomposed into a set of independent
|
|
|
|
|
(though not necessarily scalar) variables. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
static bool
|
|
|
|
|
decl_can_be_decomposed_p (tree var)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Early out for scalars. */
|
|
|
|
|
if (is_sra_scalar_type (TREE_TYPE (var)))
|
|
|
|
|
return false;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* The variable must not be aliased. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
if (!is_gimple_non_addressable (var))
|
|
|
|
|
{
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
|
{
|
|
|
|
|
fprintf (dump_file, "Cannot scalarize variable ");
|
|
|
|
|
print_generic_expr (dump_file, var, dump_flags);
|
|
|
|
|
fprintf (dump_file, " because it must live in memory\n");
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* The variable must not be volatile. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
if (TREE_THIS_VOLATILE (var))
|
|
|
|
|
{
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
|
{
|
|
|
|
|
fprintf (dump_file, "Cannot scalarize variable ");
|
|
|
|
|
print_generic_expr (dump_file, var, dump_flags);
|
|
|
|
|
fprintf (dump_file, " because it is declared volatile\n");
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* We must be able to decompose the variable's type. */
|
|
|
|
|
if (!type_can_be_decomposed_p (TREE_TYPE (var)))
|
|
|
|
|
{
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
|
{
|
|
|
|
|
fprintf (dump_file, "Cannot scalarize variable ");
|
|
|
|
|
print_generic_expr (dump_file, var, dump_flags);
|
|
|
|
|
fprintf (dump_file, " because its type cannot be decomposed\n");
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Return true if TYPE can be *completely* decomposed into scalars. */
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
|
type_can_instantiate_all_elements (tree type)
|
|
|
|
|
{
|
|
|
|
|
if (is_sra_scalar_type (type))
|
2004-05-13 08:41:07 +02:00
|
|
|
|
return true;
|
2004-06-29 18:25:28 +02:00
|
|
|
|
if (!type_can_be_decomposed_p (type))
|
|
|
|
|
return false;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
switch (TREE_CODE (type))
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
case RECORD_TYPE:
|
|
|
|
|
{
|
|
|
|
|
unsigned int cache = TYPE_UID (TYPE_MAIN_VARIANT (type)) * 2;
|
|
|
|
|
tree f;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
if (bitmap_bit_p (sra_type_inst_cache, cache+0))
|
|
|
|
|
return true;
|
|
|
|
|
if (bitmap_bit_p (sra_type_inst_cache, cache+1))
|
2004-05-13 08:41:07 +02:00
|
|
|
|
return false;
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
for (f = TYPE_FIELDS (type); f ; f = TREE_CHAIN (f))
|
|
|
|
|
if (TREE_CODE (f) == FIELD_DECL)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
if (!type_can_instantiate_all_elements (TREE_TYPE (f)))
|
|
|
|
|
{
|
|
|
|
|
bitmap_set_bit (sra_type_inst_cache, cache+1);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
bitmap_set_bit (sra_type_inst_cache, cache+0);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
case ARRAY_TYPE:
|
|
|
|
|
return type_can_instantiate_all_elements (TREE_TYPE (type));
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
case COMPLEX_TYPE:
|
|
|
|
|
return true;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
default:
|
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* targhooks.c (default_unwind_emit, default_scalar_mode_supported_p):
Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* timevar.c (timevar_push, timevar_pop, timevar_start,
timevar_stop): Likewise.
* toplev.c (default_pch_valid_p): Likewise.
* tracer.c (tail_duplicate): Likewise.
* tree-alias-common.c (get_alias_var_decl,
get_values_from_constructor, create_alias_var, delete_alias_vars,
empty_points_to_set, same_points_to_set, ptr_may_alias_var):
Likewise.
* tree.c (tree_size, make_node_stat, copy_node_stat,
build_int_cst_wide, integer_all_onesp, list_length, chainon,
tree_node_structure, type_contains_placeholder_p, substitute_in_expr,
substitute_placeholder_in_expr, tabilize_reference_1, build0_stat,
build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p,
lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr,
build_method_type_directly, decl_type_context, get_callee_fndecl,
get_set_constructor_bits, build_vector_type_for_mode, int_cst_value,
tree_fold_gcd): Likewise.
* tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges,
make_cond_expr_edges, group_case_labels, tree_merge_blocks,
cleanup_control_expr_graph, find_taken_edge,
find_taken_edge_switch_expr, phi_alternatives_equal,
is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt,
stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate,
tree_split_edge, tree_verify_flow_info, thread_jumps,
tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise.
* tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly,
chrec_fold_multiply_poly_poly): Likewise.
* tree-complex.c (extract_component, expand_complex_division,
expand_complex_comparison, expand_complex_operations_1,
build_replicated_const, expand_vector_operations_1): Likewise.
* tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector,
build_classic_dir_vector): Likewise.
* tree-dfa.c (compute_immediate_uses_for_phi,
compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann,
create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise.
* tree-dump.c (dequeue_and_dump): Likewise.
* tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region,
record_in_finally_tree, replace_goto_queue_1,
maybe_record_in_goto_queue, verify_norecord_switch_expr,
do_return_redirection): Likewise.
* tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr,
add_to_dst_predicate_list, find_phi_replacement_condition,
replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order):
Likewise.
* tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r,
initialize_inlined_parameters, declare_return_variable,
estimate_num_insns_1, expand_call_inline, expand_calls_inline,
optimize_inline_calls, copy_tree_r): Likewise.
* tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt,
ssa_rewrite_stmt, rewrite_into_ssa): Likewise.
* tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after,
tsi_split_statement_list_after, tsi_split_statement_list_before):
Likewise.
* tree-mudflap.c (mf_varname_tree): Likewise.
* tree-nested.c (create_tmp_var_for, lookup_field_for_decl,
lookup_tramp_for_decl, convert_all_function_calls): Likewise.
* tree-optimize.c (tree_rest_of_compilation): Likewise.
* tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi,
coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis,
free_temp_expr_table, add_dependance, finish_expr, rewrite_trees):
Likewise.
* tree-phinodes.c (resize_phi_node, add_phi_arg,
remove_all_phi_nodes_for): Likewise.
* tree-pretty-print.c (op_prio, print_call_name): Likewise.
* tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler,
tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise.
* tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree,
sra_elt_eq, sra_walk_expr, instantiate_missing_elements,
generate_one_element_ref, generate_element_copy,
generate_element_zero, scalarize_copy, scalarize_init,
scalarize_ldst): Likewise.
* tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p,
add_may_alias, add_pointed_to_expr, add_pointed_to_var,
collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise.
* tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise.
* tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value,
set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment,
widen_bitfield, ccp_fold_builtin): Likewise.
* tree-ssa-copy.c (may_propagate_copy, merge_alias_info,
replace_exp_1, propagate_tree_value): Likewise.
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise.
* tree-ssa-dce.c (set_control_dependence_map_bit,
find_control_dependence, find_pdom, mark_operand_necessary,
mark_stmt_if_obviously_necessary,
mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise.
* tree-ssa-dom.c (dom_opt_initialize_block_local_data,
simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis,
eliminate_redundant_computations, avail_expr_eq): Likewise.
* tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise.
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p,
duplicate_blocks): Likewise.
* tree-ssa-loop-im.c (for_each_index, set_level,
is_call_clobbered_ref): Likewise.
* tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos,
stmt_after_increment, set_iv, contains_abnormal_ssa_name_p,
find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates,
peel_address, ptr_difference_cost, may_replace_final_value,
determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer,
rewrite_use, rewrite_uses): Likewise.
* tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa,
check_loop_closed_ssa_use): Likewise.
* tree-ssanames.c (make_ssa_name): Likewise.
* tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses,
finalize_ssa_v_must_defs, finalize_ssa_stmt_operands,
get_stmt_operands, get_expr_operands, get_asm_expr_operands,
get_indirect_ref_operands, add_stmt_operand): Likewise.
* tree-ssa-pre.c (value_exists_in_set_bitmap,
value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set,
phi_translate, valid_in_set, compute_antic,
find_or_generate_expression, create_expression_by_pieces, insert_aux,
create_value_expr_from, eliminate): Likewise.
* tree-ssa-propagate.c (cfg_blocks_get): Likewise.
* tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges):
Likewise.
* tree-tailcall.c (independent_of_stmt_p, adjust_return_value,
eliminate_tail_call): Likewise.
* tree-vectorizer.c (vect_create_index_for_array_ref,
vect_align_data_ref, vect_create_data_ref,
vect_create_destination_var, vect_get_vec_def_for_operand,
vect_finish_stmt_generation, vect_transform_stmt,
vect_transform_loop_bound, vect_transform_loop,
vect_analyze_operations): Likewise.
* tree-vn.c (vn_compute, set_value_handle, get_value_handle):
Likewise.
* tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr,
get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start,
bsi_after_labels, bsi_last): Likewise.
* tree-ssa-live.c (var_union, change_partition_var,
create_ssa_var_map, calculate_live_on_entry, root_var_init,
type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce):
Likewise.
* tree-ssa-live.h (partition_is_global, live_entry_blocks,
tpa_find_tree): Likewise.
(register_ssa_partition_check): Declare.
(register_ssa_partition): use it.
* tree-ssa-live.c: Include errors.h.
(register_ssa_partition_check): New.
* tree-ssa-operands.c: Include errors.h.
* Makefile.in (tree-ssa-operands.o): Depend on errors.h.
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
From-SVN: r87223
2004-09-09 09:54:12 +02:00
|
|
|
|
gcc_unreachable ();
|
2004-06-29 18:25:28 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Test whether ELT or some sub-element cannot be scalarized. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
static bool
|
|
|
|
|
can_completely_scalarize_p (struct sra_elt *elt)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
struct sra_elt *c;
|
|
|
|
|
|
|
|
|
|
if (elt->cannot_scalarize)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
for (c = elt->children; c ; c = c->sibling)
|
|
|
|
|
if (!can_completely_scalarize_p (c))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
|
|
|
|
|
/* A simplified tree hashing algorithm that only handles the types of
|
|
|
|
|
trees we expect to find in sra_elt->element. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
static hashval_t
|
|
|
|
|
sra_hash_tree (tree t)
|
|
|
|
|
{
|
2004-07-11 19:41:52 +02:00
|
|
|
|
hashval_t h;
|
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
|
switch (TREE_CODE (t))
|
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
case VAR_DECL:
|
|
|
|
|
case PARM_DECL:
|
|
|
|
|
case RESULT_DECL:
|
2004-07-11 19:41:52 +02:00
|
|
|
|
h = DECL_UID (t);
|
|
|
|
|
break;
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
case INTEGER_CST:
|
2004-07-11 19:41:52 +02:00
|
|
|
|
h = TREE_INT_CST_LOW (t) ^ TREE_INT_CST_HIGH (t);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case FIELD_DECL:
|
|
|
|
|
/* We can have types that are compatible, but have different member
|
|
|
|
|
lists, so we can't hash fields by ID. Use offsets instead. */
|
|
|
|
|
h = iterative_hash_expr (DECL_FIELD_OFFSET (t), 0);
|
|
|
|
|
h = iterative_hash_expr (DECL_FIELD_BIT_OFFSET (t), h);
|
|
|
|
|
break;
|
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
|
default:
|
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* targhooks.c (default_unwind_emit, default_scalar_mode_supported_p):
Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* timevar.c (timevar_push, timevar_pop, timevar_start,
timevar_stop): Likewise.
* toplev.c (default_pch_valid_p): Likewise.
* tracer.c (tail_duplicate): Likewise.
* tree-alias-common.c (get_alias_var_decl,
get_values_from_constructor, create_alias_var, delete_alias_vars,
empty_points_to_set, same_points_to_set, ptr_may_alias_var):
Likewise.
* tree.c (tree_size, make_node_stat, copy_node_stat,
build_int_cst_wide, integer_all_onesp, list_length, chainon,
tree_node_structure, type_contains_placeholder_p, substitute_in_expr,
substitute_placeholder_in_expr, tabilize_reference_1, build0_stat,
build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p,
lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr,
build_method_type_directly, decl_type_context, get_callee_fndecl,
get_set_constructor_bits, build_vector_type_for_mode, int_cst_value,
tree_fold_gcd): Likewise.
* tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges,
make_cond_expr_edges, group_case_labels, tree_merge_blocks,
cleanup_control_expr_graph, find_taken_edge,
find_taken_edge_switch_expr, phi_alternatives_equal,
is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt,
stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate,
tree_split_edge, tree_verify_flow_info, thread_jumps,
tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise.
* tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly,
chrec_fold_multiply_poly_poly): Likewise.
* tree-complex.c (extract_component, expand_complex_division,
expand_complex_comparison, expand_complex_operations_1,
build_replicated_const, expand_vector_operations_1): Likewise.
* tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector,
build_classic_dir_vector): Likewise.
* tree-dfa.c (compute_immediate_uses_for_phi,
compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann,
create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise.
* tree-dump.c (dequeue_and_dump): Likewise.
* tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region,
record_in_finally_tree, replace_goto_queue_1,
maybe_record_in_goto_queue, verify_norecord_switch_expr,
do_return_redirection): Likewise.
* tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr,
add_to_dst_predicate_list, find_phi_replacement_condition,
replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order):
Likewise.
* tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r,
initialize_inlined_parameters, declare_return_variable,
estimate_num_insns_1, expand_call_inline, expand_calls_inline,
optimize_inline_calls, copy_tree_r): Likewise.
* tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt,
ssa_rewrite_stmt, rewrite_into_ssa): Likewise.
* tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after,
tsi_split_statement_list_after, tsi_split_statement_list_before):
Likewise.
* tree-mudflap.c (mf_varname_tree): Likewise.
* tree-nested.c (create_tmp_var_for, lookup_field_for_decl,
lookup_tramp_for_decl, convert_all_function_calls): Likewise.
* tree-optimize.c (tree_rest_of_compilation): Likewise.
* tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi,
coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis,
free_temp_expr_table, add_dependance, finish_expr, rewrite_trees):
Likewise.
* tree-phinodes.c (resize_phi_node, add_phi_arg,
remove_all_phi_nodes_for): Likewise.
* tree-pretty-print.c (op_prio, print_call_name): Likewise.
* tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler,
tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise.
* tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree,
sra_elt_eq, sra_walk_expr, instantiate_missing_elements,
generate_one_element_ref, generate_element_copy,
generate_element_zero, scalarize_copy, scalarize_init,
scalarize_ldst): Likewise.
* tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p,
add_may_alias, add_pointed_to_expr, add_pointed_to_var,
collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise.
* tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise.
* tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value,
set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment,
widen_bitfield, ccp_fold_builtin): Likewise.
* tree-ssa-copy.c (may_propagate_copy, merge_alias_info,
replace_exp_1, propagate_tree_value): Likewise.
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise.
* tree-ssa-dce.c (set_control_dependence_map_bit,
find_control_dependence, find_pdom, mark_operand_necessary,
mark_stmt_if_obviously_necessary,
mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise.
* tree-ssa-dom.c (dom_opt_initialize_block_local_data,
simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis,
eliminate_redundant_computations, avail_expr_eq): Likewise.
* tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise.
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p,
duplicate_blocks): Likewise.
* tree-ssa-loop-im.c (for_each_index, set_level,
is_call_clobbered_ref): Likewise.
* tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos,
stmt_after_increment, set_iv, contains_abnormal_ssa_name_p,
find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates,
peel_address, ptr_difference_cost, may_replace_final_value,
determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer,
rewrite_use, rewrite_uses): Likewise.
* tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa,
check_loop_closed_ssa_use): Likewise.
* tree-ssanames.c (make_ssa_name): Likewise.
* tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses,
finalize_ssa_v_must_defs, finalize_ssa_stmt_operands,
get_stmt_operands, get_expr_operands, get_asm_expr_operands,
get_indirect_ref_operands, add_stmt_operand): Likewise.
* tree-ssa-pre.c (value_exists_in_set_bitmap,
value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set,
phi_translate, valid_in_set, compute_antic,
find_or_generate_expression, create_expression_by_pieces, insert_aux,
create_value_expr_from, eliminate): Likewise.
* tree-ssa-propagate.c (cfg_blocks_get): Likewise.
* tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges):
Likewise.
* tree-tailcall.c (independent_of_stmt_p, adjust_return_value,
eliminate_tail_call): Likewise.
* tree-vectorizer.c (vect_create_index_for_array_ref,
vect_align_data_ref, vect_create_data_ref,
vect_create_destination_var, vect_get_vec_def_for_operand,
vect_finish_stmt_generation, vect_transform_stmt,
vect_transform_loop_bound, vect_transform_loop,
vect_analyze_operations): Likewise.
* tree-vn.c (vn_compute, set_value_handle, get_value_handle):
Likewise.
* tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr,
get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start,
bsi_after_labels, bsi_last): Likewise.
* tree-ssa-live.c (var_union, change_partition_var,
create_ssa_var_map, calculate_live_on_entry, root_var_init,
type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce):
Likewise.
* tree-ssa-live.h (partition_is_global, live_entry_blocks,
tpa_find_tree): Likewise.
(register_ssa_partition_check): Declare.
(register_ssa_partition): use it.
* tree-ssa-live.c: Include errors.h.
(register_ssa_partition_check): New.
* tree-ssa-operands.c: Include errors.h.
* Makefile.in (tree-ssa-operands.o): Depend on errors.h.
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
From-SVN: r87223
2004-09-09 09:54:12 +02:00
|
|
|
|
gcc_unreachable ();
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
2004-07-11 19:41:52 +02:00
|
|
|
|
|
|
|
|
|
return h;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Hash function for type SRA_PAIR. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
static hashval_t
|
|
|
|
|
sra_elt_hash (const void *x)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
const struct sra_elt *e = x;
|
|
|
|
|
const struct sra_elt *p;
|
|
|
|
|
hashval_t h;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
h = sra_hash_tree (e->element);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Take into account everything back up the chain. Given that chain
|
|
|
|
|
lengths are rarely very long, this should be acceptable. If we
|
c-common.c, [...]: Fix comment typos.
* c-common.c, cfgexpand.c, cgraphunit.c, defaults.h,
et-forest.c, expr.c, gimplify.c, global.c, gthr-lynx.h,
hard-reg-set.h, modulo-sched.c, optabs.c, postreload-gcse.c,
tree-data-ref.c, tree-flow.h, tree-if-conv.c, tree-inline.c,
tree-sra.c, tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c,
tree-ssa-loop-niter.c, tree-ssa-operands.c,
tree-ssa-operands.h, tree-ssa-propagate.c,
tree-ssa-propagate.h, tree-ssa-threadupdate.c, value-prof.c,
vec.c, vec.h: Fix comment typos. Follow spelling conventions.
From-SVN: r87104
2004-09-05 17:24:15 +02:00
|
|
|
|
truly identify this as a performance problem, it should work to
|
2004-06-29 18:25:28 +02:00
|
|
|
|
hash the pointer value "e->parent". */
|
|
|
|
|
for (p = e->parent; p ; p = p->parent)
|
|
|
|
|
h = (h * 65521) ^ sra_hash_tree (p->element);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
return h;
|
|
|
|
|
}
|
2004-08-19 23:34:37 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Equality function for type SRA_PAIR. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
static int
|
|
|
|
|
sra_elt_eq (const void *x, const void *y)
|
|
|
|
|
{
|
|
|
|
|
const struct sra_elt *a = x;
|
|
|
|
|
const struct sra_elt *b = y;
|
2004-07-11 19:41:52 +02:00
|
|
|
|
tree ae, be;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
if (a->parent != b->parent)
|
|
|
|
|
return false;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-07-11 19:41:52 +02:00
|
|
|
|
ae = a->element;
|
|
|
|
|
be = b->element;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-07-11 19:41:52 +02:00
|
|
|
|
if (ae == be)
|
|
|
|
|
return true;
|
|
|
|
|
if (TREE_CODE (ae) != TREE_CODE (be))
|
2004-06-29 18:25:28 +02:00
|
|
|
|
return false;
|
2004-07-11 19:41:52 +02:00
|
|
|
|
|
|
|
|
|
switch (TREE_CODE (ae))
|
|
|
|
|
{
|
|
|
|
|
case VAR_DECL:
|
|
|
|
|
case PARM_DECL:
|
|
|
|
|
case RESULT_DECL:
|
|
|
|
|
/* These are all pointer unique. */
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
case INTEGER_CST:
|
|
|
|
|
/* Integers are not pointer unique, so compare their values. */
|
|
|
|
|
return tree_int_cst_equal (ae, be);
|
|
|
|
|
|
|
|
|
|
case FIELD_DECL:
|
|
|
|
|
/* Fields are unique within a record, but not between
|
|
|
|
|
compatible records. */
|
|
|
|
|
if (DECL_FIELD_CONTEXT (ae) == DECL_FIELD_CONTEXT (be))
|
|
|
|
|
return false;
|
|
|
|
|
return fields_compatible_p (ae, be);
|
|
|
|
|
|
|
|
|
|
default:
|
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* targhooks.c (default_unwind_emit, default_scalar_mode_supported_p):
Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* timevar.c (timevar_push, timevar_pop, timevar_start,
timevar_stop): Likewise.
* toplev.c (default_pch_valid_p): Likewise.
* tracer.c (tail_duplicate): Likewise.
* tree-alias-common.c (get_alias_var_decl,
get_values_from_constructor, create_alias_var, delete_alias_vars,
empty_points_to_set, same_points_to_set, ptr_may_alias_var):
Likewise.
* tree.c (tree_size, make_node_stat, copy_node_stat,
build_int_cst_wide, integer_all_onesp, list_length, chainon,
tree_node_structure, type_contains_placeholder_p, substitute_in_expr,
substitute_placeholder_in_expr, tabilize_reference_1, build0_stat,
build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p,
lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr,
build_method_type_directly, decl_type_context, get_callee_fndecl,
get_set_constructor_bits, build_vector_type_for_mode, int_cst_value,
tree_fold_gcd): Likewise.
* tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges,
make_cond_expr_edges, group_case_labels, tree_merge_blocks,
cleanup_control_expr_graph, find_taken_edge,
find_taken_edge_switch_expr, phi_alternatives_equal,
is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt,
stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate,
tree_split_edge, tree_verify_flow_info, thread_jumps,
tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise.
* tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly,
chrec_fold_multiply_poly_poly): Likewise.
* tree-complex.c (extract_component, expand_complex_division,
expand_complex_comparison, expand_complex_operations_1,
build_replicated_const, expand_vector_operations_1): Likewise.
* tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector,
build_classic_dir_vector): Likewise.
* tree-dfa.c (compute_immediate_uses_for_phi,
compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann,
create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise.
* tree-dump.c (dequeue_and_dump): Likewise.
* tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region,
record_in_finally_tree, replace_goto_queue_1,
maybe_record_in_goto_queue, verify_norecord_switch_expr,
do_return_redirection): Likewise.
* tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr,
add_to_dst_predicate_list, find_phi_replacement_condition,
replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order):
Likewise.
* tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r,
initialize_inlined_parameters, declare_return_variable,
estimate_num_insns_1, expand_call_inline, expand_calls_inline,
optimize_inline_calls, copy_tree_r): Likewise.
* tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt,
ssa_rewrite_stmt, rewrite_into_ssa): Likewise.
* tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after,
tsi_split_statement_list_after, tsi_split_statement_list_before):
Likewise.
* tree-mudflap.c (mf_varname_tree): Likewise.
* tree-nested.c (create_tmp_var_for, lookup_field_for_decl,
lookup_tramp_for_decl, convert_all_function_calls): Likewise.
* tree-optimize.c (tree_rest_of_compilation): Likewise.
* tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi,
coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis,
free_temp_expr_table, add_dependance, finish_expr, rewrite_trees):
Likewise.
* tree-phinodes.c (resize_phi_node, add_phi_arg,
remove_all_phi_nodes_for): Likewise.
* tree-pretty-print.c (op_prio, print_call_name): Likewise.
* tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler,
tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise.
* tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree,
sra_elt_eq, sra_walk_expr, instantiate_missing_elements,
generate_one_element_ref, generate_element_copy,
generate_element_zero, scalarize_copy, scalarize_init,
scalarize_ldst): Likewise.
* tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p,
add_may_alias, add_pointed_to_expr, add_pointed_to_var,
collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise.
* tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise.
* tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value,
set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment,
widen_bitfield, ccp_fold_builtin): Likewise.
* tree-ssa-copy.c (may_propagate_copy, merge_alias_info,
replace_exp_1, propagate_tree_value): Likewise.
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise.
* tree-ssa-dce.c (set_control_dependence_map_bit,
find_control_dependence, find_pdom, mark_operand_necessary,
mark_stmt_if_obviously_necessary,
mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise.
* tree-ssa-dom.c (dom_opt_initialize_block_local_data,
simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis,
eliminate_redundant_computations, avail_expr_eq): Likewise.
* tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise.
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p,
duplicate_blocks): Likewise.
* tree-ssa-loop-im.c (for_each_index, set_level,
is_call_clobbered_ref): Likewise.
* tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos,
stmt_after_increment, set_iv, contains_abnormal_ssa_name_p,
find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates,
peel_address, ptr_difference_cost, may_replace_final_value,
determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer,
rewrite_use, rewrite_uses): Likewise.
* tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa,
check_loop_closed_ssa_use): Likewise.
* tree-ssanames.c (make_ssa_name): Likewise.
* tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses,
finalize_ssa_v_must_defs, finalize_ssa_stmt_operands,
get_stmt_operands, get_expr_operands, get_asm_expr_operands,
get_indirect_ref_operands, add_stmt_operand): Likewise.
* tree-ssa-pre.c (value_exists_in_set_bitmap,
value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set,
phi_translate, valid_in_set, compute_antic,
find_or_generate_expression, create_expression_by_pieces, insert_aux,
create_value_expr_from, eliminate): Likewise.
* tree-ssa-propagate.c (cfg_blocks_get): Likewise.
* tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges):
Likewise.
* tree-tailcall.c (independent_of_stmt_p, adjust_return_value,
eliminate_tail_call): Likewise.
* tree-vectorizer.c (vect_create_index_for_array_ref,
vect_align_data_ref, vect_create_data_ref,
vect_create_destination_var, vect_get_vec_def_for_operand,
vect_finish_stmt_generation, vect_transform_stmt,
vect_transform_loop_bound, vect_transform_loop,
vect_analyze_operations): Likewise.
* tree-vn.c (vn_compute, set_value_handle, get_value_handle):
Likewise.
* tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr,
get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start,
bsi_after_labels, bsi_last): Likewise.
* tree-ssa-live.c (var_union, change_partition_var,
create_ssa_var_map, calculate_live_on_entry, root_var_init,
type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce):
Likewise.
* tree-ssa-live.h (partition_is_global, live_entry_blocks,
tpa_find_tree): Likewise.
(register_ssa_partition_check): Declare.
(register_ssa_partition): use it.
* tree-ssa-live.c: Include errors.h.
(register_ssa_partition_check): New.
* tree-ssa-operands.c: Include errors.h.
* Makefile.in (tree-ssa-operands.o): Depend on errors.h.
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
From-SVN: r87223
2004-09-09 09:54:12 +02:00
|
|
|
|
gcc_unreachable ();
|
2004-07-11 19:41:52 +02:00
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Create or return the SRA_ELT structure for CHILD in PARENT. PARENT
|
|
|
|
|
may be null, in which case CHILD must be a DECL. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
static struct sra_elt *
|
|
|
|
|
lookup_element (struct sra_elt *parent, tree child, tree type,
|
|
|
|
|
enum insert_option insert)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
struct sra_elt dummy;
|
|
|
|
|
struct sra_elt **slot;
|
|
|
|
|
struct sra_elt *elt;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
dummy.parent = parent;
|
|
|
|
|
dummy.element = child;
|
|
|
|
|
|
|
|
|
|
slot = (struct sra_elt **) htab_find_slot (sra_map, &dummy, insert);
|
|
|
|
|
if (!slot && insert == NO_INSERT)
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
elt = *slot;
|
|
|
|
|
if (!elt && insert == INSERT)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
*slot = elt = obstack_alloc (&sra_obstack, sizeof (*elt));
|
|
|
|
|
memset (elt, 0, sizeof (*elt));
|
|
|
|
|
|
|
|
|
|
elt->parent = parent;
|
|
|
|
|
elt->element = child;
|
|
|
|
|
elt->type = type;
|
|
|
|
|
elt->is_scalar = is_sra_scalar_type (type);
|
|
|
|
|
|
|
|
|
|
if (parent)
|
|
|
|
|
{
|
|
|
|
|
elt->sibling = parent->children;
|
|
|
|
|
parent->children = elt;
|
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* If this is a parameter, then if we want to scalarize, we have
|
|
|
|
|
one copy from the true function parameter. Count it now. */
|
|
|
|
|
if (TREE_CODE (child) == PARM_DECL)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
elt->n_copies = 1;
|
|
|
|
|
bitmap_set_bit (needs_copy_in, var_ann (child)->uid);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
return elt;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Return true if the ARRAY_REF in EXPR is a constant, in bounds access. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
static bool
|
|
|
|
|
is_valid_const_index (tree expr)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
tree dom, t, index = TREE_OPERAND (expr, 1);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
if (TREE_CODE (index) != INTEGER_CST)
|
|
|
|
|
return false;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Watch out for stupid user tricks, indexing outside the array.
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
Careful, we're not called only on scalarizable types, so do not
|
|
|
|
|
assume constant array bounds. We needn't do anything with such
|
|
|
|
|
cases, since they'll be referring to objects that we should have
|
|
|
|
|
already rejected for scalarization, so returning false is fine. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
dom = TYPE_DOMAIN (TREE_TYPE (TREE_OPERAND (expr, 0)));
|
|
|
|
|
if (dom == NULL)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
t = TYPE_MIN_VALUE (dom);
|
|
|
|
|
if (!t || TREE_CODE (t) != INTEGER_CST)
|
|
|
|
|
return false;
|
|
|
|
|
if (tree_int_cst_lt (index, t))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
t = TYPE_MAX_VALUE (dom);
|
|
|
|
|
if (!t || TREE_CODE (t) != INTEGER_CST)
|
|
|
|
|
return false;
|
|
|
|
|
if (tree_int_cst_lt (t, index))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-19 23:34:37 +02:00
|
|
|
|
/* Create or return the SRA_ELT structure for EXPR if the expression
|
2004-06-29 18:25:28 +02:00
|
|
|
|
refers to a scalarizable variable. */
|
|
|
|
|
|
|
|
|
|
static struct sra_elt *
|
|
|
|
|
maybe_lookup_element_for_expr (tree expr)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
struct sra_elt *elt;
|
|
|
|
|
tree child;
|
|
|
|
|
|
|
|
|
|
switch (TREE_CODE (expr))
|
|
|
|
|
{
|
|
|
|
|
case VAR_DECL:
|
|
|
|
|
case PARM_DECL:
|
|
|
|
|
case RESULT_DECL:
|
|
|
|
|
if (is_sra_candidate_decl (expr))
|
|
|
|
|
return lookup_element (NULL, expr, TREE_TYPE (expr), INSERT);
|
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
|
|
case ARRAY_REF:
|
|
|
|
|
/* We can't scalarize variable array indicies. */
|
|
|
|
|
if (is_valid_const_index (expr))
|
|
|
|
|
child = TREE_OPERAND (expr, 1);
|
|
|
|
|
else
|
|
|
|
|
return NULL;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case COMPONENT_REF:
|
|
|
|
|
/* Don't look through unions. */
|
|
|
|
|
if (TREE_CODE (TREE_TYPE (TREE_OPERAND (expr, 0))) != RECORD_TYPE)
|
|
|
|
|
return NULL;
|
|
|
|
|
child = TREE_OPERAND (expr, 1);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case REALPART_EXPR:
|
|
|
|
|
child = integer_zero_node;
|
|
|
|
|
break;
|
|
|
|
|
case IMAGPART_EXPR:
|
|
|
|
|
child = integer_one_node;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
elt = maybe_lookup_element_for_expr (TREE_OPERAND (expr, 0));
|
|
|
|
|
if (elt)
|
|
|
|
|
return lookup_element (elt, child, TREE_TYPE (expr), INSERT);
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Functions to walk just enough of the tree to see all scalarizable
|
|
|
|
|
references, and categorize them. */
|
|
|
|
|
|
|
|
|
|
/* A set of callbacks for phases 2 and 4. They'll be invoked for the
|
|
|
|
|
various kinds of references seen. In all cases, *BSI is an iterator
|
|
|
|
|
pointing to the statement being processed. */
|
|
|
|
|
struct sra_walk_fns
|
|
|
|
|
{
|
|
|
|
|
/* Invoked when ELT is required as a unit. Note that ELT might refer to
|
|
|
|
|
a leaf node, in which case this is a simple scalar reference. *EXPR_P
|
|
|
|
|
points to the location of the expression. IS_OUTPUT is true if this
|
|
|
|
|
is a left-hand-side reference. */
|
|
|
|
|
void (*use) (struct sra_elt *elt, tree *expr_p,
|
|
|
|
|
block_stmt_iterator *bsi, bool is_output);
|
|
|
|
|
|
|
|
|
|
/* Invoked when we have a copy between two scalarizable references. */
|
|
|
|
|
void (*copy) (struct sra_elt *lhs_elt, struct sra_elt *rhs_elt,
|
|
|
|
|
block_stmt_iterator *bsi);
|
|
|
|
|
|
|
|
|
|
/* Invoked when ELT is initialized from a constant. VALUE may be NULL,
|
2004-07-07 01:02:22 +02:00
|
|
|
|
in which case it should be treated as an empty CONSTRUCTOR. */
|
|
|
|
|
void (*init) (struct sra_elt *elt, tree value, block_stmt_iterator *bsi);
|
2004-06-29 18:25:28 +02:00
|
|
|
|
|
|
|
|
|
/* Invoked when we have a copy between one scalarizable reference ELT
|
|
|
|
|
and one non-scalarizable reference OTHER. IS_OUTPUT is true if ELT
|
|
|
|
|
is on the left-hand side. */
|
|
|
|
|
void (*ldst) (struct sra_elt *elt, tree other,
|
|
|
|
|
block_stmt_iterator *bsi, bool is_output);
|
|
|
|
|
|
|
|
|
|
/* True during phase 2, false during phase 4. */
|
|
|
|
|
/* ??? This is a hack. */
|
|
|
|
|
bool initial_scan;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#ifdef ENABLE_CHECKING
|
c-cppbuiltin.c, [...]: Fix comment typos.
* c-cppbuiltin.c, cgraph.c, domwalk.h, except.c, gimplify.c,
lambda-code.c, postreload.c, predict.c, tree-sra.c,
tree-ssa-loop-manip.c, tree.c: Fix comment typos.
From-SVN: r90596
2004-11-13 22:11:04 +01:00
|
|
|
|
/* Invoked via walk_tree, if *TP contains a candidate decl, return it. */
|
2004-06-29 18:25:28 +02:00
|
|
|
|
|
|
|
|
|
static tree
|
|
|
|
|
sra_find_candidate_decl (tree *tp, int *walk_subtrees,
|
|
|
|
|
void *data ATTRIBUTE_UNUSED)
|
|
|
|
|
{
|
|
|
|
|
tree t = *tp;
|
|
|
|
|
enum tree_code code = TREE_CODE (t);
|
|
|
|
|
|
|
|
|
|
if (code == VAR_DECL || code == PARM_DECL || code == RESULT_DECL)
|
|
|
|
|
{
|
|
|
|
|
*walk_subtrees = 0;
|
|
|
|
|
if (is_sra_candidate_decl (t))
|
|
|
|
|
return t;
|
|
|
|
|
}
|
|
|
|
|
else if (TYPE_P (t))
|
|
|
|
|
*walk_subtrees = 0;
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* Walk most expressions looking for a scalarizable aggregate.
|
|
|
|
|
If we find one, invoke FNS->USE. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
sra_walk_expr (tree *expr_p, block_stmt_iterator *bsi, bool is_output,
|
|
|
|
|
const struct sra_walk_fns *fns)
|
|
|
|
|
{
|
|
|
|
|
tree expr = *expr_p;
|
|
|
|
|
tree inner = expr;
|
2004-07-02 00:26:12 +02:00
|
|
|
|
bool disable_scalarization = false;
|
2004-06-29 18:25:28 +02:00
|
|
|
|
|
|
|
|
|
/* We're looking to collect a reference expression between EXPR and INNER,
|
|
|
|
|
such that INNER is a scalarizable decl and all other nodes through EXPR
|
|
|
|
|
are references that we can scalarize. If we come across something that
|
|
|
|
|
we can't scalarize, we reset EXPR. This has the effect of making it
|
|
|
|
|
appear that we're referring to the larger expression as a whole. */
|
|
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
|
switch (TREE_CODE (inner))
|
|
|
|
|
{
|
|
|
|
|
case VAR_DECL:
|
|
|
|
|
case PARM_DECL:
|
|
|
|
|
case RESULT_DECL:
|
|
|
|
|
/* If there is a scalarizable decl at the bottom, then process it. */
|
|
|
|
|
if (is_sra_candidate_decl (inner))
|
|
|
|
|
{
|
|
|
|
|
struct sra_elt *elt = maybe_lookup_element_for_expr (expr);
|
2004-07-02 00:26:12 +02:00
|
|
|
|
if (disable_scalarization)
|
|
|
|
|
elt->cannot_scalarize = true;
|
|
|
|
|
else
|
|
|
|
|
fns->use (elt, expr_p, bsi, is_output);
|
2004-06-29 18:25:28 +02:00
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case ARRAY_REF:
|
|
|
|
|
/* Non-constant index means any member may be accessed. Prevent the
|
|
|
|
|
expression from being scalarized. If we were to treat this as a
|
|
|
|
|
reference to the whole array, we can wind up with a single dynamic
|
|
|
|
|
index reference inside a loop being overridden by several constant
|
|
|
|
|
index references during loop setup. It's possible that this could
|
|
|
|
|
be avoided by using dynamic usage counts based on BB trip counts
|
2004-08-19 23:34:37 +02:00
|
|
|
|
(based on loop analysis or profiling), but that hardly seems worth
|
2004-06-29 18:25:28 +02:00
|
|
|
|
the effort. */
|
|
|
|
|
/* ??? Hack. Figure out how to push this into the scan routines
|
|
|
|
|
without duplicating too much code. */
|
|
|
|
|
if (!is_valid_const_index (inner))
|
|
|
|
|
{
|
2004-07-02 00:26:12 +02:00
|
|
|
|
disable_scalarization = true;
|
|
|
|
|
goto use_all;
|
2004-06-29 18:25:28 +02:00
|
|
|
|
}
|
|
|
|
|
/* ??? Are we assured that non-constant bounds and stride will have
|
|
|
|
|
the same value everywhere? I don't think Fortran will... */
|
|
|
|
|
if (TREE_OPERAND (inner, 2) || TREE_OPERAND (inner, 3))
|
|
|
|
|
goto use_all;
|
|
|
|
|
inner = TREE_OPERAND (inner, 0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case COMPONENT_REF:
|
|
|
|
|
/* A reference to a union member constitutes a reference to the
|
|
|
|
|
entire union. */
|
|
|
|
|
if (TREE_CODE (TREE_TYPE (TREE_OPERAND (inner, 0))) != RECORD_TYPE)
|
|
|
|
|
goto use_all;
|
|
|
|
|
/* ??? See above re non-constant stride. */
|
|
|
|
|
if (TREE_OPERAND (inner, 2))
|
|
|
|
|
goto use_all;
|
|
|
|
|
inner = TREE_OPERAND (inner, 0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case REALPART_EXPR:
|
|
|
|
|
case IMAGPART_EXPR:
|
|
|
|
|
inner = TREE_OPERAND (inner, 0);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case BIT_FIELD_REF:
|
|
|
|
|
/* A bit field reference (access to *multiple* fields simultaneously)
|
2004-08-19 23:34:37 +02:00
|
|
|
|
is not currently scalarized. Consider this an access to the
|
2004-06-29 18:25:28 +02:00
|
|
|
|
complete outer element, to which walk_tree will bring us next. */
|
|
|
|
|
goto use_all;
|
|
|
|
|
|
|
|
|
|
case ARRAY_RANGE_REF:
|
|
|
|
|
/* Similarly, an subrange reference is used to modify indexing. Which
|
|
|
|
|
means that the canonical element names that we have won't work. */
|
|
|
|
|
goto use_all;
|
|
|
|
|
|
|
|
|
|
case VIEW_CONVERT_EXPR:
|
|
|
|
|
case NOP_EXPR:
|
|
|
|
|
/* Similarly, a view/nop explicitly wants to look at an object in a
|
|
|
|
|
type other than the one we've scalarized. */
|
|
|
|
|
goto use_all;
|
|
|
|
|
|
2004-07-16 23:13:08 +02:00
|
|
|
|
case WITH_SIZE_EXPR:
|
|
|
|
|
/* This is a transparent wrapper. The entire inner expression really
|
|
|
|
|
is being used. */
|
|
|
|
|
goto use_all;
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
use_all:
|
|
|
|
|
expr_p = &TREE_OPERAND (inner, 0);
|
|
|
|
|
inner = expr = *expr_p;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
#ifdef ENABLE_CHECKING
|
|
|
|
|
/* Validate that we're not missing any references. */
|
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* targhooks.c (default_unwind_emit, default_scalar_mode_supported_p):
Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* timevar.c (timevar_push, timevar_pop, timevar_start,
timevar_stop): Likewise.
* toplev.c (default_pch_valid_p): Likewise.
* tracer.c (tail_duplicate): Likewise.
* tree-alias-common.c (get_alias_var_decl,
get_values_from_constructor, create_alias_var, delete_alias_vars,
empty_points_to_set, same_points_to_set, ptr_may_alias_var):
Likewise.
* tree.c (tree_size, make_node_stat, copy_node_stat,
build_int_cst_wide, integer_all_onesp, list_length, chainon,
tree_node_structure, type_contains_placeholder_p, substitute_in_expr,
substitute_placeholder_in_expr, tabilize_reference_1, build0_stat,
build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p,
lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr,
build_method_type_directly, decl_type_context, get_callee_fndecl,
get_set_constructor_bits, build_vector_type_for_mode, int_cst_value,
tree_fold_gcd): Likewise.
* tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges,
make_cond_expr_edges, group_case_labels, tree_merge_blocks,
cleanup_control_expr_graph, find_taken_edge,
find_taken_edge_switch_expr, phi_alternatives_equal,
is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt,
stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate,
tree_split_edge, tree_verify_flow_info, thread_jumps,
tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise.
* tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly,
chrec_fold_multiply_poly_poly): Likewise.
* tree-complex.c (extract_component, expand_complex_division,
expand_complex_comparison, expand_complex_operations_1,
build_replicated_const, expand_vector_operations_1): Likewise.
* tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector,
build_classic_dir_vector): Likewise.
* tree-dfa.c (compute_immediate_uses_for_phi,
compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann,
create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise.
* tree-dump.c (dequeue_and_dump): Likewise.
* tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region,
record_in_finally_tree, replace_goto_queue_1,
maybe_record_in_goto_queue, verify_norecord_switch_expr,
do_return_redirection): Likewise.
* tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr,
add_to_dst_predicate_list, find_phi_replacement_condition,
replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order):
Likewise.
* tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r,
initialize_inlined_parameters, declare_return_variable,
estimate_num_insns_1, expand_call_inline, expand_calls_inline,
optimize_inline_calls, copy_tree_r): Likewise.
* tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt,
ssa_rewrite_stmt, rewrite_into_ssa): Likewise.
* tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after,
tsi_split_statement_list_after, tsi_split_statement_list_before):
Likewise.
* tree-mudflap.c (mf_varname_tree): Likewise.
* tree-nested.c (create_tmp_var_for, lookup_field_for_decl,
lookup_tramp_for_decl, convert_all_function_calls): Likewise.
* tree-optimize.c (tree_rest_of_compilation): Likewise.
* tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi,
coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis,
free_temp_expr_table, add_dependance, finish_expr, rewrite_trees):
Likewise.
* tree-phinodes.c (resize_phi_node, add_phi_arg,
remove_all_phi_nodes_for): Likewise.
* tree-pretty-print.c (op_prio, print_call_name): Likewise.
* tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler,
tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise.
* tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree,
sra_elt_eq, sra_walk_expr, instantiate_missing_elements,
generate_one_element_ref, generate_element_copy,
generate_element_zero, scalarize_copy, scalarize_init,
scalarize_ldst): Likewise.
* tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p,
add_may_alias, add_pointed_to_expr, add_pointed_to_var,
collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise.
* tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise.
* tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value,
set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment,
widen_bitfield, ccp_fold_builtin): Likewise.
* tree-ssa-copy.c (may_propagate_copy, merge_alias_info,
replace_exp_1, propagate_tree_value): Likewise.
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise.
* tree-ssa-dce.c (set_control_dependence_map_bit,
find_control_dependence, find_pdom, mark_operand_necessary,
mark_stmt_if_obviously_necessary,
mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise.
* tree-ssa-dom.c (dom_opt_initialize_block_local_data,
simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis,
eliminate_redundant_computations, avail_expr_eq): Likewise.
* tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise.
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p,
duplicate_blocks): Likewise.
* tree-ssa-loop-im.c (for_each_index, set_level,
is_call_clobbered_ref): Likewise.
* tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos,
stmt_after_increment, set_iv, contains_abnormal_ssa_name_p,
find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates,
peel_address, ptr_difference_cost, may_replace_final_value,
determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer,
rewrite_use, rewrite_uses): Likewise.
* tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa,
check_loop_closed_ssa_use): Likewise.
* tree-ssanames.c (make_ssa_name): Likewise.
* tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses,
finalize_ssa_v_must_defs, finalize_ssa_stmt_operands,
get_stmt_operands, get_expr_operands, get_asm_expr_operands,
get_indirect_ref_operands, add_stmt_operand): Likewise.
* tree-ssa-pre.c (value_exists_in_set_bitmap,
value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set,
phi_translate, valid_in_set, compute_antic,
find_or_generate_expression, create_expression_by_pieces, insert_aux,
create_value_expr_from, eliminate): Likewise.
* tree-ssa-propagate.c (cfg_blocks_get): Likewise.
* tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges):
Likewise.
* tree-tailcall.c (independent_of_stmt_p, adjust_return_value,
eliminate_tail_call): Likewise.
* tree-vectorizer.c (vect_create_index_for_array_ref,
vect_align_data_ref, vect_create_data_ref,
vect_create_destination_var, vect_get_vec_def_for_operand,
vect_finish_stmt_generation, vect_transform_stmt,
vect_transform_loop_bound, vect_transform_loop,
vect_analyze_operations): Likewise.
* tree-vn.c (vn_compute, set_value_handle, get_value_handle):
Likewise.
* tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr,
get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start,
bsi_after_labels, bsi_last): Likewise.
* tree-ssa-live.c (var_union, change_partition_var,
create_ssa_var_map, calculate_live_on_entry, root_var_init,
type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce):
Likewise.
* tree-ssa-live.h (partition_is_global, live_entry_blocks,
tpa_find_tree): Likewise.
(register_ssa_partition_check): Declare.
(register_ssa_partition): use it.
* tree-ssa-live.c: Include errors.h.
(register_ssa_partition_check): New.
* tree-ssa-operands.c: Include errors.h.
* Makefile.in (tree-ssa-operands.o): Depend on errors.h.
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
From-SVN: r87223
2004-09-09 09:54:12 +02:00
|
|
|
|
gcc_assert (!walk_tree (&inner, sra_find_candidate_decl, NULL, NULL));
|
2004-06-29 18:25:28 +02:00
|
|
|
|
#endif
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Walk a TREE_LIST of values looking for scalarizable aggregates.
|
|
|
|
|
If we find one, invoke FNS->USE. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
sra_walk_tree_list (tree list, block_stmt_iterator *bsi, bool is_output,
|
|
|
|
|
const struct sra_walk_fns *fns)
|
|
|
|
|
{
|
|
|
|
|
tree op;
|
|
|
|
|
for (op = list; op ; op = TREE_CHAIN (op))
|
|
|
|
|
sra_walk_expr (&TREE_VALUE (op), bsi, is_output, fns);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Walk the arguments of a CALL_EXPR looking for scalarizable aggregates.
|
|
|
|
|
If we find one, invoke FNS->USE. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
sra_walk_call_expr (tree expr, block_stmt_iterator *bsi,
|
|
|
|
|
const struct sra_walk_fns *fns)
|
|
|
|
|
{
|
|
|
|
|
sra_walk_tree_list (TREE_OPERAND (expr, 1), bsi, false, fns);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Walk the inputs and outputs of an ASM_EXPR looking for scalarizable
|
|
|
|
|
aggregates. If we find one, invoke FNS->USE. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
sra_walk_asm_expr (tree expr, block_stmt_iterator *bsi,
|
|
|
|
|
const struct sra_walk_fns *fns)
|
|
|
|
|
{
|
|
|
|
|
sra_walk_tree_list (ASM_INPUTS (expr), bsi, false, fns);
|
|
|
|
|
sra_walk_tree_list (ASM_OUTPUTS (expr), bsi, true, fns);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Walk a MODIFY_EXPR and categorize the assignment appropriately. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
sra_walk_modify_expr (tree expr, block_stmt_iterator *bsi,
|
|
|
|
|
const struct sra_walk_fns *fns)
|
|
|
|
|
{
|
|
|
|
|
struct sra_elt *lhs_elt, *rhs_elt;
|
|
|
|
|
tree lhs, rhs;
|
|
|
|
|
|
|
|
|
|
lhs = TREE_OPERAND (expr, 0);
|
|
|
|
|
rhs = TREE_OPERAND (expr, 1);
|
|
|
|
|
lhs_elt = maybe_lookup_element_for_expr (lhs);
|
|
|
|
|
rhs_elt = maybe_lookup_element_for_expr (rhs);
|
|
|
|
|
|
|
|
|
|
/* If both sides are scalarizable, this is a COPY operation. */
|
|
|
|
|
if (lhs_elt && rhs_elt)
|
|
|
|
|
{
|
|
|
|
|
fns->copy (lhs_elt, rhs_elt, bsi);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2004-11-24 21:21:29 +01:00
|
|
|
|
/* If the RHS is scalarizable, handle it. There are only two cases. */
|
|
|
|
|
if (rhs_elt)
|
|
|
|
|
{
|
|
|
|
|
if (!rhs_elt->is_scalar)
|
|
|
|
|
fns->ldst (rhs_elt, lhs, bsi, false);
|
|
|
|
|
else
|
|
|
|
|
fns->use (rhs_elt, &TREE_OPERAND (expr, 1), bsi, false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If it isn't scalarizable, there may be scalarizable variables within, so
|
|
|
|
|
check for a call or else walk the RHS to see if we need to do any
|
|
|
|
|
copy-in operations. We need to do it before the LHS is scalarized so
|
|
|
|
|
that the statements get inserted in the proper place, before any
|
|
|
|
|
copy-out operations. */
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
tree call = get_call_expr_in (rhs);
|
|
|
|
|
if (call)
|
|
|
|
|
sra_walk_call_expr (call, bsi, fns);
|
|
|
|
|
else
|
|
|
|
|
sra_walk_expr (&TREE_OPERAND (expr, 1), bsi, false, fns);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Likewise, handle the LHS being scalarizable. We have cases similar
|
|
|
|
|
to those above, but also want to handle RHS being constant. */
|
2004-06-29 18:25:28 +02:00
|
|
|
|
if (lhs_elt)
|
|
|
|
|
{
|
|
|
|
|
/* If this is an assignment from a constant, or constructor, then
|
|
|
|
|
we have access to all of the elements individually. Invoke INIT. */
|
2004-07-07 01:02:22 +02:00
|
|
|
|
if (TREE_CODE (rhs) == COMPLEX_EXPR
|
|
|
|
|
|| TREE_CODE (rhs) == COMPLEX_CST
|
|
|
|
|
|| TREE_CODE (rhs) == CONSTRUCTOR)
|
|
|
|
|
fns->init (lhs_elt, rhs, bsi);
|
2004-06-29 18:25:28 +02:00
|
|
|
|
|
|
|
|
|
/* If this is an assignment from read-only memory, treat this as if
|
|
|
|
|
we'd been passed the constructor directly. Invoke INIT. */
|
|
|
|
|
else if (TREE_CODE (rhs) == VAR_DECL
|
|
|
|
|
&& TREE_STATIC (rhs)
|
|
|
|
|
&& TREE_READONLY (rhs)
|
2004-07-07 01:02:22 +02:00
|
|
|
|
&& targetm.binds_local_p (rhs))
|
|
|
|
|
fns->init (lhs_elt, DECL_INITIAL (rhs), bsi);
|
2004-06-29 18:25:28 +02:00
|
|
|
|
|
|
|
|
|
/* If this is a copy from a non-scalarizable lvalue, invoke LDST.
|
|
|
|
|
The lvalue requirement prevents us from trying to directly scalarize
|
|
|
|
|
the result of a function call. Which would result in trying to call
|
|
|
|
|
the function multiple times, and other evil things. */
|
2004-07-28 03:17:00 +02:00
|
|
|
|
else if (!lhs_elt->is_scalar && is_gimple_addressable (rhs))
|
2004-06-29 18:25:28 +02:00
|
|
|
|
fns->ldst (lhs_elt, rhs, bsi, true);
|
2004-08-19 23:34:37 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Otherwise we're being used in some context that requires the
|
|
|
|
|
aggregate to be seen as a whole. Invoke USE. */
|
|
|
|
|
else
|
|
|
|
|
fns->use (lhs_elt, &TREE_OPERAND (expr, 0), bsi, true);
|
|
|
|
|
}
|
|
|
|
|
|
2004-11-24 21:21:29 +01:00
|
|
|
|
/* Similarly to above, LHS_ELT being null only means that the LHS as a
|
|
|
|
|
whole is not a scalarizable reference. There may be occurrences of
|
|
|
|
|
scalarizable variables within, which implies a USE. */
|
2004-06-29 18:25:28 +02:00
|
|
|
|
else
|
2004-11-24 21:21:29 +01:00
|
|
|
|
sra_walk_expr (&TREE_OPERAND (expr, 0), bsi, true, fns);
|
2004-06-29 18:25:28 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Entry point to the walk functions. Search the entire function,
|
|
|
|
|
invoking the callbacks in FNS on each of the references to
|
|
|
|
|
scalarizable variables. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
sra_walk_function (const struct sra_walk_fns *fns)
|
|
|
|
|
{
|
|
|
|
|
basic_block bb;
|
2004-07-04 04:52:36 +02:00
|
|
|
|
block_stmt_iterator si, ni;
|
2004-06-29 18:25:28 +02:00
|
|
|
|
|
|
|
|
|
/* ??? Phase 4 could derive some benefit to walking the function in
|
|
|
|
|
dominator tree order. */
|
|
|
|
|
|
|
|
|
|
FOR_EACH_BB (bb)
|
2004-07-04 04:52:36 +02:00
|
|
|
|
for (si = bsi_start (bb); !bsi_end_p (si); si = ni)
|
2004-06-29 18:25:28 +02:00
|
|
|
|
{
|
|
|
|
|
tree stmt, t;
|
|
|
|
|
stmt_ann_t ann;
|
|
|
|
|
|
|
|
|
|
stmt = bsi_stmt (si);
|
|
|
|
|
ann = stmt_ann (stmt);
|
|
|
|
|
|
2004-07-04 04:52:36 +02:00
|
|
|
|
ni = si;
|
|
|
|
|
bsi_next (&ni);
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* If the statement has no virtual operands, then it doesn't
|
|
|
|
|
make any structure references that we care about. */
|
|
|
|
|
if (NUM_V_MAY_DEFS (V_MAY_DEF_OPS (ann)) == 0
|
|
|
|
|
&& NUM_VUSES (VUSE_OPS (ann)) == 0
|
|
|
|
|
&& NUM_V_MUST_DEFS (V_MUST_DEF_OPS (ann)) == 0)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
switch (TREE_CODE (stmt))
|
|
|
|
|
{
|
|
|
|
|
case RETURN_EXPR:
|
|
|
|
|
/* If we have "return <retval>" then the return value is
|
|
|
|
|
already exposed for our pleasure. Walk it as a USE to
|
|
|
|
|
force all the components back in place for the return.
|
|
|
|
|
|
|
|
|
|
If we have an embedded assignment, then <retval> is of
|
|
|
|
|
a type that gets returned in registers in this ABI, and
|
|
|
|
|
we do not wish to extend their lifetimes. Treat this
|
|
|
|
|
as a USE of the variable on the RHS of this assignment. */
|
|
|
|
|
|
|
|
|
|
t = TREE_OPERAND (stmt, 0);
|
|
|
|
|
if (TREE_CODE (t) == MODIFY_EXPR)
|
|
|
|
|
sra_walk_expr (&TREE_OPERAND (t, 1), &si, false, fns);
|
|
|
|
|
else
|
|
|
|
|
sra_walk_expr (&TREE_OPERAND (stmt, 0), &si, false, fns);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case MODIFY_EXPR:
|
|
|
|
|
sra_walk_modify_expr (stmt, &si, fns);
|
|
|
|
|
break;
|
|
|
|
|
case CALL_EXPR:
|
|
|
|
|
sra_walk_call_expr (stmt, &si, fns);
|
|
|
|
|
break;
|
|
|
|
|
case ASM_EXPR:
|
|
|
|
|
sra_walk_asm_expr (stmt, &si, fns);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Phase One: Scan all referenced variables in the program looking for
|
|
|
|
|
structures that could be decomposed. */
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
|
find_candidates_for_sra (void)
|
|
|
|
|
{
|
|
|
|
|
size_t i;
|
|
|
|
|
bool any_set = false;
|
|
|
|
|
|
|
|
|
|
for (i = 0; i < num_referenced_vars; i++)
|
|
|
|
|
{
|
|
|
|
|
tree var = referenced_var (i);
|
|
|
|
|
if (decl_can_be_decomposed_p (var))
|
|
|
|
|
{
|
|
|
|
|
bitmap_set_bit (sra_candidates, var_ann (var)->uid);
|
|
|
|
|
any_set = true;
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-08-19 23:34:37 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
return any_set;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Phase Two: Scan all references to scalarizable variables. Count the
|
|
|
|
|
number of times they are used or copied respectively. */
|
|
|
|
|
|
|
|
|
|
/* Callbacks to fill in SRA_WALK_FNS. Everything but USE is
|
|
|
|
|
considered a copy, because we can decompose the reference such that
|
|
|
|
|
the sub-elements needn't be contiguous. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
scan_use (struct sra_elt *elt, tree *expr_p ATTRIBUTE_UNUSED,
|
|
|
|
|
block_stmt_iterator *bsi ATTRIBUTE_UNUSED,
|
|
|
|
|
bool is_output ATTRIBUTE_UNUSED)
|
|
|
|
|
{
|
|
|
|
|
elt->n_uses += 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
scan_copy (struct sra_elt *lhs_elt, struct sra_elt *rhs_elt,
|
|
|
|
|
block_stmt_iterator *bsi ATTRIBUTE_UNUSED)
|
|
|
|
|
{
|
|
|
|
|
lhs_elt->n_copies += 1;
|
|
|
|
|
rhs_elt->n_copies += 1;
|
|
|
|
|
}
|
|
|
|
|
|
2004-07-07 01:02:22 +02:00
|
|
|
|
static void
|
2004-06-29 18:25:28 +02:00
|
|
|
|
scan_init (struct sra_elt *lhs_elt, tree rhs ATTRIBUTE_UNUSED,
|
|
|
|
|
block_stmt_iterator *bsi ATTRIBUTE_UNUSED)
|
|
|
|
|
{
|
|
|
|
|
lhs_elt->n_copies += 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
scan_ldst (struct sra_elt *elt, tree other ATTRIBUTE_UNUSED,
|
|
|
|
|
block_stmt_iterator *bsi ATTRIBUTE_UNUSED,
|
|
|
|
|
bool is_output ATTRIBUTE_UNUSED)
|
|
|
|
|
{
|
|
|
|
|
elt->n_copies += 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Dump the values we collected during the scanning phase. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
scan_dump (struct sra_elt *elt)
|
|
|
|
|
{
|
|
|
|
|
struct sra_elt *c;
|
|
|
|
|
|
|
|
|
|
dump_sra_elt_name (dump_file, elt);
|
|
|
|
|
fprintf (dump_file, ": n_uses=%u n_copies=%u\n", elt->n_uses, elt->n_copies);
|
|
|
|
|
|
|
|
|
|
for (c = elt->children; c ; c = c->sibling)
|
|
|
|
|
scan_dump (c);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Entry point to phase 2. Scan the entire function, building up
|
|
|
|
|
scalarization data structures, recording copies and uses. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
scan_function (void)
|
|
|
|
|
{
|
|
|
|
|
static const struct sra_walk_fns fns = {
|
|
|
|
|
scan_use, scan_copy, scan_init, scan_ldst, true
|
|
|
|
|
};
|
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style.
* bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP,
EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style.
(bitmap_iterator): New type.
(bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init,
bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1,
bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1,
bmp_iter_and_init, bmp_iter_and_next): New functions.
* basic-block.h (EXECUTE_IF_SET_IN_REG_SET,
EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to
use iterator-style EXECUTE_IF_IN_BITMAP macros.
* bitmap.c (bitmap_print): Ditto.
* bt-load.c (clear_btr_from_live_range, add_btr_to_live_range,
btr_def_live_range): Ditto.
* cfganal.c (compute_dominance_frontiers_1) Ditto.
* cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics):
Ditto.
* ddg.c (build_inter_loop_deps): Ditto.
* df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update):
Ditto.
* except.c (remove_eh_handler): Ditto.
* flow.c (reg_set_to_hard_reg_set): Ditto.
* gcse.c (clear_modify_mem_tables): Ditto.
* global.c (build_insn_chain): Ditto.
* ifcvt.c (dead_or_predicable): Ditto.
* loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg):
Ditto.
* ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto.
* ra-rewrite.c (reloads_to_loads, rewrite_program2,
detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto.
* tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region,
tree_purge_all_dead_eh_edges): Ditto.
* tree-into-ssa.c (compute_global_livein, insert_phi_nodes,
insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags,
rewrite_ssa_into_ssa): Ditto.
* tree-outof-ssa.c (find_replaceable_exprs): Ditto.
* tree-sra.c (scan_function, decide_instantiations, scalarize_parms):
Ditto.
* tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape,
compute_flow_sensitive_aliasing, maybe_create_global_var,
dump_points_to_info_for): Ditto.
* tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto.
* tree-ssa-dse.c (dse_finalize_block): Ditto.
* tree-ssa-live.c (live_worklist, calculate_live_on_entry,
calculate_live_on_exit, build_tree_conflict_graph, dump_live_info):
Ditto.
* tree-ssa-loop-ivopts.c (find_induction_variables,
find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map,
determine_use_iv_costs, determine_set_costs, find_best_candidate,
set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data):
Ditto.
* tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto.
* tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops,
add_call_read_ops): Ditto.
* tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto.
From-SVN: r88145
2004-09-26 21:53:13 +02:00
|
|
|
|
bitmap_iterator bi;
|
2004-06-29 18:25:28 +02:00
|
|
|
|
|
|
|
|
|
sra_walk_function (&fns);
|
|
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
|
{
|
bitmap.c (bitmap_print): Make bitno unsigned.
* bitmap.c (bitmap_print): Make bitno unsigned.
* bt-load.c (clear_btr_from_live_range,
btr_def_live_range): Likewise.
* caller-save.c (save_call_clobbered_regs): Likewise.
* cfganal.c (compute_dominance_frontiers_1): Likewise.
* cfgcleanup.c (thread_jump): Likewise.
* cfgrtl.c (safe_insert_insn_on_edge): Likewise.
* conflict.c (conflict_graph_compute): Likewise.
* ddg.c (add_deps_for_use): Likewise.
* df.c (df_refs_update): Likewise.
* except.c (remove_eh_handler): Likewise.
* flow.c (verify_local_live_at_start, update_life_info,
initialize_uninitialized_subregs, propagate_one_insn,
free_propagate_block_info, propagate_block, find_use_as_address,
reg_set_to_hard_reg_set): Likewise.
* gcse.c (clear_modify_mem_tables): Likewise.
* global.c (global_conflicts, build_insn_chain): Likewise.
* ifcvt.c (dead_or_predicable): Likewise.
* local-alloc.c (update_equiv_regs): Likewise.
* loop.c (load_mems): Likewise.
* ra-build.c (livethrough_conflicts_bb, conflicts_between_webs):
Likewise.
* ra-rewrite.c (reloads_to_loads, rewrite_program2, actual_spill):
Likewise.
* reload1.c (order_regs_for_reload, finish_spills): Likewise.
* sched-deps.c (sched_analyze_insn, free_deps): Likewise.
* sched-rgn.c (propagate_deps
* tree-cfg.c (tree_purge_all_dead_eh_edges): Likewise.
* tree-dfa.c (dump_dfa_stats
tree-into-ssa.c (compute_global_livein, insert_phi_nodes,
insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags):
Likewise.
* tree-outof-ssa.c (coalesce_ssa_name, coalesce_vars,
free_temp_expr_table, find_replaceable_exprs): Likewise.
* tree-sra.c (scan_function, scalarize_parms): Likewise.
* tree-ssa-alias.c (init_alias_info,
compute_points_to_and_addr_escape,
compute_flow_sensitive_aliasing, maybe_create_global_var): Likewise.
* tree-ssa-dce.c (mark_control_dependent_edges_necessary): Likewise.
* tree-ssa-live.c (new_tree_live_info, live_worklist,
calculate_live_on_entry, calculate_live_on_exit, compare_pairs,
sort_coalesce_list, build_tree_conflict_graph, dump_live_info
tree-ssa-loop-manip.c (add_exit_phis_var): Likewise.
tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops,
add_call_read_ops): Likewise.
* tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Likewise.
* tree-ssa-live.h (num_var_partitions): Return unsigned.
From-SVN: r90053
2004-11-04 09:41:16 +01:00
|
|
|
|
unsigned i;
|
2004-06-29 18:25:28 +02:00
|
|
|
|
|
|
|
|
|
fputs ("\nScan results:\n", dump_file);
|
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style.
* bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP,
EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style.
(bitmap_iterator): New type.
(bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init,
bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1,
bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1,
bmp_iter_and_init, bmp_iter_and_next): New functions.
* basic-block.h (EXECUTE_IF_SET_IN_REG_SET,
EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to
use iterator-style EXECUTE_IF_IN_BITMAP macros.
* bitmap.c (bitmap_print): Ditto.
* bt-load.c (clear_btr_from_live_range, add_btr_to_live_range,
btr_def_live_range): Ditto.
* cfganal.c (compute_dominance_frontiers_1) Ditto.
* cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics):
Ditto.
* ddg.c (build_inter_loop_deps): Ditto.
* df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update):
Ditto.
* except.c (remove_eh_handler): Ditto.
* flow.c (reg_set_to_hard_reg_set): Ditto.
* gcse.c (clear_modify_mem_tables): Ditto.
* global.c (build_insn_chain): Ditto.
* ifcvt.c (dead_or_predicable): Ditto.
* loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg):
Ditto.
* ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto.
* ra-rewrite.c (reloads_to_loads, rewrite_program2,
detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto.
* tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region,
tree_purge_all_dead_eh_edges): Ditto.
* tree-into-ssa.c (compute_global_livein, insert_phi_nodes,
insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags,
rewrite_ssa_into_ssa): Ditto.
* tree-outof-ssa.c (find_replaceable_exprs): Ditto.
* tree-sra.c (scan_function, decide_instantiations, scalarize_parms):
Ditto.
* tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape,
compute_flow_sensitive_aliasing, maybe_create_global_var,
dump_points_to_info_for): Ditto.
* tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto.
* tree-ssa-dse.c (dse_finalize_block): Ditto.
* tree-ssa-live.c (live_worklist, calculate_live_on_entry,
calculate_live_on_exit, build_tree_conflict_graph, dump_live_info):
Ditto.
* tree-ssa-loop-ivopts.c (find_induction_variables,
find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map,
determine_use_iv_costs, determine_set_costs, find_best_candidate,
set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data):
Ditto.
* tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto.
* tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops,
add_call_read_ops): Ditto.
* tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto.
From-SVN: r88145
2004-09-26 21:53:13 +02:00
|
|
|
|
EXECUTE_IF_SET_IN_BITMAP (sra_candidates, 0, i, bi)
|
2004-06-29 18:25:28 +02:00
|
|
|
|
{
|
|
|
|
|
tree var = referenced_var (i);
|
|
|
|
|
struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT);
|
|
|
|
|
if (elt)
|
|
|
|
|
scan_dump (elt);
|
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style.
* bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP,
EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style.
(bitmap_iterator): New type.
(bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init,
bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1,
bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1,
bmp_iter_and_init, bmp_iter_and_next): New functions.
* basic-block.h (EXECUTE_IF_SET_IN_REG_SET,
EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to
use iterator-style EXECUTE_IF_IN_BITMAP macros.
* bitmap.c (bitmap_print): Ditto.
* bt-load.c (clear_btr_from_live_range, add_btr_to_live_range,
btr_def_live_range): Ditto.
* cfganal.c (compute_dominance_frontiers_1) Ditto.
* cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics):
Ditto.
* ddg.c (build_inter_loop_deps): Ditto.
* df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update):
Ditto.
* except.c (remove_eh_handler): Ditto.
* flow.c (reg_set_to_hard_reg_set): Ditto.
* gcse.c (clear_modify_mem_tables): Ditto.
* global.c (build_insn_chain): Ditto.
* ifcvt.c (dead_or_predicable): Ditto.
* loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg):
Ditto.
* ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto.
* ra-rewrite.c (reloads_to_loads, rewrite_program2,
detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto.
* tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region,
tree_purge_all_dead_eh_edges): Ditto.
* tree-into-ssa.c (compute_global_livein, insert_phi_nodes,
insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags,
rewrite_ssa_into_ssa): Ditto.
* tree-outof-ssa.c (find_replaceable_exprs): Ditto.
* tree-sra.c (scan_function, decide_instantiations, scalarize_parms):
Ditto.
* tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape,
compute_flow_sensitive_aliasing, maybe_create_global_var,
dump_points_to_info_for): Ditto.
* tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto.
* tree-ssa-dse.c (dse_finalize_block): Ditto.
* tree-ssa-live.c (live_worklist, calculate_live_on_entry,
calculate_live_on_exit, build_tree_conflict_graph, dump_live_info):
Ditto.
* tree-ssa-loop-ivopts.c (find_induction_variables,
find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map,
determine_use_iv_costs, determine_set_costs, find_best_candidate,
set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data):
Ditto.
* tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto.
* tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops,
add_call_read_ops): Ditto.
* tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto.
From-SVN: r88145
2004-09-26 21:53:13 +02:00
|
|
|
|
}
|
2004-06-29 18:25:28 +02:00
|
|
|
|
fputc ('\n', dump_file);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Phase Three: Make decisions about which variables to scalarize, if any.
|
|
|
|
|
All elements to be scalarized have replacement variables made for them. */
|
|
|
|
|
|
|
|
|
|
/* A subroutine of build_element_name. Recursively build the element
|
|
|
|
|
name on the obstack. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
build_element_name_1 (struct sra_elt *elt)
|
|
|
|
|
{
|
|
|
|
|
tree t;
|
|
|
|
|
char buffer[32];
|
|
|
|
|
|
|
|
|
|
if (elt->parent)
|
|
|
|
|
{
|
|
|
|
|
build_element_name_1 (elt->parent);
|
|
|
|
|
obstack_1grow (&sra_obstack, '$');
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (elt->parent->type) == COMPLEX_TYPE)
|
|
|
|
|
{
|
|
|
|
|
if (elt->element == integer_zero_node)
|
|
|
|
|
obstack_grow (&sra_obstack, "real", 4);
|
|
|
|
|
else
|
|
|
|
|
obstack_grow (&sra_obstack, "imag", 4);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
t = elt->element;
|
|
|
|
|
if (TREE_CODE (t) == INTEGER_CST)
|
|
|
|
|
{
|
|
|
|
|
/* ??? Eh. Don't bother doing double-wide printing. */
|
|
|
|
|
sprintf (buffer, HOST_WIDE_INT_PRINT_DEC, TREE_INT_CST_LOW (t));
|
|
|
|
|
obstack_grow (&sra_obstack, buffer, strlen (buffer));
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
tree name = DECL_NAME (t);
|
|
|
|
|
if (name)
|
|
|
|
|
obstack_grow (&sra_obstack, IDENTIFIER_POINTER (name),
|
|
|
|
|
IDENTIFIER_LENGTH (name));
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sprintf (buffer, "D%u", DECL_UID (t));
|
|
|
|
|
obstack_grow (&sra_obstack, buffer, strlen (buffer));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Construct a pretty variable name for an element's replacement variable.
|
|
|
|
|
The name is built on the obstack. */
|
|
|
|
|
|
|
|
|
|
static char *
|
|
|
|
|
build_element_name (struct sra_elt *elt)
|
|
|
|
|
{
|
|
|
|
|
build_element_name_1 (elt);
|
|
|
|
|
obstack_1grow (&sra_obstack, '\0');
|
|
|
|
|
return obstack_finish (&sra_obstack);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Instantiate an element as an independent variable. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
instantiate_element (struct sra_elt *elt)
|
|
|
|
|
{
|
|
|
|
|
struct sra_elt *base_elt;
|
|
|
|
|
tree var, base;
|
|
|
|
|
|
|
|
|
|
for (base_elt = elt; base_elt->parent; base_elt = base_elt->parent)
|
|
|
|
|
continue;
|
|
|
|
|
base = base_elt->element;
|
|
|
|
|
|
|
|
|
|
elt->replacement = var = make_rename_temp (elt->type, "SR");
|
|
|
|
|
DECL_SOURCE_LOCATION (var) = DECL_SOURCE_LOCATION (base);
|
2005-01-27 10:28:45 +01:00
|
|
|
|
DECL_ARTIFICIAL (var) = 1;
|
2004-06-29 18:25:28 +02:00
|
|
|
|
|
2005-02-25 02:56:14 +01:00
|
|
|
|
if (TREE_THIS_VOLATILE (elt->type))
|
|
|
|
|
{
|
|
|
|
|
TREE_THIS_VOLATILE (var) = 1;
|
|
|
|
|
TREE_SIDE_EFFECTS (var) = 1;
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
if (DECL_NAME (base) && !DECL_IGNORED_P (base))
|
|
|
|
|
{
|
|
|
|
|
char *pretty_name = build_element_name (elt);
|
|
|
|
|
DECL_NAME (var) = get_identifier (pretty_name);
|
|
|
|
|
obstack_free (&sra_obstack, pretty_name);
|
2005-01-27 10:28:45 +01:00
|
|
|
|
|
|
|
|
|
DECL_DEBUG_EXPR (var) = generate_element_ref (elt);
|
|
|
|
|
DECL_DEBUG_EXPR_IS_FROM (var) = 1;
|
|
|
|
|
|
|
|
|
|
DECL_IGNORED_P (var) = 0;
|
|
|
|
|
TREE_NO_WARNING (var) = TREE_NO_WARNING (base);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
DECL_IGNORED_P (var) = 1;
|
|
|
|
|
/* ??? We can't generate any warning that would be meaningful. */
|
|
|
|
|
TREE_NO_WARNING (var) = 1;
|
2004-06-29 18:25:28 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (dump_file)
|
|
|
|
|
{
|
|
|
|
|
fputs (" ", dump_file);
|
|
|
|
|
dump_sra_elt_name (dump_file, elt);
|
|
|
|
|
fputs (" -> ", dump_file);
|
|
|
|
|
print_generic_expr (dump_file, var, dump_flags);
|
|
|
|
|
fputc ('\n', dump_file);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Make one pass across an element tree deciding whether or not it's
|
|
|
|
|
profitable to instantiate individual leaf scalars.
|
|
|
|
|
|
|
|
|
|
PARENT_USES and PARENT_COPIES are the sum of the N_USES and N_COPIES
|
|
|
|
|
fields all the way up the tree. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
decide_instantiation_1 (struct sra_elt *elt, unsigned int parent_uses,
|
|
|
|
|
unsigned int parent_copies)
|
|
|
|
|
{
|
|
|
|
|
if (dump_file && !elt->parent)
|
|
|
|
|
{
|
|
|
|
|
fputs ("Initial instantiation for ", dump_file);
|
|
|
|
|
dump_sra_elt_name (dump_file, elt);
|
|
|
|
|
fputc ('\n', dump_file);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (elt->cannot_scalarize)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (elt->is_scalar)
|
|
|
|
|
{
|
|
|
|
|
/* The decision is simple: instantiate if we're used more frequently
|
|
|
|
|
than the parent needs to be seen as a complete unit. */
|
|
|
|
|
if (elt->n_uses + elt->n_copies + parent_copies > parent_uses)
|
|
|
|
|
instantiate_element (elt);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
struct sra_elt *c;
|
|
|
|
|
unsigned int this_uses = elt->n_uses + parent_uses;
|
|
|
|
|
unsigned int this_copies = elt->n_copies + parent_copies;
|
|
|
|
|
|
|
|
|
|
for (c = elt->children; c ; c = c->sibling)
|
|
|
|
|
decide_instantiation_1 (c, this_uses, this_copies);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Compute the size and number of all instantiated elements below ELT.
|
|
|
|
|
We will only care about this if the size of the complete structure
|
|
|
|
|
fits in a HOST_WIDE_INT, so we don't have to worry about overflow. */
|
|
|
|
|
|
|
|
|
|
static unsigned int
|
|
|
|
|
sum_instantiated_sizes (struct sra_elt *elt, unsigned HOST_WIDE_INT *sizep)
|
|
|
|
|
{
|
|
|
|
|
if (elt->replacement)
|
|
|
|
|
{
|
|
|
|
|
*sizep += TREE_INT_CST_LOW (TYPE_SIZE_UNIT (elt->type));
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
struct sra_elt *c;
|
|
|
|
|
unsigned int count = 0;
|
|
|
|
|
|
|
|
|
|
for (c = elt->children; c ; c = c->sibling)
|
|
|
|
|
count += sum_instantiated_sizes (c, sizep);
|
|
|
|
|
|
|
|
|
|
return count;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Instantiate fields in ELT->TYPE that are not currently present as
|
|
|
|
|
children of ELT. */
|
|
|
|
|
|
|
|
|
|
static void instantiate_missing_elements (struct sra_elt *elt);
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
instantiate_missing_elements_1 (struct sra_elt *elt, tree child, tree type)
|
|
|
|
|
{
|
|
|
|
|
struct sra_elt *sub = lookup_element (elt, child, type, INSERT);
|
|
|
|
|
if (sub->is_scalar)
|
|
|
|
|
{
|
|
|
|
|
if (sub->replacement == NULL)
|
|
|
|
|
instantiate_element (sub);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
instantiate_missing_elements (sub);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
instantiate_missing_elements (struct sra_elt *elt)
|
|
|
|
|
{
|
|
|
|
|
tree type = elt->type;
|
|
|
|
|
|
|
|
|
|
switch (TREE_CODE (type))
|
|
|
|
|
{
|
|
|
|
|
case RECORD_TYPE:
|
|
|
|
|
{
|
|
|
|
|
tree f;
|
|
|
|
|
for (f = TYPE_FIELDS (type); f ; f = TREE_CHAIN (f))
|
|
|
|
|
if (TREE_CODE (f) == FIELD_DECL)
|
|
|
|
|
instantiate_missing_elements_1 (elt, f, TREE_TYPE (f));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case ARRAY_TYPE:
|
|
|
|
|
{
|
|
|
|
|
tree i, max, subtype;
|
|
|
|
|
|
|
|
|
|
i = TYPE_MIN_VALUE (TYPE_DOMAIN (type));
|
|
|
|
|
max = TYPE_MAX_VALUE (TYPE_DOMAIN (type));
|
|
|
|
|
subtype = TREE_TYPE (type);
|
|
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
|
{
|
|
|
|
|
instantiate_missing_elements_1 (elt, i, subtype);
|
|
|
|
|
if (tree_int_cst_equal (i, max))
|
|
|
|
|
break;
|
|
|
|
|
i = int_const_binop (PLUS_EXPR, i, integer_one_node, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case COMPLEX_TYPE:
|
|
|
|
|
type = TREE_TYPE (type);
|
|
|
|
|
instantiate_missing_elements_1 (elt, integer_zero_node, type);
|
|
|
|
|
instantiate_missing_elements_1 (elt, integer_one_node, type);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* targhooks.c (default_unwind_emit, default_scalar_mode_supported_p):
Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* timevar.c (timevar_push, timevar_pop, timevar_start,
timevar_stop): Likewise.
* toplev.c (default_pch_valid_p): Likewise.
* tracer.c (tail_duplicate): Likewise.
* tree-alias-common.c (get_alias_var_decl,
get_values_from_constructor, create_alias_var, delete_alias_vars,
empty_points_to_set, same_points_to_set, ptr_may_alias_var):
Likewise.
* tree.c (tree_size, make_node_stat, copy_node_stat,
build_int_cst_wide, integer_all_onesp, list_length, chainon,
tree_node_structure, type_contains_placeholder_p, substitute_in_expr,
substitute_placeholder_in_expr, tabilize_reference_1, build0_stat,
build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p,
lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr,
build_method_type_directly, decl_type_context, get_callee_fndecl,
get_set_constructor_bits, build_vector_type_for_mode, int_cst_value,
tree_fold_gcd): Likewise.
* tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges,
make_cond_expr_edges, group_case_labels, tree_merge_blocks,
cleanup_control_expr_graph, find_taken_edge,
find_taken_edge_switch_expr, phi_alternatives_equal,
is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt,
stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate,
tree_split_edge, tree_verify_flow_info, thread_jumps,
tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise.
* tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly,
chrec_fold_multiply_poly_poly): Likewise.
* tree-complex.c (extract_component, expand_complex_division,
expand_complex_comparison, expand_complex_operations_1,
build_replicated_const, expand_vector_operations_1): Likewise.
* tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector,
build_classic_dir_vector): Likewise.
* tree-dfa.c (compute_immediate_uses_for_phi,
compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann,
create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise.
* tree-dump.c (dequeue_and_dump): Likewise.
* tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region,
record_in_finally_tree, replace_goto_queue_1,
maybe_record_in_goto_queue, verify_norecord_switch_expr,
do_return_redirection): Likewise.
* tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr,
add_to_dst_predicate_list, find_phi_replacement_condition,
replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order):
Likewise.
* tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r,
initialize_inlined_parameters, declare_return_variable,
estimate_num_insns_1, expand_call_inline, expand_calls_inline,
optimize_inline_calls, copy_tree_r): Likewise.
* tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt,
ssa_rewrite_stmt, rewrite_into_ssa): Likewise.
* tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after,
tsi_split_statement_list_after, tsi_split_statement_list_before):
Likewise.
* tree-mudflap.c (mf_varname_tree): Likewise.
* tree-nested.c (create_tmp_var_for, lookup_field_for_decl,
lookup_tramp_for_decl, convert_all_function_calls): Likewise.
* tree-optimize.c (tree_rest_of_compilation): Likewise.
* tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi,
coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis,
free_temp_expr_table, add_dependance, finish_expr, rewrite_trees):
Likewise.
* tree-phinodes.c (resize_phi_node, add_phi_arg,
remove_all_phi_nodes_for): Likewise.
* tree-pretty-print.c (op_prio, print_call_name): Likewise.
* tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler,
tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise.
* tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree,
sra_elt_eq, sra_walk_expr, instantiate_missing_elements,
generate_one_element_ref, generate_element_copy,
generate_element_zero, scalarize_copy, scalarize_init,
scalarize_ldst): Likewise.
* tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p,
add_may_alias, add_pointed_to_expr, add_pointed_to_var,
collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise.
* tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise.
* tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value,
set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment,
widen_bitfield, ccp_fold_builtin): Likewise.
* tree-ssa-copy.c (may_propagate_copy, merge_alias_info,
replace_exp_1, propagate_tree_value): Likewise.
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise.
* tree-ssa-dce.c (set_control_dependence_map_bit,
find_control_dependence, find_pdom, mark_operand_necessary,
mark_stmt_if_obviously_necessary,
mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise.
* tree-ssa-dom.c (dom_opt_initialize_block_local_data,
simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis,
eliminate_redundant_computations, avail_expr_eq): Likewise.
* tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise.
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p,
duplicate_blocks): Likewise.
* tree-ssa-loop-im.c (for_each_index, set_level,
is_call_clobbered_ref): Likewise.
* tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos,
stmt_after_increment, set_iv, contains_abnormal_ssa_name_p,
find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates,
peel_address, ptr_difference_cost, may_replace_final_value,
determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer,
rewrite_use, rewrite_uses): Likewise.
* tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa,
check_loop_closed_ssa_use): Likewise.
* tree-ssanames.c (make_ssa_name): Likewise.
* tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses,
finalize_ssa_v_must_defs, finalize_ssa_stmt_operands,
get_stmt_operands, get_expr_operands, get_asm_expr_operands,
get_indirect_ref_operands, add_stmt_operand): Likewise.
* tree-ssa-pre.c (value_exists_in_set_bitmap,
value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set,
phi_translate, valid_in_set, compute_antic,
find_or_generate_expression, create_expression_by_pieces, insert_aux,
create_value_expr_from, eliminate): Likewise.
* tree-ssa-propagate.c (cfg_blocks_get): Likewise.
* tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges):
Likewise.
* tree-tailcall.c (independent_of_stmt_p, adjust_return_value,
eliminate_tail_call): Likewise.
* tree-vectorizer.c (vect_create_index_for_array_ref,
vect_align_data_ref, vect_create_data_ref,
vect_create_destination_var, vect_get_vec_def_for_operand,
vect_finish_stmt_generation, vect_transform_stmt,
vect_transform_loop_bound, vect_transform_loop,
vect_analyze_operations): Likewise.
* tree-vn.c (vn_compute, set_value_handle, get_value_handle):
Likewise.
* tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr,
get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start,
bsi_after_labels, bsi_last): Likewise.
* tree-ssa-live.c (var_union, change_partition_var,
create_ssa_var_map, calculate_live_on_entry, root_var_init,
type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce):
Likewise.
* tree-ssa-live.h (partition_is_global, live_entry_blocks,
tpa_find_tree): Likewise.
(register_ssa_partition_check): Declare.
(register_ssa_partition): use it.
* tree-ssa-live.c: Include errors.h.
(register_ssa_partition_check): New.
* tree-ssa-operands.c: Include errors.h.
* Makefile.in (tree-ssa-operands.o): Depend on errors.h.
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
From-SVN: r87223
2004-09-09 09:54:12 +02:00
|
|
|
|
gcc_unreachable ();
|
2004-06-29 18:25:28 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Make one pass across an element tree deciding whether to perform block
|
|
|
|
|
or element copies. If we decide on element copies, instantiate all
|
|
|
|
|
elements. Return true if there are any instantiated sub-elements. */
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
|
decide_block_copy (struct sra_elt *elt)
|
|
|
|
|
{
|
|
|
|
|
struct sra_elt *c;
|
|
|
|
|
bool any_inst;
|
|
|
|
|
|
|
|
|
|
/* If scalarization is disabled, respect it. */
|
|
|
|
|
if (elt->cannot_scalarize)
|
|
|
|
|
{
|
|
|
|
|
elt->use_block_copy = 1;
|
|
|
|
|
|
|
|
|
|
if (dump_file)
|
|
|
|
|
{
|
|
|
|
|
fputs ("Scalarization disabled for ", dump_file);
|
|
|
|
|
dump_sra_elt_name (dump_file, elt);
|
|
|
|
|
fputc ('\n', dump_file);
|
|
|
|
|
}
|
|
|
|
|
|
2005-03-31 02:58:26 +02:00
|
|
|
|
/* Disable scalarization of sub-elements */
|
|
|
|
|
for (c = elt->children; c; c = c->sibling)
|
|
|
|
|
{
|
|
|
|
|
c->cannot_scalarize = 1;
|
|
|
|
|
decide_block_copy (c);
|
|
|
|
|
}
|
2004-06-29 18:25:28 +02:00
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Don't decide if we've no uses. */
|
|
|
|
|
if (elt->n_uses == 0 && elt->n_copies == 0)
|
|
|
|
|
;
|
|
|
|
|
|
|
|
|
|
else if (!elt->is_scalar)
|
|
|
|
|
{
|
|
|
|
|
tree size_tree = TYPE_SIZE_UNIT (elt->type);
|
|
|
|
|
bool use_block_copy = true;
|
|
|
|
|
|
2005-01-01 03:38:06 +01:00
|
|
|
|
/* Tradeoffs for COMPLEX types pretty much always make it better
|
|
|
|
|
to go ahead and split the components. */
|
|
|
|
|
if (TREE_CODE (elt->type) == COMPLEX_TYPE)
|
|
|
|
|
use_block_copy = false;
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Don't bother trying to figure out the rest if the structure is
|
|
|
|
|
so large we can't do easy arithmetic. This also forces block
|
|
|
|
|
copies for variable sized structures. */
|
2005-01-01 03:38:06 +01:00
|
|
|
|
else if (host_integerp (size_tree, 1))
|
2004-06-29 18:25:28 +02:00
|
|
|
|
{
|
|
|
|
|
unsigned HOST_WIDE_INT full_size, inst_size = 0;
|
2004-10-27 23:02:16 +02:00
|
|
|
|
unsigned int max_size;
|
|
|
|
|
|
|
|
|
|
/* If the sra-max-structure-size parameter is 0, then the
|
|
|
|
|
user has not overridden the parameter and we can choose a
|
|
|
|
|
sensible default. */
|
|
|
|
|
max_size = SRA_MAX_STRUCTURE_SIZE
|
|
|
|
|
? SRA_MAX_STRUCTURE_SIZE
|
|
|
|
|
: MOVE_RATIO * UNITS_PER_WORD;
|
2004-06-29 18:25:28 +02:00
|
|
|
|
|
|
|
|
|
full_size = tree_low_cst (size_tree, 1);
|
|
|
|
|
|
2004-08-19 23:34:37 +02:00
|
|
|
|
/* ??? What to do here. If there are two fields, and we've only
|
2004-06-29 18:25:28 +02:00
|
|
|
|
instantiated one, then instantiating the other is clearly a win.
|
|
|
|
|
If there are a large number of fields then the size of the copy
|
|
|
|
|
is much more of a factor. */
|
|
|
|
|
|
|
|
|
|
/* If the structure is small, and we've made copies, go ahead
|
|
|
|
|
and instantiate, hoping that the copies will go away. */
|
2004-10-27 23:02:16 +02:00
|
|
|
|
if (full_size <= max_size
|
2004-06-29 18:25:28 +02:00
|
|
|
|
&& elt->n_copies > elt->n_uses)
|
|
|
|
|
use_block_copy = false;
|
|
|
|
|
else
|
|
|
|
|
{
|
2005-03-09 12:35:34 +01:00
|
|
|
|
sum_instantiated_sizes (elt, &inst_size);
|
2004-06-29 18:25:28 +02:00
|
|
|
|
|
2004-10-27 23:02:16 +02:00
|
|
|
|
if (inst_size * 100 >= full_size * SRA_FIELD_STRUCTURE_RATIO)
|
2004-06-29 18:25:28 +02:00
|
|
|
|
use_block_copy = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* In order to avoid block copy, we have to be able to instantiate
|
|
|
|
|
all elements of the type. See if this is possible. */
|
|
|
|
|
if (!use_block_copy
|
|
|
|
|
&& (!can_completely_scalarize_p (elt)
|
|
|
|
|
|| !type_can_instantiate_all_elements (elt->type)))
|
|
|
|
|
use_block_copy = true;
|
|
|
|
|
}
|
|
|
|
|
elt->use_block_copy = use_block_copy;
|
|
|
|
|
|
|
|
|
|
if (dump_file)
|
|
|
|
|
{
|
|
|
|
|
fprintf (dump_file, "Using %s for ",
|
|
|
|
|
use_block_copy ? "block-copy" : "element-copy");
|
|
|
|
|
dump_sra_elt_name (dump_file, elt);
|
|
|
|
|
fputc ('\n', dump_file);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!use_block_copy)
|
|
|
|
|
{
|
|
|
|
|
instantiate_missing_elements (elt);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
any_inst = elt->replacement != NULL;
|
|
|
|
|
|
|
|
|
|
for (c = elt->children; c ; c = c->sibling)
|
|
|
|
|
any_inst |= decide_block_copy (c);
|
|
|
|
|
|
|
|
|
|
return any_inst;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Entry point to phase 3. Instantiate scalar replacement variables. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
decide_instantiations (void)
|
|
|
|
|
{
|
|
|
|
|
unsigned int i;
|
|
|
|
|
bool cleared_any;
|
bitmap.h (struct bitmap_obstack): New obstack type.
* bitmap.h (struct bitmap_obstack): New obstack type.
(struct bitmap_head_def): Replace using_obstack with obstack
pointer.
(bitmap_default_obstack): New.
(bitmap_initialize): Make inline, does not do allocation.
(bitmap_release_memory): Remove.
(bitmap_obstack_initialize, bitmap_obstack_release): Declare.
(bitmap_obstack_alloc, bitmap_malloc_alloc, bitmap_gc_alloc,
bitmap_obstack_free, bitmap_malloc_free): Declare.
(BITMAP_OBSTACK_ALLOC, BITMAP_GGC_ALLOC, BITMAP_XMALLOC): Adjust.
(BITMAP_FREE): Replace with ...
(BITMAP_OBSTACK_FREE): ... this.
(BITMAP_XFREE): Adjust.
(BITMAP_INIT_ONCE): Remove.
* bitmap.c (bitmap_obstack, bitmap_obstack_init, bitmap_free: Remove.
(bitmap_default_obstack): New.
(bitmap_elem_to_freelist): Adjust.
(bitmap_element_allocate): Adjust. Break initialization into ...
(bitmap_obstack_initialize): ... here.
(bitmap_release_memory): Replace with ...
(bitmap_obstack_release): ... this.
(bitmap_obstack_alloc, bitmap_malloc_alloc, bitmap_gc_alloc,
bitmap_obstack_free, bitmap_malloc_free): New.
(bitmap_ior_and_compl, bitmap_ior_and_compl_into): Use
bitmap_initialize.
(bitmap_initialize): Move to bitmap.h.
* gengtype.c (open_base_files): Add obstack.h to ifiles.
* Makefile.in (BASIC_BLOCK_H, REGS_H): Add obstack.h.
* basic-block.h (INIT_REG_SET): Allocate from reg_obstack.
(INITIALIZE_REG_SET): Remove.
(FREE_REG_SET): Use BITMAP_OBSTACK_FREE.
(INIT_ONCE_REG_SET, MAX_REGNO_REG_SET): Remove.
(flow_obstack): Do not declare.
(reg_obstack): Declare.
* regs.h: Include obstack.h.
* tree-optimize.c (tree_rest_of_compilation): Initialize and
release bitmap obstack here.
* bb-reorder.c: #include regs, not basic-block.
(fix_crossing_conditional_branches): Allocate regsets from
reg_obstack.
* bt-load.c: Do not inlude bitmap.h, sbitmap.h, basic-block.h or
obstack.h.
* caller-save.c: Include regs.h earlier.
* cfg.c: Do not include basic-block.h or obstack.h.
(reg_obstack): Define.
* cfganal.c: Include obstack.h
* cfgcleanyp.c: Do not include basic-block.h. Include regs.h
earlier.
* cfglayout.c: Do not include obstack.h.
(flow_obstack): Remove declaration.
(cfg_layout_duplicate_bb): Use reg_obstack.
* cfgloop.c, cfgloopanal.c, cfgloopmanip.c: Include obstack.h.
* cfgrtl.c (rtl_split_block): Use reg_obstack.
(force_nonfallthru_and_redirect, rtl_split_edge): Likewise.
(safe_insert_insn_on_edge): Use OBSTACK_ALLOC_REG_SET, adjust.
(cfg_layout_split_edge): Use reg_obstack.
* cse.c: Include regs.h earlier.
* ddg.c: Do not include basic-block.h.
* dominance.c: Inlude obstack.h.
* flow.c (update_life_info): Use OBSTACK_ALLOC_REG_SET, adjust.
(calculate_global_regs_live): Likewise.
(allocate_bb_life_data): Use reg_obstack.
(init_propagate_block_info): Use OBSTACK_ALLOC_REGSET.
* global.c: Do not include basic-block.h.
(build_insn_chain): Use OBSTACK_ALLOC_REG_SET, adjust.
* graph.c: Include obstack.h.
* haifa-sched.c: Do not include basic-block.h.
* ifcvt.c: Use OBSTACK_ALLOC_REG_SET, adjust.
* local-alloc.c: Do not include basic-block.h.
* loop-init.c, loop-invariant.c: Include obstack.h.
* loop-iv.c: Likewise.
(simplify_using_initial_values): Use OBSTACK_ALLOC_REG_SET,
adjust.
* loop-unroll.c, loop-unswitch.c: Inlude obstack.h.
* modulo-sched.c: Do not include basic-block.h.
* passes.c (rest_of_handle_final): Do not call
regset_release_memory.
* ra-debug.c: Include regs.h earlier. Do not include
basic-block.h.
* recog.c (peephole2_optimize): Use OBSTACK_ALLOC_REG_SET, adjust.
* regclass.c (init_reg_sets): Do not call INIT_ONCE_REG_SET.
(allocate_reg_info): Do not call MAX_REGNO_REG_SET.
(regset_release_memory): Remove.
* resource.c: Do not include basic-block.h.
* rtlanal.c: Do not include basic-block.h.
* sbitmap.c: Include obstack.h.
* sched-deps.c: Do not include basic-block.h.
(reg_pending_sets_head, reg_pending_clobbers_head,
reg_pending_uses_head): Remove.
(init_deps_global): Use OBSTACK_ALLOC_REG_SET.
* sched-ebb.c: Do not include basic-block.h.
* sched-rgn.c: Likewise.
* tree-if-conv.c (get_loop_body_in_if_conv_order): Use
BITMAP_XFREE.
* tree-outof-ssa.c (perform_edge_inserts): Use BITMAP_XFREE.
* tree-sra.c (decide_instantiations): Adjust bitmap
initialization.
* tree-ssa-dce.c: Include obstack.h.
* tree-ssa-pre.c (grand_bitmap_obstack): Make a bitmap_obstack.
(value_insert_into_set_bitmap): Remove useless bitmap_clear.
(bitmap_set_new): Likewise.
(init_pre): Initialize bitmap obstack.
(fini_pre): Release bitmap obstack.
* tree-ssanames.c (ssa_names_to_rewrite): Make static.
(marked_for_rewrite_p): ssa_names_to_rewrite is never NULL.
(mark_for_rewrite, unmark_for_rewrite): Likewise.
(marked_ssa_names): Likewise.
(init_ssanames): Use BITMAP_XMALLOC.
(fini_ssanames): Use BITMAP_XFREE.
* web.c: Include obstack.h
From-SVN: r91009
2004-11-22 13:23:59 +01:00
|
|
|
|
bitmap_head done_head;
|
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style.
* bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP,
EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style.
(bitmap_iterator): New type.
(bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init,
bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1,
bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1,
bmp_iter_and_init, bmp_iter_and_next): New functions.
* basic-block.h (EXECUTE_IF_SET_IN_REG_SET,
EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to
use iterator-style EXECUTE_IF_IN_BITMAP macros.
* bitmap.c (bitmap_print): Ditto.
* bt-load.c (clear_btr_from_live_range, add_btr_to_live_range,
btr_def_live_range): Ditto.
* cfganal.c (compute_dominance_frontiers_1) Ditto.
* cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics):
Ditto.
* ddg.c (build_inter_loop_deps): Ditto.
* df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update):
Ditto.
* except.c (remove_eh_handler): Ditto.
* flow.c (reg_set_to_hard_reg_set): Ditto.
* gcse.c (clear_modify_mem_tables): Ditto.
* global.c (build_insn_chain): Ditto.
* ifcvt.c (dead_or_predicable): Ditto.
* loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg):
Ditto.
* ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto.
* ra-rewrite.c (reloads_to_loads, rewrite_program2,
detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto.
* tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region,
tree_purge_all_dead_eh_edges): Ditto.
* tree-into-ssa.c (compute_global_livein, insert_phi_nodes,
insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags,
rewrite_ssa_into_ssa): Ditto.
* tree-outof-ssa.c (find_replaceable_exprs): Ditto.
* tree-sra.c (scan_function, decide_instantiations, scalarize_parms):
Ditto.
* tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape,
compute_flow_sensitive_aliasing, maybe_create_global_var,
dump_points_to_info_for): Ditto.
* tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto.
* tree-ssa-dse.c (dse_finalize_block): Ditto.
* tree-ssa-live.c (live_worklist, calculate_live_on_entry,
calculate_live_on_exit, build_tree_conflict_graph, dump_live_info):
Ditto.
* tree-ssa-loop-ivopts.c (find_induction_variables,
find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map,
determine_use_iv_costs, determine_set_costs, find_best_candidate,
set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data):
Ditto.
* tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto.
* tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops,
add_call_read_ops): Ditto.
* tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto.
From-SVN: r88145
2004-09-26 21:53:13 +02:00
|
|
|
|
bitmap_iterator bi;
|
2004-06-29 18:25:28 +02:00
|
|
|
|
|
|
|
|
|
/* We cannot clear bits from a bitmap we're iterating over,
|
|
|
|
|
so save up all the bits to clear until the end. */
|
bitmap.h (struct bitmap_obstack): New obstack type.
* bitmap.h (struct bitmap_obstack): New obstack type.
(struct bitmap_head_def): Replace using_obstack with obstack
pointer.
(bitmap_default_obstack): New.
(bitmap_initialize): Make inline, does not do allocation.
(bitmap_release_memory): Remove.
(bitmap_obstack_initialize, bitmap_obstack_release): Declare.
(bitmap_obstack_alloc, bitmap_malloc_alloc, bitmap_gc_alloc,
bitmap_obstack_free, bitmap_malloc_free): Declare.
(BITMAP_OBSTACK_ALLOC, BITMAP_GGC_ALLOC, BITMAP_XMALLOC): Adjust.
(BITMAP_FREE): Replace with ...
(BITMAP_OBSTACK_FREE): ... this.
(BITMAP_XFREE): Adjust.
(BITMAP_INIT_ONCE): Remove.
* bitmap.c (bitmap_obstack, bitmap_obstack_init, bitmap_free: Remove.
(bitmap_default_obstack): New.
(bitmap_elem_to_freelist): Adjust.
(bitmap_element_allocate): Adjust. Break initialization into ...
(bitmap_obstack_initialize): ... here.
(bitmap_release_memory): Replace with ...
(bitmap_obstack_release): ... this.
(bitmap_obstack_alloc, bitmap_malloc_alloc, bitmap_gc_alloc,
bitmap_obstack_free, bitmap_malloc_free): New.
(bitmap_ior_and_compl, bitmap_ior_and_compl_into): Use
bitmap_initialize.
(bitmap_initialize): Move to bitmap.h.
* gengtype.c (open_base_files): Add obstack.h to ifiles.
* Makefile.in (BASIC_BLOCK_H, REGS_H): Add obstack.h.
* basic-block.h (INIT_REG_SET): Allocate from reg_obstack.
(INITIALIZE_REG_SET): Remove.
(FREE_REG_SET): Use BITMAP_OBSTACK_FREE.
(INIT_ONCE_REG_SET, MAX_REGNO_REG_SET): Remove.
(flow_obstack): Do not declare.
(reg_obstack): Declare.
* regs.h: Include obstack.h.
* tree-optimize.c (tree_rest_of_compilation): Initialize and
release bitmap obstack here.
* bb-reorder.c: #include regs, not basic-block.
(fix_crossing_conditional_branches): Allocate regsets from
reg_obstack.
* bt-load.c: Do not inlude bitmap.h, sbitmap.h, basic-block.h or
obstack.h.
* caller-save.c: Include regs.h earlier.
* cfg.c: Do not include basic-block.h or obstack.h.
(reg_obstack): Define.
* cfganal.c: Include obstack.h
* cfgcleanyp.c: Do not include basic-block.h. Include regs.h
earlier.
* cfglayout.c: Do not include obstack.h.
(flow_obstack): Remove declaration.
(cfg_layout_duplicate_bb): Use reg_obstack.
* cfgloop.c, cfgloopanal.c, cfgloopmanip.c: Include obstack.h.
* cfgrtl.c (rtl_split_block): Use reg_obstack.
(force_nonfallthru_and_redirect, rtl_split_edge): Likewise.
(safe_insert_insn_on_edge): Use OBSTACK_ALLOC_REG_SET, adjust.
(cfg_layout_split_edge): Use reg_obstack.
* cse.c: Include regs.h earlier.
* ddg.c: Do not include basic-block.h.
* dominance.c: Inlude obstack.h.
* flow.c (update_life_info): Use OBSTACK_ALLOC_REG_SET, adjust.
(calculate_global_regs_live): Likewise.
(allocate_bb_life_data): Use reg_obstack.
(init_propagate_block_info): Use OBSTACK_ALLOC_REGSET.
* global.c: Do not include basic-block.h.
(build_insn_chain): Use OBSTACK_ALLOC_REG_SET, adjust.
* graph.c: Include obstack.h.
* haifa-sched.c: Do not include basic-block.h.
* ifcvt.c: Use OBSTACK_ALLOC_REG_SET, adjust.
* local-alloc.c: Do not include basic-block.h.
* loop-init.c, loop-invariant.c: Include obstack.h.
* loop-iv.c: Likewise.
(simplify_using_initial_values): Use OBSTACK_ALLOC_REG_SET,
adjust.
* loop-unroll.c, loop-unswitch.c: Inlude obstack.h.
* modulo-sched.c: Do not include basic-block.h.
* passes.c (rest_of_handle_final): Do not call
regset_release_memory.
* ra-debug.c: Include regs.h earlier. Do not include
basic-block.h.
* recog.c (peephole2_optimize): Use OBSTACK_ALLOC_REG_SET, adjust.
* regclass.c (init_reg_sets): Do not call INIT_ONCE_REG_SET.
(allocate_reg_info): Do not call MAX_REGNO_REG_SET.
(regset_release_memory): Remove.
* resource.c: Do not include basic-block.h.
* rtlanal.c: Do not include basic-block.h.
* sbitmap.c: Include obstack.h.
* sched-deps.c: Do not include basic-block.h.
(reg_pending_sets_head, reg_pending_clobbers_head,
reg_pending_uses_head): Remove.
(init_deps_global): Use OBSTACK_ALLOC_REG_SET.
* sched-ebb.c: Do not include basic-block.h.
* sched-rgn.c: Likewise.
* tree-if-conv.c (get_loop_body_in_if_conv_order): Use
BITMAP_XFREE.
* tree-outof-ssa.c (perform_edge_inserts): Use BITMAP_XFREE.
* tree-sra.c (decide_instantiations): Adjust bitmap
initialization.
* tree-ssa-dce.c: Include obstack.h.
* tree-ssa-pre.c (grand_bitmap_obstack): Make a bitmap_obstack.
(value_insert_into_set_bitmap): Remove useless bitmap_clear.
(bitmap_set_new): Likewise.
(init_pre): Initialize bitmap obstack.
(fini_pre): Release bitmap obstack.
* tree-ssanames.c (ssa_names_to_rewrite): Make static.
(marked_for_rewrite_p): ssa_names_to_rewrite is never NULL.
(mark_for_rewrite, unmark_for_rewrite): Likewise.
(marked_ssa_names): Likewise.
(init_ssanames): Use BITMAP_XMALLOC.
(fini_ssanames): Use BITMAP_XFREE.
* web.c: Include obstack.h
From-SVN: r91009
2004-11-22 13:23:59 +01:00
|
|
|
|
bitmap_initialize (&done_head, &bitmap_default_obstack);
|
2004-06-29 18:25:28 +02:00
|
|
|
|
cleared_any = false;
|
|
|
|
|
|
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style.
* bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP,
EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style.
(bitmap_iterator): New type.
(bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init,
bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1,
bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1,
bmp_iter_and_init, bmp_iter_and_next): New functions.
* basic-block.h (EXECUTE_IF_SET_IN_REG_SET,
EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to
use iterator-style EXECUTE_IF_IN_BITMAP macros.
* bitmap.c (bitmap_print): Ditto.
* bt-load.c (clear_btr_from_live_range, add_btr_to_live_range,
btr_def_live_range): Ditto.
* cfganal.c (compute_dominance_frontiers_1) Ditto.
* cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics):
Ditto.
* ddg.c (build_inter_loop_deps): Ditto.
* df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update):
Ditto.
* except.c (remove_eh_handler): Ditto.
* flow.c (reg_set_to_hard_reg_set): Ditto.
* gcse.c (clear_modify_mem_tables): Ditto.
* global.c (build_insn_chain): Ditto.
* ifcvt.c (dead_or_predicable): Ditto.
* loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg):
Ditto.
* ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto.
* ra-rewrite.c (reloads_to_loads, rewrite_program2,
detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto.
* tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region,
tree_purge_all_dead_eh_edges): Ditto.
* tree-into-ssa.c (compute_global_livein, insert_phi_nodes,
insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags,
rewrite_ssa_into_ssa): Ditto.
* tree-outof-ssa.c (find_replaceable_exprs): Ditto.
* tree-sra.c (scan_function, decide_instantiations, scalarize_parms):
Ditto.
* tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape,
compute_flow_sensitive_aliasing, maybe_create_global_var,
dump_points_to_info_for): Ditto.
* tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto.
* tree-ssa-dse.c (dse_finalize_block): Ditto.
* tree-ssa-live.c (live_worklist, calculate_live_on_entry,
calculate_live_on_exit, build_tree_conflict_graph, dump_live_info):
Ditto.
* tree-ssa-loop-ivopts.c (find_induction_variables,
find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map,
determine_use_iv_costs, determine_set_costs, find_best_candidate,
set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data):
Ditto.
* tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto.
* tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops,
add_call_read_ops): Ditto.
* tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto.
From-SVN: r88145
2004-09-26 21:53:13 +02:00
|
|
|
|
EXECUTE_IF_SET_IN_BITMAP (sra_candidates, 0, i, bi)
|
2004-06-29 18:25:28 +02:00
|
|
|
|
{
|
|
|
|
|
tree var = referenced_var (i);
|
|
|
|
|
struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT);
|
|
|
|
|
if (elt)
|
|
|
|
|
{
|
|
|
|
|
decide_instantiation_1 (elt, 0, 0);
|
|
|
|
|
if (!decide_block_copy (elt))
|
|
|
|
|
elt = NULL;
|
|
|
|
|
}
|
|
|
|
|
if (!elt)
|
|
|
|
|
{
|
|
|
|
|
bitmap_set_bit (&done_head, i);
|
|
|
|
|
cleared_any = true;
|
|
|
|
|
}
|
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style.
* bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP,
EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style.
(bitmap_iterator): New type.
(bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init,
bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1,
bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1,
bmp_iter_and_init, bmp_iter_and_next): New functions.
* basic-block.h (EXECUTE_IF_SET_IN_REG_SET,
EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to
use iterator-style EXECUTE_IF_IN_BITMAP macros.
* bitmap.c (bitmap_print): Ditto.
* bt-load.c (clear_btr_from_live_range, add_btr_to_live_range,
btr_def_live_range): Ditto.
* cfganal.c (compute_dominance_frontiers_1) Ditto.
* cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics):
Ditto.
* ddg.c (build_inter_loop_deps): Ditto.
* df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update):
Ditto.
* except.c (remove_eh_handler): Ditto.
* flow.c (reg_set_to_hard_reg_set): Ditto.
* gcse.c (clear_modify_mem_tables): Ditto.
* global.c (build_insn_chain): Ditto.
* ifcvt.c (dead_or_predicable): Ditto.
* loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg):
Ditto.
* ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto.
* ra-rewrite.c (reloads_to_loads, rewrite_program2,
detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto.
* tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region,
tree_purge_all_dead_eh_edges): Ditto.
* tree-into-ssa.c (compute_global_livein, insert_phi_nodes,
insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags,
rewrite_ssa_into_ssa): Ditto.
* tree-outof-ssa.c (find_replaceable_exprs): Ditto.
* tree-sra.c (scan_function, decide_instantiations, scalarize_parms):
Ditto.
* tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape,
compute_flow_sensitive_aliasing, maybe_create_global_var,
dump_points_to_info_for): Ditto.
* tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto.
* tree-ssa-dse.c (dse_finalize_block): Ditto.
* tree-ssa-live.c (live_worklist, calculate_live_on_entry,
calculate_live_on_exit, build_tree_conflict_graph, dump_live_info):
Ditto.
* tree-ssa-loop-ivopts.c (find_induction_variables,
find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map,
determine_use_iv_costs, determine_set_costs, find_best_candidate,
set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data):
Ditto.
* tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto.
* tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops,
add_call_read_ops): Ditto.
* tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto.
From-SVN: r88145
2004-09-26 21:53:13 +02:00
|
|
|
|
}
|
2004-06-29 18:25:28 +02:00
|
|
|
|
|
|
|
|
|
if (cleared_any)
|
|
|
|
|
{
|
bitmap.h (bitmap_empty_p): New.
* bitmap.h (bitmap_empty_p): New.
(bitmap_and, bitmap_and_into, bitmap_and_compl,
bitmap_and_compl_into, bitmap_ior, bitmap_ior_into,
bitmap_ior_compl, bitmap_xor, bitmap_xor_into): New bitmap
operation macros.
(bitmap_ior_and_compl): Rename to ...
(bitmap_ior_and_compl_into): ... here.
* bitmap.c (bitmap_equal_p): Use bitmap_xor.
(bitmap_ior_and_compl): Rename to ...
(bitmap_ior_and_compl_into): ... here. Adjust. Return changed
flag.
(bitmap_union_of_diff): Use renamed bitmap functions.
* basic-block.h (AND_REG_SET, AND_COMPL_REG_SET, IOR_REG_SET,
XOR_REG_SET, IOR_AND_COMPL_REG_SET): Likewise.
* cfgrtl.c (safe_insert_insn_on_edge): Likewise.
* df.c (df_bb_rd_local_compute)
* flow.c (calculate_global_regs_live,
init_propagate_block_info): Likewise.
* ifcvt.c (find_if_case_1, find_if_case_2,
dead_or_predicable): Likewise.
* ra-build.c (union_web_part_roots, livethrough_conflicts_bb,
reset_conflicts, conflicts_between_webs): Likewise.
* ra-rewrite.c (reloads_to_loads, rewrite_program2,
detect_web_parts_to_rebuild): Likewise.
* sched-ebb.c (compute_jump_reg_dependencies): Likewise.
* tree-int-ssa.c (insert_phi_nodes_for, rewrite_into_ssa): Likewise.
* tree-sra.c (decide_instantiations): Likewise.
* tree-ssa-alias.c (create_name_tags,
merge_pointed_to_info): Likewise.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Likewise.
* tree-ssa-loop-im.c (move_computations): Likewise.
* tree-ssa-operands.c (get_call_expr_operands): Likewise.
* tree-ssa-pre.c (fini_pre): Likewise.
* tree-ssa.c (verify_flow_sensitive_alias_info): Likewise.
* tree-ssanames.c (any_marked_for_rewrite_p): Likewise.
* tree-vectorizer.c (vectorize_loops): Likewise.
From-SVN: r89827
2004-10-29 10:41:10 +02:00
|
|
|
|
bitmap_and_compl_into (sra_candidates, &done_head);
|
|
|
|
|
bitmap_and_compl_into (needs_copy_in, &done_head);
|
2004-06-29 18:25:28 +02:00
|
|
|
|
}
|
|
|
|
|
bitmap_clear (&done_head);
|
|
|
|
|
|
|
|
|
|
if (dump_file)
|
|
|
|
|
fputc ('\n', dump_file);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Phase Four: Update the function to match the replacements created. */
|
|
|
|
|
|
|
|
|
|
/* Mark all the variables in V_MAY_DEF or V_MUST_DEF operands for STMT for
|
|
|
|
|
renaming. This becomes necessary when we modify all of a non-scalar. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
mark_all_v_defs (tree stmt)
|
|
|
|
|
{
|
tree-ssa-operands.h (struct ssa_operand_iterator_d): New.
2004-08-25 Andrew MacLeod <amacleod@redhat.com>
* tree-ssa-operands.h (struct ssa_operand_iterator_d): New. SSA operand
iterator controlling structure.
(SSA_OP_USE, SSA_OP_DEF, SSA_OP_VUSE, SSA_OP_VMAYUSE, SSA_OP_VMAYDEF,
SSA_OP_VMUSTDEF, SSA_OP_VIRTUAL_USES, SSA_OP_VIRTUAL_DEFS,
SSA_OP_ALL_USES, SSA_OP_ALL_DEFS, SSA_OP_ALL_OPERANDS): New. Operand
iterator flags.
(FOR_EACH_SSA_TREE_OPERAND): New. Iterate over operands as trees.
(FOR_EACH_SSA_USE_OPERAND): New. Iterate over operands as uses.
(FOR_EACH_SSA_DEF_OPERAND): New. Iterate over operands as defs.
(FOR_EACH_SSA_MAYDEF_OPERAND): New. Iterate over V_MAY_DEFs.
* tree-ssa-operands.c (NULL_DEF_OPERAND_P, NULL_USE_OPERAND_P): New.
Empty operand pointers.
* tree-flow-inline.h (op_iter_done): New. Return true if finished.
(op_iter_next_use): New. Return next use_operand_p.
(op_iter_next_def): New. Return next def_operand_p.
(op_iter_next_tree): New. Return next operands as a tree.
(op_iter_init): New. Initialize an iterator structure.
(op_iter_init_use): New. Initialize structure and get the first use.
(op_iter_init_def): New. Initialize structure and get the first def.
(op_iter_init_tree): New. Initialize structure and get the first tree.
(op_iter_next_maydef): New. Return next V_MAY_DEF operands.
(op_iter_init_maydef): New. Initialize structure and get the first
V_MAY_DEF operands.
* tree-cfg.c (tree_duplicate_bb): Use new operand iterator.
* tree-dfa.c (compute_immediate_uses_for_stmt,
redirect_immediate_uses): Use new operand iterator.
(v_may_defs_disappeared_p, v_must_defs_disappeared_p): Delete.
(mark_new_vars_to_rename): Use new operand iterator. Count virtual
operands instead of using *_disappeared_p routines.
* tree-into-ssa.c (mark_def_sites, ssa_mark_def_sites, rewrite_stmt,
ssa_rewrite_stmt): Use new operand iterator.
* tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb,
rewrite_trees): Use new operand iterator.
* tree-pretty-print.c (dump_vops): Use new operand iterator.
* tree-sra.c (mark_all_v_defs): Use new operand iterator.
* tree-ssa-alias.c (compute_points_to_and_addr_escape,
dump_points_to_info): Use new operand iterator.
* tree-ssa-ccp.c (cp_lattice_meet, visit_stmt, initialize,
replace_uses_in, replace_vuse_in, likely_value, set_rhs): Use new
operand iterator.
* tree-ssa-dce.c (mark_stmt_if_obviously_necessary,
propagate_necessity): Use new operand iterator.
* tree-ssa-dom.c (cprop_into_stmt, optimize_stmt): Use operand iterator.
(register_definitions_for_stmt): Use new operand iterator. Take stmt as
a parameter instead of a stmt_ann_t.
* tree-ssa-live.c (create_ssa_var_map, calculate_live_on_entry,
build_tree_conflict_graph): Use new operand iterator.
* tree-ssa-loop-im.c (determine_max_movement, single_reachable_address,
rewrite_mem_refs): Use new operand iterator.
* tree-ssa-loop-manip.c (find_uses_to_rename_stmt,
check_loop_closed_ssa_use): Use new operand iterator.
* tree-ssa.c (verify_ssa, replace_immediate_uses): Use operand iterator.
* tree-ssanames.c (release_defs): Use new operand iterator.
* tree-vectorizer.c (vect_create_data_ref): Use new operand iterator.
From-SVN: r86583
2004-08-25 23:21:19 +02:00
|
|
|
|
tree sym;
|
|
|
|
|
ssa_op_iter iter;
|
2004-06-29 18:25:28 +02:00
|
|
|
|
|
|
|
|
|
get_stmt_operands (stmt);
|
|
|
|
|
|
2004-12-10 22:54:42 +01:00
|
|
|
|
FOR_EACH_SSA_TREE_OPERAND (sym, stmt, iter, SSA_OP_ALL_VIRTUALS)
|
2004-06-29 18:25:28 +02:00
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (sym) == SSA_NAME)
|
|
|
|
|
sym = SSA_NAME_VAR (sym);
|
|
|
|
|
bitmap_set_bit (vars_to_rename, var_ann (sym)->uid);
|
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Build a single level component reference to ELT rooted at BASE. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
|
|
static tree
|
2004-06-29 18:25:28 +02:00
|
|
|
|
generate_one_element_ref (struct sra_elt *elt, tree base)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
switch (TREE_CODE (TREE_TYPE (base)))
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
case RECORD_TYPE:
|
2004-07-11 19:41:52 +02:00
|
|
|
|
{
|
|
|
|
|
tree field = elt->element;
|
|
|
|
|
|
|
|
|
|
/* Watch out for compatible records with differing field lists. */
|
|
|
|
|
if (DECL_FIELD_CONTEXT (field) != TYPE_MAIN_VARIANT (TREE_TYPE (base)))
|
|
|
|
|
field = find_compatible_field (TREE_TYPE (base), field);
|
|
|
|
|
|
|
|
|
|
return build (COMPONENT_REF, elt->type, base, field, NULL);
|
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
case ARRAY_TYPE:
|
|
|
|
|
return build (ARRAY_REF, elt->type, base, elt->element, NULL, NULL);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
case COMPLEX_TYPE:
|
|
|
|
|
if (elt->element == integer_zero_node)
|
|
|
|
|
return build (REALPART_EXPR, elt->type, base);
|
|
|
|
|
else
|
|
|
|
|
return build (IMAGPART_EXPR, elt->type, base);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
default:
|
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* targhooks.c (default_unwind_emit, default_scalar_mode_supported_p):
Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* timevar.c (timevar_push, timevar_pop, timevar_start,
timevar_stop): Likewise.
* toplev.c (default_pch_valid_p): Likewise.
* tracer.c (tail_duplicate): Likewise.
* tree-alias-common.c (get_alias_var_decl,
get_values_from_constructor, create_alias_var, delete_alias_vars,
empty_points_to_set, same_points_to_set, ptr_may_alias_var):
Likewise.
* tree.c (tree_size, make_node_stat, copy_node_stat,
build_int_cst_wide, integer_all_onesp, list_length, chainon,
tree_node_structure, type_contains_placeholder_p, substitute_in_expr,
substitute_placeholder_in_expr, tabilize_reference_1, build0_stat,
build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p,
lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr,
build_method_type_directly, decl_type_context, get_callee_fndecl,
get_set_constructor_bits, build_vector_type_for_mode, int_cst_value,
tree_fold_gcd): Likewise.
* tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges,
make_cond_expr_edges, group_case_labels, tree_merge_blocks,
cleanup_control_expr_graph, find_taken_edge,
find_taken_edge_switch_expr, phi_alternatives_equal,
is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt,
stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate,
tree_split_edge, tree_verify_flow_info, thread_jumps,
tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise.
* tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly,
chrec_fold_multiply_poly_poly): Likewise.
* tree-complex.c (extract_component, expand_complex_division,
expand_complex_comparison, expand_complex_operations_1,
build_replicated_const, expand_vector_operations_1): Likewise.
* tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector,
build_classic_dir_vector): Likewise.
* tree-dfa.c (compute_immediate_uses_for_phi,
compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann,
create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise.
* tree-dump.c (dequeue_and_dump): Likewise.
* tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region,
record_in_finally_tree, replace_goto_queue_1,
maybe_record_in_goto_queue, verify_norecord_switch_expr,
do_return_redirection): Likewise.
* tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr,
add_to_dst_predicate_list, find_phi_replacement_condition,
replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order):
Likewise.
* tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r,
initialize_inlined_parameters, declare_return_variable,
estimate_num_insns_1, expand_call_inline, expand_calls_inline,
optimize_inline_calls, copy_tree_r): Likewise.
* tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt,
ssa_rewrite_stmt, rewrite_into_ssa): Likewise.
* tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after,
tsi_split_statement_list_after, tsi_split_statement_list_before):
Likewise.
* tree-mudflap.c (mf_varname_tree): Likewise.
* tree-nested.c (create_tmp_var_for, lookup_field_for_decl,
lookup_tramp_for_decl, convert_all_function_calls): Likewise.
* tree-optimize.c (tree_rest_of_compilation): Likewise.
* tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi,
coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis,
free_temp_expr_table, add_dependance, finish_expr, rewrite_trees):
Likewise.
* tree-phinodes.c (resize_phi_node, add_phi_arg,
remove_all_phi_nodes_for): Likewise.
* tree-pretty-print.c (op_prio, print_call_name): Likewise.
* tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler,
tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise.
* tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree,
sra_elt_eq, sra_walk_expr, instantiate_missing_elements,
generate_one_element_ref, generate_element_copy,
generate_element_zero, scalarize_copy, scalarize_init,
scalarize_ldst): Likewise.
* tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p,
add_may_alias, add_pointed_to_expr, add_pointed_to_var,
collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise.
* tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise.
* tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value,
set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment,
widen_bitfield, ccp_fold_builtin): Likewise.
* tree-ssa-copy.c (may_propagate_copy, merge_alias_info,
replace_exp_1, propagate_tree_value): Likewise.
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise.
* tree-ssa-dce.c (set_control_dependence_map_bit,
find_control_dependence, find_pdom, mark_operand_necessary,
mark_stmt_if_obviously_necessary,
mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise.
* tree-ssa-dom.c (dom_opt_initialize_block_local_data,
simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis,
eliminate_redundant_computations, avail_expr_eq): Likewise.
* tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise.
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p,
duplicate_blocks): Likewise.
* tree-ssa-loop-im.c (for_each_index, set_level,
is_call_clobbered_ref): Likewise.
* tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos,
stmt_after_increment, set_iv, contains_abnormal_ssa_name_p,
find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates,
peel_address, ptr_difference_cost, may_replace_final_value,
determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer,
rewrite_use, rewrite_uses): Likewise.
* tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa,
check_loop_closed_ssa_use): Likewise.
* tree-ssanames.c (make_ssa_name): Likewise.
* tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses,
finalize_ssa_v_must_defs, finalize_ssa_stmt_operands,
get_stmt_operands, get_expr_operands, get_asm_expr_operands,
get_indirect_ref_operands, add_stmt_operand): Likewise.
* tree-ssa-pre.c (value_exists_in_set_bitmap,
value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set,
phi_translate, valid_in_set, compute_antic,
find_or_generate_expression, create_expression_by_pieces, insert_aux,
create_value_expr_from, eliminate): Likewise.
* tree-ssa-propagate.c (cfg_blocks_get): Likewise.
* tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges):
Likewise.
* tree-tailcall.c (independent_of_stmt_p, adjust_return_value,
eliminate_tail_call): Likewise.
* tree-vectorizer.c (vect_create_index_for_array_ref,
vect_align_data_ref, vect_create_data_ref,
vect_create_destination_var, vect_get_vec_def_for_operand,
vect_finish_stmt_generation, vect_transform_stmt,
vect_transform_loop_bound, vect_transform_loop,
vect_analyze_operations): Likewise.
* tree-vn.c (vn_compute, set_value_handle, get_value_handle):
Likewise.
* tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr,
get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start,
bsi_after_labels, bsi_last): Likewise.
* tree-ssa-live.c (var_union, change_partition_var,
create_ssa_var_map, calculate_live_on_entry, root_var_init,
type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce):
Likewise.
* tree-ssa-live.h (partition_is_global, live_entry_blocks,
tpa_find_tree): Likewise.
(register_ssa_partition_check): Declare.
(register_ssa_partition): use it.
* tree-ssa-live.c: Include errors.h.
(register_ssa_partition_check): New.
* tree-ssa-operands.c: Include errors.h.
* Makefile.in (tree-ssa-operands.o): Depend on errors.h.
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
From-SVN: r87223
2004-09-09 09:54:12 +02:00
|
|
|
|
gcc_unreachable ();
|
2004-06-29 18:25:28 +02:00
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Build a full component reference to ELT rooted at its native variable. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
|
|
static tree
|
2004-06-29 18:25:28 +02:00
|
|
|
|
generate_element_ref (struct sra_elt *elt)
|
|
|
|
|
{
|
|
|
|
|
if (elt->parent)
|
|
|
|
|
return generate_one_element_ref (elt, generate_element_ref (elt->parent));
|
|
|
|
|
else
|
|
|
|
|
return elt->element;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Generate a set of assignment statements in *LIST_P to copy all
|
|
|
|
|
instantiated elements under ELT to or from the equivalent structure
|
|
|
|
|
rooted at EXPR. COPY_OUT controls the direction of the copy, with
|
|
|
|
|
true meaning to copy out of EXPR into ELT. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
generate_copy_inout (struct sra_elt *elt, bool copy_out, tree expr,
|
|
|
|
|
tree *list_p)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
struct sra_elt *c;
|
|
|
|
|
tree t;
|
|
|
|
|
|
|
|
|
|
if (elt->replacement)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
if (copy_out)
|
|
|
|
|
t = build (MODIFY_EXPR, void_type_node, elt->replacement, expr);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
else
|
2004-06-29 18:25:28 +02:00
|
|
|
|
t = build (MODIFY_EXPR, void_type_node, expr, elt->replacement);
|
|
|
|
|
append_to_statement_list (t, list_p);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
for (c = elt->children; c ; c = c->sibling)
|
|
|
|
|
{
|
|
|
|
|
t = generate_one_element_ref (c, unshare_expr (expr));
|
|
|
|
|
generate_copy_inout (c, copy_out, t, list_p);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Generate a set of assignment statements in *LIST_P to copy all instantiated
|
|
|
|
|
elements under SRC to their counterparts under DST. There must be a 1-1
|
|
|
|
|
correspondence of instantiated elements. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
static void
|
|
|
|
|
generate_element_copy (struct sra_elt *dst, struct sra_elt *src, tree *list_p)
|
|
|
|
|
{
|
|
|
|
|
struct sra_elt *dc, *sc;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
for (dc = dst->children; dc ; dc = dc->sibling)
|
|
|
|
|
{
|
|
|
|
|
sc = lookup_element (src, dc->element, NULL, NO_INSERT);
|
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* targhooks.c (default_unwind_emit, default_scalar_mode_supported_p):
Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* timevar.c (timevar_push, timevar_pop, timevar_start,
timevar_stop): Likewise.
* toplev.c (default_pch_valid_p): Likewise.
* tracer.c (tail_duplicate): Likewise.
* tree-alias-common.c (get_alias_var_decl,
get_values_from_constructor, create_alias_var, delete_alias_vars,
empty_points_to_set, same_points_to_set, ptr_may_alias_var):
Likewise.
* tree.c (tree_size, make_node_stat, copy_node_stat,
build_int_cst_wide, integer_all_onesp, list_length, chainon,
tree_node_structure, type_contains_placeholder_p, substitute_in_expr,
substitute_placeholder_in_expr, tabilize_reference_1, build0_stat,
build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p,
lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr,
build_method_type_directly, decl_type_context, get_callee_fndecl,
get_set_constructor_bits, build_vector_type_for_mode, int_cst_value,
tree_fold_gcd): Likewise.
* tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges,
make_cond_expr_edges, group_case_labels, tree_merge_blocks,
cleanup_control_expr_graph, find_taken_edge,
find_taken_edge_switch_expr, phi_alternatives_equal,
is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt,
stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate,
tree_split_edge, tree_verify_flow_info, thread_jumps,
tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise.
* tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly,
chrec_fold_multiply_poly_poly): Likewise.
* tree-complex.c (extract_component, expand_complex_division,
expand_complex_comparison, expand_complex_operations_1,
build_replicated_const, expand_vector_operations_1): Likewise.
* tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector,
build_classic_dir_vector): Likewise.
* tree-dfa.c (compute_immediate_uses_for_phi,
compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann,
create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise.
* tree-dump.c (dequeue_and_dump): Likewise.
* tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region,
record_in_finally_tree, replace_goto_queue_1,
maybe_record_in_goto_queue, verify_norecord_switch_expr,
do_return_redirection): Likewise.
* tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr,
add_to_dst_predicate_list, find_phi_replacement_condition,
replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order):
Likewise.
* tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r,
initialize_inlined_parameters, declare_return_variable,
estimate_num_insns_1, expand_call_inline, expand_calls_inline,
optimize_inline_calls, copy_tree_r): Likewise.
* tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt,
ssa_rewrite_stmt, rewrite_into_ssa): Likewise.
* tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after,
tsi_split_statement_list_after, tsi_split_statement_list_before):
Likewise.
* tree-mudflap.c (mf_varname_tree): Likewise.
* tree-nested.c (create_tmp_var_for, lookup_field_for_decl,
lookup_tramp_for_decl, convert_all_function_calls): Likewise.
* tree-optimize.c (tree_rest_of_compilation): Likewise.
* tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi,
coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis,
free_temp_expr_table, add_dependance, finish_expr, rewrite_trees):
Likewise.
* tree-phinodes.c (resize_phi_node, add_phi_arg,
remove_all_phi_nodes_for): Likewise.
* tree-pretty-print.c (op_prio, print_call_name): Likewise.
* tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler,
tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise.
* tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree,
sra_elt_eq, sra_walk_expr, instantiate_missing_elements,
generate_one_element_ref, generate_element_copy,
generate_element_zero, scalarize_copy, scalarize_init,
scalarize_ldst): Likewise.
* tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p,
add_may_alias, add_pointed_to_expr, add_pointed_to_var,
collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise.
* tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise.
* tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value,
set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment,
widen_bitfield, ccp_fold_builtin): Likewise.
* tree-ssa-copy.c (may_propagate_copy, merge_alias_info,
replace_exp_1, propagate_tree_value): Likewise.
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise.
* tree-ssa-dce.c (set_control_dependence_map_bit,
find_control_dependence, find_pdom, mark_operand_necessary,
mark_stmt_if_obviously_necessary,
mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise.
* tree-ssa-dom.c (dom_opt_initialize_block_local_data,
simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis,
eliminate_redundant_computations, avail_expr_eq): Likewise.
* tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise.
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p,
duplicate_blocks): Likewise.
* tree-ssa-loop-im.c (for_each_index, set_level,
is_call_clobbered_ref): Likewise.
* tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos,
stmt_after_increment, set_iv, contains_abnormal_ssa_name_p,
find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates,
peel_address, ptr_difference_cost, may_replace_final_value,
determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer,
rewrite_use, rewrite_uses): Likewise.
* tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa,
check_loop_closed_ssa_use): Likewise.
* tree-ssanames.c (make_ssa_name): Likewise.
* tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses,
finalize_ssa_v_must_defs, finalize_ssa_stmt_operands,
get_stmt_operands, get_expr_operands, get_asm_expr_operands,
get_indirect_ref_operands, add_stmt_operand): Likewise.
* tree-ssa-pre.c (value_exists_in_set_bitmap,
value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set,
phi_translate, valid_in_set, compute_antic,
find_or_generate_expression, create_expression_by_pieces, insert_aux,
create_value_expr_from, eliminate): Likewise.
* tree-ssa-propagate.c (cfg_blocks_get): Likewise.
* tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges):
Likewise.
* tree-tailcall.c (independent_of_stmt_p, adjust_return_value,
eliminate_tail_call): Likewise.
* tree-vectorizer.c (vect_create_index_for_array_ref,
vect_align_data_ref, vect_create_data_ref,
vect_create_destination_var, vect_get_vec_def_for_operand,
vect_finish_stmt_generation, vect_transform_stmt,
vect_transform_loop_bound, vect_transform_loop,
vect_analyze_operations): Likewise.
* tree-vn.c (vn_compute, set_value_handle, get_value_handle):
Likewise.
* tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr,
get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start,
bsi_after_labels, bsi_last): Likewise.
* tree-ssa-live.c (var_union, change_partition_var,
create_ssa_var_map, calculate_live_on_entry, root_var_init,
type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce):
Likewise.
* tree-ssa-live.h (partition_is_global, live_entry_blocks,
tpa_find_tree): Likewise.
(register_ssa_partition_check): Declare.
(register_ssa_partition): use it.
* tree-ssa-live.c: Include errors.h.
(register_ssa_partition_check): New.
* tree-ssa-operands.c: Include errors.h.
* Makefile.in (tree-ssa-operands.o): Depend on errors.h.
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
From-SVN: r87223
2004-09-09 09:54:12 +02:00
|
|
|
|
gcc_assert (sc);
|
2004-06-29 18:25:28 +02:00
|
|
|
|
generate_element_copy (dc, sc, list_p);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
if (dst->replacement)
|
|
|
|
|
{
|
|
|
|
|
tree t;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* targhooks.c (default_unwind_emit, default_scalar_mode_supported_p):
Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* timevar.c (timevar_push, timevar_pop, timevar_start,
timevar_stop): Likewise.
* toplev.c (default_pch_valid_p): Likewise.
* tracer.c (tail_duplicate): Likewise.
* tree-alias-common.c (get_alias_var_decl,
get_values_from_constructor, create_alias_var, delete_alias_vars,
empty_points_to_set, same_points_to_set, ptr_may_alias_var):
Likewise.
* tree.c (tree_size, make_node_stat, copy_node_stat,
build_int_cst_wide, integer_all_onesp, list_length, chainon,
tree_node_structure, type_contains_placeholder_p, substitute_in_expr,
substitute_placeholder_in_expr, tabilize_reference_1, build0_stat,
build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p,
lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr,
build_method_type_directly, decl_type_context, get_callee_fndecl,
get_set_constructor_bits, build_vector_type_for_mode, int_cst_value,
tree_fold_gcd): Likewise.
* tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges,
make_cond_expr_edges, group_case_labels, tree_merge_blocks,
cleanup_control_expr_graph, find_taken_edge,
find_taken_edge_switch_expr, phi_alternatives_equal,
is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt,
stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate,
tree_split_edge, tree_verify_flow_info, thread_jumps,
tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise.
* tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly,
chrec_fold_multiply_poly_poly): Likewise.
* tree-complex.c (extract_component, expand_complex_division,
expand_complex_comparison, expand_complex_operations_1,
build_replicated_const, expand_vector_operations_1): Likewise.
* tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector,
build_classic_dir_vector): Likewise.
* tree-dfa.c (compute_immediate_uses_for_phi,
compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann,
create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise.
* tree-dump.c (dequeue_and_dump): Likewise.
* tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region,
record_in_finally_tree, replace_goto_queue_1,
maybe_record_in_goto_queue, verify_norecord_switch_expr,
do_return_redirection): Likewise.
* tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr,
add_to_dst_predicate_list, find_phi_replacement_condition,
replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order):
Likewise.
* tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r,
initialize_inlined_parameters, declare_return_variable,
estimate_num_insns_1, expand_call_inline, expand_calls_inline,
optimize_inline_calls, copy_tree_r): Likewise.
* tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt,
ssa_rewrite_stmt, rewrite_into_ssa): Likewise.
* tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after,
tsi_split_statement_list_after, tsi_split_statement_list_before):
Likewise.
* tree-mudflap.c (mf_varname_tree): Likewise.
* tree-nested.c (create_tmp_var_for, lookup_field_for_decl,
lookup_tramp_for_decl, convert_all_function_calls): Likewise.
* tree-optimize.c (tree_rest_of_compilation): Likewise.
* tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi,
coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis,
free_temp_expr_table, add_dependance, finish_expr, rewrite_trees):
Likewise.
* tree-phinodes.c (resize_phi_node, add_phi_arg,
remove_all_phi_nodes_for): Likewise.
* tree-pretty-print.c (op_prio, print_call_name): Likewise.
* tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler,
tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise.
* tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree,
sra_elt_eq, sra_walk_expr, instantiate_missing_elements,
generate_one_element_ref, generate_element_copy,
generate_element_zero, scalarize_copy, scalarize_init,
scalarize_ldst): Likewise.
* tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p,
add_may_alias, add_pointed_to_expr, add_pointed_to_var,
collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise.
* tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise.
* tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value,
set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment,
widen_bitfield, ccp_fold_builtin): Likewise.
* tree-ssa-copy.c (may_propagate_copy, merge_alias_info,
replace_exp_1, propagate_tree_value): Likewise.
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise.
* tree-ssa-dce.c (set_control_dependence_map_bit,
find_control_dependence, find_pdom, mark_operand_necessary,
mark_stmt_if_obviously_necessary,
mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise.
* tree-ssa-dom.c (dom_opt_initialize_block_local_data,
simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis,
eliminate_redundant_computations, avail_expr_eq): Likewise.
* tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise.
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p,
duplicate_blocks): Likewise.
* tree-ssa-loop-im.c (for_each_index, set_level,
is_call_clobbered_ref): Likewise.
* tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos,
stmt_after_increment, set_iv, contains_abnormal_ssa_name_p,
find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates,
peel_address, ptr_difference_cost, may_replace_final_value,
determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer,
rewrite_use, rewrite_uses): Likewise.
* tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa,
check_loop_closed_ssa_use): Likewise.
* tree-ssanames.c (make_ssa_name): Likewise.
* tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses,
finalize_ssa_v_must_defs, finalize_ssa_stmt_operands,
get_stmt_operands, get_expr_operands, get_asm_expr_operands,
get_indirect_ref_operands, add_stmt_operand): Likewise.
* tree-ssa-pre.c (value_exists_in_set_bitmap,
value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set,
phi_translate, valid_in_set, compute_antic,
find_or_generate_expression, create_expression_by_pieces, insert_aux,
create_value_expr_from, eliminate): Likewise.
* tree-ssa-propagate.c (cfg_blocks_get): Likewise.
* tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges):
Likewise.
* tree-tailcall.c (independent_of_stmt_p, adjust_return_value,
eliminate_tail_call): Likewise.
* tree-vectorizer.c (vect_create_index_for_array_ref,
vect_align_data_ref, vect_create_data_ref,
vect_create_destination_var, vect_get_vec_def_for_operand,
vect_finish_stmt_generation, vect_transform_stmt,
vect_transform_loop_bound, vect_transform_loop,
vect_analyze_operations): Likewise.
* tree-vn.c (vn_compute, set_value_handle, get_value_handle):
Likewise.
* tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr,
get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start,
bsi_after_labels, bsi_last): Likewise.
* tree-ssa-live.c (var_union, change_partition_var,
create_ssa_var_map, calculate_live_on_entry, root_var_init,
type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce):
Likewise.
* tree-ssa-live.h (partition_is_global, live_entry_blocks,
tpa_find_tree): Likewise.
(register_ssa_partition_check): Declare.
(register_ssa_partition): use it.
* tree-ssa-live.c: Include errors.h.
(register_ssa_partition_check): New.
* tree-ssa-operands.c: Include errors.h.
* Makefile.in (tree-ssa-operands.o): Depend on errors.h.
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
From-SVN: r87223
2004-09-09 09:54:12 +02:00
|
|
|
|
gcc_assert (src->replacement);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
t = build (MODIFY_EXPR, void_type_node, dst->replacement,
|
|
|
|
|
src->replacement);
|
|
|
|
|
append_to_statement_list (t, list_p);
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Generate a set of assignment statements in *LIST_P to zero all instantiated
|
|
|
|
|
elements under ELT. In addition, do not assign to elements that have been
|
|
|
|
|
marked VISITED but do reset the visited flag; this allows easy coordination
|
|
|
|
|
with generate_element_init. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
static void
|
|
|
|
|
generate_element_zero (struct sra_elt *elt, tree *list_p)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
struct sra_elt *c;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-07-07 01:02:22 +02:00
|
|
|
|
if (elt->visited)
|
|
|
|
|
{
|
|
|
|
|
elt->visited = false;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
for (c = elt->children; c ; c = c->sibling)
|
|
|
|
|
generate_element_zero (c, list_p);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-07-07 01:02:22 +02:00
|
|
|
|
if (elt->replacement)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
tree t;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* targhooks.c (default_unwind_emit, default_scalar_mode_supported_p):
Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* timevar.c (timevar_push, timevar_pop, timevar_start,
timevar_stop): Likewise.
* toplev.c (default_pch_valid_p): Likewise.
* tracer.c (tail_duplicate): Likewise.
* tree-alias-common.c (get_alias_var_decl,
get_values_from_constructor, create_alias_var, delete_alias_vars,
empty_points_to_set, same_points_to_set, ptr_may_alias_var):
Likewise.
* tree.c (tree_size, make_node_stat, copy_node_stat,
build_int_cst_wide, integer_all_onesp, list_length, chainon,
tree_node_structure, type_contains_placeholder_p, substitute_in_expr,
substitute_placeholder_in_expr, tabilize_reference_1, build0_stat,
build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p,
lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr,
build_method_type_directly, decl_type_context, get_callee_fndecl,
get_set_constructor_bits, build_vector_type_for_mode, int_cst_value,
tree_fold_gcd): Likewise.
* tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges,
make_cond_expr_edges, group_case_labels, tree_merge_blocks,
cleanup_control_expr_graph, find_taken_edge,
find_taken_edge_switch_expr, phi_alternatives_equal,
is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt,
stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate,
tree_split_edge, tree_verify_flow_info, thread_jumps,
tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise.
* tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly,
chrec_fold_multiply_poly_poly): Likewise.
* tree-complex.c (extract_component, expand_complex_division,
expand_complex_comparison, expand_complex_operations_1,
build_replicated_const, expand_vector_operations_1): Likewise.
* tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector,
build_classic_dir_vector): Likewise.
* tree-dfa.c (compute_immediate_uses_for_phi,
compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann,
create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise.
* tree-dump.c (dequeue_and_dump): Likewise.
* tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region,
record_in_finally_tree, replace_goto_queue_1,
maybe_record_in_goto_queue, verify_norecord_switch_expr,
do_return_redirection): Likewise.
* tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr,
add_to_dst_predicate_list, find_phi_replacement_condition,
replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order):
Likewise.
* tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r,
initialize_inlined_parameters, declare_return_variable,
estimate_num_insns_1, expand_call_inline, expand_calls_inline,
optimize_inline_calls, copy_tree_r): Likewise.
* tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt,
ssa_rewrite_stmt, rewrite_into_ssa): Likewise.
* tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after,
tsi_split_statement_list_after, tsi_split_statement_list_before):
Likewise.
* tree-mudflap.c (mf_varname_tree): Likewise.
* tree-nested.c (create_tmp_var_for, lookup_field_for_decl,
lookup_tramp_for_decl, convert_all_function_calls): Likewise.
* tree-optimize.c (tree_rest_of_compilation): Likewise.
* tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi,
coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis,
free_temp_expr_table, add_dependance, finish_expr, rewrite_trees):
Likewise.
* tree-phinodes.c (resize_phi_node, add_phi_arg,
remove_all_phi_nodes_for): Likewise.
* tree-pretty-print.c (op_prio, print_call_name): Likewise.
* tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler,
tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise.
* tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree,
sra_elt_eq, sra_walk_expr, instantiate_missing_elements,
generate_one_element_ref, generate_element_copy,
generate_element_zero, scalarize_copy, scalarize_init,
scalarize_ldst): Likewise.
* tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p,
add_may_alias, add_pointed_to_expr, add_pointed_to_var,
collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise.
* tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise.
* tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value,
set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment,
widen_bitfield, ccp_fold_builtin): Likewise.
* tree-ssa-copy.c (may_propagate_copy, merge_alias_info,
replace_exp_1, propagate_tree_value): Likewise.
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise.
* tree-ssa-dce.c (set_control_dependence_map_bit,
find_control_dependence, find_pdom, mark_operand_necessary,
mark_stmt_if_obviously_necessary,
mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise.
* tree-ssa-dom.c (dom_opt_initialize_block_local_data,
simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis,
eliminate_redundant_computations, avail_expr_eq): Likewise.
* tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise.
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p,
duplicate_blocks): Likewise.
* tree-ssa-loop-im.c (for_each_index, set_level,
is_call_clobbered_ref): Likewise.
* tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos,
stmt_after_increment, set_iv, contains_abnormal_ssa_name_p,
find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates,
peel_address, ptr_difference_cost, may_replace_final_value,
determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer,
rewrite_use, rewrite_uses): Likewise.
* tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa,
check_loop_closed_ssa_use): Likewise.
* tree-ssanames.c (make_ssa_name): Likewise.
* tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses,
finalize_ssa_v_must_defs, finalize_ssa_stmt_operands,
get_stmt_operands, get_expr_operands, get_asm_expr_operands,
get_indirect_ref_operands, add_stmt_operand): Likewise.
* tree-ssa-pre.c (value_exists_in_set_bitmap,
value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set,
phi_translate, valid_in_set, compute_antic,
find_or_generate_expression, create_expression_by_pieces, insert_aux,
create_value_expr_from, eliminate): Likewise.
* tree-ssa-propagate.c (cfg_blocks_get): Likewise.
* tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges):
Likewise.
* tree-tailcall.c (independent_of_stmt_p, adjust_return_value,
eliminate_tail_call): Likewise.
* tree-vectorizer.c (vect_create_index_for_array_ref,
vect_align_data_ref, vect_create_data_ref,
vect_create_destination_var, vect_get_vec_def_for_operand,
vect_finish_stmt_generation, vect_transform_stmt,
vect_transform_loop_bound, vect_transform_loop,
vect_analyze_operations): Likewise.
* tree-vn.c (vn_compute, set_value_handle, get_value_handle):
Likewise.
* tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr,
get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start,
bsi_after_labels, bsi_last): Likewise.
* tree-ssa-live.c (var_union, change_partition_var,
create_ssa_var_map, calculate_live_on_entry, root_var_init,
type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce):
Likewise.
* tree-ssa-live.h (partition_is_global, live_entry_blocks,
tpa_find_tree): Likewise.
(register_ssa_partition_check): Declare.
(register_ssa_partition): use it.
* tree-ssa-live.c: Include errors.h.
(register_ssa_partition_check): New.
* tree-ssa-operands.c: Include errors.h.
* Makefile.in (tree-ssa-operands.o): Depend on errors.h.
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
From-SVN: r87223
2004-09-09 09:54:12 +02:00
|
|
|
|
gcc_assert (elt->is_scalar);
|
2004-09-12 01:44:21 +02:00
|
|
|
|
t = fold_convert (elt->type, integer_zero_node);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
t = build (MODIFY_EXPR, void_type_node, elt->replacement, t);
|
|
|
|
|
append_to_statement_list (t, list_p);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
2004-06-29 18:25:28 +02:00
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-07-11 19:33:02 +02:00
|
|
|
|
/* Generate an assignment VAR = INIT, where INIT may need gimplification.
|
|
|
|
|
Add the result to *LIST_P. */
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
generate_one_element_init (tree var, tree init, tree *list_p)
|
|
|
|
|
{
|
|
|
|
|
/* The replacement can be almost arbitrarily complex. Gimplify. */
|
2005-01-05 00:54:26 +01:00
|
|
|
|
tree stmt = build (MODIFY_EXPR, void_type_node, var, init);
|
|
|
|
|
gimplify_and_add (stmt, list_p);
|
2004-07-11 19:33:02 +02:00
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Generate a set of assignment statements in *LIST_P to set all instantiated
|
|
|
|
|
elements under ELT with the contents of the initializer INIT. In addition,
|
|
|
|
|
mark all assigned elements VISITED; this allows easy coordination with
|
2004-07-05 18:14:51 +02:00
|
|
|
|
generate_element_zero. Return false if we found a case we couldn't
|
|
|
|
|
handle. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-07-05 18:14:51 +02:00
|
|
|
|
static bool
|
2005-01-05 00:54:26 +01:00
|
|
|
|
generate_element_init_1 (struct sra_elt *elt, tree init, tree *list_p)
|
2004-06-29 18:25:28 +02:00
|
|
|
|
{
|
2004-07-05 18:14:51 +02:00
|
|
|
|
bool result = true;
|
2004-07-03 15:56:38 +02:00
|
|
|
|
enum tree_code init_code;
|
2004-06-29 18:25:28 +02:00
|
|
|
|
struct sra_elt *sub;
|
|
|
|
|
tree t;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-07-05 18:14:51 +02:00
|
|
|
|
/* We can be passed DECL_INITIAL of a static variable. It might have a
|
|
|
|
|
conversion, which we strip off here. */
|
2004-07-03 15:56:38 +02:00
|
|
|
|
STRIP_USELESS_TYPE_CONVERSION (init);
|
|
|
|
|
init_code = TREE_CODE (init);
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
if (elt->is_scalar)
|
|
|
|
|
{
|
|
|
|
|
if (elt->replacement)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-07-11 19:33:02 +02:00
|
|
|
|
generate_one_element_init (elt->replacement, init, list_p);
|
2004-06-29 18:25:28 +02:00
|
|
|
|
elt->visited = true;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
2004-07-05 18:14:51 +02:00
|
|
|
|
return result;
|
2004-06-29 18:25:28 +02:00
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
switch (init_code)
|
|
|
|
|
{
|
|
|
|
|
case COMPLEX_CST:
|
|
|
|
|
case COMPLEX_EXPR:
|
|
|
|
|
for (sub = elt->children; sub ; sub = sub->sibling)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
if (sub->element == integer_zero_node)
|
|
|
|
|
t = (init_code == COMPLEX_EXPR
|
|
|
|
|
? TREE_OPERAND (init, 0) : TREE_REALPART (init));
|
2004-05-13 08:41:07 +02:00
|
|
|
|
else
|
2004-06-29 18:25:28 +02:00
|
|
|
|
t = (init_code == COMPLEX_EXPR
|
|
|
|
|
? TREE_OPERAND (init, 1) : TREE_IMAGPART (init));
|
2005-01-05 00:54:26 +01:00
|
|
|
|
result &= generate_element_init_1 (sub, t, list_p);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
2004-06-29 18:25:28 +02:00
|
|
|
|
break;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
case CONSTRUCTOR:
|
|
|
|
|
for (t = CONSTRUCTOR_ELTS (init); t ; t = TREE_CHAIN (t))
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2005-03-30 00:43:48 +02:00
|
|
|
|
tree purpose = TREE_PURPOSE (t);
|
|
|
|
|
tree value = TREE_VALUE (t);
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (purpose) == RANGE_EXPR)
|
|
|
|
|
{
|
|
|
|
|
tree lower = TREE_OPERAND (purpose, 0);
|
|
|
|
|
tree upper = TREE_OPERAND (purpose, 1);
|
|
|
|
|
|
|
|
|
|
while (1)
|
|
|
|
|
{
|
|
|
|
|
sub = lookup_element (elt, lower, NULL, NO_INSERT);
|
|
|
|
|
if (sub != NULL)
|
|
|
|
|
result &= generate_element_init_1 (sub, value, list_p);
|
|
|
|
|
if (tree_int_cst_equal (lower, upper))
|
|
|
|
|
break;
|
|
|
|
|
lower = int_const_binop (PLUS_EXPR, lower,
|
|
|
|
|
integer_one_node, true);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
sub = lookup_element (elt, purpose, NULL, NO_INSERT);
|
|
|
|
|
if (sub != NULL)
|
|
|
|
|
result &= generate_element_init_1 (sub, value, list_p);
|
|
|
|
|
}
|
2004-06-29 18:25:28 +02:00
|
|
|
|
}
|
|
|
|
|
break;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
default:
|
2004-07-07 01:02:22 +02:00
|
|
|
|
elt->visited = true;
|
2004-07-05 18:14:51 +02:00
|
|
|
|
result = false;
|
2004-06-29 18:25:28 +02:00
|
|
|
|
}
|
2004-07-05 18:14:51 +02:00
|
|
|
|
|
|
|
|
|
return result;
|
2004-06-29 18:25:28 +02:00
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2005-01-05 00:54:26 +01:00
|
|
|
|
/* A wrapper function for generate_element_init_1 that handles cleanup after
|
|
|
|
|
gimplification. */
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
|
generate_element_init (struct sra_elt *elt, tree init, tree *list_p)
|
|
|
|
|
{
|
|
|
|
|
bool ret;
|
|
|
|
|
|
|
|
|
|
push_gimplify_context ();
|
|
|
|
|
ret = generate_element_init_1 (elt, init, list_p);
|
|
|
|
|
pop_gimplify_context (NULL);
|
|
|
|
|
|
|
|
|
|
/* The replacement can expose previously unreferenced variables. */
|
|
|
|
|
if (ret && *list_p)
|
|
|
|
|
{
|
|
|
|
|
tree_stmt_iterator i;
|
|
|
|
|
size_t old, new, j;
|
|
|
|
|
|
|
|
|
|
old = num_referenced_vars;
|
|
|
|
|
|
|
|
|
|
for (i = tsi_start (*list_p); !tsi_end_p (i); tsi_next (&i))
|
|
|
|
|
find_new_referenced_vars (tsi_stmt_ptr (i));
|
|
|
|
|
|
|
|
|
|
new = num_referenced_vars;
|
|
|
|
|
for (j = old; j < new; ++j)
|
|
|
|
|
bitmap_set_bit (vars_to_rename, j);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Insert STMT on all the outgoing edges out of BB. Note that if BB
|
|
|
|
|
has more than one edge, STMT will be replicated for each edge. Also,
|
|
|
|
|
abnormal edges will be ignored. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
void
|
|
|
|
|
insert_edge_copies (tree stmt, basic_block bb)
|
|
|
|
|
{
|
|
|
|
|
edge e;
|
backport: basic-block.h: Include vec.h, errors.h.
2004-09-24 Ben Elliston <bje@au.ibm.com>
Steven Bosscher <stevenb@suse.de>
Andrew Pinski <pinskia@physics.uc.edu>
Merge from edge-vector-branch:
* basic-block.h: Include vec.h, errors.h. Instantiate a VEC(edge).
(struct edge_def): Remove pred_next, succ_next members.
(struct basic_block_def): Remove pred, succ members. Add preds
and succs members of type VEC(edge).
(FALLTHRU_EDGE): Redefine using EDGE_SUCC.
(BRANCH_EDGE): Likewise.
(EDGE_CRITICAL_P): Redefine using EDGE_COUNT.
(EDGE_COUNT, EDGE_I, EDGE_PRED, EDGE_SUCC): New.
(edge_iterator): New.
(ei_start, ei_last, ei_end_p, ei_one_before_end_p): New.
(ei_next, ei_prev, ei_edge, ei_safe_edge): Likewise.
(FOR_EACH_EDGE): New.
* bb-reorder.c (find_traces): Use FOR_EACH_EDGE and EDGE_* macros
where applicable.
(rotate_loop): Likewise.
(find_traces_1_route): Likewise.
(bb_to_key): Likewise.
(connect_traces): Likewise.
(copy_bb_p): Likewise.
(find_rarely_executed_basic_blocks_and_crossing_edges): Likewise.
(add_labels_and_missing_jumps): Likewise.
(fix_up_fall_thru_edges): Likewise.
(find_jump_block): Likewise.
(fix_crossing_conditional_branches): Likewise.
(fix_crossing_unconditional_branches): Likewise.
(add_reg_crossing_jump_notes): Likewise.
* bt-load.c (augment_live_range): Likewise.
* cfg.c (clear_edges): Likewise.
(unchecked_make_edge): Likewise.
(cached_make_edge): Likewise.
(make_single_succ_edge): Likewise.
(remove_edge): Likewise.
(redirect_edge_succ_nodup): Likewise.
(check_bb_profile): Likewise.
(dump_flow_info): Likewise.
(alloc_aux_for_edges): Likewise.
(clear_aux_for_edges): Likewise.
(dump_cfg_bb_info): Likewise.
* cfganal.c (forwarder_block_p): Likewise.
(can_fallthru): Likewise.
(could_fall_through): Likewise.
(mark_dfs_back_edges): Likewise.
(set_edge_can_fallthru_flag): Likewise.
(find_unreachable_blocks): Likewise.
(create_edge_list): Likewise.
(verify_edge_list): Likewise.
(add_noreturn_fake_exit_edges): Likewise.
(connect_infinite_loops_to_exit): Likewise.
(flow_reverse_top_sort_order_compute): Likewise.
(flow_depth_first_order_compute): Likewise.
(flow_preorder_transversal_compute): Likewise.
(flow_dfs_compute_reverse_execute): Likewise.
(dfs_enumerate_from): Likewise.
(compute_dominance_frontiers_1): Likewise.
* cfgbuild.c (make_edges): Likewise.
(compute_outgoing_frequencies): Likewise.
(find_many_sub_basic_blocks): Likewise.
(find_sub_basic_blocks): Likewise.
* cfgcleanup.c (try_simplify_condjump): Likewise.
(thread_jump): Likewise.
(try_forward_edges): Likewise.
(merge_blocks_move): Likewise.
(outgoing_edges_match): Likewise.
(try_crossjump_to_edge): Likewise.
(try_crossjump_bb): Likewise.
(try_optimize_cfg): Likewise.
(merge_seq_blocks): Likewise.
* cfgexpand.c (expand_gimple_tailcall): Likewise.
(expand_gimple_basic_block): Likewise.
(construct_init_block): Likewise.
(construct_exit_block): Likewise.
* cfghooks.c (verify_flow_info): Likewise.
(dump_bb): Likewise.
(delete_basic_block): Likewise.
(split_edge): Likewise.
(merge_blocks): Likewise.
(make_forwarder_block): Likewise.
(tidy_fallthru_edges): Likewise.
(can_duplicate_block_p): Likewise.
(duplicate_block): Likewise.
* cfglayout.c (fixup_reorder_chain): Likewise.
(fixup_fallthru_exit_predecessor): Likewise.
(can_copy_bbs_p): Likewise.
(copy_bbs): Likewise.
* cfgloop.c (flow_loops_cfg_dump): Likewise.
(flow_loop_entry_edges_find): Likewise.
(flow_loop_exit_edges_find): Likewise.
(flow_loop_nodes_find): Likewise.
(mark_single_exit_loops): Likewise.
(flow_loop_pre_header_scan): Likewise.
(flow_loop_pre_header_find): Likewise.
(update_latch_info): Likewise.
(canonicalize_loop_headers): Likewise.
(flow_loops_find): Likewise.
(get_loop_body_in_bfs_order): Likewise.
(get_loop_exit_edges): Likewise.
(num_loop_branches): Likewise.
(verify_loop_structure): Likewise.
(loop_latch_edge): Likewise.
(loop_preheader_edge): Likewise.
* cfgloopanal.c (mark_irreducible_loops): Likewise.
(expected_loop_iterations): Likewise.
* cfgloopmanip.c (remove_bbs): Likewise.
(fix_bb_placement): Likewise.
(fix_irreducible_loops): Likewise.
(remove_path): Likewise.
(scale_bbs_frequencies): Likewise.
(loopify): Likewise.
(unloop): Likewise.
(fix_loop_placement): Likewise.
(loop_delete_branch_edge): Likewise.
(duplicate_loop_to_header_edge): Likewise.
(mfb_keep_just): Likewise.
(create_preheader): Likewise.
(force_single_succ_latches): Likewise.
(loop_split_edge_with): Likewise.
(create_loop_notes): Likewise.
* cfgrtl.c (rtl_split_block): Likewise.
(rtl_merge_blocks): Likewise.
(rtl_can_merge_blocks): Likewise.
(try_redirect_by_replacing_jump): Likewise.
(force_nonfallthru_and_redirect): Likewise.
(rtl_tidy_fallthru_edge): Likewise.
(commit_one_edge_insertion): Likewise.
(commit_edge_insertions): Likewise.
(commit_edge_insertions_watch_calls): Likewise.
(rtl_verify_flow_info_1): Likewise.
(rtl_verify_flow_info): Likewise.
(purge_dead_edges): Likewise.
(cfg_layout_redirect_edge_and_branch): Likewise.
(cfg_layout_can_merge_blocks_p): Likewise.
(rtl_flow_call_edges_add): Likewise.
* cse.c (cse_cc_succs): Likewise.
* df.c (hybrid_search): Likewise.
* dominance.c (calc_dfs_tree_nonrec): Likewise.
(calc_dfs_tree): Likewise.
(calc_idoms): Likewise.
(recount_dominator): Likewise.
* domwalk.c (walk_dominator_tree): Likewise.
* except.c (emit_to_new_bb_before): Likewise.
(connect_post_landing_pads): Likewise.
(sjlj_emit_function_enter): Likewise.
(sjlj_emit_function_exit): Likewise.
(finish_eh_generation): Likewise.
* final.c (compute_alignments): Likewise.
* flow.c (calculate_global_regs_live): Likewise.
(initialize_uninitialized_subregs): Likewise.
(init_propagate_block_info): Likewise.
* function.c (thread_prologue_and_epilogue_insns): Likewise.
* gcse.c (find_implicit_sets): Likewise.
(bypass_block): Likewise.
(bypass_conditional_jumps): Likewise.
(compute_pre_data): Likewise.
(insert_insn_end_bb): Likewise.
(insert_store): Likewise.
(remove_reachable_equiv_notes): Likewise.
* global.c (global_conflicts): Likewise.
(calculate_reg_pav): Likewise.
* graph.c (print_rtl_graph_with_bb): Likewise.
* ifcvt.c (mark_loop_exit_edges): Likewise.
(merge_if_block): Likewise.
(find_if_header): Likewise.
(block_jumps_and_fallthru_p): Likewise.
(find_if_block): Likewise.
(find_cond_trap): Likewise.
(block_has_only_trap): Likewise.
(find_if_case1): Likewise.
(find_if_case_2): Likewise.
* lambda-code.c (lambda_loopnest_to_gcc_loopnest): Likewise.
(perfect_nestify): Likewise.
* lcm.c (compute_antinout_edge): Likewise.
(compute_laterin): Likewise.
(compute_available): Likewise.
(compute_nearerout): Likewise.
* loop-doloop.c (doloop_modify): Likewise.
* loop-init.c (loop_optimizer_init): Likewise.
* loop-invariant.c (find_exits): Likewise.
* loop-iv.c (simplify_using_initial_values): Likewise.
(check_simple_exit): Likewise.
(find_simple_exit): Likewise.
* loop-unroll.c (peel_loop_completely): Likewise.
(unroll_loop_constant_iterations): Likewise.
(unroll_loop_runtime_iterations): Likewise.
* loop-unswitch.c (may_unswitch_on): Likewise.
(unswitch_loop): Likewise.
* modulo-sched.c (generate_prolog_epilog): Likewise.
(sms_schedule): Likewise.
* postreload-gcse.c (eliminate_partially_redundant_load):
Likewise.
* predict.c (can_predict_insn_p): Likewise.
(set_even_probabilities): Likewise.
(combine_predictions_for_bb): Likewise.
(predict_loops): Likewise.
(estimate_probability): Likewise.
(tree_predict_by_opcode): Likewise.
(tree_estimate_probability): Likewise.
(last_basic_block_p): Likewise.
(propagate_freq): Likewise.
(estimate_loops_at_level): Likewise.
(estimate_bb_frequencies): Likewise.
* profile.c (instrument_edges): Likewise.
(get_exec_counts): Likewise.
(compute_branch_probabilities): Likewise.
(branch_prob): Likewise.
* ra-build.c (live_in): Likewise.
* ra-rewrite.c (rewrite_program2): Likewise.
* ra.c (reg_alloc): Likewise.
* reg-stack.c (reg_to_stack): Likewise.
(convert_regs_entry): Likewise.
(compensate_edge): Likewise.
(convert_regs_1): Likewise,
(convert_regs_2): Likewise.
(convert_regs): Likewise.
* regrename.c (copyprop_hardreg_forward): Likewise.
* reload1.c (fixup_abnormal_edges): Likewise.
* sbitmap.c (sbitmap_intersection_of_succs): Likewise.
(sbitmap_insersection_of_preds): Likewise.
(sbitmap_union_of_succs): Likewise.
(sbitmap_union_of_preds): Likewise.
* sched-ebb.c (compute_jump_reg_dependencies): Likewise.
(fix_basic_block_boundaries): Likewise.
(sched_ebbs): Likewise.
* sched-rgn.c (build_control_flow): Likewise.
(find_rgns): Likewise.
* tracer.c (find_best_successor): Likewise.
(find_best_predecessor): Likewise.
(tail_duplicate): Likewise.
* tree-cfg.c (make_edges): Likewise.
(make_ctrl_stmt_edges): Likewise.
(make_goto_expr_edges): Likewise.
(tree_can_merge_blocks_p): Likewise.
(tree_merge_blocks): Likewise.
(cfg_remove_useless_stmts_bb): Likewise.
(remove_phi_nodes_and_edges_for_unreachable_block): Likewise.
(tree_block_forwards_to): Likewise.
(cleanup_control_expr_graph): Likewise.
(find_taken_edge): Likewise.
(dump_cfg_stats): Likewise.
(tree_cfg2vcg): Likewise.
(disband_implicit_edges): Likewise.
(tree_find_edge_insert_loc): Likewise.
(bsi_commit_edge_inserts): Likewise.
(tree_split_edge): Likewise.
(tree_verify_flow_info): Likewise.
(tree_make_forwarder_block): Likewise.
(tree_forwarder_block_p): Likewise.
(thread_jumps): Likewise.
(tree_try_redirect_by_replacing_jump): Likewise.
(tree_split_block): Likewise.
(add_phi_args_after_copy_bb): Likewise.
(rewrite_to_new_ssa_names_bb): Likewise.
(dump_function_to_file): Likewise.
(print_pred_bbs): Likewise.
(print_loop): Likewise.
(tree_flow_call_edges_add): Likewise.
(split_critical_edges): Likewise.
(execute_warn_function_return): Likewise.
(extract_true_false_edges_from_block): Likewise.
* tree-if-conv.c (tree_if_conversion): Likewise.
(if_convertable_bb_p): Likewise.
(find_phi_replacement_condition): Likewise.
(combine_blocks): Likewise.
* tree-into-ssa.c (compute_global_livein): Likewise.
(ssa_mark_phi_uses): Likewise.
(ssa_rewrite_initialize_block): Likewise.
(rewrite_add_phi_arguments): Likewise.
(ssa_rewrite_phi_arguments): Likewise.
(insert_phi_nodes_for): Likewise.
(rewrite_into_ssa): Likewise.
(rewrite_ssa_into_ssa): Likewise.
* tree-mudflap.c (mf_build_check_statement_for): Likewise.
* tree-outof-ssa.c (coalesce_abnormal_edges): Likewise.
(rewrite_trees): Likewise.
* tree-pretty-print.c (dump_bb_header): Likewise.
(dump_implicit_edges): Likewise.
* tree-sra.c (insert_edge_copies): Likewise.
(find_obviously_necessary_stmts): Likewise.
(remove_data_stmt): Likewise.
* tree-ssa-dom.c (thread_across_edge): Likewise.
(dom_opt_finalize_block): Likewise.
(single_incoming_edge_ignoring_loop_edges): Likewise.
(record_equivalences_from_incoming_edges): Likewise.
(cprop_into_successor_phis): Likewise.
* tree-ssa-live.c (live_worklist): Likewise.
(calculate_live_on_entry): Likewise.
(calculate_live_on_exit): Likewise.
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p): Likewise.
(copy_loop_headers): Likewise.
* tree-ssa-loop-im.c (loop_commit_inserts): Likewise.
(fill_always_executed_in): Likewise.
* tree-ssa-loop-ivcanon.c (create_canonical_iv): Likewise.
* tree-ssa-loop-ivopts.c (find_interesting_uses): Likewise.
(compute_phi_arg_on_exit): Likewise.
* tree-ssa-loop-manip.c (add_exit_phis_edge): Likewise.
(get_loops_exit): Likewise.
(split_loop_exit_edge): Likewise.
(ip_normal_pos): Likewise.
* tree-ssa-loop-niter.c (simplify_using_initial_conditions):
Likewise.
* tree-ssa-phiopt.c (candidate_bb_for_phi_optimization): Likewise.
(replace_phi_with_stmt): Likewise.
(value_replacement): Likewise.
* tree-ssa-pre.c (compute_antic_aux): Likewise.
(insert_aux): Likewise.
(init_pre): Likewise.
* tree-ssa-propagate.c (simulate_stmt): Likewise.
(simulate_block): Likewise.
(ssa_prop_init): Likewise.
* tree-ssa-threadupdate.c (thread_block): Likewise.
(create_block_for_threading): Likewise.
(remove_last_stmt_and_useless_edges): Likewise.
* tree-ssa.c (verify_phi_args): Likewise.
(verify_ssa): Likewise.
* tree_tailcall.c (independent_of_stmt_p): Likewise.
(find_tail_calls): Likewise.
(eliminate_tail_call): Likewise.
(tree_optimize_tail_calls_1): Likewise.
* tree-vectorizer.c (vect_transform_loop): Likewise.
* var-tracking.c (prologue_stack_adjust): Likewise.
(vt_stack_adjustments): Likewise.
(vt_find_locations): Likewise.
* config/frv/frv.c (frv_ifcvt_modify_tests): Likewise.
* config/i386/i386.c (ix86_pad_returns): Likewise.
* config/ia64/ia64.c (ia64_expand_prologue): Likewise.
* config/rs6000/rs6000.c (rs6000_emit_prologue): Likewise.
Co-Authored-By: Andrew Pinski <pinskia@physics.uc.edu>
Co-Authored-By: Steven Bosscher <stevenb@suse.de>
From-SVN: r88222
2004-09-28 09:59:54 +02:00
|
|
|
|
edge_iterator ei;
|
2004-06-29 18:25:28 +02:00
|
|
|
|
bool first_copy;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
first_copy = true;
|
backport: basic-block.h: Include vec.h, errors.h.
2004-09-24 Ben Elliston <bje@au.ibm.com>
Steven Bosscher <stevenb@suse.de>
Andrew Pinski <pinskia@physics.uc.edu>
Merge from edge-vector-branch:
* basic-block.h: Include vec.h, errors.h. Instantiate a VEC(edge).
(struct edge_def): Remove pred_next, succ_next members.
(struct basic_block_def): Remove pred, succ members. Add preds
and succs members of type VEC(edge).
(FALLTHRU_EDGE): Redefine using EDGE_SUCC.
(BRANCH_EDGE): Likewise.
(EDGE_CRITICAL_P): Redefine using EDGE_COUNT.
(EDGE_COUNT, EDGE_I, EDGE_PRED, EDGE_SUCC): New.
(edge_iterator): New.
(ei_start, ei_last, ei_end_p, ei_one_before_end_p): New.
(ei_next, ei_prev, ei_edge, ei_safe_edge): Likewise.
(FOR_EACH_EDGE): New.
* bb-reorder.c (find_traces): Use FOR_EACH_EDGE and EDGE_* macros
where applicable.
(rotate_loop): Likewise.
(find_traces_1_route): Likewise.
(bb_to_key): Likewise.
(connect_traces): Likewise.
(copy_bb_p): Likewise.
(find_rarely_executed_basic_blocks_and_crossing_edges): Likewise.
(add_labels_and_missing_jumps): Likewise.
(fix_up_fall_thru_edges): Likewise.
(find_jump_block): Likewise.
(fix_crossing_conditional_branches): Likewise.
(fix_crossing_unconditional_branches): Likewise.
(add_reg_crossing_jump_notes): Likewise.
* bt-load.c (augment_live_range): Likewise.
* cfg.c (clear_edges): Likewise.
(unchecked_make_edge): Likewise.
(cached_make_edge): Likewise.
(make_single_succ_edge): Likewise.
(remove_edge): Likewise.
(redirect_edge_succ_nodup): Likewise.
(check_bb_profile): Likewise.
(dump_flow_info): Likewise.
(alloc_aux_for_edges): Likewise.
(clear_aux_for_edges): Likewise.
(dump_cfg_bb_info): Likewise.
* cfganal.c (forwarder_block_p): Likewise.
(can_fallthru): Likewise.
(could_fall_through): Likewise.
(mark_dfs_back_edges): Likewise.
(set_edge_can_fallthru_flag): Likewise.
(find_unreachable_blocks): Likewise.
(create_edge_list): Likewise.
(verify_edge_list): Likewise.
(add_noreturn_fake_exit_edges): Likewise.
(connect_infinite_loops_to_exit): Likewise.
(flow_reverse_top_sort_order_compute): Likewise.
(flow_depth_first_order_compute): Likewise.
(flow_preorder_transversal_compute): Likewise.
(flow_dfs_compute_reverse_execute): Likewise.
(dfs_enumerate_from): Likewise.
(compute_dominance_frontiers_1): Likewise.
* cfgbuild.c (make_edges): Likewise.
(compute_outgoing_frequencies): Likewise.
(find_many_sub_basic_blocks): Likewise.
(find_sub_basic_blocks): Likewise.
* cfgcleanup.c (try_simplify_condjump): Likewise.
(thread_jump): Likewise.
(try_forward_edges): Likewise.
(merge_blocks_move): Likewise.
(outgoing_edges_match): Likewise.
(try_crossjump_to_edge): Likewise.
(try_crossjump_bb): Likewise.
(try_optimize_cfg): Likewise.
(merge_seq_blocks): Likewise.
* cfgexpand.c (expand_gimple_tailcall): Likewise.
(expand_gimple_basic_block): Likewise.
(construct_init_block): Likewise.
(construct_exit_block): Likewise.
* cfghooks.c (verify_flow_info): Likewise.
(dump_bb): Likewise.
(delete_basic_block): Likewise.
(split_edge): Likewise.
(merge_blocks): Likewise.
(make_forwarder_block): Likewise.
(tidy_fallthru_edges): Likewise.
(can_duplicate_block_p): Likewise.
(duplicate_block): Likewise.
* cfglayout.c (fixup_reorder_chain): Likewise.
(fixup_fallthru_exit_predecessor): Likewise.
(can_copy_bbs_p): Likewise.
(copy_bbs): Likewise.
* cfgloop.c (flow_loops_cfg_dump): Likewise.
(flow_loop_entry_edges_find): Likewise.
(flow_loop_exit_edges_find): Likewise.
(flow_loop_nodes_find): Likewise.
(mark_single_exit_loops): Likewise.
(flow_loop_pre_header_scan): Likewise.
(flow_loop_pre_header_find): Likewise.
(update_latch_info): Likewise.
(canonicalize_loop_headers): Likewise.
(flow_loops_find): Likewise.
(get_loop_body_in_bfs_order): Likewise.
(get_loop_exit_edges): Likewise.
(num_loop_branches): Likewise.
(verify_loop_structure): Likewise.
(loop_latch_edge): Likewise.
(loop_preheader_edge): Likewise.
* cfgloopanal.c (mark_irreducible_loops): Likewise.
(expected_loop_iterations): Likewise.
* cfgloopmanip.c (remove_bbs): Likewise.
(fix_bb_placement): Likewise.
(fix_irreducible_loops): Likewise.
(remove_path): Likewise.
(scale_bbs_frequencies): Likewise.
(loopify): Likewise.
(unloop): Likewise.
(fix_loop_placement): Likewise.
(loop_delete_branch_edge): Likewise.
(duplicate_loop_to_header_edge): Likewise.
(mfb_keep_just): Likewise.
(create_preheader): Likewise.
(force_single_succ_latches): Likewise.
(loop_split_edge_with): Likewise.
(create_loop_notes): Likewise.
* cfgrtl.c (rtl_split_block): Likewise.
(rtl_merge_blocks): Likewise.
(rtl_can_merge_blocks): Likewise.
(try_redirect_by_replacing_jump): Likewise.
(force_nonfallthru_and_redirect): Likewise.
(rtl_tidy_fallthru_edge): Likewise.
(commit_one_edge_insertion): Likewise.
(commit_edge_insertions): Likewise.
(commit_edge_insertions_watch_calls): Likewise.
(rtl_verify_flow_info_1): Likewise.
(rtl_verify_flow_info): Likewise.
(purge_dead_edges): Likewise.
(cfg_layout_redirect_edge_and_branch): Likewise.
(cfg_layout_can_merge_blocks_p): Likewise.
(rtl_flow_call_edges_add): Likewise.
* cse.c (cse_cc_succs): Likewise.
* df.c (hybrid_search): Likewise.
* dominance.c (calc_dfs_tree_nonrec): Likewise.
(calc_dfs_tree): Likewise.
(calc_idoms): Likewise.
(recount_dominator): Likewise.
* domwalk.c (walk_dominator_tree): Likewise.
* except.c (emit_to_new_bb_before): Likewise.
(connect_post_landing_pads): Likewise.
(sjlj_emit_function_enter): Likewise.
(sjlj_emit_function_exit): Likewise.
(finish_eh_generation): Likewise.
* final.c (compute_alignments): Likewise.
* flow.c (calculate_global_regs_live): Likewise.
(initialize_uninitialized_subregs): Likewise.
(init_propagate_block_info): Likewise.
* function.c (thread_prologue_and_epilogue_insns): Likewise.
* gcse.c (find_implicit_sets): Likewise.
(bypass_block): Likewise.
(bypass_conditional_jumps): Likewise.
(compute_pre_data): Likewise.
(insert_insn_end_bb): Likewise.
(insert_store): Likewise.
(remove_reachable_equiv_notes): Likewise.
* global.c (global_conflicts): Likewise.
(calculate_reg_pav): Likewise.
* graph.c (print_rtl_graph_with_bb): Likewise.
* ifcvt.c (mark_loop_exit_edges): Likewise.
(merge_if_block): Likewise.
(find_if_header): Likewise.
(block_jumps_and_fallthru_p): Likewise.
(find_if_block): Likewise.
(find_cond_trap): Likewise.
(block_has_only_trap): Likewise.
(find_if_case1): Likewise.
(find_if_case_2): Likewise.
* lambda-code.c (lambda_loopnest_to_gcc_loopnest): Likewise.
(perfect_nestify): Likewise.
* lcm.c (compute_antinout_edge): Likewise.
(compute_laterin): Likewise.
(compute_available): Likewise.
(compute_nearerout): Likewise.
* loop-doloop.c (doloop_modify): Likewise.
* loop-init.c (loop_optimizer_init): Likewise.
* loop-invariant.c (find_exits): Likewise.
* loop-iv.c (simplify_using_initial_values): Likewise.
(check_simple_exit): Likewise.
(find_simple_exit): Likewise.
* loop-unroll.c (peel_loop_completely): Likewise.
(unroll_loop_constant_iterations): Likewise.
(unroll_loop_runtime_iterations): Likewise.
* loop-unswitch.c (may_unswitch_on): Likewise.
(unswitch_loop): Likewise.
* modulo-sched.c (generate_prolog_epilog): Likewise.
(sms_schedule): Likewise.
* postreload-gcse.c (eliminate_partially_redundant_load):
Likewise.
* predict.c (can_predict_insn_p): Likewise.
(set_even_probabilities): Likewise.
(combine_predictions_for_bb): Likewise.
(predict_loops): Likewise.
(estimate_probability): Likewise.
(tree_predict_by_opcode): Likewise.
(tree_estimate_probability): Likewise.
(last_basic_block_p): Likewise.
(propagate_freq): Likewise.
(estimate_loops_at_level): Likewise.
(estimate_bb_frequencies): Likewise.
* profile.c (instrument_edges): Likewise.
(get_exec_counts): Likewise.
(compute_branch_probabilities): Likewise.
(branch_prob): Likewise.
* ra-build.c (live_in): Likewise.
* ra-rewrite.c (rewrite_program2): Likewise.
* ra.c (reg_alloc): Likewise.
* reg-stack.c (reg_to_stack): Likewise.
(convert_regs_entry): Likewise.
(compensate_edge): Likewise.
(convert_regs_1): Likewise,
(convert_regs_2): Likewise.
(convert_regs): Likewise.
* regrename.c (copyprop_hardreg_forward): Likewise.
* reload1.c (fixup_abnormal_edges): Likewise.
* sbitmap.c (sbitmap_intersection_of_succs): Likewise.
(sbitmap_insersection_of_preds): Likewise.
(sbitmap_union_of_succs): Likewise.
(sbitmap_union_of_preds): Likewise.
* sched-ebb.c (compute_jump_reg_dependencies): Likewise.
(fix_basic_block_boundaries): Likewise.
(sched_ebbs): Likewise.
* sched-rgn.c (build_control_flow): Likewise.
(find_rgns): Likewise.
* tracer.c (find_best_successor): Likewise.
(find_best_predecessor): Likewise.
(tail_duplicate): Likewise.
* tree-cfg.c (make_edges): Likewise.
(make_ctrl_stmt_edges): Likewise.
(make_goto_expr_edges): Likewise.
(tree_can_merge_blocks_p): Likewise.
(tree_merge_blocks): Likewise.
(cfg_remove_useless_stmts_bb): Likewise.
(remove_phi_nodes_and_edges_for_unreachable_block): Likewise.
(tree_block_forwards_to): Likewise.
(cleanup_control_expr_graph): Likewise.
(find_taken_edge): Likewise.
(dump_cfg_stats): Likewise.
(tree_cfg2vcg): Likewise.
(disband_implicit_edges): Likewise.
(tree_find_edge_insert_loc): Likewise.
(bsi_commit_edge_inserts): Likewise.
(tree_split_edge): Likewise.
(tree_verify_flow_info): Likewise.
(tree_make_forwarder_block): Likewise.
(tree_forwarder_block_p): Likewise.
(thread_jumps): Likewise.
(tree_try_redirect_by_replacing_jump): Likewise.
(tree_split_block): Likewise.
(add_phi_args_after_copy_bb): Likewise.
(rewrite_to_new_ssa_names_bb): Likewise.
(dump_function_to_file): Likewise.
(print_pred_bbs): Likewise.
(print_loop): Likewise.
(tree_flow_call_edges_add): Likewise.
(split_critical_edges): Likewise.
(execute_warn_function_return): Likewise.
(extract_true_false_edges_from_block): Likewise.
* tree-if-conv.c (tree_if_conversion): Likewise.
(if_convertable_bb_p): Likewise.
(find_phi_replacement_condition): Likewise.
(combine_blocks): Likewise.
* tree-into-ssa.c (compute_global_livein): Likewise.
(ssa_mark_phi_uses): Likewise.
(ssa_rewrite_initialize_block): Likewise.
(rewrite_add_phi_arguments): Likewise.
(ssa_rewrite_phi_arguments): Likewise.
(insert_phi_nodes_for): Likewise.
(rewrite_into_ssa): Likewise.
(rewrite_ssa_into_ssa): Likewise.
* tree-mudflap.c (mf_build_check_statement_for): Likewise.
* tree-outof-ssa.c (coalesce_abnormal_edges): Likewise.
(rewrite_trees): Likewise.
* tree-pretty-print.c (dump_bb_header): Likewise.
(dump_implicit_edges): Likewise.
* tree-sra.c (insert_edge_copies): Likewise.
(find_obviously_necessary_stmts): Likewise.
(remove_data_stmt): Likewise.
* tree-ssa-dom.c (thread_across_edge): Likewise.
(dom_opt_finalize_block): Likewise.
(single_incoming_edge_ignoring_loop_edges): Likewise.
(record_equivalences_from_incoming_edges): Likewise.
(cprop_into_successor_phis): Likewise.
* tree-ssa-live.c (live_worklist): Likewise.
(calculate_live_on_entry): Likewise.
(calculate_live_on_exit): Likewise.
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p): Likewise.
(copy_loop_headers): Likewise.
* tree-ssa-loop-im.c (loop_commit_inserts): Likewise.
(fill_always_executed_in): Likewise.
* tree-ssa-loop-ivcanon.c (create_canonical_iv): Likewise.
* tree-ssa-loop-ivopts.c (find_interesting_uses): Likewise.
(compute_phi_arg_on_exit): Likewise.
* tree-ssa-loop-manip.c (add_exit_phis_edge): Likewise.
(get_loops_exit): Likewise.
(split_loop_exit_edge): Likewise.
(ip_normal_pos): Likewise.
* tree-ssa-loop-niter.c (simplify_using_initial_conditions):
Likewise.
* tree-ssa-phiopt.c (candidate_bb_for_phi_optimization): Likewise.
(replace_phi_with_stmt): Likewise.
(value_replacement): Likewise.
* tree-ssa-pre.c (compute_antic_aux): Likewise.
(insert_aux): Likewise.
(init_pre): Likewise.
* tree-ssa-propagate.c (simulate_stmt): Likewise.
(simulate_block): Likewise.
(ssa_prop_init): Likewise.
* tree-ssa-threadupdate.c (thread_block): Likewise.
(create_block_for_threading): Likewise.
(remove_last_stmt_and_useless_edges): Likewise.
* tree-ssa.c (verify_phi_args): Likewise.
(verify_ssa): Likewise.
* tree_tailcall.c (independent_of_stmt_p): Likewise.
(find_tail_calls): Likewise.
(eliminate_tail_call): Likewise.
(tree_optimize_tail_calls_1): Likewise.
* tree-vectorizer.c (vect_transform_loop): Likewise.
* var-tracking.c (prologue_stack_adjust): Likewise.
(vt_stack_adjustments): Likewise.
(vt_find_locations): Likewise.
* config/frv/frv.c (frv_ifcvt_modify_tests): Likewise.
* config/i386/i386.c (ix86_pad_returns): Likewise.
* config/ia64/ia64.c (ia64_expand_prologue): Likewise.
* config/rs6000/rs6000.c (rs6000_emit_prologue): Likewise.
Co-Authored-By: Andrew Pinski <pinskia@physics.uc.edu>
Co-Authored-By: Steven Bosscher <stevenb@suse.de>
From-SVN: r88222
2004-09-28 09:59:54 +02:00
|
|
|
|
FOR_EACH_EDGE (e, ei, bb->succs)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* We don't need to insert copies on abnormal edges. The
|
|
|
|
|
value of the scalar replacement is not guaranteed to
|
|
|
|
|
be valid through an abnormal edge. */
|
|
|
|
|
if (!(e->flags & EDGE_ABNORMAL))
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
if (first_copy)
|
|
|
|
|
{
|
|
|
|
|
bsi_insert_on_edge (e, stmt);
|
|
|
|
|
first_copy = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
2004-08-19 23:34:37 +02:00
|
|
|
|
bsi_insert_on_edge (e, unsave_expr_now (stmt));
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Helper function to insert LIST before BSI, and set up line number info. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
|
|
static void
|
2004-06-29 18:25:28 +02:00
|
|
|
|
sra_insert_before (block_stmt_iterator *bsi, tree list)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
|
|
|
|
tree stmt = bsi_stmt (*bsi);
|
|
|
|
|
|
|
|
|
|
if (EXPR_HAS_LOCATION (stmt))
|
|
|
|
|
annotate_all_with_locus (&list, EXPR_LOCATION (stmt));
|
|
|
|
|
bsi_insert_before (bsi, list, BSI_SAME_STMT);
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Similarly, but insert after BSI. Handles insertion onto edges as well. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
|
|
static void
|
2004-06-29 18:25:28 +02:00
|
|
|
|
sra_insert_after (block_stmt_iterator *bsi, tree list)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
tree stmt = bsi_stmt (*bsi);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
if (EXPR_HAS_LOCATION (stmt))
|
|
|
|
|
annotate_all_with_locus (&list, EXPR_LOCATION (stmt));
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
if (stmt_ends_bb_p (stmt))
|
|
|
|
|
insert_edge_copies (list, bsi->bb);
|
|
|
|
|
else
|
2004-07-04 04:52:36 +02:00
|
|
|
|
bsi_insert_after (bsi, list, BSI_SAME_STMT);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Similarly, but replace the statement at BSI. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
|
|
static void
|
2004-06-29 18:25:28 +02:00
|
|
|
|
sra_replace (block_stmt_iterator *bsi, tree list)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
sra_insert_before (bsi, list);
|
|
|
|
|
bsi_remove (bsi);
|
|
|
|
|
if (bsi_end_p (*bsi))
|
|
|
|
|
*bsi = bsi_last (bsi->bb);
|
|
|
|
|
else
|
|
|
|
|
bsi_prev (bsi);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Scalarize a USE. To recap, this is either a simple reference to ELT,
|
2004-07-02 02:51:01 +02:00
|
|
|
|
if elt is scalar, or some occurrence of ELT that requires a complete
|
2004-06-29 18:25:28 +02:00
|
|
|
|
aggregate. IS_OUTPUT is true if ELT is being modified. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
|
|
static void
|
2004-06-29 18:25:28 +02:00
|
|
|
|
scalarize_use (struct sra_elt *elt, tree *expr_p, block_stmt_iterator *bsi,
|
|
|
|
|
bool is_output)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
tree list = NULL, stmt = bsi_stmt (*bsi);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
if (elt->replacement)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* If we have a replacement, then updating the reference is as
|
|
|
|
|
simple as modifying the existing statement in place. */
|
|
|
|
|
if (is_output)
|
|
|
|
|
mark_all_v_defs (stmt);
|
|
|
|
|
*expr_p = elt->replacement;
|
|
|
|
|
modify_stmt (stmt);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
2004-06-29 18:25:28 +02:00
|
|
|
|
else
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Otherwise we need some copies. If ELT is being read, then we want
|
|
|
|
|
to store all (modified) sub-elements back into the structure before
|
|
|
|
|
the reference takes place. If ELT is being written, then we want to
|
|
|
|
|
load the changed values back into our shadow variables. */
|
|
|
|
|
/* ??? We don't check modified for reads, we just always write all of
|
|
|
|
|
the values. We should be able to record the SSA number of the VOP
|
|
|
|
|
for which the values were last read. If that number matches the
|
|
|
|
|
SSA number of the VOP in the current statement, then we needn't
|
|
|
|
|
emit an assignment. This would also eliminate double writes when
|
|
|
|
|
a structure is passed as more than one argument to a function call.
|
|
|
|
|
This optimization would be most effective if sra_walk_function
|
|
|
|
|
processed the blocks in dominator order. */
|
|
|
|
|
|
|
|
|
|
generate_copy_inout (elt, is_output, generate_element_ref (elt), &list);
|
|
|
|
|
if (list == NULL)
|
|
|
|
|
return;
|
2004-08-18 01:33:46 +02:00
|
|
|
|
mark_all_v_defs (expr_first (list));
|
2004-06-29 18:25:28 +02:00
|
|
|
|
if (is_output)
|
2004-08-18 01:33:46 +02:00
|
|
|
|
sra_insert_after (bsi, list);
|
2004-06-29 18:25:28 +02:00
|
|
|
|
else
|
|
|
|
|
sra_insert_before (bsi, list);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Scalarize a COPY. To recap, this is an assignment statement between
|
|
|
|
|
two scalarizable references, LHS_ELT and RHS_ELT. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
static void
|
|
|
|
|
scalarize_copy (struct sra_elt *lhs_elt, struct sra_elt *rhs_elt,
|
|
|
|
|
block_stmt_iterator *bsi)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
tree list, stmt;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
if (lhs_elt->replacement && rhs_elt->replacement)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* If we have two scalar operands, modify the existing statement. */
|
|
|
|
|
stmt = bsi_stmt (*bsi);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* See the commentary in sra_walk_function concerning
|
|
|
|
|
RETURN_EXPR, and why we should never see one here. */
|
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* targhooks.c (default_unwind_emit, default_scalar_mode_supported_p):
Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* timevar.c (timevar_push, timevar_pop, timevar_start,
timevar_stop): Likewise.
* toplev.c (default_pch_valid_p): Likewise.
* tracer.c (tail_duplicate): Likewise.
* tree-alias-common.c (get_alias_var_decl,
get_values_from_constructor, create_alias_var, delete_alias_vars,
empty_points_to_set, same_points_to_set, ptr_may_alias_var):
Likewise.
* tree.c (tree_size, make_node_stat, copy_node_stat,
build_int_cst_wide, integer_all_onesp, list_length, chainon,
tree_node_structure, type_contains_placeholder_p, substitute_in_expr,
substitute_placeholder_in_expr, tabilize_reference_1, build0_stat,
build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p,
lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr,
build_method_type_directly, decl_type_context, get_callee_fndecl,
get_set_constructor_bits, build_vector_type_for_mode, int_cst_value,
tree_fold_gcd): Likewise.
* tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges,
make_cond_expr_edges, group_case_labels, tree_merge_blocks,
cleanup_control_expr_graph, find_taken_edge,
find_taken_edge_switch_expr, phi_alternatives_equal,
is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt,
stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate,
tree_split_edge, tree_verify_flow_info, thread_jumps,
tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise.
* tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly,
chrec_fold_multiply_poly_poly): Likewise.
* tree-complex.c (extract_component, expand_complex_division,
expand_complex_comparison, expand_complex_operations_1,
build_replicated_const, expand_vector_operations_1): Likewise.
* tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector,
build_classic_dir_vector): Likewise.
* tree-dfa.c (compute_immediate_uses_for_phi,
compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann,
create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise.
* tree-dump.c (dequeue_and_dump): Likewise.
* tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region,
record_in_finally_tree, replace_goto_queue_1,
maybe_record_in_goto_queue, verify_norecord_switch_expr,
do_return_redirection): Likewise.
* tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr,
add_to_dst_predicate_list, find_phi_replacement_condition,
replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order):
Likewise.
* tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r,
initialize_inlined_parameters, declare_return_variable,
estimate_num_insns_1, expand_call_inline, expand_calls_inline,
optimize_inline_calls, copy_tree_r): Likewise.
* tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt,
ssa_rewrite_stmt, rewrite_into_ssa): Likewise.
* tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after,
tsi_split_statement_list_after, tsi_split_statement_list_before):
Likewise.
* tree-mudflap.c (mf_varname_tree): Likewise.
* tree-nested.c (create_tmp_var_for, lookup_field_for_decl,
lookup_tramp_for_decl, convert_all_function_calls): Likewise.
* tree-optimize.c (tree_rest_of_compilation): Likewise.
* tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi,
coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis,
free_temp_expr_table, add_dependance, finish_expr, rewrite_trees):
Likewise.
* tree-phinodes.c (resize_phi_node, add_phi_arg,
remove_all_phi_nodes_for): Likewise.
* tree-pretty-print.c (op_prio, print_call_name): Likewise.
* tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler,
tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise.
* tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree,
sra_elt_eq, sra_walk_expr, instantiate_missing_elements,
generate_one_element_ref, generate_element_copy,
generate_element_zero, scalarize_copy, scalarize_init,
scalarize_ldst): Likewise.
* tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p,
add_may_alias, add_pointed_to_expr, add_pointed_to_var,
collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise.
* tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise.
* tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value,
set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment,
widen_bitfield, ccp_fold_builtin): Likewise.
* tree-ssa-copy.c (may_propagate_copy, merge_alias_info,
replace_exp_1, propagate_tree_value): Likewise.
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise.
* tree-ssa-dce.c (set_control_dependence_map_bit,
find_control_dependence, find_pdom, mark_operand_necessary,
mark_stmt_if_obviously_necessary,
mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise.
* tree-ssa-dom.c (dom_opt_initialize_block_local_data,
simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis,
eliminate_redundant_computations, avail_expr_eq): Likewise.
* tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise.
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p,
duplicate_blocks): Likewise.
* tree-ssa-loop-im.c (for_each_index, set_level,
is_call_clobbered_ref): Likewise.
* tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos,
stmt_after_increment, set_iv, contains_abnormal_ssa_name_p,
find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates,
peel_address, ptr_difference_cost, may_replace_final_value,
determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer,
rewrite_use, rewrite_uses): Likewise.
* tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa,
check_loop_closed_ssa_use): Likewise.
* tree-ssanames.c (make_ssa_name): Likewise.
* tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses,
finalize_ssa_v_must_defs, finalize_ssa_stmt_operands,
get_stmt_operands, get_expr_operands, get_asm_expr_operands,
get_indirect_ref_operands, add_stmt_operand): Likewise.
* tree-ssa-pre.c (value_exists_in_set_bitmap,
value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set,
phi_translate, valid_in_set, compute_antic,
find_or_generate_expression, create_expression_by_pieces, insert_aux,
create_value_expr_from, eliminate): Likewise.
* tree-ssa-propagate.c (cfg_blocks_get): Likewise.
* tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges):
Likewise.
* tree-tailcall.c (independent_of_stmt_p, adjust_return_value,
eliminate_tail_call): Likewise.
* tree-vectorizer.c (vect_create_index_for_array_ref,
vect_align_data_ref, vect_create_data_ref,
vect_create_destination_var, vect_get_vec_def_for_operand,
vect_finish_stmt_generation, vect_transform_stmt,
vect_transform_loop_bound, vect_transform_loop,
vect_analyze_operations): Likewise.
* tree-vn.c (vn_compute, set_value_handle, get_value_handle):
Likewise.
* tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr,
get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start,
bsi_after_labels, bsi_last): Likewise.
* tree-ssa-live.c (var_union, change_partition_var,
create_ssa_var_map, calculate_live_on_entry, root_var_init,
type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce):
Likewise.
* tree-ssa-live.h (partition_is_global, live_entry_blocks,
tpa_find_tree): Likewise.
(register_ssa_partition_check): Declare.
(register_ssa_partition): use it.
* tree-ssa-live.c: Include errors.h.
(register_ssa_partition_check): New.
* tree-ssa-operands.c: Include errors.h.
* Makefile.in (tree-ssa-operands.o): Depend on errors.h.
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
From-SVN: r87223
2004-09-09 09:54:12 +02:00
|
|
|
|
gcc_assert (TREE_CODE (stmt) == MODIFY_EXPR);
|
2004-06-29 18:25:28 +02:00
|
|
|
|
|
|
|
|
|
TREE_OPERAND (stmt, 0) = lhs_elt->replacement;
|
|
|
|
|
TREE_OPERAND (stmt, 1) = rhs_elt->replacement;
|
|
|
|
|
modify_stmt (stmt);
|
|
|
|
|
}
|
|
|
|
|
else if (lhs_elt->use_block_copy || rhs_elt->use_block_copy)
|
|
|
|
|
{
|
|
|
|
|
/* If either side requires a block copy, then sync the RHS back
|
2004-08-19 23:34:37 +02:00
|
|
|
|
to the original structure, leave the original assignment
|
2004-06-29 18:25:28 +02:00
|
|
|
|
statement (which will perform the block copy), then load the
|
|
|
|
|
LHS values out of its now-updated original structure. */
|
|
|
|
|
/* ??? Could perform a modified pair-wise element copy. That
|
|
|
|
|
would at least allow those elements that are instantiated in
|
|
|
|
|
both structures to be optimized well. */
|
|
|
|
|
|
|
|
|
|
list = NULL;
|
|
|
|
|
generate_copy_inout (rhs_elt, false,
|
|
|
|
|
generate_element_ref (rhs_elt), &list);
|
|
|
|
|
if (list)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
mark_all_v_defs (expr_first (list));
|
|
|
|
|
sra_insert_before (bsi, list);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
2004-06-29 18:25:28 +02:00
|
|
|
|
|
|
|
|
|
list = NULL;
|
|
|
|
|
generate_copy_inout (lhs_elt, true,
|
|
|
|
|
generate_element_ref (lhs_elt), &list);
|
|
|
|
|
if (list)
|
|
|
|
|
sra_insert_after (bsi, list);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
2004-06-29 18:25:28 +02:00
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* Otherwise both sides must be fully instantiated. In which
|
|
|
|
|
case perform pair-wise element assignments and replace the
|
|
|
|
|
original block copy statement. */
|
|
|
|
|
|
|
|
|
|
stmt = bsi_stmt (*bsi);
|
|
|
|
|
mark_all_v_defs (stmt);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
list = NULL;
|
|
|
|
|
generate_element_copy (lhs_elt, rhs_elt, &list);
|
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* targhooks.c (default_unwind_emit, default_scalar_mode_supported_p):
Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* timevar.c (timevar_push, timevar_pop, timevar_start,
timevar_stop): Likewise.
* toplev.c (default_pch_valid_p): Likewise.
* tracer.c (tail_duplicate): Likewise.
* tree-alias-common.c (get_alias_var_decl,
get_values_from_constructor, create_alias_var, delete_alias_vars,
empty_points_to_set, same_points_to_set, ptr_may_alias_var):
Likewise.
* tree.c (tree_size, make_node_stat, copy_node_stat,
build_int_cst_wide, integer_all_onesp, list_length, chainon,
tree_node_structure, type_contains_placeholder_p, substitute_in_expr,
substitute_placeholder_in_expr, tabilize_reference_1, build0_stat,
build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p,
lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr,
build_method_type_directly, decl_type_context, get_callee_fndecl,
get_set_constructor_bits, build_vector_type_for_mode, int_cst_value,
tree_fold_gcd): Likewise.
* tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges,
make_cond_expr_edges, group_case_labels, tree_merge_blocks,
cleanup_control_expr_graph, find_taken_edge,
find_taken_edge_switch_expr, phi_alternatives_equal,
is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt,
stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate,
tree_split_edge, tree_verify_flow_info, thread_jumps,
tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise.
* tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly,
chrec_fold_multiply_poly_poly): Likewise.
* tree-complex.c (extract_component, expand_complex_division,
expand_complex_comparison, expand_complex_operations_1,
build_replicated_const, expand_vector_operations_1): Likewise.
* tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector,
build_classic_dir_vector): Likewise.
* tree-dfa.c (compute_immediate_uses_for_phi,
compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann,
create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise.
* tree-dump.c (dequeue_and_dump): Likewise.
* tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region,
record_in_finally_tree, replace_goto_queue_1,
maybe_record_in_goto_queue, verify_norecord_switch_expr,
do_return_redirection): Likewise.
* tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr,
add_to_dst_predicate_list, find_phi_replacement_condition,
replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order):
Likewise.
* tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r,
initialize_inlined_parameters, declare_return_variable,
estimate_num_insns_1, expand_call_inline, expand_calls_inline,
optimize_inline_calls, copy_tree_r): Likewise.
* tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt,
ssa_rewrite_stmt, rewrite_into_ssa): Likewise.
* tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after,
tsi_split_statement_list_after, tsi_split_statement_list_before):
Likewise.
* tree-mudflap.c (mf_varname_tree): Likewise.
* tree-nested.c (create_tmp_var_for, lookup_field_for_decl,
lookup_tramp_for_decl, convert_all_function_calls): Likewise.
* tree-optimize.c (tree_rest_of_compilation): Likewise.
* tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi,
coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis,
free_temp_expr_table, add_dependance, finish_expr, rewrite_trees):
Likewise.
* tree-phinodes.c (resize_phi_node, add_phi_arg,
remove_all_phi_nodes_for): Likewise.
* tree-pretty-print.c (op_prio, print_call_name): Likewise.
* tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler,
tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise.
* tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree,
sra_elt_eq, sra_walk_expr, instantiate_missing_elements,
generate_one_element_ref, generate_element_copy,
generate_element_zero, scalarize_copy, scalarize_init,
scalarize_ldst): Likewise.
* tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p,
add_may_alias, add_pointed_to_expr, add_pointed_to_var,
collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise.
* tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise.
* tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value,
set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment,
widen_bitfield, ccp_fold_builtin): Likewise.
* tree-ssa-copy.c (may_propagate_copy, merge_alias_info,
replace_exp_1, propagate_tree_value): Likewise.
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise.
* tree-ssa-dce.c (set_control_dependence_map_bit,
find_control_dependence, find_pdom, mark_operand_necessary,
mark_stmt_if_obviously_necessary,
mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise.
* tree-ssa-dom.c (dom_opt_initialize_block_local_data,
simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis,
eliminate_redundant_computations, avail_expr_eq): Likewise.
* tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise.
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p,
duplicate_blocks): Likewise.
* tree-ssa-loop-im.c (for_each_index, set_level,
is_call_clobbered_ref): Likewise.
* tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos,
stmt_after_increment, set_iv, contains_abnormal_ssa_name_p,
find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates,
peel_address, ptr_difference_cost, may_replace_final_value,
determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer,
rewrite_use, rewrite_uses): Likewise.
* tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa,
check_loop_closed_ssa_use): Likewise.
* tree-ssanames.c (make_ssa_name): Likewise.
* tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses,
finalize_ssa_v_must_defs, finalize_ssa_stmt_operands,
get_stmt_operands, get_expr_operands, get_asm_expr_operands,
get_indirect_ref_operands, add_stmt_operand): Likewise.
* tree-ssa-pre.c (value_exists_in_set_bitmap,
value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set,
phi_translate, valid_in_set, compute_antic,
find_or_generate_expression, create_expression_by_pieces, insert_aux,
create_value_expr_from, eliminate): Likewise.
* tree-ssa-propagate.c (cfg_blocks_get): Likewise.
* tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges):
Likewise.
* tree-tailcall.c (independent_of_stmt_p, adjust_return_value,
eliminate_tail_call): Likewise.
* tree-vectorizer.c (vect_create_index_for_array_ref,
vect_align_data_ref, vect_create_data_ref,
vect_create_destination_var, vect_get_vec_def_for_operand,
vect_finish_stmt_generation, vect_transform_stmt,
vect_transform_loop_bound, vect_transform_loop,
vect_analyze_operations): Likewise.
* tree-vn.c (vn_compute, set_value_handle, get_value_handle):
Likewise.
* tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr,
get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start,
bsi_after_labels, bsi_last): Likewise.
* tree-ssa-live.c (var_union, change_partition_var,
create_ssa_var_map, calculate_live_on_entry, root_var_init,
type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce):
Likewise.
* tree-ssa-live.h (partition_is_global, live_entry_blocks,
tpa_find_tree): Likewise.
(register_ssa_partition_check): Declare.
(register_ssa_partition): use it.
* tree-ssa-live.c: Include errors.h.
(register_ssa_partition_check): New.
* tree-ssa-operands.c: Include errors.h.
* Makefile.in (tree-ssa-operands.o): Depend on errors.h.
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
From-SVN: r87223
2004-09-09 09:54:12 +02:00
|
|
|
|
gcc_assert (list);
|
2004-06-29 18:25:28 +02:00
|
|
|
|
sra_replace (bsi, list);
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Scalarize an INIT. To recap, this is an assignment to a scalarizable
|
|
|
|
|
reference from some form of constructor: CONSTRUCTOR, COMPLEX_CST or
|
|
|
|
|
COMPLEX_EXPR. If RHS is NULL, it should be treated as an empty
|
2004-07-07 01:02:22 +02:00
|
|
|
|
CONSTRUCTOR. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-07-07 01:02:22 +02:00
|
|
|
|
static void
|
2004-06-29 18:25:28 +02:00
|
|
|
|
scalarize_init (struct sra_elt *lhs_elt, tree rhs, block_stmt_iterator *bsi)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-07-05 18:14:51 +02:00
|
|
|
|
bool result = true;
|
2004-06-29 18:25:28 +02:00
|
|
|
|
tree list = NULL;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Generate initialization statements for all members extant in the RHS. */
|
|
|
|
|
if (rhs)
|
2004-07-11 19:33:02 +02:00
|
|
|
|
{
|
2004-11-22 21:02:16 +01:00
|
|
|
|
/* Unshare the expression just in case this is from a decl's initial. */
|
|
|
|
|
rhs = unshare_expr (rhs);
|
2004-07-11 19:33:02 +02:00
|
|
|
|
result = generate_element_init (lhs_elt, rhs, &list);
|
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* CONSTRUCTOR is defined such that any member not mentioned is assigned
|
|
|
|
|
a zero value. Initialize the rest of the instantiated elements. */
|
|
|
|
|
generate_element_zero (lhs_elt, &list);
|
2004-07-05 18:14:51 +02:00
|
|
|
|
|
2004-07-07 01:02:22 +02:00
|
|
|
|
if (!result)
|
|
|
|
|
{
|
|
|
|
|
/* If we failed to convert the entire initializer, then we must
|
|
|
|
|
leave the structure assignment in place and must load values
|
|
|
|
|
from the structure into the slots for which we did not find
|
|
|
|
|
constants. The easiest way to do this is to generate a complete
|
|
|
|
|
copy-out, and then follow that with the constant assignments
|
|
|
|
|
that we were able to build. DCE will clean things up. */
|
|
|
|
|
tree list0 = NULL;
|
|
|
|
|
generate_copy_inout (lhs_elt, true, generate_element_ref (lhs_elt),
|
|
|
|
|
&list0);
|
|
|
|
|
append_to_statement_list (list, &list0);
|
|
|
|
|
list = list0;
|
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-07-07 01:02:22 +02:00
|
|
|
|
if (lhs_elt->use_block_copy || !result)
|
2004-06-29 18:25:28 +02:00
|
|
|
|
{
|
|
|
|
|
/* Since LHS is not fully instantiated, we must leave the structure
|
|
|
|
|
assignment in place. Treating this case differently from a USE
|
|
|
|
|
exposes constants to later optimizations. */
|
2004-07-07 01:02:22 +02:00
|
|
|
|
if (list)
|
|
|
|
|
{
|
|
|
|
|
mark_all_v_defs (expr_first (list));
|
|
|
|
|
sra_insert_after (bsi, list);
|
|
|
|
|
}
|
2004-06-29 18:25:28 +02:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
/* The LHS is fully instantiated. The list of initializations
|
|
|
|
|
replaces the original structure assignment. */
|
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* targhooks.c (default_unwind_emit, default_scalar_mode_supported_p):
Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* timevar.c (timevar_push, timevar_pop, timevar_start,
timevar_stop): Likewise.
* toplev.c (default_pch_valid_p): Likewise.
* tracer.c (tail_duplicate): Likewise.
* tree-alias-common.c (get_alias_var_decl,
get_values_from_constructor, create_alias_var, delete_alias_vars,
empty_points_to_set, same_points_to_set, ptr_may_alias_var):
Likewise.
* tree.c (tree_size, make_node_stat, copy_node_stat,
build_int_cst_wide, integer_all_onesp, list_length, chainon,
tree_node_structure, type_contains_placeholder_p, substitute_in_expr,
substitute_placeholder_in_expr, tabilize_reference_1, build0_stat,
build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p,
lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr,
build_method_type_directly, decl_type_context, get_callee_fndecl,
get_set_constructor_bits, build_vector_type_for_mode, int_cst_value,
tree_fold_gcd): Likewise.
* tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges,
make_cond_expr_edges, group_case_labels, tree_merge_blocks,
cleanup_control_expr_graph, find_taken_edge,
find_taken_edge_switch_expr, phi_alternatives_equal,
is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt,
stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate,
tree_split_edge, tree_verify_flow_info, thread_jumps,
tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise.
* tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly,
chrec_fold_multiply_poly_poly): Likewise.
* tree-complex.c (extract_component, expand_complex_division,
expand_complex_comparison, expand_complex_operations_1,
build_replicated_const, expand_vector_operations_1): Likewise.
* tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector,
build_classic_dir_vector): Likewise.
* tree-dfa.c (compute_immediate_uses_for_phi,
compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann,
create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise.
* tree-dump.c (dequeue_and_dump): Likewise.
* tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region,
record_in_finally_tree, replace_goto_queue_1,
maybe_record_in_goto_queue, verify_norecord_switch_expr,
do_return_redirection): Likewise.
* tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr,
add_to_dst_predicate_list, find_phi_replacement_condition,
replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order):
Likewise.
* tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r,
initialize_inlined_parameters, declare_return_variable,
estimate_num_insns_1, expand_call_inline, expand_calls_inline,
optimize_inline_calls, copy_tree_r): Likewise.
* tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt,
ssa_rewrite_stmt, rewrite_into_ssa): Likewise.
* tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after,
tsi_split_statement_list_after, tsi_split_statement_list_before):
Likewise.
* tree-mudflap.c (mf_varname_tree): Likewise.
* tree-nested.c (create_tmp_var_for, lookup_field_for_decl,
lookup_tramp_for_decl, convert_all_function_calls): Likewise.
* tree-optimize.c (tree_rest_of_compilation): Likewise.
* tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi,
coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis,
free_temp_expr_table, add_dependance, finish_expr, rewrite_trees):
Likewise.
* tree-phinodes.c (resize_phi_node, add_phi_arg,
remove_all_phi_nodes_for): Likewise.
* tree-pretty-print.c (op_prio, print_call_name): Likewise.
* tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler,
tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise.
* tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree,
sra_elt_eq, sra_walk_expr, instantiate_missing_elements,
generate_one_element_ref, generate_element_copy,
generate_element_zero, scalarize_copy, scalarize_init,
scalarize_ldst): Likewise.
* tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p,
add_may_alias, add_pointed_to_expr, add_pointed_to_var,
collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise.
* tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise.
* tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value,
set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment,
widen_bitfield, ccp_fold_builtin): Likewise.
* tree-ssa-copy.c (may_propagate_copy, merge_alias_info,
replace_exp_1, propagate_tree_value): Likewise.
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise.
* tree-ssa-dce.c (set_control_dependence_map_bit,
find_control_dependence, find_pdom, mark_operand_necessary,
mark_stmt_if_obviously_necessary,
mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise.
* tree-ssa-dom.c (dom_opt_initialize_block_local_data,
simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis,
eliminate_redundant_computations, avail_expr_eq): Likewise.
* tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise.
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p,
duplicate_blocks): Likewise.
* tree-ssa-loop-im.c (for_each_index, set_level,
is_call_clobbered_ref): Likewise.
* tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos,
stmt_after_increment, set_iv, contains_abnormal_ssa_name_p,
find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates,
peel_address, ptr_difference_cost, may_replace_final_value,
determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer,
rewrite_use, rewrite_uses): Likewise.
* tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa,
check_loop_closed_ssa_use): Likewise.
* tree-ssanames.c (make_ssa_name): Likewise.
* tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses,
finalize_ssa_v_must_defs, finalize_ssa_stmt_operands,
get_stmt_operands, get_expr_operands, get_asm_expr_operands,
get_indirect_ref_operands, add_stmt_operand): Likewise.
* tree-ssa-pre.c (value_exists_in_set_bitmap,
value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set,
phi_translate, valid_in_set, compute_antic,
find_or_generate_expression, create_expression_by_pieces, insert_aux,
create_value_expr_from, eliminate): Likewise.
* tree-ssa-propagate.c (cfg_blocks_get): Likewise.
* tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges):
Likewise.
* tree-tailcall.c (independent_of_stmt_p, adjust_return_value,
eliminate_tail_call): Likewise.
* tree-vectorizer.c (vect_create_index_for_array_ref,
vect_align_data_ref, vect_create_data_ref,
vect_create_destination_var, vect_get_vec_def_for_operand,
vect_finish_stmt_generation, vect_transform_stmt,
vect_transform_loop_bound, vect_transform_loop,
vect_analyze_operations): Likewise.
* tree-vn.c (vn_compute, set_value_handle, get_value_handle):
Likewise.
* tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr,
get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start,
bsi_after_labels, bsi_last): Likewise.
* tree-ssa-live.c (var_union, change_partition_var,
create_ssa_var_map, calculate_live_on_entry, root_var_init,
type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce):
Likewise.
* tree-ssa-live.h (partition_is_global, live_entry_blocks,
tpa_find_tree): Likewise.
(register_ssa_partition_check): Declare.
(register_ssa_partition): use it.
* tree-ssa-live.c: Include errors.h.
(register_ssa_partition_check): New.
* tree-ssa-operands.c: Include errors.h.
* Makefile.in (tree-ssa-operands.o): Depend on errors.h.
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
From-SVN: r87223
2004-09-09 09:54:12 +02:00
|
|
|
|
gcc_assert (list);
|
2004-06-29 18:25:28 +02:00
|
|
|
|
mark_all_v_defs (bsi_stmt (*bsi));
|
|
|
|
|
sra_replace (bsi, list);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* A subroutine of scalarize_ldst called via walk_tree. Set TREE_NO_TRAP
|
|
|
|
|
on all INDIRECT_REFs. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
static tree
|
|
|
|
|
mark_notrap (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
tree t = *tp;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
if (TREE_CODE (t) == INDIRECT_REF)
|
|
|
|
|
{
|
|
|
|
|
TREE_THIS_NOTRAP (t) = 1;
|
|
|
|
|
*walk_subtrees = 0;
|
|
|
|
|
}
|
alias.c (find_base_decl): Remove unreachable case '3' block.
2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com>
Zack Weinberg <zack@codesourcery.com>
* alias.c (find_base_decl): Remove unreachable case '3' block.
* expr.c (safe_from_p): Abort if passed a type.
* tree-gimple.c (recalculate_side_effects): Abort if passed
anything other than an expression.
* tree-ssa-pre.c (phi_translate): Return expr immediately if
is_gimple_min_invariant is true for it. Reorder cases for clarity.
Abort on un-handled tree classes.
(valid_in_set): Likewise.
* tree.c (tree_code_class_strings): New static data.
* tree.h (enum tree_code_class): New.
(tree_code_class_strings): Declare.
(TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P)
(REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P)
(STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros.
(TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS)
(checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update.
* tree.def, c-common.def, objc/objc-tree.def: Use
tree_code_class enumeration constants instead of code letters.
* alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c
* c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c
* emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c
* langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c
* tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c
* tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c
* tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c
* tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c
* tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c
* tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c
* tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c
* config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c
* config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c
Update to match.
* LANGUAGES: Add note about change.
ada:
* ada-tree.def: Use tree_code_class enumeration constants
instead of code letters.
* ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c:
Update for new tree-class enumeration constants.
cp:
* cp-tree.def: Use tree_code_class enumeration constants
instead of code letters.
* call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c
* mangle.c, pt.c, semantics.c, tree.c, typeck.c:
Update for new tree-class enumeration constants.
fortran:
* f95-lang.c, trans-expr.c, trans.c: Update for new tree-class
enumeration constants.
java:
* java-tree.def: Use tree_code_class enumeration constants
instead of code letters.
* java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for
new tree-class enumeration constants.
treelang:
* treetree.c: Update for new tree-class enumeration constants.
From-SVN: r87675
2004-09-17 23:55:02 +02:00
|
|
|
|
else if (IS_TYPE_OR_DECL_P (t))
|
2004-06-29 18:25:28 +02:00
|
|
|
|
*walk_subtrees = 0;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
return NULL;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Scalarize a LDST. To recap, this is an assignment between one scalarizable
|
|
|
|
|
reference ELT and one non-scalarizable reference OTHER. IS_OUTPUT is true
|
|
|
|
|
if ELT is on the left-hand side. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
|
|
static void
|
2004-06-29 18:25:28 +02:00
|
|
|
|
scalarize_ldst (struct sra_elt *elt, tree other,
|
|
|
|
|
block_stmt_iterator *bsi, bool is_output)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Shouldn't have gotten called for a scalar. */
|
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* targhooks.c (default_unwind_emit, default_scalar_mode_supported_p):
Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* timevar.c (timevar_push, timevar_pop, timevar_start,
timevar_stop): Likewise.
* toplev.c (default_pch_valid_p): Likewise.
* tracer.c (tail_duplicate): Likewise.
* tree-alias-common.c (get_alias_var_decl,
get_values_from_constructor, create_alias_var, delete_alias_vars,
empty_points_to_set, same_points_to_set, ptr_may_alias_var):
Likewise.
* tree.c (tree_size, make_node_stat, copy_node_stat,
build_int_cst_wide, integer_all_onesp, list_length, chainon,
tree_node_structure, type_contains_placeholder_p, substitute_in_expr,
substitute_placeholder_in_expr, tabilize_reference_1, build0_stat,
build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p,
lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr,
build_method_type_directly, decl_type_context, get_callee_fndecl,
get_set_constructor_bits, build_vector_type_for_mode, int_cst_value,
tree_fold_gcd): Likewise.
* tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges,
make_cond_expr_edges, group_case_labels, tree_merge_blocks,
cleanup_control_expr_graph, find_taken_edge,
find_taken_edge_switch_expr, phi_alternatives_equal,
is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt,
stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate,
tree_split_edge, tree_verify_flow_info, thread_jumps,
tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise.
* tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly,
chrec_fold_multiply_poly_poly): Likewise.
* tree-complex.c (extract_component, expand_complex_division,
expand_complex_comparison, expand_complex_operations_1,
build_replicated_const, expand_vector_operations_1): Likewise.
* tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector,
build_classic_dir_vector): Likewise.
* tree-dfa.c (compute_immediate_uses_for_phi,
compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann,
create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise.
* tree-dump.c (dequeue_and_dump): Likewise.
* tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region,
record_in_finally_tree, replace_goto_queue_1,
maybe_record_in_goto_queue, verify_norecord_switch_expr,
do_return_redirection): Likewise.
* tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr,
add_to_dst_predicate_list, find_phi_replacement_condition,
replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order):
Likewise.
* tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r,
initialize_inlined_parameters, declare_return_variable,
estimate_num_insns_1, expand_call_inline, expand_calls_inline,
optimize_inline_calls, copy_tree_r): Likewise.
* tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt,
ssa_rewrite_stmt, rewrite_into_ssa): Likewise.
* tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after,
tsi_split_statement_list_after, tsi_split_statement_list_before):
Likewise.
* tree-mudflap.c (mf_varname_tree): Likewise.
* tree-nested.c (create_tmp_var_for, lookup_field_for_decl,
lookup_tramp_for_decl, convert_all_function_calls): Likewise.
* tree-optimize.c (tree_rest_of_compilation): Likewise.
* tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi,
coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis,
free_temp_expr_table, add_dependance, finish_expr, rewrite_trees):
Likewise.
* tree-phinodes.c (resize_phi_node, add_phi_arg,
remove_all_phi_nodes_for): Likewise.
* tree-pretty-print.c (op_prio, print_call_name): Likewise.
* tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler,
tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise.
* tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree,
sra_elt_eq, sra_walk_expr, instantiate_missing_elements,
generate_one_element_ref, generate_element_copy,
generate_element_zero, scalarize_copy, scalarize_init,
scalarize_ldst): Likewise.
* tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p,
add_may_alias, add_pointed_to_expr, add_pointed_to_var,
collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise.
* tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise.
* tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value,
set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment,
widen_bitfield, ccp_fold_builtin): Likewise.
* tree-ssa-copy.c (may_propagate_copy, merge_alias_info,
replace_exp_1, propagate_tree_value): Likewise.
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise.
* tree-ssa-dce.c (set_control_dependence_map_bit,
find_control_dependence, find_pdom, mark_operand_necessary,
mark_stmt_if_obviously_necessary,
mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise.
* tree-ssa-dom.c (dom_opt_initialize_block_local_data,
simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis,
eliminate_redundant_computations, avail_expr_eq): Likewise.
* tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise.
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p,
duplicate_blocks): Likewise.
* tree-ssa-loop-im.c (for_each_index, set_level,
is_call_clobbered_ref): Likewise.
* tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos,
stmt_after_increment, set_iv, contains_abnormal_ssa_name_p,
find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates,
peel_address, ptr_difference_cost, may_replace_final_value,
determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer,
rewrite_use, rewrite_uses): Likewise.
* tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa,
check_loop_closed_ssa_use): Likewise.
* tree-ssanames.c (make_ssa_name): Likewise.
* tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses,
finalize_ssa_v_must_defs, finalize_ssa_stmt_operands,
get_stmt_operands, get_expr_operands, get_asm_expr_operands,
get_indirect_ref_operands, add_stmt_operand): Likewise.
* tree-ssa-pre.c (value_exists_in_set_bitmap,
value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set,
phi_translate, valid_in_set, compute_antic,
find_or_generate_expression, create_expression_by_pieces, insert_aux,
create_value_expr_from, eliminate): Likewise.
* tree-ssa-propagate.c (cfg_blocks_get): Likewise.
* tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges):
Likewise.
* tree-tailcall.c (independent_of_stmt_p, adjust_return_value,
eliminate_tail_call): Likewise.
* tree-vectorizer.c (vect_create_index_for_array_ref,
vect_align_data_ref, vect_create_data_ref,
vect_create_destination_var, vect_get_vec_def_for_operand,
vect_finish_stmt_generation, vect_transform_stmt,
vect_transform_loop_bound, vect_transform_loop,
vect_analyze_operations): Likewise.
* tree-vn.c (vn_compute, set_value_handle, get_value_handle):
Likewise.
* tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr,
get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start,
bsi_after_labels, bsi_last): Likewise.
* tree-ssa-live.c (var_union, change_partition_var,
create_ssa_var_map, calculate_live_on_entry, root_var_init,
type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce):
Likewise.
* tree-ssa-live.h (partition_is_global, live_entry_blocks,
tpa_find_tree): Likewise.
(register_ssa_partition_check): Declare.
(register_ssa_partition): use it.
* tree-ssa-live.c: Include errors.h.
(register_ssa_partition_check): New.
* tree-ssa-operands.c: Include errors.h.
* Makefile.in (tree-ssa-operands.o): Depend on errors.h.
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
From-SVN: r87223
2004-09-09 09:54:12 +02:00
|
|
|
|
gcc_assert (!elt->replacement);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
if (elt->use_block_copy)
|
|
|
|
|
{
|
|
|
|
|
/* Since ELT is not fully instantiated, we have to leave the
|
|
|
|
|
block copy in place. Treat this as a USE. */
|
|
|
|
|
scalarize_use (elt, NULL, bsi, is_output);
|
|
|
|
|
}
|
|
|
|
|
else
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* The interesting case is when ELT is fully instantiated. In this
|
|
|
|
|
case we can have each element stored/loaded directly to/from the
|
|
|
|
|
corresponding slot in OTHER. This avoids a block copy. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
tree list = NULL, stmt = bsi_stmt (*bsi);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
mark_all_v_defs (stmt);
|
|
|
|
|
generate_copy_inout (elt, is_output, other, &list);
|
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* targhooks.c (default_unwind_emit, default_scalar_mode_supported_p):
Use gcc_assert, gcc_unreachable & internal_error instead of abort.
* timevar.c (timevar_push, timevar_pop, timevar_start,
timevar_stop): Likewise.
* toplev.c (default_pch_valid_p): Likewise.
* tracer.c (tail_duplicate): Likewise.
* tree-alias-common.c (get_alias_var_decl,
get_values_from_constructor, create_alias_var, delete_alias_vars,
empty_points_to_set, same_points_to_set, ptr_may_alias_var):
Likewise.
* tree.c (tree_size, make_node_stat, copy_node_stat,
build_int_cst_wide, integer_all_onesp, list_length, chainon,
tree_node_structure, type_contains_placeholder_p, substitute_in_expr,
substitute_placeholder_in_expr, tabilize_reference_1, build0_stat,
build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p,
lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr,
build_method_type_directly, decl_type_context, get_callee_fndecl,
get_set_constructor_bits, build_vector_type_for_mode, int_cst_value,
tree_fold_gcd): Likewise.
* tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges,
make_cond_expr_edges, group_case_labels, tree_merge_blocks,
cleanup_control_expr_graph, find_taken_edge,
find_taken_edge_switch_expr, phi_alternatives_equal,
is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt,
stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate,
tree_split_edge, tree_verify_flow_info, thread_jumps,
tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise.
* tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly,
chrec_fold_multiply_poly_poly): Likewise.
* tree-complex.c (extract_component, expand_complex_division,
expand_complex_comparison, expand_complex_operations_1,
build_replicated_const, expand_vector_operations_1): Likewise.
* tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector,
build_classic_dir_vector): Likewise.
* tree-dfa.c (compute_immediate_uses_for_phi,
compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann,
create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise.
* tree-dump.c (dequeue_and_dump): Likewise.
* tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region,
record_in_finally_tree, replace_goto_queue_1,
maybe_record_in_goto_queue, verify_norecord_switch_expr,
do_return_redirection): Likewise.
* tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr,
add_to_dst_predicate_list, find_phi_replacement_condition,
replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order):
Likewise.
* tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r,
initialize_inlined_parameters, declare_return_variable,
estimate_num_insns_1, expand_call_inline, expand_calls_inline,
optimize_inline_calls, copy_tree_r): Likewise.
* tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt,
ssa_rewrite_stmt, rewrite_into_ssa): Likewise.
* tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after,
tsi_split_statement_list_after, tsi_split_statement_list_before):
Likewise.
* tree-mudflap.c (mf_varname_tree): Likewise.
* tree-nested.c (create_tmp_var_for, lookup_field_for_decl,
lookup_tramp_for_decl, convert_all_function_calls): Likewise.
* tree-optimize.c (tree_rest_of_compilation): Likewise.
* tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi,
coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis,
free_temp_expr_table, add_dependance, finish_expr, rewrite_trees):
Likewise.
* tree-phinodes.c (resize_phi_node, add_phi_arg,
remove_all_phi_nodes_for): Likewise.
* tree-pretty-print.c (op_prio, print_call_name): Likewise.
* tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler,
tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise.
* tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree,
sra_elt_eq, sra_walk_expr, instantiate_missing_elements,
generate_one_element_ref, generate_element_copy,
generate_element_zero, scalarize_copy, scalarize_init,
scalarize_ldst): Likewise.
* tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p,
add_may_alias, add_pointed_to_expr, add_pointed_to_var,
collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise.
* tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise.
* tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value,
set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment,
widen_bitfield, ccp_fold_builtin): Likewise.
* tree-ssa-copy.c (may_propagate_copy, merge_alias_info,
replace_exp_1, propagate_tree_value): Likewise.
* tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise.
* tree-ssa-dce.c (set_control_dependence_map_bit,
find_control_dependence, find_pdom, mark_operand_necessary,
mark_stmt_if_obviously_necessary,
mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise.
* tree-ssa-dom.c (dom_opt_initialize_block_local_data,
simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis,
eliminate_redundant_computations, avail_expr_eq): Likewise.
* tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise.
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p,
duplicate_blocks): Likewise.
* tree-ssa-loop-im.c (for_each_index, set_level,
is_call_clobbered_ref): Likewise.
* tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos,
stmt_after_increment, set_iv, contains_abnormal_ssa_name_p,
find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates,
peel_address, ptr_difference_cost, may_replace_final_value,
determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer,
rewrite_use, rewrite_uses): Likewise.
* tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa,
check_loop_closed_ssa_use): Likewise.
* tree-ssanames.c (make_ssa_name): Likewise.
* tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses,
finalize_ssa_v_must_defs, finalize_ssa_stmt_operands,
get_stmt_operands, get_expr_operands, get_asm_expr_operands,
get_indirect_ref_operands, add_stmt_operand): Likewise.
* tree-ssa-pre.c (value_exists_in_set_bitmap,
value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set,
phi_translate, valid_in_set, compute_antic,
find_or_generate_expression, create_expression_by_pieces, insert_aux,
create_value_expr_from, eliminate): Likewise.
* tree-ssa-propagate.c (cfg_blocks_get): Likewise.
* tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges):
Likewise.
* tree-tailcall.c (independent_of_stmt_p, adjust_return_value,
eliminate_tail_call): Likewise.
* tree-vectorizer.c (vect_create_index_for_array_ref,
vect_align_data_ref, vect_create_data_ref,
vect_create_destination_var, vect_get_vec_def_for_operand,
vect_finish_stmt_generation, vect_transform_stmt,
vect_transform_loop_bound, vect_transform_loop,
vect_analyze_operations): Likewise.
* tree-vn.c (vn_compute, set_value_handle, get_value_handle):
Likewise.
* tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr,
get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start,
bsi_after_labels, bsi_last): Likewise.
* tree-ssa-live.c (var_union, change_partition_var,
create_ssa_var_map, calculate_live_on_entry, root_var_init,
type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce):
Likewise.
* tree-ssa-live.h (partition_is_global, live_entry_blocks,
tpa_find_tree): Likewise.
(register_ssa_partition_check): Declare.
(register_ssa_partition): use it.
* tree-ssa-live.c: Include errors.h.
(register_ssa_partition_check): New.
* tree-ssa-operands.c: Include errors.h.
* Makefile.in (tree-ssa-operands.o): Depend on errors.h.
Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com>
From-SVN: r87223
2004-09-09 09:54:12 +02:00
|
|
|
|
gcc_assert (list);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Preserve EH semantics. */
|
|
|
|
|
if (stmt_ends_bb_p (stmt))
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
tree_stmt_iterator tsi;
|
|
|
|
|
tree first;
|
|
|
|
|
|
|
|
|
|
/* Extract the first statement from LIST. */
|
|
|
|
|
tsi = tsi_start (list);
|
|
|
|
|
first = tsi_stmt (tsi);
|
|
|
|
|
tsi_delink (&tsi);
|
|
|
|
|
|
|
|
|
|
/* Replace the old statement with this new representative. */
|
|
|
|
|
bsi_replace (bsi, first, true);
|
2004-08-19 23:34:37 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
if (!tsi_end_p (tsi))
|
|
|
|
|
{
|
|
|
|
|
/* If any reference would trap, then they all would. And more
|
|
|
|
|
to the point, the first would. Therefore none of the rest
|
|
|
|
|
will trap since the first didn't. Indicate this by
|
|
|
|
|
iterating over the remaining statements and set
|
|
|
|
|
TREE_THIS_NOTRAP in all INDIRECT_REFs. */
|
|
|
|
|
do
|
|
|
|
|
{
|
|
|
|
|
walk_tree (tsi_stmt_ptr (tsi), mark_notrap, NULL, NULL);
|
|
|
|
|
tsi_next (&tsi);
|
|
|
|
|
}
|
|
|
|
|
while (!tsi_end_p (tsi));
|
|
|
|
|
|
|
|
|
|
insert_edge_copies (list, bsi->bb);
|
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
2004-06-29 18:25:28 +02:00
|
|
|
|
else
|
|
|
|
|
sra_replace (bsi, list);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Generate initializations for all scalarizable parameters. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
static void
|
|
|
|
|
scalarize_parms (void)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
tree list = NULL;
|
bitmap.c (bitmap_print): Make bitno unsigned.
* bitmap.c (bitmap_print): Make bitno unsigned.
* bt-load.c (clear_btr_from_live_range,
btr_def_live_range): Likewise.
* caller-save.c (save_call_clobbered_regs): Likewise.
* cfganal.c (compute_dominance_frontiers_1): Likewise.
* cfgcleanup.c (thread_jump): Likewise.
* cfgrtl.c (safe_insert_insn_on_edge): Likewise.
* conflict.c (conflict_graph_compute): Likewise.
* ddg.c (add_deps_for_use): Likewise.
* df.c (df_refs_update): Likewise.
* except.c (remove_eh_handler): Likewise.
* flow.c (verify_local_live_at_start, update_life_info,
initialize_uninitialized_subregs, propagate_one_insn,
free_propagate_block_info, propagate_block, find_use_as_address,
reg_set_to_hard_reg_set): Likewise.
* gcse.c (clear_modify_mem_tables): Likewise.
* global.c (global_conflicts, build_insn_chain): Likewise.
* ifcvt.c (dead_or_predicable): Likewise.
* local-alloc.c (update_equiv_regs): Likewise.
* loop.c (load_mems): Likewise.
* ra-build.c (livethrough_conflicts_bb, conflicts_between_webs):
Likewise.
* ra-rewrite.c (reloads_to_loads, rewrite_program2, actual_spill):
Likewise.
* reload1.c (order_regs_for_reload, finish_spills): Likewise.
* sched-deps.c (sched_analyze_insn, free_deps): Likewise.
* sched-rgn.c (propagate_deps
* tree-cfg.c (tree_purge_all_dead_eh_edges): Likewise.
* tree-dfa.c (dump_dfa_stats
tree-into-ssa.c (compute_global_livein, insert_phi_nodes,
insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags):
Likewise.
* tree-outof-ssa.c (coalesce_ssa_name, coalesce_vars,
free_temp_expr_table, find_replaceable_exprs): Likewise.
* tree-sra.c (scan_function, scalarize_parms): Likewise.
* tree-ssa-alias.c (init_alias_info,
compute_points_to_and_addr_escape,
compute_flow_sensitive_aliasing, maybe_create_global_var): Likewise.
* tree-ssa-dce.c (mark_control_dependent_edges_necessary): Likewise.
* tree-ssa-live.c (new_tree_live_info, live_worklist,
calculate_live_on_entry, calculate_live_on_exit, compare_pairs,
sort_coalesce_list, build_tree_conflict_graph, dump_live_info
tree-ssa-loop-manip.c (add_exit_phis_var): Likewise.
tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops,
add_call_read_ops): Likewise.
* tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Likewise.
* tree-ssa-live.h (num_var_partitions): Return unsigned.
From-SVN: r90053
2004-11-04 09:41:16 +01:00
|
|
|
|
unsigned i;
|
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style.
* bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP,
EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style.
(bitmap_iterator): New type.
(bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init,
bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1,
bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1,
bmp_iter_and_init, bmp_iter_and_next): New functions.
* basic-block.h (EXECUTE_IF_SET_IN_REG_SET,
EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to
use iterator-style EXECUTE_IF_IN_BITMAP macros.
* bitmap.c (bitmap_print): Ditto.
* bt-load.c (clear_btr_from_live_range, add_btr_to_live_range,
btr_def_live_range): Ditto.
* cfganal.c (compute_dominance_frontiers_1) Ditto.
* cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics):
Ditto.
* ddg.c (build_inter_loop_deps): Ditto.
* df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update):
Ditto.
* except.c (remove_eh_handler): Ditto.
* flow.c (reg_set_to_hard_reg_set): Ditto.
* gcse.c (clear_modify_mem_tables): Ditto.
* global.c (build_insn_chain): Ditto.
* ifcvt.c (dead_or_predicable): Ditto.
* loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg):
Ditto.
* ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto.
* ra-rewrite.c (reloads_to_loads, rewrite_program2,
detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto.
* tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region,
tree_purge_all_dead_eh_edges): Ditto.
* tree-into-ssa.c (compute_global_livein, insert_phi_nodes,
insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags,
rewrite_ssa_into_ssa): Ditto.
* tree-outof-ssa.c (find_replaceable_exprs): Ditto.
* tree-sra.c (scan_function, decide_instantiations, scalarize_parms):
Ditto.
* tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape,
compute_flow_sensitive_aliasing, maybe_create_global_var,
dump_points_to_info_for): Ditto.
* tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto.
* tree-ssa-dse.c (dse_finalize_block): Ditto.
* tree-ssa-live.c (live_worklist, calculate_live_on_entry,
calculate_live_on_exit, build_tree_conflict_graph, dump_live_info):
Ditto.
* tree-ssa-loop-ivopts.c (find_induction_variables,
find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map,
determine_use_iv_costs, determine_set_costs, find_best_candidate,
set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data):
Ditto.
* tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto.
* tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops,
add_call_read_ops): Ditto.
* tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto.
From-SVN: r88145
2004-09-26 21:53:13 +02:00
|
|
|
|
bitmap_iterator bi;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style.
* bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP,
EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style.
(bitmap_iterator): New type.
(bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init,
bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1,
bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1,
bmp_iter_and_init, bmp_iter_and_next): New functions.
* basic-block.h (EXECUTE_IF_SET_IN_REG_SET,
EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to
use iterator-style EXECUTE_IF_IN_BITMAP macros.
* bitmap.c (bitmap_print): Ditto.
* bt-load.c (clear_btr_from_live_range, add_btr_to_live_range,
btr_def_live_range): Ditto.
* cfganal.c (compute_dominance_frontiers_1) Ditto.
* cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics):
Ditto.
* ddg.c (build_inter_loop_deps): Ditto.
* df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update):
Ditto.
* except.c (remove_eh_handler): Ditto.
* flow.c (reg_set_to_hard_reg_set): Ditto.
* gcse.c (clear_modify_mem_tables): Ditto.
* global.c (build_insn_chain): Ditto.
* ifcvt.c (dead_or_predicable): Ditto.
* loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg):
Ditto.
* ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto.
* ra-rewrite.c (reloads_to_loads, rewrite_program2,
detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto.
* tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region,
tree_purge_all_dead_eh_edges): Ditto.
* tree-into-ssa.c (compute_global_livein, insert_phi_nodes,
insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags,
rewrite_ssa_into_ssa): Ditto.
* tree-outof-ssa.c (find_replaceable_exprs): Ditto.
* tree-sra.c (scan_function, decide_instantiations, scalarize_parms):
Ditto.
* tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape,
compute_flow_sensitive_aliasing, maybe_create_global_var,
dump_points_to_info_for): Ditto.
* tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto.
* tree-ssa-dse.c (dse_finalize_block): Ditto.
* tree-ssa-live.c (live_worklist, calculate_live_on_entry,
calculate_live_on_exit, build_tree_conflict_graph, dump_live_info):
Ditto.
* tree-ssa-loop-ivopts.c (find_induction_variables,
find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map,
determine_use_iv_costs, determine_set_costs, find_best_candidate,
set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data):
Ditto.
* tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto.
* tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops,
add_call_read_ops): Ditto.
* tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto.
From-SVN: r88145
2004-09-26 21:53:13 +02:00
|
|
|
|
EXECUTE_IF_SET_IN_BITMAP (needs_copy_in, 0, i, bi)
|
2004-08-19 23:34:37 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
tree var = referenced_var (i);
|
|
|
|
|
struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT);
|
|
|
|
|
generate_copy_inout (elt, true, var, &list);
|
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style.
* bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP,
EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style.
(bitmap_iterator): New type.
(bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init,
bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1,
bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1,
bmp_iter_and_init, bmp_iter_and_next): New functions.
* basic-block.h (EXECUTE_IF_SET_IN_REG_SET,
EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to
use iterator-style EXECUTE_IF_IN_BITMAP macros.
* bitmap.c (bitmap_print): Ditto.
* bt-load.c (clear_btr_from_live_range, add_btr_to_live_range,
btr_def_live_range): Ditto.
* cfganal.c (compute_dominance_frontiers_1) Ditto.
* cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics):
Ditto.
* ddg.c (build_inter_loop_deps): Ditto.
* df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update):
Ditto.
* except.c (remove_eh_handler): Ditto.
* flow.c (reg_set_to_hard_reg_set): Ditto.
* gcse.c (clear_modify_mem_tables): Ditto.
* global.c (build_insn_chain): Ditto.
* ifcvt.c (dead_or_predicable): Ditto.
* loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg):
Ditto.
* ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto.
* ra-rewrite.c (reloads_to_loads, rewrite_program2,
detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto.
* tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region,
tree_purge_all_dead_eh_edges): Ditto.
* tree-into-ssa.c (compute_global_livein, insert_phi_nodes,
insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags,
rewrite_ssa_into_ssa): Ditto.
* tree-outof-ssa.c (find_replaceable_exprs): Ditto.
* tree-sra.c (scan_function, decide_instantiations, scalarize_parms):
Ditto.
* tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape,
compute_flow_sensitive_aliasing, maybe_create_global_var,
dump_points_to_info_for): Ditto.
* tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto.
* tree-ssa-dse.c (dse_finalize_block): Ditto.
* tree-ssa-live.c (live_worklist, calculate_live_on_entry,
calculate_live_on_exit, build_tree_conflict_graph, dump_live_info):
Ditto.
* tree-ssa-loop-ivopts.c (find_induction_variables,
find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map,
determine_use_iv_costs, determine_set_costs, find_best_candidate,
set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data):
Ditto.
* tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto.
* tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops,
add_call_read_ops): Ditto.
* tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto.
From-SVN: r88145
2004-09-26 21:53:13 +02:00
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
if (list)
|
|
|
|
|
insert_edge_copies (list, ENTRY_BLOCK_PTR);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Entry point to phase 4. Update the function to match replacements. */
|
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
|
static void
|
2004-06-29 18:25:28 +02:00
|
|
|
|
scalarize_function (void)
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
static const struct sra_walk_fns fns = {
|
|
|
|
|
scalarize_use, scalarize_copy, scalarize_init, scalarize_ldst, false
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
sra_walk_function (&fns);
|
|
|
|
|
scalarize_parms ();
|
2004-11-16 01:08:04 +01:00
|
|
|
|
bsi_commit_edge_inserts ();
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
|
|
|
|
|
/* Debug helper function. Print ELT in a nice human-readable format. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
static void
|
|
|
|
|
dump_sra_elt_name (FILE *f, struct sra_elt *elt)
|
|
|
|
|
{
|
|
|
|
|
if (elt->parent && TREE_CODE (elt->parent->type) == COMPLEX_TYPE)
|
|
|
|
|
{
|
|
|
|
|
fputs (elt->element == integer_zero_node ? "__real__ " : "__imag__ ", f);
|
|
|
|
|
dump_sra_elt_name (f, elt->parent);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (elt->parent)
|
|
|
|
|
dump_sra_elt_name (f, elt->parent);
|
|
|
|
|
if (DECL_P (elt->element))
|
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (elt->element) == FIELD_DECL)
|
|
|
|
|
fputc ('.', f);
|
|
|
|
|
print_generic_expr (f, elt->element, dump_flags);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
fprintf (f, "[" HOST_WIDE_INT_PRINT_DEC "]",
|
|
|
|
|
TREE_INT_CST_LOW (elt->element));
|
|
|
|
|
}
|
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Likewise, but callable from the debugger. */
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
debug_sra_elt_name (struct sra_elt *elt)
|
|
|
|
|
{
|
|
|
|
|
dump_sra_elt_name (stderr, elt);
|
|
|
|
|
fputc ('\n', stderr);
|
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Main entry point. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
tree_sra (void)
|
|
|
|
|
{
|
|
|
|
|
/* Initialize local variables. */
|
2004-06-29 18:25:28 +02:00
|
|
|
|
gcc_obstack_init (&sra_obstack);
|
bitmap.h (BITMAP_XMALLOC, [...]): Remove.
* bitmap.h (BITMAP_XMALLOC, BITMAP_XFREE): Remove.
* bb-reorder.c (duplicate_computed_gotos): Use BITMAP_ALLOC and
BITMAP_FREE.
* bt-load.c (btr_def_live_range, combine_btr_defs,
migrate_btr_def, migrate_btr_defs): Likewise.
* cfgcleanup.c (thread_jump): Likewise.
* cfgloop.c (get_loop_body_in_bfs_order): Likewise.
* df.c (df_insn_table_realloc, df_bitmaps_alloc, df_bitmaps_free,
df_alloc, df_free, df_du_chain_create, df_bb_rd_local_compute,
df_rd_local_compute, df_reg_info_compute): Likewise.
* dominance.c (init_dom_info, free_dom_info): Likewise.
* flow.c (init_propagate_block_info,
free_propagate_block_info): Likewise.
* gcse.c (alloc_gcse_mem, free_gcse_mem): Likewise.
* global.c (allocate_bb_info, free_bb_info, calculate_reg_pav,
modify_reg_pav): Likewise.
* loop-invariant.c (find_defs, find_invariant_insn,
find_invariants, free_inv_motion_data): Likewise.
* predict.c (tree_predict_by_opcode,
estimate_bb_frequencies): Likewise.
* stmt.c (expand_case): Likewise.
* tree-cfg.c (tree_duplicate_sese_region): Likewise.
* tree-dfa.c (mark_new_vars_to_rename): Likewise.
* tree-if-conv.c (get_loop_body_in_if_conv_order): Likewise.
* tree-into-ssa.c (insert_phi_nodes_for, def_blocks_free,
get_def_blocks_for, mark_def_site_blocks, rewrite_into_ssa,
rewrite_ssa_into_ssa): Likewise.
* tree-optimize.c (tree_rest_of_compilation): Likewise.
* tree-outof-ssa.c (new_temp_expr_table, free_temp_expr_table,
analyze_edges_for_bb, perform_edge_inserts): Likewise.
* tree-scalar-evolution.c (scev_initialize, scev_finalize): Likewise.
* tree-sra.c (tree_sra): Likewise.
* tree-ssa-alias.c (init_alias_info, delete_alias_info): Likewise.
* tree-ssa-ccp.c (ccp_fold_builtin): Likewise.
* tree-ssa-dce.c (tree_dce_init, tree_dce_done): Likewise.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Likewise.
* tree-ssa-dse.c (tree_ssa_dse): Likewise.
* tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_var):
Likewise.
* tree-ssa-live.c (new_tree_live_info, delete_tree_live_info,
calculate_live_on_entry, calculate_live_on_exit,
build_tree_conflict_graph): Likewise.
* tree-ssa-loop-ivopts.c (tree_ssa_iv_optimize_init, record_use,
record_important_candidates, set_use_iv_cost, find_depends,
determine_use_iv_costs, iv_ca_new, iv_ca_free, free_loop_data,
tree_ssa_iv_optimize_finalize): Likewise.
* tree-ssa-loop-manip.c (add_exit_phis_var, get_loops_exit,
find_uses_to_rename_use, rewrite_into_loop_closed_ssa,
tree_duplicate_loop_to_header_edge): Likewise.
* tree-ssa-pre.c (init_pre, fini_pre): Likewise.
* tree-ssa.c (verify_flow_insensitive_alias_info,
verify_name_tags, verify_ssa, init_tree_ssa,
delete_tree_ssa): Likewise.
* tree-ssanames.c (marked_ssa_names, init_ssanames,
fini_ssanames): Likewise.
* tree-vectorizer.c (slpeel_tree_peel_loop_to_edge): Likewise.
From-SVN: r95172
2005-02-17 17:19:49 +01:00
|
|
|
|
sra_candidates = BITMAP_ALLOC (NULL);
|
|
|
|
|
needs_copy_in = BITMAP_ALLOC (NULL);
|
|
|
|
|
sra_type_decomp_cache = BITMAP_ALLOC (NULL);
|
|
|
|
|
sra_type_inst_cache = BITMAP_ALLOC (NULL);
|
2004-06-29 18:25:28 +02:00
|
|
|
|
sra_map = htab_create (101, sra_elt_hash, sra_elt_eq, NULL);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
2004-06-29 18:25:28 +02:00
|
|
|
|
/* Scan. If we find anything, instantiate and scalarize. */
|
|
|
|
|
if (find_candidates_for_sra ())
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
2004-06-29 18:25:28 +02:00
|
|
|
|
scan_function ();
|
|
|
|
|
decide_instantiations ();
|
|
|
|
|
scalarize_function ();
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Free allocated memory. */
|
|
|
|
|
htab_delete (sra_map);
|
|
|
|
|
sra_map = NULL;
|
bitmap.h (BITMAP_XMALLOC, [...]): Remove.
* bitmap.h (BITMAP_XMALLOC, BITMAP_XFREE): Remove.
* bb-reorder.c (duplicate_computed_gotos): Use BITMAP_ALLOC and
BITMAP_FREE.
* bt-load.c (btr_def_live_range, combine_btr_defs,
migrate_btr_def, migrate_btr_defs): Likewise.
* cfgcleanup.c (thread_jump): Likewise.
* cfgloop.c (get_loop_body_in_bfs_order): Likewise.
* df.c (df_insn_table_realloc, df_bitmaps_alloc, df_bitmaps_free,
df_alloc, df_free, df_du_chain_create, df_bb_rd_local_compute,
df_rd_local_compute, df_reg_info_compute): Likewise.
* dominance.c (init_dom_info, free_dom_info): Likewise.
* flow.c (init_propagate_block_info,
free_propagate_block_info): Likewise.
* gcse.c (alloc_gcse_mem, free_gcse_mem): Likewise.
* global.c (allocate_bb_info, free_bb_info, calculate_reg_pav,
modify_reg_pav): Likewise.
* loop-invariant.c (find_defs, find_invariant_insn,
find_invariants, free_inv_motion_data): Likewise.
* predict.c (tree_predict_by_opcode,
estimate_bb_frequencies): Likewise.
* stmt.c (expand_case): Likewise.
* tree-cfg.c (tree_duplicate_sese_region): Likewise.
* tree-dfa.c (mark_new_vars_to_rename): Likewise.
* tree-if-conv.c (get_loop_body_in_if_conv_order): Likewise.
* tree-into-ssa.c (insert_phi_nodes_for, def_blocks_free,
get_def_blocks_for, mark_def_site_blocks, rewrite_into_ssa,
rewrite_ssa_into_ssa): Likewise.
* tree-optimize.c (tree_rest_of_compilation): Likewise.
* tree-outof-ssa.c (new_temp_expr_table, free_temp_expr_table,
analyze_edges_for_bb, perform_edge_inserts): Likewise.
* tree-scalar-evolution.c (scev_initialize, scev_finalize): Likewise.
* tree-sra.c (tree_sra): Likewise.
* tree-ssa-alias.c (init_alias_info, delete_alias_info): Likewise.
* tree-ssa-ccp.c (ccp_fold_builtin): Likewise.
* tree-ssa-dce.c (tree_dce_init, tree_dce_done): Likewise.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Likewise.
* tree-ssa-dse.c (tree_ssa_dse): Likewise.
* tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_var):
Likewise.
* tree-ssa-live.c (new_tree_live_info, delete_tree_live_info,
calculate_live_on_entry, calculate_live_on_exit,
build_tree_conflict_graph): Likewise.
* tree-ssa-loop-ivopts.c (tree_ssa_iv_optimize_init, record_use,
record_important_candidates, set_use_iv_cost, find_depends,
determine_use_iv_costs, iv_ca_new, iv_ca_free, free_loop_data,
tree_ssa_iv_optimize_finalize): Likewise.
* tree-ssa-loop-manip.c (add_exit_phis_var, get_loops_exit,
find_uses_to_rename_use, rewrite_into_loop_closed_ssa,
tree_duplicate_loop_to_header_edge): Likewise.
* tree-ssa-pre.c (init_pre, fini_pre): Likewise.
* tree-ssa.c (verify_flow_insensitive_alias_info,
verify_name_tags, verify_ssa, init_tree_ssa,
delete_tree_ssa): Likewise.
* tree-ssanames.c (marked_ssa_names, init_ssanames,
fini_ssanames): Likewise.
* tree-vectorizer.c (slpeel_tree_peel_loop_to_edge): Likewise.
From-SVN: r95172
2005-02-17 17:19:49 +01:00
|
|
|
|
BITMAP_FREE (sra_candidates);
|
|
|
|
|
BITMAP_FREE (needs_copy_in);
|
|
|
|
|
BITMAP_FREE (sra_type_decomp_cache);
|
|
|
|
|
BITMAP_FREE (sra_type_inst_cache);
|
2004-06-29 18:25:28 +02:00
|
|
|
|
obstack_free (&sra_obstack, NULL);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
|
gate_sra (void)
|
|
|
|
|
{
|
|
|
|
|
return flag_tree_sra != 0;
|
|
|
|
|
}
|
|
|
|
|
|
2004-08-19 23:34:37 +02:00
|
|
|
|
struct tree_opt_pass pass_sra =
|
2004-05-13 08:41:07 +02:00
|
|
|
|
{
|
|
|
|
|
"sra", /* name */
|
|
|
|
|
gate_sra, /* gate */
|
|
|
|
|
tree_sra, /* execute */
|
|
|
|
|
NULL, /* sub */
|
|
|
|
|
NULL, /* next */
|
|
|
|
|
0, /* static_pass_number */
|
|
|
|
|
TV_TREE_SRA, /* tv_id */
|
2004-07-28 07:13:10 +02:00
|
|
|
|
PROP_cfg | PROP_ssa | PROP_alias, /* properties_required */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
0, /* properties_provided */
|
|
|
|
|
0, /* properties_destroyed */
|
|
|
|
|
0, /* todo_flags_start */
|
|
|
|
|
TODO_dump_func | TODO_rename_vars
|
Unify the management of RTL and tree-level dump files.
2004-09-06 Paolo Bonzini <bonzini@gnu.org>
Unify the management of RTL and tree-level dump files.
* cfgexpand.c (tree_expand_cfg): Fix incorrect comment.
Don't print function name to the dump file, the pass manager
would do this for us. Add code from the top of
rest_of_compilation, up to the initial RTL dump.
* passes.c (rest_of_handle_jump): Call fixup_tail_calls and
close the DFI_sibling dump file.
(rest_of_compilation): Don't do that here. Remove code up to the
initial RTL dump.
(init_optimization_passes): Remove.
(pass_rest_of_compilation): Change pass name to NULL.
* toplev.c (lang_dependent_init): Do not use an empty dump file prefix.
Do not call init_optimization_passes.
* toplev.h (init_optimization_passes): Remove.
* graph.c (print_rtl_graph_with_bb, clean_graph_dump_file,
finish_graph_dump_file): Remove SUFFIX parameter.
* graph.h (print_rtl_graph_with_bb, clean_graph_dump_file,
finish_graph_dump_file): Likewise.
* tree-pass.h (struct tree_opt_pass): Add `letter' field.
* cfgexpand.c (pass_expand): Adjust.
* gimple-low.c (pass_lower_cf, pass_remove_useless_vars): Adjust.
* passes.c (pass_rest_of_compilation): Adjust.
* predict.c (pass_profile): Adjust.
* tree-alias-common.c (pass_build_pta, pass_del_pta): Adjust.
* tree-cfg.c (pass_build_cfg, pass_remove_useless_stmts,
pass_split_crit_edges, pass_warn_function_return): Adjust.
* tree-complex.c (pass_lower_vector_ssa, pass_pre_expand): Adjust.
* tree-dfa.c (pass_referenced_vars): Adjust.
* tree-eh.c (pass_lower_eh): Adjust.
* tree-if-conv.c (pass_build_ssa): Adjust.
* tree-into-ssa.c (pass_build_ssa): Adjust.
* tree-mudflap.c (pass_mudflap_1, pass_mudflap_2): Adjust.
* tree-nomudflap.c (pass_mudflap_1, pass_mudflap_2): Adjust.
* tree-nrv.c (pass_nrv): Adjust.
* tree-optimize.c (pass_gimple, pass_all_optimizations,
pass_cleanup_cfg_post_optimizing, pass_free_datastructures,
pass_init_datastructures): Adjust.
* tree-outof-ssa.c (pass_del_ssa): Adjust.
* tree-profile.c (pass_tree_profile): Adjust.
* tree-sra.c (pass_sra): Adjust.
* tree-ssa-alias.c (pass_may_alias): Adjust.
* tree-ssa-ccp.c (pass_ccp, pass_fold_builtins): Adjust.
* tree-ssa-copyrename.c (pass_rename_ssa_copies): Adjust.
* tree-ssa-dce.c (pass_dce, pass_cd_dce): Adjust.
* tree-ssa-dom.c (pass_dominator): Adjust.
* tree-ssa-dse.c (pass_dse): Adjust.
* tree-ssa-forwprop.c (pass_forwprop): Adjust.
* tree-ssa-if-conv.c (pass_if_conversion): Adjust.
* tree-ssa-loop-ch.c (pass_ch): Adjust.
* tree-ssa-loop.c (pass_loop, pass_loop_init, pass_lim,
pass_loop_done, pass_complete_unroll, pass_iv_canon,
pass_iv_optimize, pass_vectorize): Adjust.
* tree-ssa-phiopt.c (pass_phiopt): Adjust.
* tree-ssa-pre.c (pass_pre, pass_fre): Adjust.
* tree-ssa.c (pass_redundant_phi, pass_early_warn_uninitialized,
pass_late_warn_uninnitialized): Adjust.
* tree-tailcall.c (pass_tail_recursion, pass_tail_calls): Adjust.
* Makefile.in (tree-dump.o): Add new dependencies.
* cgraph.c (cgraph_remove_node): TDF_all -> TDF_tree_all.
* cgraphunit.c (cgraph_preserve_function_body_p, cgraph_optimize):
Likewise.
* toplev.c (dump_file_name): New.
* tree-dump.c (dump_enable_all): Add LETTER parameter.
(struct dump_file_info): Add NUM and LETTER fields.
(dump_files): Adjust and add RTL dump files.
(dump_register): Add NUM and LETTER fields.
(get_dump_file_name, dump_initialized_p, enable_rtl_dump_file): New.
(dump_begin): Use get_dump_file_name.
(dump_switch_p_1): Adjust call to dump_enable_all.
* tree-dump.h (dump_register): Adjust prototype.
* tree-optimize.c (register_one_dump_file): Take dump file index.
Support flags for RTL dumps.
(register_dump_files): Fill in NUM field of struct dump_file_info.
Track properties both when the gate is executed and when it is not.
(execute_todo): Dump RTL. Add PROPERTIES parameter.
(execute_one_pass): Pass properties to execute_todo. Handle VCG
dumps of RTL.
* tree-pass.h (dump_file_name): New.
* tree.h (TDF_TREE, TDF_RTL, get_dump_file_name, dump_initialized_p):
New.
* Makefile.in (passes.o): Add new dependencies.
* passes.c (struct dump_file_info, enum dump_file_index,
dump_file_tbl, init_optimization_passes): Remove.
(open_dump_file, close_dump_file): Use tree-dumping infrastructure.
(rest_of_handle_new_regalloc, rest_of_handle_old_regalloc): Use
dump_enabled_p.
(finish_optimization_passes): Update finish_graph_dump_file loop.
(enable_rtl_dump_file): Remove.
* tree-dump.c (dump_files): Adjust and add RTL dump files.
(enable_rtl_dump_file): Add here.
* tree.h (enum tree_dump_index): Add RTL dump file indices.
* doc/invoke.texi (Debugging options): Document new RTL debugging
options. Update.
From-SVN: r87113
2004-09-06 12:08:17 +02:00
|
|
|
|
| TODO_ggc_collect | TODO_verify_ssa, /* todo_flags_finish */
|
|
|
|
|
0 /* letter */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
};
|