2004-05-13 08:41:07 +02:00
|
|
|
/* SSA Dominator optimizations for trees
|
2005-01-15 10:46:10 +01:00
|
|
|
Copyright (C) 2001, 2002, 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.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
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 "tree.h"
|
|
|
|
#include "flags.h"
|
|
|
|
#include "rtl.h"
|
|
|
|
#include "tm_p.h"
|
|
|
|
#include "ggc.h"
|
|
|
|
#include "basic-block.h"
|
2005-03-04 22:35:49 +01:00
|
|
|
#include "cfgloop.h"
|
2004-05-13 08:41:07 +02:00
|
|
|
#include "output.h"
|
|
|
|
#include "errors.h"
|
|
|
|
#include "expr.h"
|
|
|
|
#include "function.h"
|
|
|
|
#include "diagnostic.h"
|
|
|
|
#include "timevar.h"
|
|
|
|
#include "tree-dump.h"
|
|
|
|
#include "tree-flow.h"
|
|
|
|
#include "domwalk.h"
|
|
|
|
#include "real.h"
|
|
|
|
#include "tree-pass.h"
|
2004-09-15 23:47:45 +02:00
|
|
|
#include "tree-ssa-propagate.h"
|
2004-05-13 08:41:07 +02:00
|
|
|
#include "langhooks.h"
|
|
|
|
|
|
|
|
/* This file implements optimizations on the dominator tree. */
|
|
|
|
|
2004-10-30 02:06:22 +02:00
|
|
|
|
|
|
|
/* Structure for recording edge equivalences as well as any pending
|
|
|
|
edge redirections during the dominator optimizer.
|
|
|
|
|
|
|
|
Computing and storing the edge equivalences instead of creating
|
|
|
|
them on-demand can save significant amounts of time, particularly
|
|
|
|
for pathological cases involving switch statements.
|
|
|
|
|
|
|
|
These structures live for a single iteration of the dominator
|
|
|
|
optimizer in the edge's AUX field. At the end of an iteration we
|
|
|
|
free each of these structures and update the AUX field to point
|
|
|
|
to any requested redirection target (the code for updating the
|
|
|
|
CFG and SSA graph for edge redirection expects redirection edge
|
|
|
|
targets to be in the AUX field for each edge. */
|
|
|
|
|
|
|
|
struct edge_info
|
|
|
|
{
|
|
|
|
/* If this edge creates a simple equivalence, the LHS and RHS of
|
|
|
|
the equivalence will be stored here. */
|
|
|
|
tree lhs;
|
|
|
|
tree rhs;
|
|
|
|
|
|
|
|
/* Traversing an edge may also indicate one or more particular conditions
|
|
|
|
are true or false. The number of recorded conditions can vary, but
|
|
|
|
can be determined by the condition's code. So we have an array
|
|
|
|
and its maximum index rather than use a varray. */
|
|
|
|
tree *cond_equivalences;
|
|
|
|
unsigned int max_cond_equivalences;
|
|
|
|
|
|
|
|
/* If we can thread this edge this field records the new target. */
|
|
|
|
edge redirection_target;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
/* Hash table with expressions made available during the renaming process.
|
|
|
|
When an assignment of the form X_i = EXPR is found, the statement is
|
|
|
|
stored in this table. If the same expression EXPR is later found on the
|
|
|
|
RHS of another statement, it is replaced with X_i (thus performing
|
|
|
|
global redundancy elimination). Similarly as we pass through conditionals
|
|
|
|
we record the conditional itself as having either a true or false value
|
|
|
|
in this table. */
|
|
|
|
static htab_t avail_exprs;
|
|
|
|
|
2004-09-15 06:38:04 +02:00
|
|
|
/* Stack of available expressions in AVAIL_EXPRs. Each block pushes any
|
|
|
|
expressions it enters into the hash table along with a marker entry
|
2004-09-15 15:06:30 +02:00
|
|
|
(null). When we finish processing the block, we pop off entries and
|
2004-09-15 06:38:04 +02:00
|
|
|
remove the expressions from the global hash table until we hit the
|
|
|
|
marker. */
|
2004-11-24 00:38:12 +01:00
|
|
|
static VEC(tree_on_heap) *avail_exprs_stack;
|
2004-09-15 06:38:04 +02:00
|
|
|
|
2004-09-16 21:06:12 +02:00
|
|
|
/* Stack of trees used to restore the global currdefs to its original
|
|
|
|
state after completing optimization of a block and its dominator children.
|
|
|
|
|
|
|
|
An SSA_NAME indicates that the current definition of the underlying
|
|
|
|
variable should be set to the given SSA_NAME.
|
|
|
|
|
|
|
|
A _DECL node indicates that the underlying variable has no current
|
|
|
|
definition.
|
|
|
|
|
|
|
|
A NULL node is used to mark the last node associated with the
|
|
|
|
current block. */
|
2004-11-24 00:38:12 +01:00
|
|
|
static VEC(tree_on_heap) *block_defs_stack;
|
2004-09-16 21:06:12 +02:00
|
|
|
|
2004-09-14 17:15:34 +02:00
|
|
|
/* Stack of statements we need to rescan during finalization for newly
|
|
|
|
exposed variables.
|
|
|
|
|
|
|
|
Statement rescanning must occur after the current block's available
|
|
|
|
expressions are removed from AVAIL_EXPRS. Else we may change the
|
|
|
|
hash code for an expression and be unable to find/remove it from
|
|
|
|
AVAIL_EXPRS. */
|
2004-11-24 00:38:12 +01:00
|
|
|
static VEC(tree_on_heap) *stmts_to_rescan;
|
2004-09-14 17:15:34 +02:00
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
/* Structure for entries in the expression hash table.
|
|
|
|
|
|
|
|
This requires more memory for the hash table entries, but allows us
|
|
|
|
to avoid creating silly tree nodes and annotations for conditionals,
|
|
|
|
eliminates 2 global hash tables and two block local varrays.
|
|
|
|
|
|
|
|
It also allows us to reduce the number of hash table lookups we
|
|
|
|
have to perform in lookup_avail_expr and finally it allows us to
|
|
|
|
significantly reduce the number of calls into the hashing routine
|
|
|
|
itself. */
|
2004-08-09 21:13:07 +02:00
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
struct expr_hash_elt
|
|
|
|
{
|
|
|
|
/* The value (lhs) of this expression. */
|
|
|
|
tree lhs;
|
|
|
|
|
|
|
|
/* The expression (rhs) we want to record. */
|
|
|
|
tree rhs;
|
|
|
|
|
|
|
|
/* The annotation if this element corresponds to a statement. */
|
|
|
|
stmt_ann_t ann;
|
|
|
|
|
|
|
|
/* The hash value for RHS/ann. */
|
|
|
|
hashval_t hash;
|
|
|
|
};
|
|
|
|
|
2004-09-17 23:16:07 +02:00
|
|
|
/* Stack of dest,src pairs that need to be restored during finalization.
|
|
|
|
|
|
|
|
A NULL entry is used to mark the end of pairs which need to be
|
|
|
|
restored during finalization of this block. */
|
2004-11-24 00:38:12 +01:00
|
|
|
static VEC(tree_on_heap) *const_and_copies_stack;
|
2004-09-17 23:16:07 +02:00
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
/* Bitmap of SSA_NAMEs known to have a nonzero value, even if we do not
|
|
|
|
know their exact value. */
|
|
|
|
static bitmap nonzero_vars;
|
|
|
|
|
2004-09-19 04:51:15 +02:00
|
|
|
/* Stack of SSA_NAMEs which need their NONZERO_VARS property cleared
|
|
|
|
when the current block is finalized.
|
|
|
|
|
|
|
|
A NULL entry is used to mark the end of names needing their
|
|
|
|
entry in NONZERO_VARS cleared during finalization of this block. */
|
2004-11-24 00:38:12 +01:00
|
|
|
static VEC(tree_on_heap) *nonzero_vars_stack;
|
2004-09-19 04:51:15 +02:00
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
/* Track whether or not we have changed the control flow graph. */
|
|
|
|
static bool cfg_altered;
|
|
|
|
|
2004-06-29 08:59:35 +02:00
|
|
|
/* Bitmap of blocks that have had EH statements cleaned. We should
|
2004-07-02 02:51:01 +02:00
|
|
|
remove their dead edges eventually. */
|
2004-06-29 08:59:35 +02:00
|
|
|
static bitmap need_eh_cleanup;
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
/* Statistics for dominator optimizations. */
|
|
|
|
struct opt_stats_d
|
|
|
|
{
|
|
|
|
long num_stmts;
|
|
|
|
long num_exprs_considered;
|
|
|
|
long num_re;
|
|
|
|
};
|
|
|
|
|
2004-09-22 06:12:01 +02:00
|
|
|
static struct opt_stats_d opt_stats;
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
/* Value range propagation record. Each time we encounter a conditional
|
|
|
|
of the form SSA_NAME COND CONST we create a new vrp_element to record
|
|
|
|
how the condition affects the possible values SSA_NAME may have.
|
|
|
|
|
2005-02-24 22:47:26 +01:00
|
|
|
Each record contains the condition tested (COND), and the range of
|
2004-05-13 08:41:07 +02:00
|
|
|
values the variable may legitimately have if COND is true. Note the
|
|
|
|
range of values may be a smaller range than COND specifies if we have
|
|
|
|
recorded other ranges for this variable. Each record also contains the
|
|
|
|
block in which the range was recorded for invalidation purposes.
|
|
|
|
|
|
|
|
Note that the current known range is computed lazily. This allows us
|
|
|
|
to avoid the overhead of computing ranges which are never queried.
|
|
|
|
|
|
|
|
When we encounter a conditional, we look for records which constrain
|
|
|
|
the SSA_NAME used in the condition. In some cases those records allow
|
|
|
|
us to determine the condition's result at compile time. In other cases
|
|
|
|
they may allow us to simplify the condition.
|
|
|
|
|
|
|
|
We also use value ranges to do things like transform signed div/mod
|
|
|
|
operations into unsigned div/mod or to simplify ABS_EXPRs.
|
|
|
|
|
|
|
|
Simple experiments have shown these optimizations to not be all that
|
|
|
|
useful on switch statements (much to my surprise). So switch statement
|
|
|
|
optimizations are not performed.
|
|
|
|
|
|
|
|
Note carefully we do not propagate information through each statement
|
alias.c, [...]: Fix comment typos.
* alias.c, crtstuff.c, dbxout.c, domwalk.c, domwalk.h, gcc.c,
gcse.c, global.c, lambda-code.c, loop.c, mips-tdump.c,
optabs.h, predict.c, reg-stack.c, regclass.c, sched-rgn.c,
tree-optimize.c, tree-ssa-dom.c, tree-ssa-forwprop.c,
tree-ssa-operands.c, tree-ssa-phiopt.c,
tree-ssa-threadupdate.c: Fix comment typos.
From-SVN: r87707
2004-09-18 21:47:10 +02:00
|
|
|
in the block. i.e., if we know variable X has a value defined of
|
2004-05-13 08:41:07 +02:00
|
|
|
[0, 25] and we encounter Y = X + 1, we do not track a value range
|
|
|
|
for Y (which would be [1, 26] if we cared). Similarly we do not
|
|
|
|
constrain values as we encounter narrowing typecasts, etc. */
|
|
|
|
|
|
|
|
struct vrp_element
|
|
|
|
{
|
|
|
|
/* The highest and lowest values the variable in COND may contain when
|
|
|
|
COND is true. Note this may not necessarily be the same values
|
|
|
|
tested by COND if the same variable was used in earlier conditionals.
|
|
|
|
|
|
|
|
Note this is computed lazily and thus can be NULL indicating that
|
|
|
|
the values have not been computed yet. */
|
|
|
|
tree low;
|
|
|
|
tree high;
|
|
|
|
|
|
|
|
/* The actual conditional we recorded. This is needed since we compute
|
|
|
|
ranges lazily. */
|
|
|
|
tree cond;
|
|
|
|
|
|
|
|
/* The basic block where this record was created. We use this to determine
|
|
|
|
when to remove records. */
|
|
|
|
basic_block bb;
|
|
|
|
};
|
|
|
|
|
2004-09-22 06:12:01 +02:00
|
|
|
/* A hash table holding value range records (VRP_ELEMENTs) for a given
|
|
|
|
SSA_NAME. We used to use a varray indexed by SSA_NAME_VERSION, but
|
|
|
|
that gets awful wasteful, particularly since the density objects
|
|
|
|
with useful information is very low. */
|
|
|
|
static htab_t vrp_data;
|
|
|
|
|
|
|
|
/* An entry in the VRP_DATA hash table. We record the variable and a
|
alias.c, [...]: Fix comment formatting.
* alias.c, basic-block.h, cgraphunit.c, combine.c, domwalk.h,
final.c, gengtype.c, genpreds.c, ggc-page.c, insn-notes.def,
lambda-code.c, loop-unroll.c, modulo-sched.c, pointer-set.c,
pretty-print.c, ra-colorize.c, sbitmap.c, tree-complex.c,
tree-data-ref.c, tree-dfa.c, tree-inline.c, tree-into-ssa.c,
tree-scalar-evolution.c, tree-ssa-dom.c,
tree-ssa-loop-manip.c, tree-ssa-loop-niter.c,
tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-threadupdate.c,
tree-vectorizer.c, vec.h: Fix comment formatting.
From-SVN: r89453
2004-10-22 19:05:11 +02:00
|
|
|
varray of VRP_ELEMENT records associated with that variable. */
|
2004-09-22 06:12:01 +02:00
|
|
|
struct vrp_hash_elt
|
|
|
|
{
|
|
|
|
tree var;
|
|
|
|
varray_type records;
|
|
|
|
};
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2004-09-19 04:51:15 +02:00
|
|
|
/* Array of variables which have their values constrained by operations
|
|
|
|
in this basic block. We use this during finalization to know
|
|
|
|
which variables need their VRP data updated. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
alias.c, [...]: Fix comment typos.
* alias.c, c-common.h, c-incpath.c, c-incpath.h, expr.c,
fold-const.c, gimplify.c, params.h, tree-data-ref.c,
tree-if-conv.c, tree-nested.c, tree-outof-ssa.c,
tree-ssa-dom.c, tree-vectorizer.c, tree.def, config/darwin.c,
config/freebsd-spec.h, config/arm/arm.h,
config/h8300/h8300.md, config/i386/i386.md,
config/i386/predicates.md, config/i386/sse.md,
config/ia64/ia64.c, config/ip2k/ip2k.c, config/s390/s390.c,
config/vax/vax.md: Fix comment typos. Follow spelling
conventions.
From-SVN: r94112
2005-01-23 16:05:49 +01:00
|
|
|
/* Stack of SSA_NAMEs which had their values constrained by operations
|
2004-09-19 04:51:15 +02:00
|
|
|
in this basic block. During finalization of this block we use this
|
|
|
|
list to determine which variables need their VRP data updated.
|
|
|
|
|
|
|
|
A NULL entry marks the end of the SSA_NAMEs associated with this block. */
|
2004-11-24 00:38:12 +01:00
|
|
|
static VEC(tree_on_heap) *vrp_variables_stack;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
struct eq_expr_value
|
|
|
|
{
|
|
|
|
tree src;
|
|
|
|
tree dst;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Local functions. */
|
|
|
|
static void optimize_stmt (struct dom_walk_data *,
|
|
|
|
basic_block bb,
|
|
|
|
block_stmt_iterator);
|
2004-09-15 06:38:04 +02:00
|
|
|
static tree lookup_avail_expr (tree, bool);
|
2004-09-22 06:12:01 +02:00
|
|
|
static hashval_t vrp_hash (const void *);
|
|
|
|
static int vrp_eq (const void *, const void *);
|
2004-05-13 08:41:07 +02:00
|
|
|
static hashval_t avail_expr_hash (const void *);
|
2004-06-25 00:46:56 +02:00
|
|
|
static hashval_t real_avail_expr_hash (const void *);
|
2004-05-13 08:41:07 +02:00
|
|
|
static int avail_expr_eq (const void *, const void *);
|
|
|
|
static void htab_statistics (FILE *, htab_t);
|
2004-09-15 06:38:04 +02:00
|
|
|
static void record_cond (tree, tree);
|
2004-09-17 23:16:07 +02:00
|
|
|
static void record_const_or_copy (tree, tree);
|
|
|
|
static void record_equality (tree, tree);
|
2004-09-15 06:38:04 +02:00
|
|
|
static tree update_rhs_and_lookup_avail_expr (tree, tree, bool);
|
2004-05-13 08:41:07 +02:00
|
|
|
static tree simplify_rhs_and_lookup_avail_expr (struct dom_walk_data *,
|
2004-08-10 20:31:26 +02:00
|
|
|
tree, int);
|
2004-09-15 06:38:04 +02:00
|
|
|
static tree simplify_cond_and_lookup_avail_expr (tree, stmt_ann_t, int);
|
|
|
|
static tree simplify_switch_and_lookup_avail_expr (tree, int);
|
2004-05-13 08:41:07 +02:00
|
|
|
static tree find_equivalent_equality_comparison (tree);
|
2004-09-19 04:51:15 +02:00
|
|
|
static void record_range (tree, basic_block);
|
2004-05-13 08:41:07 +02:00
|
|
|
static bool extract_range_from_cond (tree, tree *, tree *, int *);
|
2004-10-30 02:06:22 +02:00
|
|
|
static void record_equivalences_from_phis (basic_block);
|
|
|
|
static void record_equivalences_from_incoming_edge (basic_block);
|
2004-05-13 08:41:07 +02:00
|
|
|
static bool eliminate_redundant_computations (struct dom_walk_data *,
|
|
|
|
tree, stmt_ann_t);
|
2004-09-19 04:51:15 +02:00
|
|
|
static void record_equivalences_from_stmt (tree, int, stmt_ann_t);
|
2004-05-13 08:41:07 +02:00
|
|
|
static void thread_across_edge (struct dom_walk_data *, edge);
|
|
|
|
static void dom_opt_finalize_block (struct dom_walk_data *, basic_block);
|
|
|
|
static void dom_opt_initialize_block (struct dom_walk_data *, basic_block);
|
2004-10-30 02:06:22 +02:00
|
|
|
static void propagate_to_outgoing_edges (struct dom_walk_data *, basic_block);
|
2004-09-15 06:38:04 +02:00
|
|
|
static void remove_local_expressions_from_table (void);
|
2004-09-17 23:16:07 +02:00
|
|
|
static void restore_vars_to_original_value (void);
|
2004-09-16 21:06:12 +02:00
|
|
|
static void restore_currdefs_to_original_value (void);
|
|
|
|
static void register_definitions_for_stmt (tree);
|
2004-07-19 21:01:55 +02:00
|
|
|
static edge single_incoming_edge_ignoring_loop_edges (basic_block);
|
2004-09-19 04:51:15 +02:00
|
|
|
static void restore_nonzero_vars_to_original_value (void);
|
2004-10-12 22:50:08 +02:00
|
|
|
static inline bool unsafe_associative_fp_binop (tree);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* Local version of fold that doesn't introduce cruft. */
|
|
|
|
|
|
|
|
static tree
|
|
|
|
local_fold (tree t)
|
|
|
|
{
|
|
|
|
t = fold (t);
|
|
|
|
|
|
|
|
/* Strip away useless type conversions. Both the NON_LVALUE_EXPR that
|
|
|
|
may have been added by fold, and "useless" type conversions that might
|
|
|
|
now be apparent due to propagation. */
|
|
|
|
STRIP_USELESS_TYPE_CONVERSION (t);
|
|
|
|
|
|
|
|
return t;
|
|
|
|
}
|
|
|
|
|
2004-10-30 02:06:22 +02:00
|
|
|
/* Allocate an EDGE_INFO for edge E and attach it to E.
|
|
|
|
Return the new EDGE_INFO structure. */
|
|
|
|
|
|
|
|
static struct edge_info *
|
|
|
|
allocate_edge_info (edge e)
|
|
|
|
{
|
|
|
|
struct edge_info *edge_info;
|
|
|
|
|
|
|
|
edge_info = xcalloc (1, sizeof (struct edge_info));
|
|
|
|
|
|
|
|
e->aux = edge_info;
|
|
|
|
return edge_info;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Free all EDGE_INFO structures associated with edges in the CFG.
|
2004-10-30 14:15:09 +02:00
|
|
|
If a particular edge can be threaded, copy the redirection
|
2004-10-30 02:06:22 +02:00
|
|
|
target from the EDGE_INFO structure into the edge's AUX field
|
|
|
|
as required by code to update the CFG and SSA graph for
|
|
|
|
jump threading. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
free_all_edge_infos (void)
|
|
|
|
{
|
|
|
|
basic_block bb;
|
|
|
|
edge_iterator ei;
|
|
|
|
edge e;
|
|
|
|
|
|
|
|
FOR_EACH_BB (bb)
|
|
|
|
{
|
|
|
|
FOR_EACH_EDGE (e, ei, bb->preds)
|
|
|
|
{
|
|
|
|
struct edge_info *edge_info = e->aux;
|
|
|
|
|
|
|
|
if (edge_info)
|
|
|
|
{
|
|
|
|
e->aux = edge_info->redirection_target;
|
|
|
|
if (edge_info->cond_equivalences)
|
|
|
|
free (edge_info->cond_equivalences);
|
|
|
|
free (edge_info);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
/* Jump threading, redundancy elimination and const/copy propagation.
|
|
|
|
|
|
|
|
This pass may expose new symbols that need to be renamed into SSA. For
|
|
|
|
every new symbol exposed, its corresponding bit will be set in
|
2004-06-29 03:53:04 +02:00
|
|
|
VARS_TO_RENAME. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
static void
|
|
|
|
tree_ssa_dominator_optimize (void)
|
|
|
|
{
|
|
|
|
struct dom_walk_data walk_data;
|
|
|
|
unsigned int i;
|
2005-03-04 22:35:49 +01:00
|
|
|
struct loops loops_info;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2004-10-04 15:19:20 +02:00
|
|
|
memset (&opt_stats, 0, sizeof (opt_stats));
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
for (i = 0; i < num_referenced_vars; i++)
|
|
|
|
var_ann (referenced_var (i))->current_def = NULL;
|
|
|
|
|
|
|
|
/* Create our hash tables. */
|
2004-06-25 00:46:56 +02:00
|
|
|
avail_exprs = htab_create (1024, real_avail_expr_hash, avail_expr_eq, free);
|
2004-09-22 06:12:01 +02:00
|
|
|
vrp_data = htab_create (ceil_log2 (num_ssa_names), vrp_hash, vrp_eq, free);
|
2004-11-24 00:38:12 +01:00
|
|
|
avail_exprs_stack = VEC_alloc (tree_on_heap, 20);
|
2004-11-19 19:21:44 +01:00
|
|
|
block_defs_stack = VEC_alloc (tree_on_heap, 20);
|
2004-11-24 00:38:12 +01:00
|
|
|
const_and_copies_stack = VEC_alloc (tree_on_heap, 20);
|
|
|
|
nonzero_vars_stack = VEC_alloc (tree_on_heap, 20);
|
|
|
|
vrp_variables_stack = VEC_alloc (tree_on_heap, 20);
|
|
|
|
stmts_to_rescan = VEC_alloc (tree_on_heap, 20);
|
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
|
|
|
nonzero_vars = BITMAP_ALLOC (NULL);
|
|
|
|
need_eh_cleanup = BITMAP_ALLOC (NULL);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* Setup callbacks for the generic dominator tree walker. */
|
|
|
|
walk_data.walk_stmts_backward = false;
|
|
|
|
walk_data.dom_direction = CDI_DOMINATORS;
|
2004-09-19 04:51:15 +02:00
|
|
|
walk_data.initialize_block_local_data = NULL;
|
2004-05-13 08:41:07 +02:00
|
|
|
walk_data.before_dom_children_before_stmts = dom_opt_initialize_block;
|
|
|
|
walk_data.before_dom_children_walk_stmts = optimize_stmt;
|
2004-10-30 02:06:22 +02:00
|
|
|
walk_data.before_dom_children_after_stmts = propagate_to_outgoing_edges;
|
2004-05-13 08:41:07 +02:00
|
|
|
walk_data.after_dom_children_before_stmts = NULL;
|
|
|
|
walk_data.after_dom_children_walk_stmts = NULL;
|
|
|
|
walk_data.after_dom_children_after_stmts = dom_opt_finalize_block;
|
|
|
|
/* Right now we only attach a dummy COND_EXPR to the global data pointer.
|
|
|
|
When we attach more stuff we'll need to fill this out with a real
|
|
|
|
structure. */
|
|
|
|
walk_data.global_data = NULL;
|
2004-09-19 04:51:15 +02:00
|
|
|
walk_data.block_local_data_size = 0;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* Now initialize the dominator walker. */
|
|
|
|
init_walk_dominator_tree (&walk_data);
|
|
|
|
|
|
|
|
calculate_dominance_info (CDI_DOMINATORS);
|
|
|
|
|
2005-03-04 22:35:49 +01:00
|
|
|
/* We need to know which edges exit loops so that we can
|
|
|
|
aggressively thread through loop headers to an exit
|
|
|
|
edge. */
|
|
|
|
flow_loops_find (&loops_info);
|
|
|
|
mark_loop_exit_edges (&loops_info);
|
|
|
|
flow_loops_free (&loops_info);
|
|
|
|
|
|
|
|
/* Clean up the CFG so that any forwarder blocks created by loop
|
|
|
|
canonicalization are removed. */
|
|
|
|
cleanup_tree_cfg ();
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
/* If we prove certain blocks are unreachable, then we want to
|
|
|
|
repeat the dominator optimization process as PHI nodes may
|
|
|
|
have turned into copies which allows better propagation of
|
|
|
|
values. So we repeat until we do not identify any new unreachable
|
|
|
|
blocks. */
|
|
|
|
do
|
|
|
|
{
|
|
|
|
/* Optimize the dominator tree. */
|
|
|
|
cfg_altered = false;
|
|
|
|
|
2005-03-04 22:35:49 +01:00
|
|
|
/* We need accurate information regarding back edges in the CFG
|
|
|
|
for jump threading. */
|
|
|
|
mark_dfs_back_edges ();
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
/* Recursively walk the dominator tree optimizing statements. */
|
|
|
|
walk_dominator_tree (&walk_data, ENTRY_BLOCK_PTR);
|
|
|
|
|
2004-08-09 21:13:07 +02:00
|
|
|
/* If we exposed any new variables, go ahead and put them into
|
|
|
|
SSA form now, before we handle jump threading. This simplifies
|
|
|
|
interactions between rewriting of _DECL nodes into SSA form
|
|
|
|
and rewriting SSA_NAME nodes into SSA form after block
|
|
|
|
duplication and CFG manipulation. */
|
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
|
|
|
if (!bitmap_empty_p (vars_to_rename))
|
2004-08-09 21:13:07 +02:00
|
|
|
{
|
|
|
|
rewrite_into_ssa (false);
|
|
|
|
bitmap_clear (vars_to_rename);
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2004-10-30 02:06:22 +02:00
|
|
|
free_all_edge_infos ();
|
|
|
|
|
2004-08-09 21:13:07 +02:00
|
|
|
/* Thread jumps, creating duplicate blocks as needed. */
|
2005-03-02 19:54:34 +01:00
|
|
|
cfg_altered |= thread_through_all_blocks ();
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2004-08-09 21:13:07 +02:00
|
|
|
/* Removal of statements may make some EH edges dead. Purge
|
|
|
|
such edges from the CFG as needed. */
|
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
|
|
|
if (!bitmap_empty_p (need_eh_cleanup))
|
2004-06-29 08:59:35 +02:00
|
|
|
{
|
2004-08-09 21:13:07 +02:00
|
|
|
cfg_altered |= tree_purge_all_dead_eh_edges (need_eh_cleanup);
|
2004-06-29 08:59:35 +02:00
|
|
|
bitmap_zero (need_eh_cleanup);
|
|
|
|
}
|
|
|
|
|
2005-03-02 20:12:55 +01:00
|
|
|
if (cfg_altered)
|
2005-03-04 22:35:49 +01:00
|
|
|
free_dominance_info (CDI_DOMINATORS);
|
|
|
|
|
2005-03-02 19:54:34 +01:00
|
|
|
cfg_altered |= cleanup_tree_cfg ();
|
2005-03-04 22:35:49 +01:00
|
|
|
|
|
|
|
if (rediscover_loops_after_threading)
|
|
|
|
{
|
|
|
|
/* Rerun basic loop analysis to discover any newly
|
|
|
|
created loops and update the set of exit edges. */
|
|
|
|
rediscover_loops_after_threading = false;
|
|
|
|
flow_loops_find (&loops_info);
|
|
|
|
mark_loop_exit_edges (&loops_info);
|
|
|
|
flow_loops_free (&loops_info);
|
|
|
|
|
|
|
|
/* Remove any forwarder blocks inserted by loop
|
|
|
|
header canonicalization. */
|
|
|
|
cleanup_tree_cfg ();
|
|
|
|
}
|
|
|
|
|
2004-08-09 21:13:07 +02:00
|
|
|
calculate_dominance_info (CDI_DOMINATORS);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2004-08-09 21:13:07 +02:00
|
|
|
rewrite_ssa_into_ssa ();
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* Reinitialize the various tables. */
|
|
|
|
bitmap_clear (nonzero_vars);
|
|
|
|
htab_empty (avail_exprs);
|
2004-09-22 06:12:01 +02:00
|
|
|
htab_empty (vrp_data);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2005-01-18 05:38:59 +01:00
|
|
|
for (i = 0; i < num_referenced_vars; i++)
|
|
|
|
var_ann (referenced_var (i))->current_def = NULL;
|
|
|
|
|
2005-01-18 05:36:40 +01:00
|
|
|
/* Finally, remove everything except invariants in SSA_NAME_VALUE.
|
|
|
|
|
|
|
|
This must be done before we iterate as we might have a
|
|
|
|
reference to an SSA_NAME which was removed by the call to
|
|
|
|
rewrite_ssa_into_ssa.
|
|
|
|
|
|
|
|
Long term we will be able to let everything in SSA_NAME_VALUE
|
|
|
|
persist. However, for now, we know this is the safe thing to do. */
|
|
|
|
for (i = 0; i < num_ssa_names; i++)
|
|
|
|
{
|
|
|
|
tree name = ssa_name (i);
|
|
|
|
tree value;
|
|
|
|
|
|
|
|
if (!name)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
value = SSA_NAME_VALUE (name);
|
|
|
|
if (value && !is_gimple_min_invariant (value))
|
|
|
|
SSA_NAME_VALUE (name) = NULL;
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
2005-01-27 17:32:12 +01:00
|
|
|
while (optimize > 1 && cfg_altered);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* Debugging dumps. */
|
|
|
|
if (dump_file && (dump_flags & TDF_STATS))
|
|
|
|
dump_dominator_optimization_stats (dump_file);
|
|
|
|
|
c-typeck.c, [...]: Fix comment typos.
* c-typeck.c, cfgexpand.c, ddg.c, ddg.h, df.c, fold-const.c,
gcov.c, gimplify.c, modulo-sched.c, passes.c, tree-cfg.c,
tree-mudflap.c, tree-nrv.c, tree-outof-ssa.c, tree-ssa-dom.c,
tree-ssa-dse.c, tree-ssa-operands.c, tree-ssa-pre.c,
tree-tailcall.c: Fix comment typos. Follow spelling
conventions.
From-SVN: r83703
2004-06-26 07:03:55 +02:00
|
|
|
/* We emptied the hash table earlier, now delete it completely. */
|
2004-05-13 08:41:07 +02:00
|
|
|
htab_delete (avail_exprs);
|
2004-09-22 06:12:01 +02:00
|
|
|
htab_delete (vrp_data);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
c-common.c, [...]: Fix comment typos.
* c-common.c, calls.c, cfgcleanup.c, cgraph.c, cgraphunit.c,
ddg.c, ddg.h, df.c, df.h, except.c, expr.c, flags.h,
fold-const.c, gcc.c, gimplify.c, haifa-sched.c,
modulo-sched.c, tree-inline.c, tree-into-ssa.c, tree-nested.c,
tree-nrv.c, tree-ssa-ccp.c, tree-ssa-dom.c, tree-ssa-live.c,
tree-ssa-loop.c, tree-ssa-pre.c, tree-tailcall.c, tree.h: Fix
comment typos. Follow spelling conventions.
From-SVN: r82439
2004-05-30 09:12:58 +02:00
|
|
|
/* It is not necessary to clear CURRDEFS, REDIRECTION_EDGES, VRP_DATA,
|
2004-05-13 08:41:07 +02:00
|
|
|
CONST_AND_COPIES, and NONZERO_VARS as they all get cleared at the bottom
|
|
|
|
of the do-while loop above. */
|
|
|
|
|
|
|
|
/* And finalize the dominator walker. */
|
|
|
|
fini_walk_dominator_tree (&walk_data);
|
2004-05-13 17:21:53 +02:00
|
|
|
|
alias.c, [...]: Fix comment formatting.
* alias.c, basic-block.h, cgraphunit.c, combine.c, domwalk.h,
final.c, gengtype.c, genpreds.c, ggc-page.c, insn-notes.def,
lambda-code.c, loop-unroll.c, modulo-sched.c, pointer-set.c,
pretty-print.c, ra-colorize.c, sbitmap.c, tree-complex.c,
tree-data-ref.c, tree-dfa.c, tree-inline.c, tree-into-ssa.c,
tree-scalar-evolution.c, tree-ssa-dom.c,
tree-ssa-loop-manip.c, tree-ssa-loop-niter.c,
tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-threadupdate.c,
tree-vectorizer.c, vec.h: Fix comment formatting.
From-SVN: r89453
2004-10-22 19:05:11 +02:00
|
|
|
/* Free nonzero_vars. */
|
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 (nonzero_vars);
|
|
|
|
BITMAP_FREE (need_eh_cleanup);
|
2004-11-19 19:21:44 +01:00
|
|
|
|
|
|
|
VEC_free (tree_on_heap, block_defs_stack);
|
2004-11-24 00:38:12 +01:00
|
|
|
VEC_free (tree_on_heap, avail_exprs_stack);
|
|
|
|
VEC_free (tree_on_heap, const_and_copies_stack);
|
|
|
|
VEC_free (tree_on_heap, nonzero_vars_stack);
|
|
|
|
VEC_free (tree_on_heap, vrp_variables_stack);
|
|
|
|
VEC_free (tree_on_heap, stmts_to_rescan);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static bool
|
|
|
|
gate_dominator (void)
|
|
|
|
{
|
|
|
|
return flag_tree_dom != 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct tree_opt_pass pass_dominator =
|
|
|
|
{
|
|
|
|
"dom", /* name */
|
|
|
|
gate_dominator, /* gate */
|
|
|
|
tree_ssa_dominator_optimize, /* execute */
|
|
|
|
NULL, /* sub */
|
|
|
|
NULL, /* next */
|
|
|
|
0, /* static_pass_number */
|
|
|
|
TV_TREE_SSA_DOMINATOR_OPTS, /* 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_verify_ssa, /* todo_flags_finish */
|
|
|
|
0 /* letter */
|
2004-05-13 08:41:07 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
/* We are exiting BB, see if the target block begins with a conditional
|
|
|
|
jump which has a known value when reached via BB. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
thread_across_edge (struct dom_walk_data *walk_data, edge e)
|
|
|
|
{
|
|
|
|
block_stmt_iterator bsi;
|
|
|
|
tree stmt = NULL;
|
|
|
|
tree phi;
|
|
|
|
|
|
|
|
/* Each PHI creates a temporary equivalence, record them. */
|
tree.h (PHI_CHAIN): New.
* tree.h (PHI_CHAIN): New.
* (tree-cfg.c, tree-dfa.c, tree-flow-inline.h, tree-into-ssa.c,
tree-outof-ssa.c, tree-phinodes.c, tree-pretty-print.c,
tree-ssa-alias.c, tree-ssa-ccp.c, tree-ssa-dom.c, tree-ssa-dse.c,
tree-ssa-live.c, tree-ssa-loop.c, tree-ssa-phiopt.c, tree-ssa-pre.c,
tree-ssa.c, tree-tailcall.c): Use PHI_CHAIN instead of TREE_CHAIN
when traversing a list of PHI_NODEs.
From-SVN: r83273
2004-06-17 01:03:34 +02:00
|
|
|
for (phi = phi_nodes (e->dest); phi; phi = PHI_CHAIN (phi))
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
tree-cfg.c (tree_make_forwarder_block): Use SET_PHI_RESULT.
2004-06-16 Andrew MacLeod <amacleod@redhat.com>
* tree-cfg.c (tree_make_forwarder_block): Use SET_PHI_RESULT.
* tree-flow-inline.h (get_use_op_ptr): Return a use_operand_p.
(get_use_from_ptr, get_def_from_ptr): New. Return operand pointers.
(get_def_op_ptr): Return a def_operand_p instead of a 'tree *'.
(get_v_may_def_result_ptr): Return a def_operand_p.
(get_v_may_def_op_ptr, get_vuse_op_ptr): Return a use_operand_p.
(get_v_must_def_op_ptr): Return a def_operand_p.
(get_phi_result_ptr): New. Return a pointer to the result of a PHI.
(get_phi_arg_def_ptr): New. Return a pointer to an argument of a PHI.
(phi_element_for_edge): Remove.
* tree-flow.h (propagate_value, replace_exp): Change prototype.
(propagate_tree_value): Add new prototype.
(phi_element_for_edge): Remove prototype.
* tree-into-ssa.c (mark_def_sites): Use new operand types.
(prepare_operand_for_rename): Split into two functions.
(prepare_use_operand_for_rename): Prepare use operands.
(prepare_def_operand_for_rename): Prepare def operands.
(rewrite_stmt): Use new operand types.
(rewrite_operand): Use new operand types, change parameter type.
* tree-outof-ssa.c (replace_variable): Split into two functions.
(replace_use_variable): Rewrite uses.
(replace_def_variable): Rewrite defs.
(rewrite_trees, rewrite_vars_out_of_ssa): Use new operand types.
* tree-phinodes.c (make_phi_node, resize_phi_node): Use new types.
(add_phi_arg, remove_phi_arg_num): Use new operand types.
* tree-ssa-ccp.c (substitute_and_fold): Use new operand types.
(ccp_fold, replace_uses_in): Use new operand types.
* tree-ssa-copy.c (replace_ssa_names): Rename to replace_ssa_names_ann
and no longer set the value, change parameter type.
(replace_exp_1): Use new operand types.
(propagate_value): Change parameter type, use new operand types.
(propagate_tree_value): Propagate_value without SSA operands.
(replace_exp, cprop_operand, cprop_into_stmt): Use new operand types.
(cprop_into_successor_phis): Use new operand types.
* tree-ssa-dom.c (thread_across_edge): Use new operand types.
(eliminate_redundant_computations): Use new operand types.
* tree-ssa-dse.c (fix_phi_uses): Use new operand_types.
(fix_stmt_v_may_defs): Use new operand_types.
* tree-ssa-live.c (create_ssa_var_map): Use new operand_types.
(build_tree_conflict_graph): Use new operand_types.
* tree-ssa-loop.c (duplicate_blocks): Use PHI_ARG_DEF_FROM_EDGE.
* tree-ssa-operands.c (struct freelist_d): Remove.
(check_optype_freelist, add_optype_freelist): Remove.
(allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype,
allocate_vuse_optype, allocate_v_must_def_optype): Call ggc_alloc.
(free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs):
Call ggc_free instead of add_optype_freelist.
(init_ssa_operands, fini_ssa_operands): Remove free list code.
(finalize_ssa_defs, finalize_ssa_uses): Set new use/def operands.
* tree-ssa-operands.h (struct def_optype_d): Change underlying type.
(struct use_optype_d): Change underlying type.
(def_operand_p, use_operand_p): New types for pointers to operands.
(USE_OP, DEF_OP, V_MAY_DEF_RESULT, V_MAY_DEF_OP, VUSE_OP,
V_MUST_DEF_OP): Use new pointer type instead of dereferencing directly.
(USE_FROM_PTR, DEF_FROM_PTR): New macros to "dereference" operand
pointer types.
(SET_USE, SET_DEF): New macros to set operands from their pointer.
(SET_USE_OP, SET_DEF_OP, SET_V_MAY_DEF_RESULT, SET_V_MAY_DEF_OP,
SET_VUSE_OP, SET_V_MUST_DEF_OP): New SET routines for operands.
(PHI_RESULT_PTR, PHI_RESULT, SET_PHI_RESULT): Macros to manage the
PHI result as an operand.
(PHI_ARG_DEF_PTR, PHI_ARG_DEF, SET_PHI_ARG_DEF, PHI_ARG_DEF_FROM_EDGE,
PHI_ARG_DEF_PTR_FROM_EDGE): Macros to manage the PHI arguments.
* tree-ssa-pre.c (eliminate): Call propagate_tree_value.
* tree-tailcall.c (independent_of_stmt_p, propagate_through_phis): Use
PHI_ARG_DEF_FROM_EDGE.
* tree.h (PHI_RESULT): Renamed to PHI_RESULT_TREE.
(PHI_ARG_DEF): Renamed to PHI_ARG_DEF_TREE.
From-SVN: r83298
2004-06-17 20:13:20 +02:00
|
|
|
tree src = PHI_ARG_DEF_FROM_EDGE (phi, e);
|
2004-05-13 08:41:07 +02:00
|
|
|
tree dst = PHI_RESULT (phi);
|
2004-12-13 21:12:33 +01:00
|
|
|
|
|
|
|
/* If the desired argument is not the same as this PHI's result
|
|
|
|
and it is set by a PHI in this block, then we can not thread
|
|
|
|
through this block. */
|
|
|
|
if (src != dst
|
|
|
|
&& TREE_CODE (src) == SSA_NAME
|
|
|
|
&& TREE_CODE (SSA_NAME_DEF_STMT (src)) == PHI_NODE
|
|
|
|
&& bb_for_stmt (SSA_NAME_DEF_STMT (src)) == e->dest)
|
|
|
|
return;
|
|
|
|
|
2004-09-17 23:16:07 +02:00
|
|
|
record_const_or_copy (dst, src);
|
2004-09-16 21:06:12 +02:00
|
|
|
register_new_def (dst, &block_defs_stack);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
for (bsi = bsi_start (e->dest); ! bsi_end_p (bsi); bsi_next (&bsi))
|
|
|
|
{
|
|
|
|
tree lhs, cached_lhs;
|
|
|
|
|
|
|
|
stmt = bsi_stmt (bsi);
|
|
|
|
|
|
|
|
/* Ignore empty statements and labels. */
|
|
|
|
if (IS_EMPTY_STMT (stmt) || TREE_CODE (stmt) == LABEL_EXPR)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* If this is not a MODIFY_EXPR which sets an SSA_NAME to a new
|
|
|
|
value, then stop our search here. Ideally when we stop a
|
|
|
|
search we stop on a COND_EXPR or SWITCH_EXPR. */
|
|
|
|
if (TREE_CODE (stmt) != MODIFY_EXPR
|
|
|
|
|| TREE_CODE (TREE_OPERAND (stmt, 0)) != SSA_NAME)
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* At this point we have a statement which assigns an RHS to an
|
|
|
|
SSA_VAR on the LHS. We want to prove that the RHS is already
|
|
|
|
available and that its value is held in the current definition
|
|
|
|
of the LHS -- meaning that this assignment is a NOP when
|
|
|
|
reached via edge E. */
|
|
|
|
if (TREE_CODE (TREE_OPERAND (stmt, 1)) == SSA_NAME)
|
|
|
|
cached_lhs = TREE_OPERAND (stmt, 1);
|
|
|
|
else
|
2004-09-15 06:38:04 +02:00
|
|
|
cached_lhs = lookup_avail_expr (stmt, false);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
lhs = TREE_OPERAND (stmt, 0);
|
|
|
|
|
|
|
|
/* This can happen if we thread around to the start of a loop. */
|
|
|
|
if (lhs == cached_lhs)
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* If we did not find RHS in the hash table, then try again after
|
|
|
|
temporarily const/copy propagating the operands. */
|
|
|
|
if (!cached_lhs)
|
|
|
|
{
|
|
|
|
/* Copy the operands. */
|
|
|
|
stmt_ann_t ann = stmt_ann (stmt);
|
|
|
|
use_optype uses = USE_OPS (ann);
|
|
|
|
vuse_optype vuses = VUSE_OPS (ann);
|
2005-02-10 18:53:46 +01:00
|
|
|
tree *uses_copy = xmalloc (NUM_USES (uses) * sizeof (tree));
|
|
|
|
tree *vuses_copy = xmalloc (NUM_VUSES (vuses) * sizeof (tree));
|
2004-05-13 08:41:07 +02:00
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
/* Make a copy of the uses into USES_COPY, then cprop into
|
|
|
|
the use operands. */
|
|
|
|
for (i = 0; i < NUM_USES (uses); i++)
|
|
|
|
{
|
|
|
|
tree tmp = NULL;
|
|
|
|
|
|
|
|
uses_copy[i] = USE_OP (uses, i);
|
|
|
|
if (TREE_CODE (USE_OP (uses, i)) == SSA_NAME)
|
2004-09-23 22:15:30 +02:00
|
|
|
tmp = SSA_NAME_VALUE (USE_OP (uses, i));
|
|
|
|
if (tmp && TREE_CODE (tmp) != VALUE_HANDLE)
|
tree-cfg.c (tree_make_forwarder_block): Use SET_PHI_RESULT.
2004-06-16 Andrew MacLeod <amacleod@redhat.com>
* tree-cfg.c (tree_make_forwarder_block): Use SET_PHI_RESULT.
* tree-flow-inline.h (get_use_op_ptr): Return a use_operand_p.
(get_use_from_ptr, get_def_from_ptr): New. Return operand pointers.
(get_def_op_ptr): Return a def_operand_p instead of a 'tree *'.
(get_v_may_def_result_ptr): Return a def_operand_p.
(get_v_may_def_op_ptr, get_vuse_op_ptr): Return a use_operand_p.
(get_v_must_def_op_ptr): Return a def_operand_p.
(get_phi_result_ptr): New. Return a pointer to the result of a PHI.
(get_phi_arg_def_ptr): New. Return a pointer to an argument of a PHI.
(phi_element_for_edge): Remove.
* tree-flow.h (propagate_value, replace_exp): Change prototype.
(propagate_tree_value): Add new prototype.
(phi_element_for_edge): Remove prototype.
* tree-into-ssa.c (mark_def_sites): Use new operand types.
(prepare_operand_for_rename): Split into two functions.
(prepare_use_operand_for_rename): Prepare use operands.
(prepare_def_operand_for_rename): Prepare def operands.
(rewrite_stmt): Use new operand types.
(rewrite_operand): Use new operand types, change parameter type.
* tree-outof-ssa.c (replace_variable): Split into two functions.
(replace_use_variable): Rewrite uses.
(replace_def_variable): Rewrite defs.
(rewrite_trees, rewrite_vars_out_of_ssa): Use new operand types.
* tree-phinodes.c (make_phi_node, resize_phi_node): Use new types.
(add_phi_arg, remove_phi_arg_num): Use new operand types.
* tree-ssa-ccp.c (substitute_and_fold): Use new operand types.
(ccp_fold, replace_uses_in): Use new operand types.
* tree-ssa-copy.c (replace_ssa_names): Rename to replace_ssa_names_ann
and no longer set the value, change parameter type.
(replace_exp_1): Use new operand types.
(propagate_value): Change parameter type, use new operand types.
(propagate_tree_value): Propagate_value without SSA operands.
(replace_exp, cprop_operand, cprop_into_stmt): Use new operand types.
(cprop_into_successor_phis): Use new operand types.
* tree-ssa-dom.c (thread_across_edge): Use new operand types.
(eliminate_redundant_computations): Use new operand types.
* tree-ssa-dse.c (fix_phi_uses): Use new operand_types.
(fix_stmt_v_may_defs): Use new operand_types.
* tree-ssa-live.c (create_ssa_var_map): Use new operand_types.
(build_tree_conflict_graph): Use new operand_types.
* tree-ssa-loop.c (duplicate_blocks): Use PHI_ARG_DEF_FROM_EDGE.
* tree-ssa-operands.c (struct freelist_d): Remove.
(check_optype_freelist, add_optype_freelist): Remove.
(allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype,
allocate_vuse_optype, allocate_v_must_def_optype): Call ggc_alloc.
(free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs):
Call ggc_free instead of add_optype_freelist.
(init_ssa_operands, fini_ssa_operands): Remove free list code.
(finalize_ssa_defs, finalize_ssa_uses): Set new use/def operands.
* tree-ssa-operands.h (struct def_optype_d): Change underlying type.
(struct use_optype_d): Change underlying type.
(def_operand_p, use_operand_p): New types for pointers to operands.
(USE_OP, DEF_OP, V_MAY_DEF_RESULT, V_MAY_DEF_OP, VUSE_OP,
V_MUST_DEF_OP): Use new pointer type instead of dereferencing directly.
(USE_FROM_PTR, DEF_FROM_PTR): New macros to "dereference" operand
pointer types.
(SET_USE, SET_DEF): New macros to set operands from their pointer.
(SET_USE_OP, SET_DEF_OP, SET_V_MAY_DEF_RESULT, SET_V_MAY_DEF_OP,
SET_VUSE_OP, SET_V_MUST_DEF_OP): New SET routines for operands.
(PHI_RESULT_PTR, PHI_RESULT, SET_PHI_RESULT): Macros to manage the
PHI result as an operand.
(PHI_ARG_DEF_PTR, PHI_ARG_DEF, SET_PHI_ARG_DEF, PHI_ARG_DEF_FROM_EDGE,
PHI_ARG_DEF_PTR_FROM_EDGE): Macros to manage the PHI arguments.
* tree-ssa-pre.c (eliminate): Call propagate_tree_value.
* tree-tailcall.c (independent_of_stmt_p, propagate_through_phis): Use
PHI_ARG_DEF_FROM_EDGE.
* tree.h (PHI_RESULT): Renamed to PHI_RESULT_TREE.
(PHI_ARG_DEF): Renamed to PHI_ARG_DEF_TREE.
From-SVN: r83298
2004-06-17 20:13:20 +02:00
|
|
|
SET_USE_OP (uses, i, tmp);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Similarly for virtual uses. */
|
|
|
|
for (i = 0; i < NUM_VUSES (vuses); i++)
|
|
|
|
{
|
|
|
|
tree tmp = NULL;
|
|
|
|
|
|
|
|
vuses_copy[i] = VUSE_OP (vuses, i);
|
|
|
|
if (TREE_CODE (VUSE_OP (vuses, i)) == SSA_NAME)
|
2004-09-23 22:15:30 +02:00
|
|
|
tmp = SSA_NAME_VALUE (VUSE_OP (vuses, i));
|
|
|
|
if (tmp && TREE_CODE (tmp) != VALUE_HANDLE)
|
tree-cfg.c (tree_make_forwarder_block): Use SET_PHI_RESULT.
2004-06-16 Andrew MacLeod <amacleod@redhat.com>
* tree-cfg.c (tree_make_forwarder_block): Use SET_PHI_RESULT.
* tree-flow-inline.h (get_use_op_ptr): Return a use_operand_p.
(get_use_from_ptr, get_def_from_ptr): New. Return operand pointers.
(get_def_op_ptr): Return a def_operand_p instead of a 'tree *'.
(get_v_may_def_result_ptr): Return a def_operand_p.
(get_v_may_def_op_ptr, get_vuse_op_ptr): Return a use_operand_p.
(get_v_must_def_op_ptr): Return a def_operand_p.
(get_phi_result_ptr): New. Return a pointer to the result of a PHI.
(get_phi_arg_def_ptr): New. Return a pointer to an argument of a PHI.
(phi_element_for_edge): Remove.
* tree-flow.h (propagate_value, replace_exp): Change prototype.
(propagate_tree_value): Add new prototype.
(phi_element_for_edge): Remove prototype.
* tree-into-ssa.c (mark_def_sites): Use new operand types.
(prepare_operand_for_rename): Split into two functions.
(prepare_use_operand_for_rename): Prepare use operands.
(prepare_def_operand_for_rename): Prepare def operands.
(rewrite_stmt): Use new operand types.
(rewrite_operand): Use new operand types, change parameter type.
* tree-outof-ssa.c (replace_variable): Split into two functions.
(replace_use_variable): Rewrite uses.
(replace_def_variable): Rewrite defs.
(rewrite_trees, rewrite_vars_out_of_ssa): Use new operand types.
* tree-phinodes.c (make_phi_node, resize_phi_node): Use new types.
(add_phi_arg, remove_phi_arg_num): Use new operand types.
* tree-ssa-ccp.c (substitute_and_fold): Use new operand types.
(ccp_fold, replace_uses_in): Use new operand types.
* tree-ssa-copy.c (replace_ssa_names): Rename to replace_ssa_names_ann
and no longer set the value, change parameter type.
(replace_exp_1): Use new operand types.
(propagate_value): Change parameter type, use new operand types.
(propagate_tree_value): Propagate_value without SSA operands.
(replace_exp, cprop_operand, cprop_into_stmt): Use new operand types.
(cprop_into_successor_phis): Use new operand types.
* tree-ssa-dom.c (thread_across_edge): Use new operand types.
(eliminate_redundant_computations): Use new operand types.
* tree-ssa-dse.c (fix_phi_uses): Use new operand_types.
(fix_stmt_v_may_defs): Use new operand_types.
* tree-ssa-live.c (create_ssa_var_map): Use new operand_types.
(build_tree_conflict_graph): Use new operand_types.
* tree-ssa-loop.c (duplicate_blocks): Use PHI_ARG_DEF_FROM_EDGE.
* tree-ssa-operands.c (struct freelist_d): Remove.
(check_optype_freelist, add_optype_freelist): Remove.
(allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype,
allocate_vuse_optype, allocate_v_must_def_optype): Call ggc_alloc.
(free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs):
Call ggc_free instead of add_optype_freelist.
(init_ssa_operands, fini_ssa_operands): Remove free list code.
(finalize_ssa_defs, finalize_ssa_uses): Set new use/def operands.
* tree-ssa-operands.h (struct def_optype_d): Change underlying type.
(struct use_optype_d): Change underlying type.
(def_operand_p, use_operand_p): New types for pointers to operands.
(USE_OP, DEF_OP, V_MAY_DEF_RESULT, V_MAY_DEF_OP, VUSE_OP,
V_MUST_DEF_OP): Use new pointer type instead of dereferencing directly.
(USE_FROM_PTR, DEF_FROM_PTR): New macros to "dereference" operand
pointer types.
(SET_USE, SET_DEF): New macros to set operands from their pointer.
(SET_USE_OP, SET_DEF_OP, SET_V_MAY_DEF_RESULT, SET_V_MAY_DEF_OP,
SET_VUSE_OP, SET_V_MUST_DEF_OP): New SET routines for operands.
(PHI_RESULT_PTR, PHI_RESULT, SET_PHI_RESULT): Macros to manage the
PHI result as an operand.
(PHI_ARG_DEF_PTR, PHI_ARG_DEF, SET_PHI_ARG_DEF, PHI_ARG_DEF_FROM_EDGE,
PHI_ARG_DEF_PTR_FROM_EDGE): Macros to manage the PHI arguments.
* tree-ssa-pre.c (eliminate): Call propagate_tree_value.
* tree-tailcall.c (independent_of_stmt_p, propagate_through_phis): Use
PHI_ARG_DEF_FROM_EDGE.
* tree.h (PHI_RESULT): Renamed to PHI_RESULT_TREE.
(PHI_ARG_DEF): Renamed to PHI_ARG_DEF_TREE.
From-SVN: r83298
2004-06-17 20:13:20 +02:00
|
|
|
SET_VUSE_OP (vuses, i, tmp);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Try to lookup the new expression. */
|
2004-09-15 06:38:04 +02:00
|
|
|
cached_lhs = lookup_avail_expr (stmt, false);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* Restore the statement's original uses/defs. */
|
|
|
|
for (i = 0; i < NUM_USES (uses); i++)
|
tree-cfg.c (tree_make_forwarder_block): Use SET_PHI_RESULT.
2004-06-16 Andrew MacLeod <amacleod@redhat.com>
* tree-cfg.c (tree_make_forwarder_block): Use SET_PHI_RESULT.
* tree-flow-inline.h (get_use_op_ptr): Return a use_operand_p.
(get_use_from_ptr, get_def_from_ptr): New. Return operand pointers.
(get_def_op_ptr): Return a def_operand_p instead of a 'tree *'.
(get_v_may_def_result_ptr): Return a def_operand_p.
(get_v_may_def_op_ptr, get_vuse_op_ptr): Return a use_operand_p.
(get_v_must_def_op_ptr): Return a def_operand_p.
(get_phi_result_ptr): New. Return a pointer to the result of a PHI.
(get_phi_arg_def_ptr): New. Return a pointer to an argument of a PHI.
(phi_element_for_edge): Remove.
* tree-flow.h (propagate_value, replace_exp): Change prototype.
(propagate_tree_value): Add new prototype.
(phi_element_for_edge): Remove prototype.
* tree-into-ssa.c (mark_def_sites): Use new operand types.
(prepare_operand_for_rename): Split into two functions.
(prepare_use_operand_for_rename): Prepare use operands.
(prepare_def_operand_for_rename): Prepare def operands.
(rewrite_stmt): Use new operand types.
(rewrite_operand): Use new operand types, change parameter type.
* tree-outof-ssa.c (replace_variable): Split into two functions.
(replace_use_variable): Rewrite uses.
(replace_def_variable): Rewrite defs.
(rewrite_trees, rewrite_vars_out_of_ssa): Use new operand types.
* tree-phinodes.c (make_phi_node, resize_phi_node): Use new types.
(add_phi_arg, remove_phi_arg_num): Use new operand types.
* tree-ssa-ccp.c (substitute_and_fold): Use new operand types.
(ccp_fold, replace_uses_in): Use new operand types.
* tree-ssa-copy.c (replace_ssa_names): Rename to replace_ssa_names_ann
and no longer set the value, change parameter type.
(replace_exp_1): Use new operand types.
(propagate_value): Change parameter type, use new operand types.
(propagate_tree_value): Propagate_value without SSA operands.
(replace_exp, cprop_operand, cprop_into_stmt): Use new operand types.
(cprop_into_successor_phis): Use new operand types.
* tree-ssa-dom.c (thread_across_edge): Use new operand types.
(eliminate_redundant_computations): Use new operand types.
* tree-ssa-dse.c (fix_phi_uses): Use new operand_types.
(fix_stmt_v_may_defs): Use new operand_types.
* tree-ssa-live.c (create_ssa_var_map): Use new operand_types.
(build_tree_conflict_graph): Use new operand_types.
* tree-ssa-loop.c (duplicate_blocks): Use PHI_ARG_DEF_FROM_EDGE.
* tree-ssa-operands.c (struct freelist_d): Remove.
(check_optype_freelist, add_optype_freelist): Remove.
(allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype,
allocate_vuse_optype, allocate_v_must_def_optype): Call ggc_alloc.
(free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs):
Call ggc_free instead of add_optype_freelist.
(init_ssa_operands, fini_ssa_operands): Remove free list code.
(finalize_ssa_defs, finalize_ssa_uses): Set new use/def operands.
* tree-ssa-operands.h (struct def_optype_d): Change underlying type.
(struct use_optype_d): Change underlying type.
(def_operand_p, use_operand_p): New types for pointers to operands.
(USE_OP, DEF_OP, V_MAY_DEF_RESULT, V_MAY_DEF_OP, VUSE_OP,
V_MUST_DEF_OP): Use new pointer type instead of dereferencing directly.
(USE_FROM_PTR, DEF_FROM_PTR): New macros to "dereference" operand
pointer types.
(SET_USE, SET_DEF): New macros to set operands from their pointer.
(SET_USE_OP, SET_DEF_OP, SET_V_MAY_DEF_RESULT, SET_V_MAY_DEF_OP,
SET_VUSE_OP, SET_V_MUST_DEF_OP): New SET routines for operands.
(PHI_RESULT_PTR, PHI_RESULT, SET_PHI_RESULT): Macros to manage the
PHI result as an operand.
(PHI_ARG_DEF_PTR, PHI_ARG_DEF, SET_PHI_ARG_DEF, PHI_ARG_DEF_FROM_EDGE,
PHI_ARG_DEF_PTR_FROM_EDGE): Macros to manage the PHI arguments.
* tree-ssa-pre.c (eliminate): Call propagate_tree_value.
* tree-tailcall.c (independent_of_stmt_p, propagate_through_phis): Use
PHI_ARG_DEF_FROM_EDGE.
* tree.h (PHI_RESULT): Renamed to PHI_RESULT_TREE.
(PHI_ARG_DEF): Renamed to PHI_ARG_DEF_TREE.
From-SVN: r83298
2004-06-17 20:13:20 +02:00
|
|
|
SET_USE_OP (uses, i, uses_copy[i]);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
for (i = 0; i < NUM_VUSES (vuses); i++)
|
tree-cfg.c (tree_make_forwarder_block): Use SET_PHI_RESULT.
2004-06-16 Andrew MacLeod <amacleod@redhat.com>
* tree-cfg.c (tree_make_forwarder_block): Use SET_PHI_RESULT.
* tree-flow-inline.h (get_use_op_ptr): Return a use_operand_p.
(get_use_from_ptr, get_def_from_ptr): New. Return operand pointers.
(get_def_op_ptr): Return a def_operand_p instead of a 'tree *'.
(get_v_may_def_result_ptr): Return a def_operand_p.
(get_v_may_def_op_ptr, get_vuse_op_ptr): Return a use_operand_p.
(get_v_must_def_op_ptr): Return a def_operand_p.
(get_phi_result_ptr): New. Return a pointer to the result of a PHI.
(get_phi_arg_def_ptr): New. Return a pointer to an argument of a PHI.
(phi_element_for_edge): Remove.
* tree-flow.h (propagate_value, replace_exp): Change prototype.
(propagate_tree_value): Add new prototype.
(phi_element_for_edge): Remove prototype.
* tree-into-ssa.c (mark_def_sites): Use new operand types.
(prepare_operand_for_rename): Split into two functions.
(prepare_use_operand_for_rename): Prepare use operands.
(prepare_def_operand_for_rename): Prepare def operands.
(rewrite_stmt): Use new operand types.
(rewrite_operand): Use new operand types, change parameter type.
* tree-outof-ssa.c (replace_variable): Split into two functions.
(replace_use_variable): Rewrite uses.
(replace_def_variable): Rewrite defs.
(rewrite_trees, rewrite_vars_out_of_ssa): Use new operand types.
* tree-phinodes.c (make_phi_node, resize_phi_node): Use new types.
(add_phi_arg, remove_phi_arg_num): Use new operand types.
* tree-ssa-ccp.c (substitute_and_fold): Use new operand types.
(ccp_fold, replace_uses_in): Use new operand types.
* tree-ssa-copy.c (replace_ssa_names): Rename to replace_ssa_names_ann
and no longer set the value, change parameter type.
(replace_exp_1): Use new operand types.
(propagate_value): Change parameter type, use new operand types.
(propagate_tree_value): Propagate_value without SSA operands.
(replace_exp, cprop_operand, cprop_into_stmt): Use new operand types.
(cprop_into_successor_phis): Use new operand types.
* tree-ssa-dom.c (thread_across_edge): Use new operand types.
(eliminate_redundant_computations): Use new operand types.
* tree-ssa-dse.c (fix_phi_uses): Use new operand_types.
(fix_stmt_v_may_defs): Use new operand_types.
* tree-ssa-live.c (create_ssa_var_map): Use new operand_types.
(build_tree_conflict_graph): Use new operand_types.
* tree-ssa-loop.c (duplicate_blocks): Use PHI_ARG_DEF_FROM_EDGE.
* tree-ssa-operands.c (struct freelist_d): Remove.
(check_optype_freelist, add_optype_freelist): Remove.
(allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype,
allocate_vuse_optype, allocate_v_must_def_optype): Call ggc_alloc.
(free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs):
Call ggc_free instead of add_optype_freelist.
(init_ssa_operands, fini_ssa_operands): Remove free list code.
(finalize_ssa_defs, finalize_ssa_uses): Set new use/def operands.
* tree-ssa-operands.h (struct def_optype_d): Change underlying type.
(struct use_optype_d): Change underlying type.
(def_operand_p, use_operand_p): New types for pointers to operands.
(USE_OP, DEF_OP, V_MAY_DEF_RESULT, V_MAY_DEF_OP, VUSE_OP,
V_MUST_DEF_OP): Use new pointer type instead of dereferencing directly.
(USE_FROM_PTR, DEF_FROM_PTR): New macros to "dereference" operand
pointer types.
(SET_USE, SET_DEF): New macros to set operands from their pointer.
(SET_USE_OP, SET_DEF_OP, SET_V_MAY_DEF_RESULT, SET_V_MAY_DEF_OP,
SET_VUSE_OP, SET_V_MUST_DEF_OP): New SET routines for operands.
(PHI_RESULT_PTR, PHI_RESULT, SET_PHI_RESULT): Macros to manage the
PHI result as an operand.
(PHI_ARG_DEF_PTR, PHI_ARG_DEF, SET_PHI_ARG_DEF, PHI_ARG_DEF_FROM_EDGE,
PHI_ARG_DEF_PTR_FROM_EDGE): Macros to manage the PHI arguments.
* tree-ssa-pre.c (eliminate): Call propagate_tree_value.
* tree-tailcall.c (independent_of_stmt_p, propagate_through_phis): Use
PHI_ARG_DEF_FROM_EDGE.
* tree.h (PHI_RESULT): Renamed to PHI_RESULT_TREE.
(PHI_ARG_DEF): Renamed to PHI_ARG_DEF_TREE.
From-SVN: r83298
2004-06-17 20:13:20 +02:00
|
|
|
SET_VUSE_OP (vuses, i, vuses_copy[i]);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
free (uses_copy);
|
|
|
|
free (vuses_copy);
|
|
|
|
|
|
|
|
/* If we still did not find the expression in the hash table,
|
|
|
|
then we can not ignore this statement. */
|
|
|
|
if (! cached_lhs)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If the expression in the hash table was not assigned to an
|
|
|
|
SSA_NAME, then we can not ignore this statement. */
|
|
|
|
if (TREE_CODE (cached_lhs) != SSA_NAME)
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* If we have different underlying variables, then we can not
|
|
|
|
ignore this statement. */
|
|
|
|
if (SSA_NAME_VAR (cached_lhs) != SSA_NAME_VAR (lhs))
|
|
|
|
break;
|
|
|
|
|
2004-12-12 17:55:34 +01:00
|
|
|
/* If CACHED_LHS does not represent the current value of the underlying
|
2004-05-13 08:41:07 +02:00
|
|
|
variable in CACHED_LHS/LHS, then we can not ignore this statement. */
|
|
|
|
if (var_ann (SSA_NAME_VAR (lhs))->current_def != cached_lhs)
|
|
|
|
break;
|
|
|
|
|
|
|
|
/* If we got here, then we can ignore this statement and continue
|
|
|
|
walking through the statements in the block looking for a threadable
|
|
|
|
COND_EXPR.
|
|
|
|
|
|
|
|
We want to record an equivalence lhs = cache_lhs so that if
|
|
|
|
the result of this statement is used later we can copy propagate
|
|
|
|
suitably. */
|
2004-09-17 23:16:07 +02:00
|
|
|
record_const_or_copy (lhs, cached_lhs);
|
2004-09-16 21:06:12 +02:00
|
|
|
register_new_def (lhs, &block_defs_stack);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* If we stopped at a COND_EXPR or SWITCH_EXPR, then see if we know which
|
|
|
|
arm will be taken. */
|
|
|
|
if (stmt
|
|
|
|
&& (TREE_CODE (stmt) == COND_EXPR
|
2005-03-08 04:39:19 +01:00
|
|
|
|| TREE_CODE (stmt) == SWITCH_EXPR
|
|
|
|
|| TREE_CODE (stmt) == GOTO_EXPR))
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
|
|
|
tree cond, cached_lhs;
|
|
|
|
|
|
|
|
/* Now temporarily cprop the operands and try to find the resulting
|
|
|
|
expression in the hash tables. */
|
|
|
|
if (TREE_CODE (stmt) == COND_EXPR)
|
|
|
|
cond = COND_EXPR_COND (stmt);
|
2005-03-08 04:39:19 +01:00
|
|
|
else if (TREE_CODE (stmt) == GOTO_EXPR)
|
|
|
|
cond = GOTO_DESTINATION (stmt);
|
2004-05-13 08:41:07 +02:00
|
|
|
else
|
|
|
|
cond = SWITCH_COND (stmt);
|
|
|
|
|
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
|
|
|
if (COMPARISON_CLASS_P (cond))
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
|
|
|
tree dummy_cond, op0, op1;
|
|
|
|
enum tree_code cond_code;
|
|
|
|
|
|
|
|
op0 = TREE_OPERAND (cond, 0);
|
|
|
|
op1 = TREE_OPERAND (cond, 1);
|
|
|
|
cond_code = TREE_CODE (cond);
|
|
|
|
|
|
|
|
/* Get the current value of both operands. */
|
|
|
|
if (TREE_CODE (op0) == SSA_NAME)
|
|
|
|
{
|
2004-09-23 22:15:30 +02:00
|
|
|
tree tmp = SSA_NAME_VALUE (op0);
|
|
|
|
if (tmp && TREE_CODE (tmp) != VALUE_HANDLE)
|
2004-05-13 08:41:07 +02:00
|
|
|
op0 = tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (TREE_CODE (op1) == SSA_NAME)
|
|
|
|
{
|
2004-09-23 22:15:30 +02:00
|
|
|
tree tmp = SSA_NAME_VALUE (op1);
|
|
|
|
if (tmp && TREE_CODE (tmp) != VALUE_HANDLE)
|
2004-05-13 08:41:07 +02:00
|
|
|
op1 = tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Stuff the operator and operands into our dummy conditional
|
|
|
|
expression, creating the dummy conditional if necessary. */
|
|
|
|
dummy_cond = walk_data->global_data;
|
|
|
|
if (! dummy_cond)
|
|
|
|
{
|
|
|
|
dummy_cond = build (cond_code, boolean_type_node, op0, op1);
|
|
|
|
dummy_cond = build (COND_EXPR, void_type_node,
|
|
|
|
dummy_cond, NULL, NULL);
|
|
|
|
walk_data->global_data = dummy_cond;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-11-16 01:05:30 +01:00
|
|
|
TREE_SET_CODE (COND_EXPR_COND (dummy_cond), cond_code);
|
|
|
|
TREE_OPERAND (COND_EXPR_COND (dummy_cond), 0) = op0;
|
|
|
|
TREE_OPERAND (COND_EXPR_COND (dummy_cond), 1) = op1;
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* If the conditional folds to an invariant, then we are done,
|
|
|
|
otherwise look it up in the hash tables. */
|
|
|
|
cached_lhs = local_fold (COND_EXPR_COND (dummy_cond));
|
|
|
|
if (! is_gimple_min_invariant (cached_lhs))
|
|
|
|
{
|
2004-12-10 18:58:07 +01:00
|
|
|
cached_lhs = lookup_avail_expr (dummy_cond, false);
|
|
|
|
if (!cached_lhs || ! is_gimple_min_invariant (cached_lhs))
|
|
|
|
cached_lhs = simplify_cond_and_lookup_avail_expr (dummy_cond,
|
|
|
|
NULL,
|
|
|
|
false);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
/* We can have conditionals which just test the state of a
|
|
|
|
variable rather than use a relational operator. These are
|
|
|
|
simpler to handle. */
|
|
|
|
else if (TREE_CODE (cond) == SSA_NAME)
|
|
|
|
{
|
|
|
|
cached_lhs = cond;
|
2004-09-23 22:15:30 +02:00
|
|
|
cached_lhs = SSA_NAME_VALUE (cached_lhs);
|
2004-05-13 08:41:07 +02:00
|
|
|
if (cached_lhs && ! is_gimple_min_invariant (cached_lhs))
|
|
|
|
cached_lhs = 0;
|
|
|
|
}
|
|
|
|
else
|
2004-09-15 06:38:04 +02:00
|
|
|
cached_lhs = lookup_avail_expr (stmt, false);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
if (cached_lhs)
|
|
|
|
{
|
|
|
|
edge taken_edge = find_taken_edge (e->dest, cached_lhs);
|
|
|
|
basic_block dest = (taken_edge ? taken_edge->dest : NULL);
|
|
|
|
|
2004-06-16 15:39:49 +02:00
|
|
|
if (dest == e->dest)
|
2004-05-13 08:41:07 +02:00
|
|
|
return;
|
|
|
|
|
|
|
|
/* If we have a known destination for the conditional, then
|
|
|
|
we can perform this optimization, which saves at least one
|
|
|
|
conditional jump each time it applies since we get to
|
alias.c, [...]: Fix comment formatting.
* alias.c, basic-block.h, cgraphunit.c, combine.c, domwalk.h,
final.c, gengtype.c, genpreds.c, ggc-page.c, insn-notes.def,
lambda-code.c, loop-unroll.c, modulo-sched.c, pointer-set.c,
pretty-print.c, ra-colorize.c, sbitmap.c, tree-complex.c,
tree-data-ref.c, tree-dfa.c, tree-inline.c, tree-into-ssa.c,
tree-scalar-evolution.c, tree-ssa-dom.c,
tree-ssa-loop-manip.c, tree-ssa-loop-niter.c,
tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-threadupdate.c,
tree-vectorizer.c, vec.h: Fix comment formatting.
From-SVN: r89453
2004-10-22 19:05:11 +02:00
|
|
|
bypass the conditional at our original destination. */
|
2004-05-13 08:41:07 +02:00
|
|
|
if (dest)
|
|
|
|
{
|
2004-10-30 02:06:22 +02:00
|
|
|
struct edge_info *edge_info;
|
|
|
|
|
2004-09-19 18:04:03 +02:00
|
|
|
update_bb_profile_for_threading (e->dest, EDGE_FREQUENCY (e),
|
|
|
|
e->count, taken_edge);
|
2004-10-30 02:06:22 +02:00
|
|
|
if (e->aux)
|
|
|
|
edge_info = e->aux;
|
|
|
|
else
|
|
|
|
edge_info = allocate_edge_info (e);
|
|
|
|
edge_info->redirection_target = taken_edge;
|
2004-08-09 21:13:07 +02:00
|
|
|
bb_ann (e->dest)->incoming_edge_threaded = true;
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Initialize local stacks for this optimizer and record equivalences
|
|
|
|
upon entry to BB. Equivalences can come from the edge traversed to
|
|
|
|
reach BB or they may come from PHI nodes at the start of BB. */
|
|
|
|
|
|
|
|
static void
|
2004-10-30 02:06:22 +02:00
|
|
|
dom_opt_initialize_block (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
|
|
|
|
basic_block bb)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, "\n\nOptimizing block #%d\n\n", bb->index);
|
|
|
|
|
2004-09-16 21:06:12 +02:00
|
|
|
/* Push a marker on the stacks of local information so that we know how
|
|
|
|
far to unwind when we finalize this block. */
|
2004-11-24 00:38:12 +01:00
|
|
|
VEC_safe_push (tree_on_heap, avail_exprs_stack, NULL_TREE);
|
2004-11-19 19:21:44 +01:00
|
|
|
VEC_safe_push (tree_on_heap, block_defs_stack, NULL_TREE);
|
2004-11-24 00:38:12 +01:00
|
|
|
VEC_safe_push (tree_on_heap, const_and_copies_stack, NULL_TREE);
|
|
|
|
VEC_safe_push (tree_on_heap, nonzero_vars_stack, NULL_TREE);
|
|
|
|
VEC_safe_push (tree_on_heap, vrp_variables_stack, NULL_TREE);
|
2004-09-15 06:38:04 +02:00
|
|
|
|
2004-10-30 02:06:22 +02:00
|
|
|
record_equivalences_from_incoming_edge (bb);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* PHI nodes can create equivalences too. */
|
2004-10-30 02:06:22 +02:00
|
|
|
record_equivalences_from_phis (bb);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Given an expression EXPR (a relational expression or a statement),
|
|
|
|
initialize the hash table element pointed by by ELEMENT. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
initialize_hash_element (tree expr, tree lhs, struct expr_hash_elt *element)
|
|
|
|
{
|
|
|
|
/* Hash table elements may be based on conditional expressions or statements.
|
|
|
|
|
|
|
|
For the former case, we have no annotation and we want to hash the
|
|
|
|
conditional expression. In the latter case we have an annotation and
|
|
|
|
we want to record the expression the statement evaluates. */
|
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
|
|
|
if (COMPARISON_CLASS_P (expr) || TREE_CODE (expr) == TRUTH_NOT_EXPR)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
|
|
|
element->ann = NULL;
|
|
|
|
element->rhs = expr;
|
|
|
|
}
|
|
|
|
else if (TREE_CODE (expr) == COND_EXPR)
|
|
|
|
{
|
|
|
|
element->ann = stmt_ann (expr);
|
|
|
|
element->rhs = COND_EXPR_COND (expr);
|
|
|
|
}
|
|
|
|
else if (TREE_CODE (expr) == SWITCH_EXPR)
|
|
|
|
{
|
|
|
|
element->ann = stmt_ann (expr);
|
|
|
|
element->rhs = SWITCH_COND (expr);
|
|
|
|
}
|
|
|
|
else if (TREE_CODE (expr) == RETURN_EXPR && TREE_OPERAND (expr, 0))
|
|
|
|
{
|
|
|
|
element->ann = stmt_ann (expr);
|
|
|
|
element->rhs = TREE_OPERAND (TREE_OPERAND (expr, 0), 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
element->ann = stmt_ann (expr);
|
|
|
|
element->rhs = TREE_OPERAND (expr, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
element->lhs = lhs;
|
|
|
|
element->hash = avail_expr_hash (element);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Remove all the expressions in LOCALS from TABLE, stopping when there are
|
|
|
|
LIMIT entries left in LOCALs. */
|
|
|
|
|
|
|
|
static void
|
2004-09-15 06:38:04 +02:00
|
|
|
remove_local_expressions_from_table (void)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
|
|
|
/* Remove all the expressions made available in this block. */
|
2004-11-24 00:38:12 +01:00
|
|
|
while (VEC_length (tree_on_heap, avail_exprs_stack) > 0)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
|
|
|
struct expr_hash_elt element;
|
2004-11-24 00:38:12 +01:00
|
|
|
tree expr = VEC_pop (tree_on_heap, avail_exprs_stack);
|
2004-09-15 06:38:04 +02:00
|
|
|
|
|
|
|
if (expr == NULL_TREE)
|
|
|
|
break;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
initialize_hash_element (expr, NULL, &element);
|
2004-09-15 06:38:04 +02:00
|
|
|
htab_remove_elt_with_hash (avail_exprs, &element, element.hash);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Use the SSA_NAMES in LOCALS to restore TABLE to its original
|
c-common.c, [...]: Fix comment typos.
* c-common.c, calls.c, cfgcleanup.c, cgraph.c, cgraphunit.c,
ddg.c, ddg.h, df.c, df.h, except.c, expr.c, flags.h,
fold-const.c, gcc.c, gimplify.c, haifa-sched.c,
modulo-sched.c, tree-inline.c, tree-into-ssa.c, tree-nested.c,
tree-nrv.c, tree-ssa-ccp.c, tree-ssa-dom.c, tree-ssa-live.c,
tree-ssa-loop.c, tree-ssa-pre.c, tree-tailcall.c, tree.h: Fix
comment typos. Follow spelling conventions.
From-SVN: r82439
2004-05-30 09:12:58 +02:00
|
|
|
state, stopping when there are LIMIT entries left in LOCALs. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
static void
|
2004-09-19 08:09:41 +02:00
|
|
|
restore_nonzero_vars_to_original_value (void)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
2004-11-24 00:38:12 +01:00
|
|
|
while (VEC_length (tree_on_heap, nonzero_vars_stack) > 0)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
2004-11-24 00:38:12 +01:00
|
|
|
tree name = VEC_pop (tree_on_heap, nonzero_vars_stack);
|
2004-09-19 04:51:15 +02:00
|
|
|
|
|
|
|
if (name == NULL)
|
|
|
|
break;
|
|
|
|
|
|
|
|
bitmap_clear_bit (nonzero_vars, SSA_NAME_VERSION (name));
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-09-17 23:16:07 +02:00
|
|
|
/* Use the source/dest pairs in CONST_AND_COPIES_STACK to restore
|
|
|
|
CONST_AND_COPIES to its original state, stopping when we hit a
|
|
|
|
NULL marker. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
static void
|
2004-09-17 23:16:07 +02:00
|
|
|
restore_vars_to_original_value (void)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
2004-11-24 00:38:12 +01:00
|
|
|
while (VEC_length (tree_on_heap, const_and_copies_stack) > 0)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
|
|
|
tree prev_value, dest;
|
|
|
|
|
2004-11-24 00:38:12 +01:00
|
|
|
dest = VEC_pop (tree_on_heap, const_and_copies_stack);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2004-09-17 23:16:07 +02:00
|
|
|
if (dest == NULL)
|
|
|
|
break;
|
|
|
|
|
2004-11-24 00:38:12 +01:00
|
|
|
prev_value = VEC_pop (tree_on_heap, const_and_copies_stack);
|
2004-09-23 22:15:30 +02:00
|
|
|
SSA_NAME_VALUE (dest) = prev_value;
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Similar to restore_vars_to_original_value, except that it restores
|
|
|
|
CURRDEFS to its original value. */
|
|
|
|
static void
|
2004-09-16 21:06:12 +02:00
|
|
|
restore_currdefs_to_original_value (void)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
|
|
|
/* Restore CURRDEFS to its original state. */
|
2004-11-19 19:21:44 +01:00
|
|
|
while (VEC_length (tree_on_heap, block_defs_stack) > 0)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
2004-11-19 19:21:44 +01:00
|
|
|
tree tmp = VEC_pop (tree_on_heap, block_defs_stack);
|
2004-05-13 08:41:07 +02:00
|
|
|
tree saved_def, var;
|
|
|
|
|
2004-09-16 21:06:12 +02:00
|
|
|
if (tmp == NULL_TREE)
|
|
|
|
break;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* If we recorded an SSA_NAME, then make the SSA_NAME the current
|
|
|
|
definition of its underlying variable. If we recorded anything
|
|
|
|
else, it must have been an _DECL node and its current reaching
|
|
|
|
definition must have been NULL. */
|
|
|
|
if (TREE_CODE (tmp) == SSA_NAME)
|
|
|
|
{
|
|
|
|
saved_def = tmp;
|
|
|
|
var = SSA_NAME_VAR (saved_def);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
saved_def = NULL;
|
|
|
|
var = tmp;
|
|
|
|
}
|
|
|
|
|
|
|
|
var_ann (var)->current_def = saved_def;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We have finished processing the dominator children of BB, perform
|
|
|
|
any finalization actions in preparation for leaving this node in
|
|
|
|
the dominator tree. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
dom_opt_finalize_block (struct dom_walk_data *walk_data, basic_block bb)
|
|
|
|
{
|
|
|
|
tree last;
|
|
|
|
|
2004-12-12 18:03:37 +01:00
|
|
|
/* If we are at a leaf node in the dominator tree, see if we can thread
|
2004-05-13 08:41:07 +02:00
|
|
|
the edge from BB through its successor.
|
|
|
|
|
|
|
|
Do this before we remove entries from our equivalence tables. */
|
basic-block.h (single_succ_p, [...]): New inline functions.
* basic-block.h (single_succ_p, single_pred_p, single_succ_edge,
single_pred_edge, single_succ, single_pred): New inline functions.
* bb-reorder.c (rotate_loop, find_traces_1_round,
add_labels_and_missing_jumps, fix_up_fall_thru_edges,
duplicate_computed_gotos): Use the single_succ/pred functions.
* cfganal.c (forwarder_block_p): Ditto.
* cfgbuild.c (compute_outgoing_frequencies): Ditto.
* cfgcleanup.c (try_simplify_condjump, try_forward_edges,
outgoing_edges_match, try_crossjump_to_edge, try_optimize_cfg,
merge_seq_blocks): Ditto.
* cfghooks.c (split_edge, tidy_fallthru_edges): Ditto.
* cfglayout.c (fixup_reorder_chain): Ditto.
* cfgloop.c (mark_single_exit_loops, update_latch_info,
canonicalize_loop_headers, verify_loop_structure): Ditto.
* cfgloopmanip.c (remove_path, unloop, loop_delete_branch_edge,
mfb_update_loops, create_preheader, force_single_succ_latches,
create_loop_notes): Ditto.
* cfgrtl.c (rtl_can_merge_blocks, try_redirect_by_replacing_jump,
force_nonfallthru_and_redirect, rtl_tidy_fallthru_edge,
commit_one_edge_insertion, purge_dead_edges,
cfg_layout_can_merge_blocks_p): Ditto.
* except.c (sjlj_emit_function_enter): Ditto.
* flow.c (init_propagate_block_info): Ditto.
* function.c (thread_prologue_and_epilogue_insns): Ditto.
* gcse.c (find_implicit_sets, bypass_conditional_jumps,
insert_insn_end_bb): Ditto.
* ifcvt.c (merge_if_block, find_if_block, find_if_case_1,
find_if_case_2): Ditto.
* lambda-code.c (perfect_nestify): Ditto.
* lcm.c (optimize_mode_switching): Ditto.
* loop-doloop.c (doloop_modify): Ditto.
* loop-init.c (loop_optimizer_init): Ditto.
* loop-iv.c (simplify_using_initial_values): Ditto.
* loop-unroll.c (unroll_loop_runtime_iterations): Ditto.
* loop-unswitch.c (unswitch_loop): Ditto.
* modulo-sched.c (generate_prolog_epilog): Ditto.
* predict.c (combine_predictions_for_insn, estimate_probability,
tree_estimate_probability, last_basic_block_p,
estimate_bb_frequencies): Ditto.
* profile.c (branch_prob): Ditto.
* regrename.c (copyprop_hardreg_forward): Ditto.
* sched-rgn.c (is_cfg_nonregular, find_rgns, update_live): Ditto.
* tracer.c (layout_superblocks): Ditto.
* tree-cfg.c (tree_can_merge_blocks_p, tree_merge_blocks,
cfg_remove_useless_stmts_bb, cleanup_control_flow,
cleanup_control_expr_graph, disband_implicit_edges,
tree_find_edge_insert_loc, bsi_commit_edge_inserts,
tree_verify_flow_info, tree_make_forwarder_block,
tree_forwarder_block_p, remove_forwarder_block,
remove_forwarder_block_with_phi, merge_phi_nodes): Ditto.
* tree-if-conv.c (tree_if_conversion): Ditto.
* tree-mudflap.c (mf_build_check_statement_for): Ditto.
* tree-ssa-dce.c (remove_dead_stmt): Ditto.
* tree-ssa-dom.c (dom_opt_finalize_block): Ditto.
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p,
copy_loop_headers): Ditto.
* tree-ssa-loop-im.c (loop_commit_inserts): Ditto.
* tree-ssa-loop-ivopts.c (compute_phi_arg_on_exit): Ditto.
* tree-ssa-loop-manip.c (split_loop_exit_edge, ip_normal_pos,
lv_adjust_loop_entry_edge, tree_ssa_loop_version): Ditto.
* tree-ssa-loop-niter.c (simplify_using_initial_conditions): Ditto.
* tree-ssa-loop-unswitch.c (simplify_using_entry_checks): Ditto.
* tree-ssa-phiopt.c (tree_ssa_phiopt, value_replacement): Ditto.
* tree-ssa-pre.c (compute_antic_aux, insert_aux, init_pre): Ditto.
* tree-ssa-threadupdate.c (redirect_edges): Ditto.
* tree-tailcall.c (independent_of_stmt_p, find_tail_calls,
eliminate_tail_call, tree_optimize_tail_calls_1): Ditto.
* tree-vect-analyze.c (vect_analyze_loop_form): Ditto.
* tree-vect-transform.c (vect_update_ivs_after_vectorizer): Ditto.
* tree-vectorizer.c (slpeel_update_phi_nodes_for_guard,
slpeel_add_loop_guard): Ditto.
From-SVN: r96292
2005-03-11 10:05:12 +01:00
|
|
|
if (single_succ_p (bb)
|
|
|
|
&& (single_succ_edge (bb)->flags & EDGE_ABNORMAL) == 0
|
|
|
|
&& (get_immediate_dominator (CDI_DOMINATORS, single_succ (bb)) != bb
|
|
|
|
|| phi_nodes (single_succ (bb))))
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
{
|
basic-block.h (single_succ_p, [...]): New inline functions.
* basic-block.h (single_succ_p, single_pred_p, single_succ_edge,
single_pred_edge, single_succ, single_pred): New inline functions.
* bb-reorder.c (rotate_loop, find_traces_1_round,
add_labels_and_missing_jumps, fix_up_fall_thru_edges,
duplicate_computed_gotos): Use the single_succ/pred functions.
* cfganal.c (forwarder_block_p): Ditto.
* cfgbuild.c (compute_outgoing_frequencies): Ditto.
* cfgcleanup.c (try_simplify_condjump, try_forward_edges,
outgoing_edges_match, try_crossjump_to_edge, try_optimize_cfg,
merge_seq_blocks): Ditto.
* cfghooks.c (split_edge, tidy_fallthru_edges): Ditto.
* cfglayout.c (fixup_reorder_chain): Ditto.
* cfgloop.c (mark_single_exit_loops, update_latch_info,
canonicalize_loop_headers, verify_loop_structure): Ditto.
* cfgloopmanip.c (remove_path, unloop, loop_delete_branch_edge,
mfb_update_loops, create_preheader, force_single_succ_latches,
create_loop_notes): Ditto.
* cfgrtl.c (rtl_can_merge_blocks, try_redirect_by_replacing_jump,
force_nonfallthru_and_redirect, rtl_tidy_fallthru_edge,
commit_one_edge_insertion, purge_dead_edges,
cfg_layout_can_merge_blocks_p): Ditto.
* except.c (sjlj_emit_function_enter): Ditto.
* flow.c (init_propagate_block_info): Ditto.
* function.c (thread_prologue_and_epilogue_insns): Ditto.
* gcse.c (find_implicit_sets, bypass_conditional_jumps,
insert_insn_end_bb): Ditto.
* ifcvt.c (merge_if_block, find_if_block, find_if_case_1,
find_if_case_2): Ditto.
* lambda-code.c (perfect_nestify): Ditto.
* lcm.c (optimize_mode_switching): Ditto.
* loop-doloop.c (doloop_modify): Ditto.
* loop-init.c (loop_optimizer_init): Ditto.
* loop-iv.c (simplify_using_initial_values): Ditto.
* loop-unroll.c (unroll_loop_runtime_iterations): Ditto.
* loop-unswitch.c (unswitch_loop): Ditto.
* modulo-sched.c (generate_prolog_epilog): Ditto.
* predict.c (combine_predictions_for_insn, estimate_probability,
tree_estimate_probability, last_basic_block_p,
estimate_bb_frequencies): Ditto.
* profile.c (branch_prob): Ditto.
* regrename.c (copyprop_hardreg_forward): Ditto.
* sched-rgn.c (is_cfg_nonregular, find_rgns, update_live): Ditto.
* tracer.c (layout_superblocks): Ditto.
* tree-cfg.c (tree_can_merge_blocks_p, tree_merge_blocks,
cfg_remove_useless_stmts_bb, cleanup_control_flow,
cleanup_control_expr_graph, disband_implicit_edges,
tree_find_edge_insert_loc, bsi_commit_edge_inserts,
tree_verify_flow_info, tree_make_forwarder_block,
tree_forwarder_block_p, remove_forwarder_block,
remove_forwarder_block_with_phi, merge_phi_nodes): Ditto.
* tree-if-conv.c (tree_if_conversion): Ditto.
* tree-mudflap.c (mf_build_check_statement_for): Ditto.
* tree-ssa-dce.c (remove_dead_stmt): Ditto.
* tree-ssa-dom.c (dom_opt_finalize_block): Ditto.
* tree-ssa-loop-ch.c (should_duplicate_loop_header_p,
copy_loop_headers): Ditto.
* tree-ssa-loop-im.c (loop_commit_inserts): Ditto.
* tree-ssa-loop-ivopts.c (compute_phi_arg_on_exit): Ditto.
* tree-ssa-loop-manip.c (split_loop_exit_edge, ip_normal_pos,
lv_adjust_loop_entry_edge, tree_ssa_loop_version): Ditto.
* tree-ssa-loop-niter.c (simplify_using_initial_conditions): Ditto.
* tree-ssa-loop-unswitch.c (simplify_using_entry_checks): Ditto.
* tree-ssa-phiopt.c (tree_ssa_phiopt, value_replacement): Ditto.
* tree-ssa-pre.c (compute_antic_aux, insert_aux, init_pre): Ditto.
* tree-ssa-threadupdate.c (redirect_edges): Ditto.
* tree-tailcall.c (independent_of_stmt_p, find_tail_calls,
eliminate_tail_call, tree_optimize_tail_calls_1): Ditto.
* tree-vect-analyze.c (vect_analyze_loop_form): Ditto.
* tree-vect-transform.c (vect_update_ivs_after_vectorizer): Ditto.
* tree-vectorizer.c (slpeel_update_phi_nodes_for_guard,
slpeel_add_loop_guard): Ditto.
From-SVN: r96292
2005-03-11 10:05:12 +01:00
|
|
|
thread_across_edge (walk_data, single_succ_edge (bb));
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
2005-03-08 04:39:19 +01:00
|
|
|
else if ((last = last_stmt (bb))
|
|
|
|
&& TREE_CODE (last) == GOTO_EXPR
|
|
|
|
&& TREE_CODE (TREE_OPERAND (last, 0)) == SSA_NAME)
|
|
|
|
{
|
|
|
|
edge_iterator ei;
|
|
|
|
edge e;
|
|
|
|
|
|
|
|
FOR_EACH_EDGE (e, ei, bb->succs)
|
|
|
|
{
|
|
|
|
thread_across_edge (walk_data, e);
|
|
|
|
}
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
else if ((last = last_stmt (bb))
|
|
|
|
&& TREE_CODE (last) == COND_EXPR
|
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
|
|
|
&& (COMPARISON_CLASS_P (COND_EXPR_COND (last))
|
2004-05-13 08:41:07 +02:00
|
|
|
|| TREE_CODE (COND_EXPR_COND (last)) == SSA_NAME)
|
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_COUNT (bb->succs) == 2
|
|
|
|
&& (EDGE_SUCC (bb, 0)->flags & EDGE_ABNORMAL) == 0
|
|
|
|
&& (EDGE_SUCC (bb, 1)->flags & EDGE_ABNORMAL) == 0)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
|
|
|
edge true_edge, false_edge;
|
|
|
|
|
|
|
|
extract_true_false_edges_from_block (bb, &true_edge, &false_edge);
|
|
|
|
|
|
|
|
/* If the THEN arm is the end of a dominator tree or has PHI nodes,
|
|
|
|
then try to thread through its edge. */
|
|
|
|
if (get_immediate_dominator (CDI_DOMINATORS, true_edge->dest) != bb
|
|
|
|
|| phi_nodes (true_edge->dest))
|
|
|
|
{
|
2004-10-30 02:06:22 +02:00
|
|
|
struct edge_info *edge_info;
|
|
|
|
unsigned int i;
|
|
|
|
|
2004-09-15 06:38:04 +02:00
|
|
|
/* Push a marker onto the available expression stack so that we
|
|
|
|
unwind any expressions related to the TRUE arm before processing
|
|
|
|
the false arm below. */
|
2004-11-24 00:38:12 +01:00
|
|
|
VEC_safe_push (tree_on_heap, avail_exprs_stack, NULL_TREE);
|
2004-11-19 19:21:44 +01:00
|
|
|
VEC_safe_push (tree_on_heap, block_defs_stack, NULL_TREE);
|
2004-11-24 00:38:12 +01:00
|
|
|
VEC_safe_push (tree_on_heap, const_and_copies_stack, NULL_TREE);
|
2004-09-15 06:38:04 +02:00
|
|
|
|
2004-10-30 02:06:22 +02:00
|
|
|
edge_info = true_edge->aux;
|
|
|
|
|
|
|
|
/* If we have info associated with this edge, record it into
|
|
|
|
our equivalency tables. */
|
|
|
|
if (edge_info)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
2004-10-30 02:06:22 +02:00
|
|
|
tree *cond_equivalences = edge_info->cond_equivalences;
|
|
|
|
tree lhs = edge_info->lhs;
|
|
|
|
tree rhs = edge_info->rhs;
|
|
|
|
|
|
|
|
/* If we have a simple NAME = VALUE equivalency record it.
|
|
|
|
Until the jump threading selection code improves, only
|
|
|
|
do this if both the name and value are SSA_NAMEs with
|
|
|
|
the same underlying variable to avoid missing threading
|
|
|
|
opportunities. */
|
|
|
|
if (lhs
|
|
|
|
&& TREE_CODE (COND_EXPR_COND (last)) == SSA_NAME
|
|
|
|
&& TREE_CODE (edge_info->rhs) == SSA_NAME
|
|
|
|
&& SSA_NAME_VAR (lhs) == SSA_NAME_VAR (rhs))
|
|
|
|
record_const_or_copy (lhs, rhs);
|
|
|
|
|
|
|
|
/* If we have 0 = COND or 1 = COND equivalences, record them
|
|
|
|
into our expression hash tables. */
|
|
|
|
if (cond_equivalences)
|
|
|
|
for (i = 0; i < edge_info->max_cond_equivalences; i += 2)
|
|
|
|
{
|
|
|
|
tree expr = cond_equivalences[i];
|
|
|
|
tree value = cond_equivalences[i + 1];
|
|
|
|
|
|
|
|
record_cond (expr, value);
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Now thread the edge. */
|
|
|
|
thread_across_edge (walk_data, true_edge);
|
|
|
|
|
|
|
|
/* And restore the various tables to their state before
|
|
|
|
we threaded this edge. */
|
2004-09-15 06:38:04 +02:00
|
|
|
remove_local_expressions_from_table ();
|
2004-09-17 23:16:07 +02:00
|
|
|
restore_vars_to_original_value ();
|
2004-09-16 21:06:12 +02:00
|
|
|
restore_currdefs_to_original_value ();
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Similarly for the ELSE arm. */
|
|
|
|
if (get_immediate_dominator (CDI_DOMINATORS, false_edge->dest) != bb
|
|
|
|
|| phi_nodes (false_edge->dest))
|
|
|
|
{
|
2004-10-30 02:06:22 +02:00
|
|
|
struct edge_info *edge_info;
|
|
|
|
unsigned int i;
|
|
|
|
|
|
|
|
edge_info = false_edge->aux;
|
|
|
|
|
|
|
|
/* If we have info associated with this edge, record it into
|
|
|
|
our equivalency tables. */
|
|
|
|
if (edge_info)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
2004-10-30 02:06:22 +02:00
|
|
|
tree *cond_equivalences = edge_info->cond_equivalences;
|
|
|
|
tree lhs = edge_info->lhs;
|
|
|
|
tree rhs = edge_info->rhs;
|
|
|
|
|
|
|
|
/* If we have a simple NAME = VALUE equivalency record it.
|
|
|
|
Until the jump threading selection code improves, only
|
|
|
|
do this if both the name and value are SSA_NAMEs with
|
|
|
|
the same underlying variable to avoid missing threading
|
|
|
|
opportunities. */
|
|
|
|
if (lhs
|
|
|
|
&& TREE_CODE (COND_EXPR_COND (last)) == SSA_NAME)
|
|
|
|
record_const_or_copy (lhs, rhs);
|
|
|
|
|
|
|
|
/* If we have 0 = COND or 1 = COND equivalences, record them
|
|
|
|
into our expression hash tables. */
|
|
|
|
if (cond_equivalences)
|
|
|
|
for (i = 0; i < edge_info->max_cond_equivalences; i += 2)
|
|
|
|
{
|
|
|
|
tree expr = cond_equivalences[i];
|
|
|
|
tree value = cond_equivalences[i + 1];
|
|
|
|
|
|
|
|
record_cond (expr, value);
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
thread_across_edge (walk_data, false_edge);
|
|
|
|
|
|
|
|
/* No need to remove local expressions from our tables
|
|
|
|
or restore vars to their original value as that will
|
|
|
|
be done immediately below. */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-09-15 06:38:04 +02:00
|
|
|
remove_local_expressions_from_table ();
|
2004-09-19 04:51:15 +02:00
|
|
|
restore_nonzero_vars_to_original_value ();
|
2004-09-17 23:16:07 +02:00
|
|
|
restore_vars_to_original_value ();
|
2004-09-16 21:06:12 +02:00
|
|
|
restore_currdefs_to_original_value ();
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* Remove VRP records associated with this basic block. They are no
|
|
|
|
longer valid.
|
|
|
|
|
|
|
|
To be efficient, we note which variables have had their values
|
|
|
|
constrained in this block. So walk over each variable in the
|
|
|
|
VRP_VARIABLEs array. */
|
2004-11-24 00:38:12 +01:00
|
|
|
while (VEC_length (tree_on_heap, vrp_variables_stack) > 0)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
2004-11-24 00:38:12 +01:00
|
|
|
tree var = VEC_pop (tree_on_heap, vrp_variables_stack);
|
2004-09-25 00:31:13 +02:00
|
|
|
struct vrp_hash_elt vrp_hash_elt, *vrp_hash_elt_p;
|
2004-09-22 06:12:01 +02:00
|
|
|
void **slot;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* Each variable has a stack of value range records. We want to
|
|
|
|
invalidate those associated with our basic block. So we walk
|
|
|
|
the array backwards popping off records associated with our
|
|
|
|
block. Once we hit a record not associated with our block
|
|
|
|
we are done. */
|
2004-09-19 04:51:15 +02:00
|
|
|
varray_type var_vrp_records;
|
|
|
|
|
|
|
|
if (var == NULL)
|
|
|
|
break;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2004-09-22 06:12:01 +02:00
|
|
|
vrp_hash_elt.var = var;
|
|
|
|
vrp_hash_elt.records = NULL;
|
|
|
|
|
|
|
|
slot = htab_find_slot (vrp_data, &vrp_hash_elt, NO_INSERT);
|
|
|
|
|
2004-09-25 00:31:13 +02:00
|
|
|
vrp_hash_elt_p = (struct vrp_hash_elt *) *slot;
|
|
|
|
var_vrp_records = vrp_hash_elt_p->records;
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
while (VARRAY_ACTIVE_SIZE (var_vrp_records) > 0)
|
|
|
|
{
|
|
|
|
struct vrp_element *element
|
|
|
|
= (struct vrp_element *)VARRAY_TOP_GENERIC_PTR (var_vrp_records);
|
|
|
|
|
|
|
|
if (element->bb != bb)
|
|
|
|
break;
|
|
|
|
|
|
|
|
VARRAY_POP (var_vrp_records);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-09-14 17:15:34 +02:00
|
|
|
/* If we queued any statements to rescan in this block, then
|
|
|
|
go ahead and rescan them now. */
|
2004-11-24 00:38:12 +01:00
|
|
|
while (VEC_length (tree_on_heap, stmts_to_rescan) > 0)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
2004-11-24 00:38:12 +01:00
|
|
|
tree stmt = VEC_last (tree_on_heap, stmts_to_rescan);
|
2004-09-14 17:15:34 +02:00
|
|
|
basic_block stmt_bb = bb_for_stmt (stmt);
|
|
|
|
|
|
|
|
if (stmt_bb != bb)
|
|
|
|
break;
|
|
|
|
|
2004-11-24 00:38:12 +01:00
|
|
|
VEC_pop (tree_on_heap, stmts_to_rescan);
|
2004-05-13 08:41:07 +02:00
|
|
|
mark_new_vars_to_rename (stmt, vars_to_rename);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* PHI nodes can create equivalences too.
|
|
|
|
|
|
|
|
Ignoring any alternatives which are the same as the result, if
|
|
|
|
all the alternatives are equal, then the PHI node creates an
|
2004-05-18 04:53:55 +02:00
|
|
|
equivalence.
|
|
|
|
|
|
|
|
Additionally, if all the PHI alternatives are known to have a nonzero
|
|
|
|
value, then the result of this PHI is known to have a nonzero value,
|
|
|
|
even if we do not know its exact value. */
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
static void
|
2004-10-30 02:06:22 +02:00
|
|
|
record_equivalences_from_phis (basic_block bb)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
|
|
|
tree phi;
|
|
|
|
|
tree.h (PHI_CHAIN): New.
* tree.h (PHI_CHAIN): New.
* (tree-cfg.c, tree-dfa.c, tree-flow-inline.h, tree-into-ssa.c,
tree-outof-ssa.c, tree-phinodes.c, tree-pretty-print.c,
tree-ssa-alias.c, tree-ssa-ccp.c, tree-ssa-dom.c, tree-ssa-dse.c,
tree-ssa-live.c, tree-ssa-loop.c, tree-ssa-phiopt.c, tree-ssa-pre.c,
tree-ssa.c, tree-tailcall.c): Use PHI_CHAIN instead of TREE_CHAIN
when traversing a list of PHI_NODEs.
From-SVN: r83273
2004-06-17 01:03:34 +02:00
|
|
|
for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
|
|
|
tree lhs = PHI_RESULT (phi);
|
|
|
|
tree rhs = NULL;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < PHI_NUM_ARGS (phi); i++)
|
|
|
|
{
|
|
|
|
tree t = PHI_ARG_DEF (phi, i);
|
|
|
|
|
2004-12-13 16:43:13 +01:00
|
|
|
/* Ignore alternatives which are the same as our LHS. Since
|
|
|
|
LHS is a PHI_RESULT, it is known to be a SSA_NAME, so we
|
|
|
|
can simply compare pointers. */
|
2004-12-13 16:15:48 +01:00
|
|
|
if (lhs == t)
|
2004-12-03 08:38:39 +01:00
|
|
|
continue;
|
|
|
|
|
|
|
|
/* If we have not processed an alternative yet, then set
|
|
|
|
RHS to this alternative. */
|
|
|
|
if (rhs == NULL)
|
|
|
|
rhs = t;
|
|
|
|
/* If we have processed an alternative (stored in RHS), then
|
|
|
|
see if it is equal to this one. If it isn't, then stop
|
|
|
|
the search. */
|
|
|
|
else if (! operand_equal_for_phi_arg_p (rhs, t))
|
2004-05-13 08:41:07 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If we had no interesting alternatives, then all the RHS alternatives
|
|
|
|
must have been the same as LHS. */
|
|
|
|
if (!rhs)
|
|
|
|
rhs = lhs;
|
|
|
|
|
|
|
|
/* If we managed to iterate through each PHI alternative without
|
|
|
|
breaking out of the loop, then we have a PHI which may create
|
|
|
|
a useful equivalence. We do not need to record unwind data for
|
|
|
|
this, since this is a true assignment and not an equivalence
|
c-common.c, [...]: Fix comment typos.
* c-common.c, calls.c, cfgcleanup.c, cgraph.c, cgraphunit.c,
ddg.c, ddg.h, df.c, df.h, except.c, expr.c, flags.h,
fold-const.c, gcc.c, gimplify.c, haifa-sched.c,
modulo-sched.c, tree-inline.c, tree-into-ssa.c, tree-nested.c,
tree-nrv.c, tree-ssa-ccp.c, tree-ssa-dom.c, tree-ssa-live.c,
tree-ssa-loop.c, tree-ssa-pre.c, tree-tailcall.c, tree.h: Fix
comment typos. Follow spelling conventions.
From-SVN: r82439
2004-05-30 09:12:58 +02:00
|
|
|
inferred from a comparison. All uses of this ssa name are dominated
|
2004-05-13 08:41:07 +02:00
|
|
|
by this assignment, so unwinding just costs time and space. */
|
|
|
|
if (i == PHI_NUM_ARGS (phi)
|
|
|
|
&& may_propagate_copy (lhs, rhs))
|
2004-09-23 22:15:30 +02:00
|
|
|
SSA_NAME_VALUE (lhs) = rhs;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2004-05-18 04:53:55 +02:00
|
|
|
/* Now see if we know anything about the nonzero property for the
|
|
|
|
result of this PHI. */
|
|
|
|
for (i = 0; i < PHI_NUM_ARGS (phi); i++)
|
|
|
|
{
|
|
|
|
if (!PHI_ARG_NONZERO (phi, i))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == PHI_NUM_ARGS (phi))
|
|
|
|
bitmap_set_bit (nonzero_vars, SSA_NAME_VERSION (PHI_RESULT (phi)));
|
|
|
|
|
2004-09-16 21:06:12 +02:00
|
|
|
register_new_def (lhs, &block_defs_stack);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-07-19 21:01:55 +02:00
|
|
|
/* Ignoring loop backedges, if BB has precisely one incoming edge then
|
|
|
|
return that edge. Otherwise return NULL. */
|
|
|
|
static edge
|
|
|
|
single_incoming_edge_ignoring_loop_edges (basic_block bb)
|
|
|
|
{
|
|
|
|
edge retval = NULL;
|
|
|
|
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-07-19 21:01:55 +02:00
|
|
|
|
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->preds)
|
2004-07-19 21:01:55 +02:00
|
|
|
{
|
|
|
|
/* A loop back edge can be identified by the destination of
|
|
|
|
the edge dominating the source of the edge. */
|
|
|
|
if (dominated_by_p (CDI_DOMINATORS, e->src, e->dest))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* If we have already seen a non-loop edge, then we must have
|
|
|
|
multiple incoming non-loop edges and thus we return NULL. */
|
|
|
|
if (retval)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
/* This is the first non-loop incoming edge we have found. Record
|
|
|
|
it. */
|
|
|
|
retval = e;
|
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
/* Record any equivalences created by the incoming edge to BB. If BB
|
|
|
|
has more than one incoming edge, then no equivalence is created. */
|
|
|
|
|
|
|
|
static void
|
2004-10-30 02:06:22 +02:00
|
|
|
record_equivalences_from_incoming_edge (basic_block bb)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
2004-10-30 02:06:22 +02:00
|
|
|
edge e;
|
2004-05-13 08:41:07 +02:00
|
|
|
basic_block parent;
|
2004-10-30 02:06:22 +02:00
|
|
|
struct edge_info *edge_info;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
alias.c, [...]: Fix comment typos.
* alias.c, c-common.h, c-incpath.c, c-incpath.h, expr.c,
fold-const.c, gimplify.c, params.h, tree-data-ref.c,
tree-if-conv.c, tree-nested.c, tree-outof-ssa.c,
tree-ssa-dom.c, tree-vectorizer.c, tree.def, config/darwin.c,
config/freebsd-spec.h, config/arm/arm.h,
config/h8300/h8300.md, config/i386/i386.md,
config/i386/predicates.md, config/i386/sse.md,
config/ia64/ia64.c, config/ip2k/ip2k.c, config/s390/s390.c,
config/vax/vax.md: Fix comment typos. Follow spelling
conventions.
From-SVN: r94112
2005-01-23 16:05:49 +01:00
|
|
|
/* If our parent block ended with a control statement, then we may be
|
2004-05-13 08:41:07 +02:00
|
|
|
able to record some equivalences based on which outgoing edge from
|
|
|
|
the parent was followed. */
|
|
|
|
parent = get_immediate_dominator (CDI_DOMINATORS, bb);
|
|
|
|
|
2004-10-30 02:06:22 +02:00
|
|
|
e = single_incoming_edge_ignoring_loop_edges (bb);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2004-10-30 02:06:22 +02:00
|
|
|
/* If we had a single incoming edge from our parent block, then enter
|
|
|
|
any data associated with the edge into our tables. */
|
|
|
|
if (e && e->src == parent)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
2004-10-30 02:06:22 +02:00
|
|
|
unsigned int i;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2004-10-30 02:06:22 +02:00
|
|
|
edge_info = e->aux;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2004-10-30 02:06:22 +02:00
|
|
|
if (edge_info)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
2004-10-30 02:06:22 +02:00
|
|
|
tree lhs = edge_info->lhs;
|
|
|
|
tree rhs = edge_info->rhs;
|
|
|
|
tree *cond_equivalences = edge_info->cond_equivalences;
|
|
|
|
|
|
|
|
if (lhs)
|
|
|
|
record_equality (lhs, rhs);
|
|
|
|
|
|
|
|
if (cond_equivalences)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
2004-10-30 02:06:22 +02:00
|
|
|
bool recorded_range = false;
|
|
|
|
for (i = 0; i < edge_info->max_cond_equivalences; i += 2)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
2004-10-30 02:06:22 +02:00
|
|
|
tree expr = cond_equivalences[i];
|
|
|
|
tree value = cond_equivalences[i + 1];
|
|
|
|
|
|
|
|
record_cond (expr, value);
|
|
|
|
|
|
|
|
/* For the first true equivalence, record range
|
|
|
|
information. We only do this for the first
|
|
|
|
true equivalence as it should dominate any
|
|
|
|
later true equivalences. */
|
|
|
|
if (! recorded_range
|
|
|
|
&& COMPARISON_CLASS_P (expr)
|
|
|
|
&& value == boolean_true_node
|
|
|
|
&& TREE_CONSTANT (TREE_OPERAND (expr, 1)))
|
|
|
|
{
|
|
|
|
record_range (expr, bb);
|
|
|
|
recorded_range = true;
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Dump SSA statistics on FILE. */
|
|
|
|
|
|
|
|
void
|
|
|
|
dump_dominator_optimization_stats (FILE *file)
|
|
|
|
{
|
|
|
|
long n_exprs;
|
|
|
|
|
|
|
|
fprintf (file, "Total number of statements: %6ld\n\n",
|
|
|
|
opt_stats.num_stmts);
|
|
|
|
fprintf (file, "Exprs considered for dominator optimizations: %6ld\n",
|
|
|
|
opt_stats.num_exprs_considered);
|
|
|
|
|
|
|
|
n_exprs = opt_stats.num_exprs_considered;
|
|
|
|
if (n_exprs == 0)
|
|
|
|
n_exprs = 1;
|
|
|
|
|
|
|
|
fprintf (file, " Redundant expressions eliminated: %6ld (%.0f%%)\n",
|
|
|
|
opt_stats.num_re, PERCENT (opt_stats.num_re,
|
|
|
|
n_exprs));
|
|
|
|
|
|
|
|
fprintf (file, "\nHash table statistics:\n");
|
|
|
|
|
|
|
|
fprintf (file, " avail_exprs: ");
|
|
|
|
htab_statistics (file, avail_exprs);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Dump SSA statistics on stderr. */
|
|
|
|
|
|
|
|
void
|
|
|
|
debug_dominator_optimization_stats (void)
|
|
|
|
{
|
|
|
|
dump_dominator_optimization_stats (stderr);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Dump statistics for the hash table HTAB. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
htab_statistics (FILE *file, htab_t htab)
|
|
|
|
{
|
|
|
|
fprintf (file, "size %ld, %ld elements, %f collision/search ratio\n",
|
|
|
|
(long) htab_size (htab),
|
|
|
|
(long) htab_elements (htab),
|
|
|
|
htab_collisions (htab));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Record the fact that VAR has a nonzero value, though we may not know
|
|
|
|
its exact value. Note that if VAR is already known to have a nonzero
|
|
|
|
value, then we do nothing. */
|
|
|
|
|
|
|
|
static void
|
2004-09-19 04:51:15 +02:00
|
|
|
record_var_is_nonzero (tree var)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
|
|
|
int indx = SSA_NAME_VERSION (var);
|
|
|
|
|
|
|
|
if (bitmap_bit_p (nonzero_vars, indx))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Mark it in the global table. */
|
|
|
|
bitmap_set_bit (nonzero_vars, indx);
|
|
|
|
|
|
|
|
/* Record this SSA_NAME so that we can reset the global table
|
|
|
|
when we leave this block. */
|
2004-11-24 00:38:12 +01:00
|
|
|
VEC_safe_push (tree_on_heap, nonzero_vars_stack, var);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Enter a statement into the true/false expression hash table indicating
|
|
|
|
that the condition COND has the value VALUE. */
|
|
|
|
|
|
|
|
static void
|
2004-09-15 06:38:04 +02:00
|
|
|
record_cond (tree cond, tree value)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
|
|
|
struct expr_hash_elt *element = xmalloc (sizeof (struct expr_hash_elt));
|
|
|
|
void **slot;
|
|
|
|
|
|
|
|
initialize_hash_element (cond, value, element);
|
|
|
|
|
|
|
|
slot = htab_find_slot_with_hash (avail_exprs, (void *)element,
|
2005-02-01 04:52:37 +01:00
|
|
|
element->hash, INSERT);
|
2004-05-13 08:41:07 +02:00
|
|
|
if (*slot == NULL)
|
|
|
|
{
|
|
|
|
*slot = (void *) element;
|
2004-11-24 00:38:12 +01:00
|
|
|
VEC_safe_push (tree_on_heap, avail_exprs_stack, cond);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
free (element);
|
|
|
|
}
|
|
|
|
|
2004-10-30 02:06:22 +02:00
|
|
|
/* Build a new conditional using NEW_CODE, OP0 and OP1 and store
|
|
|
|
the new conditional into *p, then store a boolean_true_node
|
2005-02-24 22:47:26 +01:00
|
|
|
into *(p + 1). */
|
2004-10-30 02:06:22 +02:00
|
|
|
|
|
|
|
static void
|
|
|
|
build_and_record_new_cond (enum tree_code new_code, tree op0, tree op1, tree *p)
|
|
|
|
{
|
|
|
|
*p = build2 (new_code, boolean_type_node, op0, op1);
|
|
|
|
p++;
|
|
|
|
*p = boolean_true_node;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Record that COND is true and INVERTED is false into the edge information
|
|
|
|
structure. Also record that any conditions dominated by COND are true
|
|
|
|
as well.
|
2004-06-24 17:59:52 +02:00
|
|
|
|
|
|
|
For example, if a < b is true, then a <= b must also be true. */
|
|
|
|
|
|
|
|
static void
|
2004-10-30 02:06:22 +02:00
|
|
|
record_conditions (struct edge_info *edge_info, tree cond, tree inverted)
|
2004-06-24 17:59:52 +02:00
|
|
|
{
|
2004-10-30 02:06:22 +02:00
|
|
|
tree op0, op1;
|
|
|
|
|
|
|
|
if (!COMPARISON_CLASS_P (cond))
|
|
|
|
return;
|
|
|
|
|
|
|
|
op0 = TREE_OPERAND (cond, 0);
|
|
|
|
op1 = TREE_OPERAND (cond, 1);
|
|
|
|
|
2004-06-24 17:59:52 +02:00
|
|
|
switch (TREE_CODE (cond))
|
|
|
|
{
|
|
|
|
case LT_EXPR:
|
|
|
|
case GT_EXPR:
|
2004-10-30 02:06:22 +02:00
|
|
|
edge_info->max_cond_equivalences = 12;
|
|
|
|
edge_info->cond_equivalences = xmalloc (12 * sizeof (tree));
|
|
|
|
build_and_record_new_cond ((TREE_CODE (cond) == LT_EXPR
|
|
|
|
? LE_EXPR : GE_EXPR),
|
|
|
|
op0, op1, &edge_info->cond_equivalences[4]);
|
|
|
|
build_and_record_new_cond (ORDERED_EXPR, op0, op1,
|
|
|
|
&edge_info->cond_equivalences[6]);
|
|
|
|
build_and_record_new_cond (NE_EXPR, op0, op1,
|
|
|
|
&edge_info->cond_equivalences[8]);
|
|
|
|
build_and_record_new_cond (LTGT_EXPR, op0, op1,
|
|
|
|
&edge_info->cond_equivalences[10]);
|
2004-06-24 17:59:52 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case GE_EXPR:
|
|
|
|
case LE_EXPR:
|
2004-10-30 02:06:22 +02:00
|
|
|
edge_info->max_cond_equivalences = 6;
|
|
|
|
edge_info->cond_equivalences = xmalloc (6 * sizeof (tree));
|
|
|
|
build_and_record_new_cond (ORDERED_EXPR, op0, op1,
|
|
|
|
&edge_info->cond_equivalences[4]);
|
2004-06-24 17:59:52 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case EQ_EXPR:
|
2004-10-30 02:06:22 +02:00
|
|
|
edge_info->max_cond_equivalences = 10;
|
|
|
|
edge_info->cond_equivalences = xmalloc (10 * sizeof (tree));
|
|
|
|
build_and_record_new_cond (ORDERED_EXPR, op0, op1,
|
|
|
|
&edge_info->cond_equivalences[4]);
|
|
|
|
build_and_record_new_cond (LE_EXPR, op0, op1,
|
|
|
|
&edge_info->cond_equivalences[6]);
|
|
|
|
build_and_record_new_cond (GE_EXPR, op0, op1,
|
|
|
|
&edge_info->cond_equivalences[8]);
|
2004-06-24 17:59:52 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case UNORDERED_EXPR:
|
2004-10-30 02:06:22 +02:00
|
|
|
edge_info->max_cond_equivalences = 16;
|
|
|
|
edge_info->cond_equivalences = xmalloc (16 * sizeof (tree));
|
|
|
|
build_and_record_new_cond (NE_EXPR, op0, op1,
|
|
|
|
&edge_info->cond_equivalences[4]);
|
|
|
|
build_and_record_new_cond (UNLE_EXPR, op0, op1,
|
|
|
|
&edge_info->cond_equivalences[6]);
|
|
|
|
build_and_record_new_cond (UNGE_EXPR, op0, op1,
|
|
|
|
&edge_info->cond_equivalences[8]);
|
|
|
|
build_and_record_new_cond (UNEQ_EXPR, op0, op1,
|
|
|
|
&edge_info->cond_equivalences[10]);
|
|
|
|
build_and_record_new_cond (UNLT_EXPR, op0, op1,
|
|
|
|
&edge_info->cond_equivalences[12]);
|
|
|
|
build_and_record_new_cond (UNGT_EXPR, op0, op1,
|
|
|
|
&edge_info->cond_equivalences[14]);
|
2004-06-24 17:59:52 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case UNLT_EXPR:
|
|
|
|
case UNGT_EXPR:
|
2004-10-30 02:06:22 +02:00
|
|
|
edge_info->max_cond_equivalences = 8;
|
|
|
|
edge_info->cond_equivalences = xmalloc (8 * sizeof (tree));
|
|
|
|
build_and_record_new_cond ((TREE_CODE (cond) == UNLT_EXPR
|
|
|
|
? UNLE_EXPR : UNGE_EXPR),
|
|
|
|
op0, op1, &edge_info->cond_equivalences[4]);
|
|
|
|
build_and_record_new_cond (NE_EXPR, op0, op1,
|
|
|
|
&edge_info->cond_equivalences[6]);
|
2004-06-24 17:59:52 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case UNEQ_EXPR:
|
2004-10-30 02:06:22 +02:00
|
|
|
edge_info->max_cond_equivalences = 8;
|
|
|
|
edge_info->cond_equivalences = xmalloc (8 * sizeof (tree));
|
|
|
|
build_and_record_new_cond (UNLE_EXPR, op0, op1,
|
|
|
|
&edge_info->cond_equivalences[4]);
|
|
|
|
build_and_record_new_cond (UNGE_EXPR, op0, op1,
|
|
|
|
&edge_info->cond_equivalences[6]);
|
2004-06-24 17:59:52 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case LTGT_EXPR:
|
2004-10-30 02:06:22 +02:00
|
|
|
edge_info->max_cond_equivalences = 8;
|
|
|
|
edge_info->cond_equivalences = xmalloc (8 * sizeof (tree));
|
|
|
|
build_and_record_new_cond (NE_EXPR, op0, op1,
|
|
|
|
&edge_info->cond_equivalences[4]);
|
|
|
|
build_and_record_new_cond (ORDERED_EXPR, op0, op1,
|
|
|
|
&edge_info->cond_equivalences[6]);
|
|
|
|
break;
|
2004-06-24 17:59:52 +02:00
|
|
|
|
|
|
|
default:
|
2004-10-30 02:06:22 +02:00
|
|
|
edge_info->max_cond_equivalences = 4;
|
|
|
|
edge_info->cond_equivalences = xmalloc (4 * sizeof (tree));
|
2004-06-24 17:59:52 +02:00
|
|
|
break;
|
|
|
|
}
|
2004-10-30 02:06:22 +02:00
|
|
|
|
|
|
|
/* Now store the original true and false conditions into the first
|
|
|
|
two slots. */
|
|
|
|
edge_info->cond_equivalences[0] = cond;
|
|
|
|
edge_info->cond_equivalences[1] = boolean_true_node;
|
|
|
|
edge_info->cond_equivalences[2] = inverted;
|
|
|
|
edge_info->cond_equivalences[3] = boolean_false_node;
|
2004-06-24 17:59:52 +02:00
|
|
|
}
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
/* A helper function for record_const_or_copy and record_equality.
|
|
|
|
Do the work of recording the value and undo info. */
|
|
|
|
|
|
|
|
static void
|
2004-09-17 23:16:07 +02:00
|
|
|
record_const_or_copy_1 (tree x, tree y, tree prev_x)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
2004-09-23 22:15:30 +02:00
|
|
|
SSA_NAME_VALUE (x) = y;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2004-11-24 00:38:12 +01:00
|
|
|
VEC_safe_push (tree_on_heap, const_and_copies_stack, prev_x);
|
|
|
|
VEC_safe_push (tree_on_heap, const_and_copies_stack, x);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
|
2004-10-23 20:00:01 +02:00
|
|
|
|
|
|
|
/* Return the loop depth of the basic block of the defining statement of X.
|
|
|
|
This number should not be treated as absolutely correct because the loop
|
|
|
|
information may not be completely up-to-date when dom runs. However, it
|
|
|
|
will be relatively correct, and as more passes are taught to keep loop info
|
|
|
|
up to date, the result will become more and more accurate. */
|
|
|
|
|
|
|
|
static int
|
|
|
|
loop_depth_of_name (tree x)
|
|
|
|
{
|
|
|
|
tree defstmt;
|
|
|
|
basic_block defbb;
|
|
|
|
|
|
|
|
/* If it's not an SSA_NAME, we have no clue where the definition is. */
|
|
|
|
if (TREE_CODE (x) != SSA_NAME)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* Otherwise return the loop depth of the defining statement's bb.
|
|
|
|
Note that there may not actually be a bb for this statement, if the
|
|
|
|
ssa_name is live on entry. */
|
|
|
|
defstmt = SSA_NAME_DEF_STMT (x);
|
|
|
|
defbb = bb_for_stmt (defstmt);
|
|
|
|
if (!defbb)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return defbb->loop_depth;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
/* Record that X is equal to Y in const_and_copies. Record undo
|
2004-11-24 00:38:12 +01:00
|
|
|
information in the block-local vector. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
static void
|
2004-09-17 23:16:07 +02:00
|
|
|
record_const_or_copy (tree x, tree y)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
2004-09-23 22:15:30 +02:00
|
|
|
tree prev_x = SSA_NAME_VALUE (x);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
if (TREE_CODE (y) == SSA_NAME)
|
|
|
|
{
|
2004-09-23 22:15:30 +02:00
|
|
|
tree tmp = SSA_NAME_VALUE (y);
|
2004-05-13 08:41:07 +02:00
|
|
|
if (tmp)
|
|
|
|
y = tmp;
|
|
|
|
}
|
|
|
|
|
2004-09-17 23:16:07 +02:00
|
|
|
record_const_or_copy_1 (x, y, prev_x);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Similarly, but assume that X and Y are the two operands of an EQ_EXPR.
|
|
|
|
This constrains the cases in which we may treat this as assignment. */
|
|
|
|
|
|
|
|
static void
|
2004-09-17 23:16:07 +02:00
|
|
|
record_equality (tree x, tree y)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
|
|
|
tree prev_x = NULL, prev_y = NULL;
|
|
|
|
|
|
|
|
if (TREE_CODE (x) == SSA_NAME)
|
2004-09-23 22:15:30 +02:00
|
|
|
prev_x = SSA_NAME_VALUE (x);
|
2004-05-13 08:41:07 +02:00
|
|
|
if (TREE_CODE (y) == SSA_NAME)
|
2004-09-23 22:15:30 +02:00
|
|
|
prev_y = SSA_NAME_VALUE (y);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2004-10-23 20:00:01 +02:00
|
|
|
/* If one of the previous values is invariant, or invariant in more loops
|
|
|
|
(by depth), then use that.
|
2004-05-13 08:41:07 +02:00
|
|
|
Otherwise it doesn't matter which value we choose, just so
|
|
|
|
long as we canonicalize on one value. */
|
|
|
|
if (TREE_INVARIANT (y))
|
|
|
|
;
|
2004-10-23 20:00:01 +02:00
|
|
|
else if (TREE_INVARIANT (x) || (loop_depth_of_name (x) <= loop_depth_of_name (y)))
|
2004-05-13 08:41:07 +02:00
|
|
|
prev_x = x, x = y, y = prev_x, prev_x = prev_y;
|
|
|
|
else if (prev_x && TREE_INVARIANT (prev_x))
|
|
|
|
x = y, y = prev_x, prev_x = prev_y;
|
2004-09-23 22:15:30 +02:00
|
|
|
else if (prev_y && TREE_CODE (prev_y) != VALUE_HANDLE)
|
2004-05-13 08:41:07 +02:00
|
|
|
y = prev_y;
|
|
|
|
|
|
|
|
/* After the swapping, we must have one SSA_NAME. */
|
|
|
|
if (TREE_CODE (x) != SSA_NAME)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* For IEEE, -0.0 == 0.0, so we don't necessarily know the sign of a
|
|
|
|
variable compared against zero. If we're honoring signed zeros,
|
|
|
|
then we cannot record this value unless we know that the value is
|
c-common.c, [...]: Fix comment typos.
* c-common.c, calls.c, cfgcleanup.c, cgraph.c, cgraphunit.c,
ddg.c, ddg.h, df.c, df.h, except.c, expr.c, flags.h,
fold-const.c, gcc.c, gimplify.c, haifa-sched.c,
modulo-sched.c, tree-inline.c, tree-into-ssa.c, tree-nested.c,
tree-nrv.c, tree-ssa-ccp.c, tree-ssa-dom.c, tree-ssa-live.c,
tree-ssa-loop.c, tree-ssa-pre.c, tree-tailcall.c, tree.h: Fix
comment typos. Follow spelling conventions.
From-SVN: r82439
2004-05-30 09:12:58 +02:00
|
|
|
nonzero. */
|
2004-05-13 08:41:07 +02:00
|
|
|
if (HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (x)))
|
|
|
|
&& (TREE_CODE (y) != REAL_CST
|
|
|
|
|| REAL_VALUES_EQUAL (dconst0, TREE_REAL_CST (y))))
|
|
|
|
return;
|
|
|
|
|
2004-09-17 23:16:07 +02:00
|
|
|
record_const_or_copy_1 (x, y, prev_x);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
|
2004-10-12 22:50:08 +02:00
|
|
|
/* Return true, if it is ok to do folding of an associative expression.
|
|
|
|
EXP is the tree for the associative expression. */
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
unsafe_associative_fp_binop (tree exp)
|
|
|
|
{
|
|
|
|
enum tree_code code = TREE_CODE (exp);
|
|
|
|
return !(!flag_unsafe_math_optimizations
|
2004-11-10 18:17:48 +01:00
|
|
|
&& (code == MULT_EXPR || code == PLUS_EXPR
|
|
|
|
|| code == MINUS_EXPR)
|
2004-10-12 22:50:08 +02:00
|
|
|
&& FLOAT_TYPE_P (TREE_TYPE (exp)));
|
|
|
|
}
|
|
|
|
|
2005-02-26 08:55:28 +01:00
|
|
|
/* Returns true when STMT is a simple iv increment. It detects the
|
|
|
|
following situation:
|
|
|
|
|
|
|
|
i_1 = phi (..., i_2)
|
|
|
|
i_2 = i_1 +/- ... */
|
|
|
|
|
|
|
|
static bool
|
|
|
|
simple_iv_increment_p (tree stmt)
|
|
|
|
{
|
|
|
|
tree lhs, rhs, preinc, phi;
|
|
|
|
unsigned i;
|
|
|
|
|
|
|
|
if (TREE_CODE (stmt) != MODIFY_EXPR)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
lhs = TREE_OPERAND (stmt, 0);
|
|
|
|
if (TREE_CODE (lhs) != SSA_NAME)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
rhs = TREE_OPERAND (stmt, 1);
|
|
|
|
|
|
|
|
if (TREE_CODE (rhs) != PLUS_EXPR
|
|
|
|
&& TREE_CODE (rhs) != MINUS_EXPR)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
preinc = TREE_OPERAND (rhs, 0);
|
|
|
|
if (TREE_CODE (preinc) != SSA_NAME)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
phi = SSA_NAME_DEF_STMT (preinc);
|
|
|
|
if (TREE_CODE (phi) != PHI_NODE)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
for (i = 0; i < (unsigned) PHI_NUM_ARGS (phi); i++)
|
|
|
|
if (PHI_ARG_DEF (phi, i) == lhs)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
/* STMT is a MODIFY_EXPR for which we were unable to find RHS in the
|
|
|
|
hash tables. Try to simplify the RHS using whatever equivalences
|
|
|
|
we may have recorded.
|
|
|
|
|
|
|
|
If we are able to simplify the RHS, then lookup the simplified form in
|
|
|
|
the hash table and return the result. Otherwise return NULL. */
|
|
|
|
|
|
|
|
static tree
|
|
|
|
simplify_rhs_and_lookup_avail_expr (struct dom_walk_data *walk_data,
|
2004-08-10 20:31:26 +02:00
|
|
|
tree stmt, int insert)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
|
|
|
tree rhs = TREE_OPERAND (stmt, 1);
|
|
|
|
enum tree_code rhs_code = TREE_CODE (rhs);
|
|
|
|
tree result = NULL;
|
|
|
|
|
|
|
|
/* If we have lhs = ~x, look and see if we earlier had x = ~y.
|
|
|
|
In which case we can change this statement to be lhs = y.
|
|
|
|
Which can then be copy propagated.
|
|
|
|
|
|
|
|
Similarly for negation. */
|
|
|
|
if ((rhs_code == BIT_NOT_EXPR || rhs_code == NEGATE_EXPR)
|
|
|
|
&& TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME)
|
|
|
|
{
|
|
|
|
/* Get the definition statement for our RHS. */
|
|
|
|
tree rhs_def_stmt = SSA_NAME_DEF_STMT (TREE_OPERAND (rhs, 0));
|
|
|
|
|
|
|
|
/* See if the RHS_DEF_STMT has the same form as our statement. */
|
|
|
|
if (TREE_CODE (rhs_def_stmt) == MODIFY_EXPR
|
|
|
|
&& TREE_CODE (TREE_OPERAND (rhs_def_stmt, 1)) == rhs_code)
|
|
|
|
{
|
|
|
|
tree rhs_def_operand;
|
|
|
|
|
|
|
|
rhs_def_operand = TREE_OPERAND (TREE_OPERAND (rhs_def_stmt, 1), 0);
|
|
|
|
|
|
|
|
/* Verify that RHS_DEF_OPERAND is a suitable SSA variable. */
|
|
|
|
if (TREE_CODE (rhs_def_operand) == SSA_NAME
|
|
|
|
&& ! SSA_NAME_OCCURS_IN_ABNORMAL_PHI (rhs_def_operand))
|
|
|
|
result = update_rhs_and_lookup_avail_expr (stmt,
|
|
|
|
rhs_def_operand,
|
|
|
|
insert);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If we have z = (x OP C1), see if we earlier had x = y OP C2.
|
|
|
|
If OP is associative, create and fold (y OP C2) OP C1 which
|
|
|
|
should result in (y OP C3), use that as the RHS for the
|
|
|
|
assignment. Add minus to this, as we handle it specially below. */
|
|
|
|
if ((associative_tree_code (rhs_code) || rhs_code == MINUS_EXPR)
|
|
|
|
&& TREE_CODE (TREE_OPERAND (rhs, 0)) == SSA_NAME
|
|
|
|
&& is_gimple_min_invariant (TREE_OPERAND (rhs, 1)))
|
|
|
|
{
|
|
|
|
tree rhs_def_stmt = SSA_NAME_DEF_STMT (TREE_OPERAND (rhs, 0));
|
|
|
|
|
2005-02-26 08:55:28 +01:00
|
|
|
/* If the statement defines an induction variable, do not propagate
|
|
|
|
its value, so that we do not create overlapping life ranges. */
|
|
|
|
if (simple_iv_increment_p (rhs_def_stmt))
|
|
|
|
goto dont_fold_assoc;
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
/* See if the RHS_DEF_STMT has the same form as our statement. */
|
|
|
|
if (TREE_CODE (rhs_def_stmt) == MODIFY_EXPR)
|
|
|
|
{
|
|
|
|
tree rhs_def_rhs = TREE_OPERAND (rhs_def_stmt, 1);
|
|
|
|
enum tree_code rhs_def_code = TREE_CODE (rhs_def_rhs);
|
|
|
|
|
2004-10-12 22:50:08 +02:00
|
|
|
if ((rhs_code == rhs_def_code && unsafe_associative_fp_binop (rhs))
|
2004-05-13 08:41:07 +02:00
|
|
|
|| (rhs_code == PLUS_EXPR && rhs_def_code == MINUS_EXPR)
|
|
|
|
|| (rhs_code == MINUS_EXPR && rhs_def_code == PLUS_EXPR))
|
|
|
|
{
|
|
|
|
tree def_stmt_op0 = TREE_OPERAND (rhs_def_rhs, 0);
|
|
|
|
tree def_stmt_op1 = TREE_OPERAND (rhs_def_rhs, 1);
|
|
|
|
|
|
|
|
if (TREE_CODE (def_stmt_op0) == SSA_NAME
|
|
|
|
&& ! SSA_NAME_OCCURS_IN_ABNORMAL_PHI (def_stmt_op0)
|
|
|
|
&& is_gimple_min_invariant (def_stmt_op1))
|
|
|
|
{
|
|
|
|
tree outer_const = TREE_OPERAND (rhs, 1);
|
|
|
|
tree type = TREE_TYPE (TREE_OPERAND (stmt, 0));
|
|
|
|
tree t;
|
|
|
|
|
2004-07-03 20:57:18 +02:00
|
|
|
/* If we care about correct floating point results, then
|
|
|
|
don't fold x + c1 - c2. Note that we need to take both
|
|
|
|
the codes and the signs to figure this out. */
|
|
|
|
if (FLOAT_TYPE_P (type)
|
|
|
|
&& !flag_unsafe_math_optimizations
|
|
|
|
&& (rhs_def_code == PLUS_EXPR
|
|
|
|
|| rhs_def_code == MINUS_EXPR))
|
|
|
|
{
|
|
|
|
bool neg = false;
|
|
|
|
|
|
|
|
neg ^= (rhs_code == MINUS_EXPR);
|
|
|
|
neg ^= (rhs_def_code == MINUS_EXPR);
|
|
|
|
neg ^= real_isneg (TREE_REAL_CST_PTR (outer_const));
|
|
|
|
neg ^= real_isneg (TREE_REAL_CST_PTR (def_stmt_op1));
|
|
|
|
|
|
|
|
if (neg)
|
|
|
|
goto dont_fold_assoc;
|
|
|
|
}
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
/* Ho hum. So fold will only operate on the outermost
|
|
|
|
thingy that we give it, so we have to build the new
|
|
|
|
expression in two pieces. This requires that we handle
|
|
|
|
combinations of plus and minus. */
|
|
|
|
if (rhs_def_code != rhs_code)
|
|
|
|
{
|
|
|
|
if (rhs_def_code == MINUS_EXPR)
|
|
|
|
t = build (MINUS_EXPR, type, outer_const, def_stmt_op1);
|
|
|
|
else
|
|
|
|
t = build (MINUS_EXPR, type, def_stmt_op1, outer_const);
|
|
|
|
rhs_code = PLUS_EXPR;
|
|
|
|
}
|
|
|
|
else if (rhs_def_code == MINUS_EXPR)
|
|
|
|
t = build (PLUS_EXPR, type, def_stmt_op1, outer_const);
|
|
|
|
else
|
|
|
|
t = build (rhs_def_code, type, def_stmt_op1, outer_const);
|
|
|
|
t = local_fold (t);
|
|
|
|
t = build (rhs_code, type, def_stmt_op0, t);
|
|
|
|
t = local_fold (t);
|
|
|
|
|
|
|
|
/* If the result is a suitable looking gimple expression,
|
|
|
|
then use it instead of the original for STMT. */
|
|
|
|
if (TREE_CODE (t) == SSA_NAME
|
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
|
|
|
|| (UNARY_CLASS_P (t)
|
2004-05-13 08:41:07 +02:00
|
|
|
&& TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME)
|
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
|
|
|
|| ((BINARY_CLASS_P (t) || COMPARISON_CLASS_P (t))
|
2004-05-13 08:41:07 +02:00
|
|
|
&& TREE_CODE (TREE_OPERAND (t, 0)) == SSA_NAME
|
|
|
|
&& is_gimple_val (TREE_OPERAND (t, 1))))
|
2004-09-15 06:38:04 +02:00
|
|
|
result = update_rhs_and_lookup_avail_expr (stmt, t, insert);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-07-03 20:57:18 +02:00
|
|
|
dont_fold_assoc:;
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Transform TRUNC_DIV_EXPR and TRUNC_MOD_EXPR into RSHIFT_EXPR
|
|
|
|
and BIT_AND_EXPR respectively if the first operand is greater
|
|
|
|
than zero and the second operand is an exact power of two. */
|
|
|
|
if ((rhs_code == TRUNC_DIV_EXPR || rhs_code == TRUNC_MOD_EXPR)
|
|
|
|
&& INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (rhs, 0)))
|
|
|
|
&& integer_pow2p (TREE_OPERAND (rhs, 1)))
|
|
|
|
{
|
|
|
|
tree val;
|
|
|
|
tree op = TREE_OPERAND (rhs, 0);
|
|
|
|
|
|
|
|
if (TYPE_UNSIGNED (TREE_TYPE (op)))
|
|
|
|
{
|
|
|
|
val = integer_one_node;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tree dummy_cond = walk_data->global_data;
|
|
|
|
|
|
|
|
if (! dummy_cond)
|
|
|
|
{
|
|
|
|
dummy_cond = build (GT_EXPR, boolean_type_node,
|
|
|
|
op, integer_zero_node);
|
|
|
|
dummy_cond = build (COND_EXPR, void_type_node,
|
|
|
|
dummy_cond, NULL, NULL);
|
|
|
|
walk_data->global_data = dummy_cond;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-11-16 01:05:30 +01:00
|
|
|
TREE_SET_CODE (COND_EXPR_COND (dummy_cond), GT_EXPR);
|
|
|
|
TREE_OPERAND (COND_EXPR_COND (dummy_cond), 0) = op;
|
|
|
|
TREE_OPERAND (COND_EXPR_COND (dummy_cond), 1)
|
2004-05-13 08:41:07 +02:00
|
|
|
= integer_zero_node;
|
|
|
|
}
|
2004-09-15 06:38:04 +02:00
|
|
|
val = simplify_cond_and_lookup_avail_expr (dummy_cond, NULL, false);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (val && integer_onep (val))
|
|
|
|
{
|
|
|
|
tree t;
|
|
|
|
tree op0 = TREE_OPERAND (rhs, 0);
|
|
|
|
tree op1 = TREE_OPERAND (rhs, 1);
|
|
|
|
|
|
|
|
if (rhs_code == TRUNC_DIV_EXPR)
|
|
|
|
t = build (RSHIFT_EXPR, TREE_TYPE (op0), op0,
|
tree.h (build_int_cst): New, sign extended constant.
* tree.h (build_int_cst): New, sign extended constant.
(build_int_cstu): New, zero extended constant.
(build_int_cst_wide): Renamed from build_int_cst.
* tree.c (build_int_cst, build_int_cstu): New.
(build_int_cst_wide): Renamed from build_int_cst.
(make_vector_type, build_common_tree_nodes,
build_common_tree_nodes_2): Adjust build_int_cst calls.
* builtins.c (expand_builtin_prefetch, expand_builtin_strstr,
expand_builtin_strpbrk, expand_builtin_fputs,
build_string_literal, expand_builtin_printf,
expand_builtin_sprintf, fold_builtin_classify_type,
fold_builtin_lround, fold_builtin_bitop, fold_builtin_isascii,
fold_builtin_toascii, fold_builtin_isdigit,
simplify_builtin_strstr, simplify_builtin_strpbrk,
fold_builtin_fputs, simplify_builtin_sprintf): Likewise.
* c-common.c (start_fname_decls, fix_string_type, shorten_compare,
DEF_ATTR_INT): Likewise.
* c-decl.c (complete_array_type, check_bitfield_type_and_width):
Likewise.
* c-lex.c (interpret_integer, lex_charconst): Likewise.
* c-parse.in (primary) <TYPES_COMPATIBLE_P> Likewise.
* c-pretty-print.c (pp_c_integer_constant): Likewise.
* c-typeck.c (really_start_incremental_init, push_init_level,
set_nonincremental_init_from_string): Likewise.
* calls.c (load_register_parameters): Likewise.
convert.c (convert_to_pointer): Likewise.
coverage.c (coverage_counter_alloc, tree_coverage_counter_ref,
build_fn_info_type, build_fn_info_value, build_ctr_info_value,
build_gcov_info): Likewise.
* except.c (init_eh, assign_filter_values): Likewise.
* expmed.c (store_fixed_bit_field, extract_bit_field,
extract_fixed_bit_field, extract_split_bit_field, expand_shift,
expand_mult_const, expand_mult_highpart_adjust, extract_high_half,
expand_sdiv_pow2, expand_divmod, make_tree): Likewise.
* expr.c (convert_move, emit_group_load, emit_group_store,
expand_assignment, store_constructor, store_field,
expand_expr_real_1, reduce_to_bit_field_precision): Likewise.
fold-const.c (force_fit_type, int_const_binop, fold_convert_const,
invert_truthvalue, optimize_bit_field_compare,
decode_field_reference, all_ones_mask_p, constant_boolean_node,
fold_div_compare, fold, fold_read_from_constant_string,
fold_negate_const, fold_abs_const, fold_not_const, round_up,
round_down): Likewise.
* function.c (assign_parm_setup_block): Likewise.
* stmt.c (shift_return_value, expand_case, estimate_case_costs):
Likewise.
* stor-layout.c (layout_type, initialize_sizetypes,
set_min_and_max_values_for_integral_type): Likewise.
* tree-chrec.c (chrec_fold_multiply_poly_poly,
reset_evolution_in_loop): Likewise.
* tree-chrec.h (build_polynomial_chrec): Likewise.
* tree-complex.c (build_replicated_const): Likewise.
* tree-eh.c (honor_protect_cleanup_actions,
lower_try_finally_onedest, lower_try_finally_copy,
lower_try_finally_switch): Likewise.
* tree-mudflap.c (mf_build_string, mx_register_decls,
mudflap_register_call, mudflap_enqueue_constant): Likewise.
* tree-nested.c (get_trampoline_type, get_nl_goto_field): Likewise.
* tree-pretty-print.c (dump_generic_node): Likewise.
* tree-ssa-ccp.c (widen_bitfield, maybe_fold_offset_to_array_ref):
Likewise.
* tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise.
* tree-ssa-loop-niter.c (number_of_iterations_cond,
loop_niter_by_eval, upper_bound_in_type, lower_bound_in_type):
Likewise.
* tree-ssa-loop-ivcanon.c (create_canonical_iv,
canonicalize_loop_induction_variables): Likewise.
* tree-vectorizer.c (vect_create_index_for_array_ref,
vect_transform_loop_bound, vect_compute_data_ref_alignment):
Likewise.
* config/alpha/alpha.c (alpha_initialize_trampoline, alpha_va_start,
alpha_gimplify_va_arg_1): Likewise.
* config/arm/arm.c (arm_get_cookie_size): Likewise.
* config/c4x/c4x.c (c4x_gimplify_va_arg_expr): Likewise.
* config/i386/i386.c (ix86_va_start, ix86_gimplify_va_arg): Likewise.
* config/ia64/ia64.c (ia64_gimplify_va_arg): Likewise.
* config/mips/mips.c (mips_build_builtin_va_list, mips_va_start,
mips_gimplify_va_arg_expr): Likewise.
* config/pa/pa.c (hppa_gimplify_va_arg_expr): Likewise.
* config/rs6000/rs6000.c (rs6000_va_start, rs6000_gimplify_va_arg,
add_compiler_branch_island): Likewise.
* config/s390/s390.c (s390_va_start): Likewise.
* config/sh/sh.c (sh_va_start): Likewise.
* config/stormy16/stormy16.c (xstormy16_expand_builtin_va_start):
Likewise.
* config/xtensa/xtensa.c (xtensa_va_start,
xtensa_gimplify_va_arg_expr): Likewise.
* objc/objc-act.c (build_objc_string_object,
build_objc_symtab_template, init_def_list, init_objc_symtab,
init_module_descriptor, generate_static_references,
build_selector_translation_table, get_proto_encoding,
build_typed_selector_reference, build_selector_reference,
build_next_objc_exception_stuff,
build_method_prototype_list_template, generate_descriptor_table,
generate_protocols, build_protocol_initializer,
build_ivar_list_template, build_method_list_template,
build_ivar_list_initializer, generate_ivars_list,
generate_dispatch_table, generate_protocol_list,
build_category_initializer, build_shared_structure_initializer,
generate_shared_structures, handle_impent,
generate_objc_image_info): Likewise.
2004-04-25 Paolo Bonzini <bonzini@gnu.org>
* cfglayout.c (duplicate_insn_chain): Remove references to
NOTE_INSN_LOOP_VTOP and NOTE_INSN_LOOP_CONT.
* cfgloop.h (struct loop): Remove fields vtop, cont and cont_dominator.
* cfgrtl.c (rtl_delete_block): Remove handling of NOTE_INSN_LOOP_CONT.
* final.c (final_scan_insn): Remove references to NOTE_INSN_LOOP_VTOP
and NOTE_INSN_LOOP_CONT.
* insn-notes.def (NOTE_INSN_LOOP_VTOP, NOTE_INSN_LOOP_CONT): Remove.
* jump.c (squeeze_notes): Remove references to NOTE_INSN_LOOP_VTOP
and NOTE_INSN_LOOP_CONT.
* loop.c (scan_loops, find_and_verify_loops, for_each_insn_in_loop,
check_dbra_loop, loop_dump_aux): Remove references to removed notes
and fields.
* reorg.c (mostly_true_jump): Do not rely on NOTE_INSN_LOOP_VTOPs.
* unroll.c (unroll_loop, copy_loop_body, loop_iterations): Remove
references to removed notes and fields.
(subtract_reg_term, ujump_to_loop_cont): Remove.
From-SVN: r86544
2004-08-25 11:52:54 +02:00
|
|
|
build_int_cst (NULL_TREE, tree_log2 (op1)));
|
2004-05-13 08:41:07 +02:00
|
|
|
else
|
|
|
|
t = build (BIT_AND_EXPR, TREE_TYPE (op0), op0,
|
|
|
|
local_fold (build (MINUS_EXPR, TREE_TYPE (op1),
|
|
|
|
op1, integer_one_node)));
|
|
|
|
|
2004-09-15 06:38:04 +02:00
|
|
|
result = update_rhs_and_lookup_avail_expr (stmt, t, insert);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Transform ABS (X) into X or -X as appropriate. */
|
|
|
|
if (rhs_code == ABS_EXPR
|
|
|
|
&& INTEGRAL_TYPE_P (TREE_TYPE (TREE_OPERAND (rhs, 0))))
|
|
|
|
{
|
|
|
|
tree val;
|
|
|
|
tree op = TREE_OPERAND (rhs, 0);
|
|
|
|
tree type = TREE_TYPE (op);
|
|
|
|
|
|
|
|
if (TYPE_UNSIGNED (type))
|
|
|
|
{
|
|
|
|
val = integer_zero_node;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tree dummy_cond = walk_data->global_data;
|
|
|
|
|
|
|
|
if (! dummy_cond)
|
|
|
|
{
|
2004-05-14 19:51:05 +02:00
|
|
|
dummy_cond = build (LE_EXPR, boolean_type_node,
|
2004-05-13 08:41:07 +02:00
|
|
|
op, integer_zero_node);
|
|
|
|
dummy_cond = build (COND_EXPR, void_type_node,
|
|
|
|
dummy_cond, NULL, NULL);
|
|
|
|
walk_data->global_data = dummy_cond;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-11-16 01:05:30 +01:00
|
|
|
TREE_SET_CODE (COND_EXPR_COND (dummy_cond), LE_EXPR);
|
|
|
|
TREE_OPERAND (COND_EXPR_COND (dummy_cond), 0) = op;
|
|
|
|
TREE_OPERAND (COND_EXPR_COND (dummy_cond), 1)
|
2004-09-07 12:22:44 +02:00
|
|
|
= build_int_cst (type, 0);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
2004-09-15 06:38:04 +02:00
|
|
|
val = simplify_cond_and_lookup_avail_expr (dummy_cond, NULL, false);
|
2004-05-14 19:51:05 +02:00
|
|
|
|
|
|
|
if (!val)
|
|
|
|
{
|
2004-11-16 01:05:30 +01:00
|
|
|
TREE_SET_CODE (COND_EXPR_COND (dummy_cond), GE_EXPR);
|
|
|
|
TREE_OPERAND (COND_EXPR_COND (dummy_cond), 0) = op;
|
|
|
|
TREE_OPERAND (COND_EXPR_COND (dummy_cond), 1)
|
2004-09-07 12:22:44 +02:00
|
|
|
= build_int_cst (type, 0);
|
2004-05-14 19:51:05 +02:00
|
|
|
|
|
|
|
val = simplify_cond_and_lookup_avail_expr (dummy_cond,
|
|
|
|
NULL, false);
|
|
|
|
|
|
|
|
if (val)
|
|
|
|
{
|
|
|
|
if (integer_zerop (val))
|
|
|
|
val = integer_one_node;
|
|
|
|
else if (integer_onep (val))
|
|
|
|
val = integer_zero_node;
|
|
|
|
}
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (val
|
|
|
|
&& (integer_onep (val) || integer_zerop (val)))
|
|
|
|
{
|
|
|
|
tree t;
|
|
|
|
|
|
|
|
if (integer_onep (val))
|
|
|
|
t = build1 (NEGATE_EXPR, TREE_TYPE (op), op);
|
|
|
|
else
|
|
|
|
t = op;
|
|
|
|
|
2004-09-15 06:38:04 +02:00
|
|
|
result = update_rhs_and_lookup_avail_expr (stmt, t, insert);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Optimize *"foo" into 'f'. This is done here rather than
|
|
|
|
in fold to avoid problems with stuff like &*"foo". */
|
|
|
|
if (TREE_CODE (rhs) == INDIRECT_REF || TREE_CODE (rhs) == ARRAY_REF)
|
|
|
|
{
|
|
|
|
tree t = fold_read_from_constant_string (rhs);
|
|
|
|
|
|
|
|
if (t)
|
2004-09-15 06:38:04 +02:00
|
|
|
result = update_rhs_and_lookup_avail_expr (stmt, t, insert);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* COND is a condition of the form:
|
|
|
|
|
|
|
|
x == const or x != const
|
|
|
|
|
|
|
|
Look back to x's defining statement and see if x is defined as
|
|
|
|
|
|
|
|
x = (type) y;
|
|
|
|
|
|
|
|
If const is unchanged if we convert it to type, then we can build
|
|
|
|
the equivalent expression:
|
|
|
|
|
|
|
|
|
|
|
|
y == const or y != const
|
|
|
|
|
|
|
|
Which may allow further optimizations.
|
|
|
|
|
|
|
|
Return the equivalent comparison or NULL if no such equivalent comparison
|
|
|
|
was found. */
|
|
|
|
|
|
|
|
static tree
|
|
|
|
find_equivalent_equality_comparison (tree cond)
|
|
|
|
{
|
|
|
|
tree op0 = TREE_OPERAND (cond, 0);
|
|
|
|
tree op1 = TREE_OPERAND (cond, 1);
|
|
|
|
tree def_stmt = SSA_NAME_DEF_STMT (op0);
|
|
|
|
|
|
|
|
/* OP0 might have been a parameter, so first make sure it
|
|
|
|
was defined by a MODIFY_EXPR. */
|
|
|
|
if (def_stmt && TREE_CODE (def_stmt) == MODIFY_EXPR)
|
|
|
|
{
|
|
|
|
tree def_rhs = TREE_OPERAND (def_stmt, 1);
|
|
|
|
|
|
|
|
/* Now make sure the RHS of the MODIFY_EXPR is a typecast. */
|
|
|
|
if ((TREE_CODE (def_rhs) == NOP_EXPR
|
|
|
|
|| TREE_CODE (def_rhs) == CONVERT_EXPR)
|
|
|
|
&& TREE_CODE (TREE_OPERAND (def_rhs, 0)) == SSA_NAME)
|
|
|
|
{
|
|
|
|
tree def_rhs_inner = TREE_OPERAND (def_rhs, 0);
|
|
|
|
tree def_rhs_inner_type = TREE_TYPE (def_rhs_inner);
|
|
|
|
tree new;
|
|
|
|
|
|
|
|
if (TYPE_PRECISION (def_rhs_inner_type)
|
|
|
|
> TYPE_PRECISION (TREE_TYPE (def_rhs)))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
/* What we want to prove is that if we convert OP1 to
|
|
|
|
the type of the object inside the NOP_EXPR that the
|
|
|
|
result is still equivalent to SRC.
|
|
|
|
|
|
|
|
If that is true, the build and return new equivalent
|
|
|
|
condition which uses the source of the typecast and the
|
|
|
|
new constant (which has only changed its type). */
|
|
|
|
new = build1 (TREE_CODE (def_rhs), def_rhs_inner_type, op1);
|
|
|
|
new = local_fold (new);
|
|
|
|
if (is_gimple_val (new) && tree_int_cst_equal (new, op1))
|
|
|
|
return build (TREE_CODE (cond), TREE_TYPE (cond),
|
|
|
|
def_rhs_inner, new);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* STMT is a COND_EXPR for which we could not trivially determine its
|
|
|
|
result. This routine attempts to find equivalent forms of the
|
|
|
|
condition which we may be able to optimize better. It also
|
|
|
|
uses simple value range propagation to optimize conditionals. */
|
|
|
|
|
|
|
|
static tree
|
|
|
|
simplify_cond_and_lookup_avail_expr (tree stmt,
|
|
|
|
stmt_ann_t ann,
|
|
|
|
int insert)
|
|
|
|
{
|
|
|
|
tree cond = COND_EXPR_COND (stmt);
|
|
|
|
|
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
|
|
|
if (COMPARISON_CLASS_P (cond))
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
|
|
|
tree op0 = TREE_OPERAND (cond, 0);
|
|
|
|
tree op1 = TREE_OPERAND (cond, 1);
|
|
|
|
|
|
|
|
if (TREE_CODE (op0) == SSA_NAME && is_gimple_min_invariant (op1))
|
|
|
|
{
|
|
|
|
int limit;
|
|
|
|
tree low, high, cond_low, cond_high;
|
|
|
|
int lowequal, highequal, swapped, no_overlap, subset, cond_inverted;
|
|
|
|
varray_type vrp_records;
|
|
|
|
struct vrp_element *element;
|
2004-09-25 00:31:13 +02:00
|
|
|
struct vrp_hash_elt vrp_hash_elt, *vrp_hash_elt_p;
|
2004-09-22 06:12:01 +02:00
|
|
|
void **slot;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* First see if we have test of an SSA_NAME against a constant
|
|
|
|
where the SSA_NAME is defined by an earlier typecast which
|
|
|
|
is irrelevant when performing tests against the given
|
|
|
|
constant. */
|
|
|
|
if (TREE_CODE (cond) == EQ_EXPR || TREE_CODE (cond) == NE_EXPR)
|
|
|
|
{
|
|
|
|
tree new_cond = find_equivalent_equality_comparison (cond);
|
|
|
|
|
|
|
|
if (new_cond)
|
|
|
|
{
|
|
|
|
/* Update the statement to use the new equivalent
|
|
|
|
condition. */
|
|
|
|
COND_EXPR_COND (stmt) = new_cond;
|
2004-08-10 20:31:26 +02:00
|
|
|
|
|
|
|
/* If this is not a real stmt, ann will be NULL and we
|
|
|
|
avoid processing the operands. */
|
|
|
|
if (ann)
|
|
|
|
modify_stmt (stmt);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* Lookup the condition and return its known value if it
|
|
|
|
exists. */
|
2004-09-15 06:38:04 +02:00
|
|
|
new_cond = lookup_avail_expr (stmt, insert);
|
2004-05-13 08:41:07 +02:00
|
|
|
if (new_cond)
|
|
|
|
return new_cond;
|
|
|
|
|
|
|
|
/* The operands have changed, so update op0 and op1. */
|
|
|
|
op0 = TREE_OPERAND (cond, 0);
|
|
|
|
op1 = TREE_OPERAND (cond, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Consult the value range records for this variable (if they exist)
|
|
|
|
to see if we can eliminate or simplify this conditional.
|
|
|
|
|
|
|
|
Note two tests are necessary to determine no records exist.
|
|
|
|
First we have to see if the virtual array exists, if it
|
|
|
|
exists, then we have to check its active size.
|
|
|
|
|
|
|
|
Also note the vast majority of conditionals are not testing
|
|
|
|
a variable which has had its range constrained by an earlier
|
|
|
|
conditional. So this filter avoids a lot of unnecessary work. */
|
2004-09-22 06:12:01 +02:00
|
|
|
vrp_hash_elt.var = op0;
|
|
|
|
vrp_hash_elt.records = NULL;
|
|
|
|
slot = htab_find_slot (vrp_data, &vrp_hash_elt, NO_INSERT);
|
|
|
|
if (slot == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
2004-09-25 00:31:13 +02:00
|
|
|
vrp_hash_elt_p = (struct vrp_hash_elt *) *slot;
|
|
|
|
vrp_records = vrp_hash_elt_p->records;
|
2004-05-13 08:41:07 +02:00
|
|
|
if (vrp_records == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
limit = VARRAY_ACTIVE_SIZE (vrp_records);
|
|
|
|
|
|
|
|
/* If we have no value range records for this variable, or we are
|
|
|
|
unable to extract a range for this condition, then there is
|
|
|
|
nothing to do. */
|
|
|
|
if (limit == 0
|
|
|
|
|| ! extract_range_from_cond (cond, &cond_high,
|
|
|
|
&cond_low, &cond_inverted))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
/* We really want to avoid unnecessary computations of range
|
|
|
|
info. So all ranges are computed lazily; this avoids a
|
alias.c, [...]: Fix comment typos.
* alias.c, crtstuff.c, dbxout.c, domwalk.c, domwalk.h, gcc.c,
gcse.c, global.c, lambda-code.c, loop.c, mips-tdump.c,
optabs.h, predict.c, reg-stack.c, regclass.c, sched-rgn.c,
tree-optimize.c, tree-ssa-dom.c, tree-ssa-forwprop.c,
tree-ssa-operands.c, tree-ssa-phiopt.c,
tree-ssa-threadupdate.c: Fix comment typos.
From-SVN: r87707
2004-09-18 21:47:10 +02:00
|
|
|
lot of unnecessary work. i.e., we record the conditional,
|
2004-05-13 08:41:07 +02:00
|
|
|
but do not process how it constrains the variable's
|
|
|
|
potential values until we know that processing the condition
|
|
|
|
could be helpful.
|
|
|
|
|
|
|
|
However, we do not want to have to walk a potentially long
|
|
|
|
list of ranges, nor do we want to compute a variable's
|
|
|
|
range more than once for a given path.
|
|
|
|
|
|
|
|
Luckily, each time we encounter a conditional that can not
|
|
|
|
be otherwise optimized we will end up here and we will
|
|
|
|
compute the necessary range information for the variable
|
|
|
|
used in this condition.
|
|
|
|
|
|
|
|
Thus you can conclude that there will never be more than one
|
|
|
|
conditional associated with a variable which has not been
|
|
|
|
processed. So we never need to merge more than one new
|
|
|
|
conditional into the current range.
|
|
|
|
|
|
|
|
These properties also help us avoid unnecessary work. */
|
|
|
|
element
|
|
|
|
= (struct vrp_element *)VARRAY_GENERIC_PTR (vrp_records, limit - 1);
|
|
|
|
|
|
|
|
if (element->high && element->low)
|
|
|
|
{
|
|
|
|
/* The last element has been processed, so there is no range
|
|
|
|
merging to do, we can simply use the high/low values
|
|
|
|
recorded in the last element. */
|
|
|
|
low = element->low;
|
|
|
|
high = element->high;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tree tmp_high, tmp_low;
|
|
|
|
int dummy;
|
|
|
|
|
2005-01-15 10:46:10 +01:00
|
|
|
/* The last element has not been processed. Process it now.
|
|
|
|
record_range should ensure for cond inverted is not set.
|
|
|
|
This call can only fail if cond is x < min or x > max,
|
|
|
|
which fold should have optimized into false.
|
|
|
|
If that doesn't happen, just pretend all values are
|
|
|
|
in the range. */
|
|
|
|
if (! extract_range_from_cond (element->cond, &tmp_high,
|
|
|
|
&tmp_low, &dummy))
|
|
|
|
gcc_unreachable ();
|
|
|
|
else
|
|
|
|
gcc_assert (dummy == 0);
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
/* If this is the only element, then no merging is necessary,
|
|
|
|
the high/low values from extract_range_from_cond are all
|
|
|
|
we need. */
|
|
|
|
if (limit == 1)
|
|
|
|
{
|
|
|
|
low = tmp_low;
|
|
|
|
high = tmp_high;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Get the high/low value from the previous element. */
|
|
|
|
struct vrp_element *prev
|
|
|
|
= (struct vrp_element *)VARRAY_GENERIC_PTR (vrp_records,
|
|
|
|
limit - 2);
|
|
|
|
low = prev->low;
|
|
|
|
high = prev->high;
|
|
|
|
|
|
|
|
/* Merge in this element's range with the range from the
|
|
|
|
previous element.
|
|
|
|
|
|
|
|
The low value for the merged range is the maximum of
|
|
|
|
the previous low value and the low value of this record.
|
|
|
|
|
|
|
|
Similarly the high value for the merged range is the
|
|
|
|
minimum of the previous high value and the high value of
|
|
|
|
this record. */
|
|
|
|
low = (tree_int_cst_compare (low, tmp_low) == 1
|
|
|
|
? low : tmp_low);
|
|
|
|
high = (tree_int_cst_compare (high, tmp_high) == -1
|
|
|
|
? high : tmp_high);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* And record the computed range. */
|
|
|
|
element->low = low;
|
|
|
|
element->high = high;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* After we have constrained this variable's potential values,
|
|
|
|
we try to determine the result of the given conditional.
|
|
|
|
|
|
|
|
To simplify later tests, first determine if the current
|
|
|
|
low value is the same low value as the conditional.
|
|
|
|
Similarly for the current high value and the high value
|
|
|
|
for the conditional. */
|
|
|
|
lowequal = tree_int_cst_equal (low, cond_low);
|
|
|
|
highequal = tree_int_cst_equal (high, cond_high);
|
|
|
|
|
|
|
|
if (lowequal && highequal)
|
|
|
|
return (cond_inverted ? boolean_false_node : boolean_true_node);
|
|
|
|
|
|
|
|
/* To simplify the overlap/subset tests below we may want
|
|
|
|
to swap the two ranges so that the larger of the two
|
|
|
|
ranges occurs "first". */
|
|
|
|
swapped = 0;
|
|
|
|
if (tree_int_cst_compare (low, cond_low) == 1
|
|
|
|
|| (lowequal
|
|
|
|
&& tree_int_cst_compare (cond_high, high) == 1))
|
|
|
|
{
|
|
|
|
tree temp;
|
|
|
|
|
|
|
|
swapped = 1;
|
|
|
|
temp = low;
|
|
|
|
low = cond_low;
|
|
|
|
cond_low = temp;
|
|
|
|
temp = high;
|
|
|
|
high = cond_high;
|
|
|
|
cond_high = temp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now determine if there is no overlap in the ranges
|
|
|
|
or if the second range is a subset of the first range. */
|
|
|
|
no_overlap = tree_int_cst_lt (high, cond_low);
|
|
|
|
subset = tree_int_cst_compare (cond_high, high) != 1;
|
|
|
|
|
|
|
|
/* If there was no overlap in the ranges, then this conditional
|
|
|
|
always has a false value (unless we had to invert this
|
|
|
|
conditional, in which case it always has a true value). */
|
|
|
|
if (no_overlap)
|
|
|
|
return (cond_inverted ? boolean_true_node : boolean_false_node);
|
|
|
|
|
|
|
|
/* If the current range is a subset of the condition's range,
|
|
|
|
then this conditional always has a true value (unless we
|
|
|
|
had to invert this conditional, in which case it always
|
|
|
|
has a true value). */
|
|
|
|
if (subset && swapped)
|
|
|
|
return (cond_inverted ? boolean_false_node : boolean_true_node);
|
|
|
|
|
|
|
|
/* We were unable to determine the result of the conditional.
|
|
|
|
However, we may be able to simplify the conditional. First
|
|
|
|
merge the ranges in the same manner as range merging above. */
|
|
|
|
low = tree_int_cst_compare (low, cond_low) == 1 ? low : cond_low;
|
|
|
|
high = tree_int_cst_compare (high, cond_high) == -1 ? high : cond_high;
|
|
|
|
|
|
|
|
/* If the range has converged to a single point, then turn this
|
|
|
|
into an equality comparison. */
|
|
|
|
if (TREE_CODE (cond) != EQ_EXPR
|
|
|
|
&& TREE_CODE (cond) != NE_EXPR
|
|
|
|
&& tree_int_cst_equal (low, high))
|
|
|
|
{
|
|
|
|
TREE_SET_CODE (cond, EQ_EXPR);
|
|
|
|
TREE_OPERAND (cond, 1) = high;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* STMT is a SWITCH_EXPR for which we could not trivially determine its
|
|
|
|
result. This routine attempts to find equivalent forms of the
|
|
|
|
condition which we may be able to optimize better. */
|
|
|
|
|
|
|
|
static tree
|
2004-09-15 06:38:04 +02:00
|
|
|
simplify_switch_and_lookup_avail_expr (tree stmt, int insert)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
|
|
|
tree cond = SWITCH_COND (stmt);
|
|
|
|
tree def, to, ti;
|
|
|
|
|
|
|
|
/* The optimization that we really care about is removing unnecessary
|
|
|
|
casts. That will let us do much better in propagating the inferred
|
|
|
|
constant at the switch target. */
|
|
|
|
if (TREE_CODE (cond) == SSA_NAME)
|
|
|
|
{
|
|
|
|
def = SSA_NAME_DEF_STMT (cond);
|
|
|
|
if (TREE_CODE (def) == MODIFY_EXPR)
|
|
|
|
{
|
|
|
|
def = TREE_OPERAND (def, 1);
|
|
|
|
if (TREE_CODE (def) == NOP_EXPR)
|
|
|
|
{
|
2004-07-08 02:03:08 +02:00
|
|
|
int need_precision;
|
|
|
|
bool fail;
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
def = TREE_OPERAND (def, 0);
|
2004-07-08 02:03:08 +02:00
|
|
|
|
|
|
|
#ifdef ENABLE_CHECKING
|
|
|
|
/* ??? Why was Jeff testing this? We are gimple... */
|
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 (is_gimple_val (def));
|
2004-07-08 02:03:08 +02:00
|
|
|
#endif
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
to = TREE_TYPE (cond);
|
|
|
|
ti = TREE_TYPE (def);
|
|
|
|
|
2004-07-08 02:03:08 +02:00
|
|
|
/* If we have an extension that preserves value, then we
|
2004-05-13 08:41:07 +02:00
|
|
|
can copy the source value into the switch. */
|
2004-07-08 02:03:08 +02:00
|
|
|
|
|
|
|
need_precision = TYPE_PRECISION (ti);
|
|
|
|
fail = false;
|
|
|
|
if (TYPE_UNSIGNED (to) && !TYPE_UNSIGNED (ti))
|
|
|
|
fail = true;
|
|
|
|
else if (!TYPE_UNSIGNED (to) && TYPE_UNSIGNED (ti))
|
|
|
|
need_precision += 1;
|
|
|
|
if (TYPE_PRECISION (to) < need_precision)
|
|
|
|
fail = true;
|
|
|
|
|
|
|
|
if (!fail)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
|
|
|
SWITCH_COND (stmt) = def;
|
2004-08-10 20:31:26 +02:00
|
|
|
modify_stmt (stmt);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2004-09-15 06:38:04 +02:00
|
|
|
return lookup_avail_expr (stmt, insert);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2004-06-29 03:53:04 +02:00
|
|
|
|
|
|
|
/* CONST_AND_COPIES is a table which maps an SSA_NAME to the current
|
|
|
|
known value for that SSA_NAME (or NULL if no value is known).
|
|
|
|
|
|
|
|
NONZERO_VARS is the set SSA_NAMES known to have a nonzero value,
|
|
|
|
even if we don't know their precise value.
|
|
|
|
|
|
|
|
Propagate values from CONST_AND_COPIES and NONZERO_VARS into the PHI
|
|
|
|
nodes of the successors of BB. */
|
|
|
|
|
|
|
|
static void
|
2004-09-21 05:19:00 +02:00
|
|
|
cprop_into_successor_phis (basic_block bb, bitmap nonzero_vars)
|
2004-06-29 03:53:04 +02:00
|
|
|
{
|
|
|
|
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 03:53:04 +02:00
|
|
|
|
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-06-29 03:53:04 +02:00
|
|
|
{
|
|
|
|
tree phi;
|
2004-11-24 16:29:44 +01:00
|
|
|
int indx;
|
2004-06-29 03:53:04 +02:00
|
|
|
|
|
|
|
/* If this is an abnormal edge, then we do not want to copy propagate
|
|
|
|
into the PHI alternative associated with this edge. */
|
|
|
|
if (e->flags & EDGE_ABNORMAL)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
phi = phi_nodes (e->dest);
|
|
|
|
if (! phi)
|
|
|
|
continue;
|
|
|
|
|
2004-11-24 16:29:44 +01:00
|
|
|
indx = e->dest_idx;
|
2004-06-29 03:53:04 +02:00
|
|
|
for ( ; phi; phi = PHI_CHAIN (phi))
|
|
|
|
{
|
|
|
|
tree new;
|
|
|
|
use_operand_p orig_p;
|
|
|
|
tree orig;
|
|
|
|
|
|
|
|
/* The alternative may be associated with a constant, so verify
|
|
|
|
it is an SSA_NAME before doing anything with it. */
|
2004-11-24 16:29:44 +01:00
|
|
|
orig_p = PHI_ARG_DEF_PTR (phi, indx);
|
2004-06-29 03:53:04 +02:00
|
|
|
orig = USE_FROM_PTR (orig_p);
|
|
|
|
if (TREE_CODE (orig) != SSA_NAME)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* If the alternative is known to have a nonzero value, record
|
|
|
|
that fact in the PHI node itself for future use. */
|
|
|
|
if (bitmap_bit_p (nonzero_vars, SSA_NAME_VERSION (orig)))
|
2004-11-24 16:29:44 +01:00
|
|
|
PHI_ARG_NONZERO (phi, indx) = true;
|
2004-06-29 03:53:04 +02:00
|
|
|
|
|
|
|
/* If we have *ORIG_P in our constant/copy table, then replace
|
|
|
|
ORIG_P with its value in our constant/copy table. */
|
2004-09-23 22:15:30 +02:00
|
|
|
new = SSA_NAME_VALUE (orig);
|
2004-06-29 03:53:04 +02:00
|
|
|
if (new
|
|
|
|
&& (TREE_CODE (new) == SSA_NAME
|
|
|
|
|| is_gimple_min_invariant (new))
|
|
|
|
&& may_propagate_copy (orig, new))
|
|
|
|
{
|
|
|
|
propagate_value (orig_p, new);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-10-30 02:06:22 +02:00
|
|
|
/* We have finished optimizing BB, record any information implied by
|
|
|
|
taking a specific outgoing edge from BB. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
record_edge_info (basic_block bb)
|
|
|
|
{
|
|
|
|
block_stmt_iterator bsi = bsi_last (bb);
|
|
|
|
struct edge_info *edge_info;
|
|
|
|
|
|
|
|
if (! bsi_end_p (bsi))
|
|
|
|
{
|
|
|
|
tree stmt = bsi_stmt (bsi);
|
|
|
|
|
|
|
|
if (stmt && TREE_CODE (stmt) == SWITCH_EXPR)
|
|
|
|
{
|
|
|
|
tree cond = SWITCH_COND (stmt);
|
|
|
|
|
|
|
|
if (TREE_CODE (cond) == SSA_NAME)
|
|
|
|
{
|
|
|
|
tree labels = SWITCH_LABELS (stmt);
|
|
|
|
int i, n_labels = TREE_VEC_LENGTH (labels);
|
|
|
|
tree *info = xcalloc (n_basic_blocks, sizeof (tree));
|
|
|
|
edge e;
|
|
|
|
edge_iterator ei;
|
|
|
|
|
|
|
|
for (i = 0; i < n_labels; i++)
|
|
|
|
{
|
|
|
|
tree label = TREE_VEC_ELT (labels, i);
|
|
|
|
basic_block target_bb = label_to_block (CASE_LABEL (label));
|
|
|
|
|
|
|
|
if (CASE_HIGH (label)
|
|
|
|
|| !CASE_LOW (label)
|
|
|
|
|| info[target_bb->index])
|
|
|
|
info[target_bb->index] = error_mark_node;
|
|
|
|
else
|
|
|
|
info[target_bb->index] = label;
|
|
|
|
}
|
|
|
|
|
|
|
|
FOR_EACH_EDGE (e, ei, bb->succs)
|
|
|
|
{
|
|
|
|
basic_block target_bb = e->dest;
|
|
|
|
tree node = info[target_bb->index];
|
2004-06-29 03:53:04 +02:00
|
|
|
|
2004-10-30 02:06:22 +02:00
|
|
|
if (node != NULL && node != error_mark_node)
|
|
|
|
{
|
|
|
|
tree x = fold_convert (TREE_TYPE (cond), CASE_LOW (node));
|
|
|
|
edge_info = allocate_edge_info (e);
|
|
|
|
edge_info->lhs = cond;
|
|
|
|
edge_info->rhs = x;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free (info);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* A COND_EXPR may create equivalences too. */
|
|
|
|
if (stmt && TREE_CODE (stmt) == COND_EXPR)
|
|
|
|
{
|
|
|
|
tree cond = COND_EXPR_COND (stmt);
|
|
|
|
edge true_edge;
|
|
|
|
edge false_edge;
|
|
|
|
|
|
|
|
extract_true_false_edges_from_block (bb, &true_edge, &false_edge);
|
|
|
|
|
2004-10-30 14:15:09 +02:00
|
|
|
/* If the conditional is a single variable 'X', record 'X = 1'
|
2004-10-30 02:06:22 +02:00
|
|
|
for the true edge and 'X = 0' on the false edge. */
|
|
|
|
if (SSA_VAR_P (cond))
|
|
|
|
{
|
|
|
|
struct edge_info *edge_info;
|
|
|
|
|
|
|
|
edge_info = allocate_edge_info (true_edge);
|
|
|
|
edge_info->lhs = cond;
|
|
|
|
edge_info->rhs = constant_boolean_node (1, TREE_TYPE (cond));
|
|
|
|
|
|
|
|
edge_info = allocate_edge_info (false_edge);
|
|
|
|
edge_info->lhs = cond;
|
|
|
|
edge_info->rhs = constant_boolean_node (0, TREE_TYPE (cond));
|
|
|
|
}
|
|
|
|
/* Equality tests may create one or two equivalences. */
|
|
|
|
else if (COMPARISON_CLASS_P (cond))
|
|
|
|
{
|
|
|
|
tree op0 = TREE_OPERAND (cond, 0);
|
|
|
|
tree op1 = TREE_OPERAND (cond, 1);
|
|
|
|
|
|
|
|
/* Special case comparing booleans against a constant as we
|
|
|
|
know the value of OP0 on both arms of the branch. i.e., we
|
|
|
|
can record an equivalence for OP0 rather than COND. */
|
|
|
|
if ((TREE_CODE (cond) == EQ_EXPR || TREE_CODE (cond) == NE_EXPR)
|
|
|
|
&& TREE_CODE (op0) == SSA_NAME
|
|
|
|
&& TREE_CODE (TREE_TYPE (op0)) == BOOLEAN_TYPE
|
|
|
|
&& is_gimple_min_invariant (op1))
|
|
|
|
{
|
|
|
|
if (TREE_CODE (cond) == EQ_EXPR)
|
|
|
|
{
|
|
|
|
edge_info = allocate_edge_info (true_edge);
|
|
|
|
edge_info->lhs = op0;
|
|
|
|
edge_info->rhs = (integer_zerop (op1)
|
|
|
|
? boolean_false_node
|
|
|
|
: boolean_true_node);
|
|
|
|
|
|
|
|
edge_info = allocate_edge_info (false_edge);
|
|
|
|
edge_info->lhs = op0;
|
|
|
|
edge_info->rhs = (integer_zerop (op1)
|
|
|
|
? boolean_true_node
|
|
|
|
: boolean_false_node);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
edge_info = allocate_edge_info (true_edge);
|
|
|
|
edge_info->lhs = op0;
|
|
|
|
edge_info->rhs = (integer_zerop (op1)
|
|
|
|
? boolean_true_node
|
|
|
|
: boolean_false_node);
|
|
|
|
|
|
|
|
edge_info = allocate_edge_info (false_edge);
|
|
|
|
edge_info->lhs = op0;
|
|
|
|
edge_info->rhs = (integer_zerop (op1)
|
|
|
|
? boolean_false_node
|
|
|
|
: boolean_true_node);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-12-13 19:10:52 +01:00
|
|
|
else if (is_gimple_min_invariant (op0)
|
|
|
|
&& (TREE_CODE (op1) == SSA_NAME
|
|
|
|
|| is_gimple_min_invariant (op1)))
|
2004-10-30 02:06:22 +02:00
|
|
|
{
|
|
|
|
tree inverted = invert_truthvalue (cond);
|
|
|
|
struct edge_info *edge_info;
|
|
|
|
|
|
|
|
edge_info = allocate_edge_info (true_edge);
|
|
|
|
record_conditions (edge_info, cond, inverted);
|
|
|
|
|
|
|
|
if (TREE_CODE (cond) == EQ_EXPR)
|
|
|
|
{
|
|
|
|
edge_info->lhs = op1;
|
|
|
|
edge_info->rhs = op0;
|
|
|
|
}
|
|
|
|
|
|
|
|
edge_info = allocate_edge_info (false_edge);
|
|
|
|
record_conditions (edge_info, inverted, cond);
|
|
|
|
|
|
|
|
if (TREE_CODE (cond) == NE_EXPR)
|
|
|
|
{
|
|
|
|
edge_info->lhs = op1;
|
|
|
|
edge_info->rhs = op0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-12-13 19:10:52 +01:00
|
|
|
else if (TREE_CODE (op0) == SSA_NAME
|
|
|
|
&& (is_gimple_min_invariant (op1)
|
|
|
|
|| TREE_CODE (op1) == SSA_NAME))
|
2004-10-30 02:06:22 +02:00
|
|
|
{
|
|
|
|
tree inverted = invert_truthvalue (cond);
|
|
|
|
struct edge_info *edge_info;
|
|
|
|
|
|
|
|
edge_info = allocate_edge_info (true_edge);
|
|
|
|
record_conditions (edge_info, cond, inverted);
|
|
|
|
|
|
|
|
if (TREE_CODE (cond) == EQ_EXPR)
|
|
|
|
{
|
|
|
|
edge_info->lhs = op0;
|
|
|
|
edge_info->rhs = op1;
|
|
|
|
}
|
|
|
|
|
|
|
|
edge_info = allocate_edge_info (false_edge);
|
|
|
|
record_conditions (edge_info, inverted, cond);
|
|
|
|
|
|
|
|
if (TREE_CODE (cond) == NE_EXPR)
|
|
|
|
{
|
|
|
|
edge_info->lhs = op0;
|
|
|
|
edge_info->rhs = op1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ??? TRUTH_NOT_EXPR can create an equivalence too. */
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Propagate information from BB to its outgoing edges.
|
|
|
|
|
|
|
|
This can include equivalency information implied by control statements
|
|
|
|
at the end of BB and const/copy propagation into PHIs in BB's
|
|
|
|
successor blocks. */
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
static void
|
2004-10-30 02:06:22 +02:00
|
|
|
propagate_to_outgoing_edges (struct dom_walk_data *walk_data ATTRIBUTE_UNUSED,
|
|
|
|
basic_block bb)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
2004-10-30 02:06:22 +02:00
|
|
|
|
|
|
|
record_edge_info (bb);
|
2004-09-21 05:19:00 +02:00
|
|
|
cprop_into_successor_phis (bb, nonzero_vars);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Search for redundant computations in STMT. If any are found, then
|
|
|
|
replace them with the variable holding the result of the computation.
|
|
|
|
|
|
|
|
If safe, record this expression into the available expression hash
|
|
|
|
table. */
|
|
|
|
|
|
|
|
static bool
|
|
|
|
eliminate_redundant_computations (struct dom_walk_data *walk_data,
|
|
|
|
tree stmt, stmt_ann_t ann)
|
|
|
|
{
|
2004-06-10 23:41:08 +02:00
|
|
|
v_may_def_optype v_may_defs = V_MAY_DEF_OPS (ann);
|
2004-05-13 08:41:07 +02:00
|
|
|
tree *expr_p, def = NULL_TREE;
|
|
|
|
bool insert = true;
|
|
|
|
tree cached_lhs;
|
|
|
|
bool retval = false;
|
|
|
|
|
|
|
|
if (TREE_CODE (stmt) == MODIFY_EXPR)
|
|
|
|
def = TREE_OPERAND (stmt, 0);
|
|
|
|
|
|
|
|
/* Certain expressions on the RHS can be optimized away, but can not
|
alias.c, [...]: Fix comment formatting.
* alias.c, basic-block.h, cgraphunit.c, combine.c, domwalk.h,
final.c, gengtype.c, genpreds.c, ggc-page.c, insn-notes.def,
lambda-code.c, loop-unroll.c, modulo-sched.c, pointer-set.c,
pretty-print.c, ra-colorize.c, sbitmap.c, tree-complex.c,
tree-data-ref.c, tree-dfa.c, tree-inline.c, tree-into-ssa.c,
tree-scalar-evolution.c, tree-ssa-dom.c,
tree-ssa-loop-manip.c, tree-ssa-loop-niter.c,
tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-threadupdate.c,
tree-vectorizer.c, vec.h: Fix comment formatting.
From-SVN: r89453
2004-10-22 19:05:11 +02:00
|
|
|
themselves be entered into the hash tables. */
|
2004-05-13 08:41:07 +02:00
|
|
|
if (ann->makes_aliased_stores
|
|
|
|
|| ! def
|
|
|
|
|| TREE_CODE (def) != SSA_NAME
|
|
|
|
|| SSA_NAME_OCCURS_IN_ABNORMAL_PHI (def)
|
2005-02-26 08:55:28 +01:00
|
|
|
|| NUM_V_MAY_DEFS (v_may_defs) != 0
|
|
|
|
/* Do not record equivalences for increments of ivs. This would create
|
|
|
|
overlapping live ranges for a very questionable gain. */
|
|
|
|
|| simple_iv_increment_p (stmt))
|
2004-05-13 08:41:07 +02:00
|
|
|
insert = false;
|
|
|
|
|
|
|
|
/* Check if the expression has been computed before. */
|
2004-09-15 06:38:04 +02:00
|
|
|
cached_lhs = lookup_avail_expr (stmt, insert);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* If this is an assignment and the RHS was not in the hash table,
|
|
|
|
then try to simplify the RHS and lookup the new RHS in the
|
|
|
|
hash table. */
|
|
|
|
if (! cached_lhs && TREE_CODE (stmt) == MODIFY_EXPR)
|
2004-09-15 06:38:04 +02:00
|
|
|
cached_lhs = simplify_rhs_and_lookup_avail_expr (walk_data, stmt, insert);
|
2004-05-13 08:41:07 +02:00
|
|
|
/* Similarly if this is a COND_EXPR and we did not find its
|
|
|
|
expression in the hash table, simplify the condition and
|
|
|
|
try again. */
|
|
|
|
else if (! cached_lhs && TREE_CODE (stmt) == COND_EXPR)
|
2004-09-15 06:38:04 +02:00
|
|
|
cached_lhs = simplify_cond_and_lookup_avail_expr (stmt, ann, insert);
|
2004-05-13 08:41:07 +02:00
|
|
|
/* Similarly for a SWITCH_EXPR. */
|
|
|
|
else if (!cached_lhs && TREE_CODE (stmt) == SWITCH_EXPR)
|
2004-09-15 06:38:04 +02:00
|
|
|
cached_lhs = simplify_switch_and_lookup_avail_expr (stmt, insert);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
opt_stats.num_exprs_considered++;
|
|
|
|
|
|
|
|
/* Get a pointer to the expression we are trying to optimize. */
|
|
|
|
if (TREE_CODE (stmt) == COND_EXPR)
|
|
|
|
expr_p = &COND_EXPR_COND (stmt);
|
|
|
|
else if (TREE_CODE (stmt) == SWITCH_EXPR)
|
|
|
|
expr_p = &SWITCH_COND (stmt);
|
|
|
|
else if (TREE_CODE (stmt) == RETURN_EXPR && TREE_OPERAND (stmt, 0))
|
|
|
|
expr_p = &TREE_OPERAND (TREE_OPERAND (stmt, 0), 1);
|
|
|
|
else
|
|
|
|
expr_p = &TREE_OPERAND (stmt, 1);
|
|
|
|
|
|
|
|
/* It is safe to ignore types here since we have already done
|
|
|
|
type checking in the hashing and equality routines. In fact
|
|
|
|
type checking here merely gets in the way of constant
|
|
|
|
propagation. Also, make sure that it is safe to propagate
|
|
|
|
CACHED_LHS into *EXPR_P. */
|
|
|
|
if (cached_lhs
|
|
|
|
&& (TREE_CODE (cached_lhs) != SSA_NAME
|
2004-06-29 03:53:04 +02:00
|
|
|
|| may_propagate_copy (*expr_p, cached_lhs)))
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, " Replaced redundant expr '");
|
|
|
|
print_generic_expr (dump_file, *expr_p, dump_flags);
|
|
|
|
fprintf (dump_file, "' with '");
|
|
|
|
print_generic_expr (dump_file, cached_lhs, dump_flags);
|
|
|
|
fprintf (dump_file, "'\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
opt_stats.num_re++;
|
|
|
|
|
|
|
|
#if defined ENABLE_CHECKING
|
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 (cached_lhs) == SSA_NAME
|
|
|
|
|| is_gimple_min_invariant (cached_lhs));
|
2004-05-13 08:41:07 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
if (TREE_CODE (cached_lhs) == ADDR_EXPR
|
|
|
|
|| (POINTER_TYPE_P (TREE_TYPE (*expr_p))
|
|
|
|
&& is_gimple_min_invariant (cached_lhs)))
|
|
|
|
retval = true;
|
|
|
|
|
tree-cfg.c (tree_make_forwarder_block): Use SET_PHI_RESULT.
2004-06-16 Andrew MacLeod <amacleod@redhat.com>
* tree-cfg.c (tree_make_forwarder_block): Use SET_PHI_RESULT.
* tree-flow-inline.h (get_use_op_ptr): Return a use_operand_p.
(get_use_from_ptr, get_def_from_ptr): New. Return operand pointers.
(get_def_op_ptr): Return a def_operand_p instead of a 'tree *'.
(get_v_may_def_result_ptr): Return a def_operand_p.
(get_v_may_def_op_ptr, get_vuse_op_ptr): Return a use_operand_p.
(get_v_must_def_op_ptr): Return a def_operand_p.
(get_phi_result_ptr): New. Return a pointer to the result of a PHI.
(get_phi_arg_def_ptr): New. Return a pointer to an argument of a PHI.
(phi_element_for_edge): Remove.
* tree-flow.h (propagate_value, replace_exp): Change prototype.
(propagate_tree_value): Add new prototype.
(phi_element_for_edge): Remove prototype.
* tree-into-ssa.c (mark_def_sites): Use new operand types.
(prepare_operand_for_rename): Split into two functions.
(prepare_use_operand_for_rename): Prepare use operands.
(prepare_def_operand_for_rename): Prepare def operands.
(rewrite_stmt): Use new operand types.
(rewrite_operand): Use new operand types, change parameter type.
* tree-outof-ssa.c (replace_variable): Split into two functions.
(replace_use_variable): Rewrite uses.
(replace_def_variable): Rewrite defs.
(rewrite_trees, rewrite_vars_out_of_ssa): Use new operand types.
* tree-phinodes.c (make_phi_node, resize_phi_node): Use new types.
(add_phi_arg, remove_phi_arg_num): Use new operand types.
* tree-ssa-ccp.c (substitute_and_fold): Use new operand types.
(ccp_fold, replace_uses_in): Use new operand types.
* tree-ssa-copy.c (replace_ssa_names): Rename to replace_ssa_names_ann
and no longer set the value, change parameter type.
(replace_exp_1): Use new operand types.
(propagate_value): Change parameter type, use new operand types.
(propagate_tree_value): Propagate_value without SSA operands.
(replace_exp, cprop_operand, cprop_into_stmt): Use new operand types.
(cprop_into_successor_phis): Use new operand types.
* tree-ssa-dom.c (thread_across_edge): Use new operand types.
(eliminate_redundant_computations): Use new operand types.
* tree-ssa-dse.c (fix_phi_uses): Use new operand_types.
(fix_stmt_v_may_defs): Use new operand_types.
* tree-ssa-live.c (create_ssa_var_map): Use new operand_types.
(build_tree_conflict_graph): Use new operand_types.
* tree-ssa-loop.c (duplicate_blocks): Use PHI_ARG_DEF_FROM_EDGE.
* tree-ssa-operands.c (struct freelist_d): Remove.
(check_optype_freelist, add_optype_freelist): Remove.
(allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype,
allocate_vuse_optype, allocate_v_must_def_optype): Call ggc_alloc.
(free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs):
Call ggc_free instead of add_optype_freelist.
(init_ssa_operands, fini_ssa_operands): Remove free list code.
(finalize_ssa_defs, finalize_ssa_uses): Set new use/def operands.
* tree-ssa-operands.h (struct def_optype_d): Change underlying type.
(struct use_optype_d): Change underlying type.
(def_operand_p, use_operand_p): New types for pointers to operands.
(USE_OP, DEF_OP, V_MAY_DEF_RESULT, V_MAY_DEF_OP, VUSE_OP,
V_MUST_DEF_OP): Use new pointer type instead of dereferencing directly.
(USE_FROM_PTR, DEF_FROM_PTR): New macros to "dereference" operand
pointer types.
(SET_USE, SET_DEF): New macros to set operands from their pointer.
(SET_USE_OP, SET_DEF_OP, SET_V_MAY_DEF_RESULT, SET_V_MAY_DEF_OP,
SET_VUSE_OP, SET_V_MUST_DEF_OP): New SET routines for operands.
(PHI_RESULT_PTR, PHI_RESULT, SET_PHI_RESULT): Macros to manage the
PHI result as an operand.
(PHI_ARG_DEF_PTR, PHI_ARG_DEF, SET_PHI_ARG_DEF, PHI_ARG_DEF_FROM_EDGE,
PHI_ARG_DEF_PTR_FROM_EDGE): Macros to manage the PHI arguments.
* tree-ssa-pre.c (eliminate): Call propagate_tree_value.
* tree-tailcall.c (independent_of_stmt_p, propagate_through_phis): Use
PHI_ARG_DEF_FROM_EDGE.
* tree.h (PHI_RESULT): Renamed to PHI_RESULT_TREE.
(PHI_ARG_DEF): Renamed to PHI_ARG_DEF_TREE.
From-SVN: r83298
2004-06-17 20:13:20 +02:00
|
|
|
propagate_tree_value (expr_p, cached_lhs);
|
2004-08-10 20:31:26 +02:00
|
|
|
modify_stmt (stmt);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* STMT, a MODIFY_EXPR, may create certain equivalences, in either
|
|
|
|
the available expressions table or the const_and_copies table.
|
|
|
|
Detect and record those equivalences. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
record_equivalences_from_stmt (tree stmt,
|
|
|
|
int may_optimize_p,
|
|
|
|
stmt_ann_t ann)
|
|
|
|
{
|
|
|
|
tree lhs = TREE_OPERAND (stmt, 0);
|
|
|
|
enum tree_code lhs_code = TREE_CODE (lhs);
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (lhs_code == SSA_NAME)
|
|
|
|
{
|
|
|
|
tree rhs = TREE_OPERAND (stmt, 1);
|
|
|
|
|
|
|
|
/* Strip away any useless type conversions. */
|
|
|
|
STRIP_USELESS_TYPE_CONVERSION (rhs);
|
|
|
|
|
|
|
|
/* If the RHS of the assignment is a constant or another variable that
|
|
|
|
may be propagated, register it in the CONST_AND_COPIES table. We
|
|
|
|
do not need to record unwind data for this, since this is a true
|
c-common.c, [...]: Fix comment typos.
* c-common.c, calls.c, cfgcleanup.c, cgraph.c, cgraphunit.c,
ddg.c, ddg.h, df.c, df.h, except.c, expr.c, flags.h,
fold-const.c, gcc.c, gimplify.c, haifa-sched.c,
modulo-sched.c, tree-inline.c, tree-into-ssa.c, tree-nested.c,
tree-nrv.c, tree-ssa-ccp.c, tree-ssa-dom.c, tree-ssa-live.c,
tree-ssa-loop.c, tree-ssa-pre.c, tree-tailcall.c, tree.h: Fix
comment typos. Follow spelling conventions.
From-SVN: r82439
2004-05-30 09:12:58 +02:00
|
|
|
assignment and not an equivalence inferred from a comparison. All
|
2004-05-13 08:41:07 +02:00
|
|
|
uses of this ssa name are dominated by this assignment, so unwinding
|
|
|
|
just costs time and space. */
|
|
|
|
if (may_optimize_p
|
|
|
|
&& (TREE_CODE (rhs) == SSA_NAME
|
|
|
|
|| is_gimple_min_invariant (rhs)))
|
2004-09-23 22:15:30 +02:00
|
|
|
SSA_NAME_VALUE (lhs) = rhs;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* alloca never returns zero and the address of a non-weak symbol
|
|
|
|
is never zero. NOP_EXPRs and CONVERT_EXPRs can be completely
|
|
|
|
stripped as they do not affect this equivalence. */
|
|
|
|
while (TREE_CODE (rhs) == NOP_EXPR
|
|
|
|
|| TREE_CODE (rhs) == CONVERT_EXPR)
|
|
|
|
rhs = TREE_OPERAND (rhs, 0);
|
|
|
|
|
|
|
|
if (alloca_call_p (rhs)
|
|
|
|
|| (TREE_CODE (rhs) == ADDR_EXPR
|
|
|
|
&& DECL_P (TREE_OPERAND (rhs, 0))
|
|
|
|
&& ! DECL_WEAK (TREE_OPERAND (rhs, 0))))
|
2004-09-19 04:51:15 +02:00
|
|
|
record_var_is_nonzero (lhs);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* IOR of any value with a nonzero value will result in a nonzero
|
|
|
|
value. Even if we do not know the exact result recording that
|
|
|
|
the result is nonzero is worth the effort. */
|
|
|
|
if (TREE_CODE (rhs) == BIT_IOR_EXPR
|
|
|
|
&& integer_nonzerop (TREE_OPERAND (rhs, 1)))
|
2004-09-19 04:51:15 +02:00
|
|
|
record_var_is_nonzero (lhs);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Look at both sides for pointer dereferences. If we find one, then
|
|
|
|
the pointer must be nonnull and we can enter that equivalence into
|
|
|
|
the hash tables. */
|
2004-05-18 04:53:55 +02:00
|
|
|
if (flag_delete_null_pointer_checks)
|
|
|
|
for (i = 0; i < 2; i++)
|
|
|
|
{
|
|
|
|
tree t = TREE_OPERAND (stmt, i);
|
|
|
|
|
|
|
|
/* Strip away any COMPONENT_REFs. */
|
|
|
|
while (TREE_CODE (t) == COMPONENT_REF)
|
|
|
|
t = TREE_OPERAND (t, 0);
|
|
|
|
|
|
|
|
/* Now see if this is a pointer dereference. */
|
2004-09-30 01:08:32 +02:00
|
|
|
if (INDIRECT_REF_P (t))
|
2004-05-18 04:53:55 +02:00
|
|
|
{
|
|
|
|
tree op = TREE_OPERAND (t, 0);
|
|
|
|
|
|
|
|
/* If the pointer is a SSA variable, then enter new
|
|
|
|
equivalences into the hash table. */
|
|
|
|
while (TREE_CODE (op) == SSA_NAME)
|
|
|
|
{
|
|
|
|
tree def = SSA_NAME_DEF_STMT (op);
|
|
|
|
|
2004-09-19 04:51:15 +02:00
|
|
|
record_var_is_nonzero (op);
|
2004-05-18 04:53:55 +02:00
|
|
|
|
|
|
|
/* And walk up the USE-DEF chains noting other SSA_NAMEs
|
|
|
|
which are known to have a nonzero value. */
|
|
|
|
if (def
|
|
|
|
&& TREE_CODE (def) == MODIFY_EXPR
|
|
|
|
&& TREE_CODE (TREE_OPERAND (def, 1)) == NOP_EXPR)
|
|
|
|
op = TREE_OPERAND (TREE_OPERAND (def, 1), 0);
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* A memory store, even an aliased store, creates a useful
|
|
|
|
equivalence. By exchanging the LHS and RHS, creating suitable
|
|
|
|
vops and recording the result in the available expression table,
|
|
|
|
we may be able to expose more redundant loads. */
|
|
|
|
if (!ann->has_volatile_ops
|
|
|
|
&& (TREE_CODE (TREE_OPERAND (stmt, 1)) == SSA_NAME
|
|
|
|
|| is_gimple_min_invariant (TREE_OPERAND (stmt, 1)))
|
|
|
|
&& !is_gimple_reg (lhs))
|
|
|
|
{
|
|
|
|
tree rhs = TREE_OPERAND (stmt, 1);
|
|
|
|
tree new;
|
|
|
|
|
|
|
|
/* FIXME: If the LHS of the assignment is a bitfield and the RHS
|
|
|
|
is a constant, we need to adjust the constant to fit into the
|
|
|
|
type of the LHS. If the LHS is a bitfield and the RHS is not
|
|
|
|
a constant, then we can not record any equivalences for this
|
|
|
|
statement since we would need to represent the widening or
|
|
|
|
narrowing of RHS. This fixes gcc.c-torture/execute/921016-1.c
|
|
|
|
and should not be necessary if GCC represented bitfields
|
|
|
|
properly. */
|
|
|
|
if (lhs_code == COMPONENT_REF
|
|
|
|
&& DECL_BIT_FIELD (TREE_OPERAND (lhs, 1)))
|
|
|
|
{
|
|
|
|
if (TREE_CONSTANT (rhs))
|
|
|
|
rhs = widen_bitfield (rhs, TREE_OPERAND (lhs, 1), lhs);
|
|
|
|
else
|
|
|
|
rhs = NULL;
|
|
|
|
|
|
|
|
/* If the value overflowed, then we can not use this equivalence. */
|
|
|
|
if (rhs && ! is_gimple_min_invariant (rhs))
|
|
|
|
rhs = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (rhs)
|
|
|
|
{
|
|
|
|
/* Build a new statement with the RHS and LHS exchanged. */
|
|
|
|
new = build (MODIFY_EXPR, TREE_TYPE (stmt), rhs, lhs);
|
|
|
|
|
tree-flow-inline.h (get_def_ops, [...]): Add operand structure reference.
2004-08-11 Andrew MacLeod <amacleod@redhat.com>
* tree-flow-inline.h (get_def_ops, get_use_ops, get_v_may_def_ops,
get_vuse_ops,get_v_must_def_ops): Add operand structure reference.
(get_v_may_def_result_ptr, get_v_may_def_op_ptr): New access struct.
(start_ssa_stmt_operands): Delete.
* tree-flow.h (struct stmt_ann_d): Replace operand vectors with new
struct stmt_operands_d.
(build_ssa_operands): New extern entry point.
* tree-ssa-dom.c (record_equivalences_from_stmt): Remove operand
building code, replace with create_ssa_artficial_load_stmt().
* tree-ssa-operands.c (struct voperands_d): Delete.
(allocate_v_may_def_optype): Allocate v_may_def_operand_type_t vector.
(allocate_v_must_def_optype): Use sizeof (tree), not sizeof (tree *).
(free_uses, free_defs, free_vuses, free_v_may_defs,
free_v_must_defs): Remove dealloc parameter.
(remove_vuses, remove_v_may_def, remove_v_must_defs): Delete.
(finalize_ssa_defs, finalize_ssa_uses, finalize_ssa_v_may_defs,
finalize_ssa_vuses, finalize_ssa_v_must_defs): Perform all operand
vector comparisons, ssa_name reuse, and allocations here.
(verify_start_operands): Delete.
(finalize_ssa_stmt_operands): Set new operands by calling finalize
routines.
(start_ssa_stmt_operands): Move from tree-flow-inline.h.
(append_def, append_usei): Simplify to simple accumulation.
(append_v_may_def, append_vuse, append_v_must_def): Simplify to avoiding
duplicates and simple accumulation.
(free_ssa_operands): Free vectors in a stmt_operand structure.
(build_ssa_operands): New. Create a new stmt_operand structure from
a stmt and an old set of stmt_operands.
(get_stmt_operands): Simplify and call build_ssa_operands.
(get_expr_operands, get_asm_expr_operands, get_indirect_ref_operands,
get_call_expr_operands, add_stmt_operand, add_call_clobber_ops,
add_call_read_ops): Don't pass prev_vops around anymore.
(note_addressable): Return if no stmt annotation.
(copy_virtual_operands): Access v_may_def operands through a struct.
(create_ssa_artficial_load_stmt): New. Create a load stmt for DOM's
hash tables without treating the stmt as a real stmt.
* tree-ssa-operands.h (struct v_may_def_operand_type): New. Access
v_may_def def and use through a struct instead of 2 array elements.
(struct v_may_def_optype_d): Use v_may_def_operand_type.
(struct stmt_operands_d): New. Struct for storing all operand vectors.
From-SVN: r85807
2004-08-11 19:50:47 +02:00
|
|
|
create_ssa_artficial_load_stmt (&(ann->operands), new);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* Finally enter the statement into the available expression
|
|
|
|
table. */
|
2004-09-15 06:38:04 +02:00
|
|
|
lookup_avail_expr (new, true);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-06-29 03:53:04 +02:00
|
|
|
/* Replace *OP_P in STMT with any known equivalent value for *OP_P from
|
|
|
|
CONST_AND_COPIES. */
|
|
|
|
|
|
|
|
static bool
|
2004-09-21 05:19:00 +02:00
|
|
|
cprop_operand (tree stmt, use_operand_p op_p)
|
2004-06-29 03:53:04 +02:00
|
|
|
{
|
|
|
|
bool may_have_exposed_new_symbols = false;
|
|
|
|
tree val;
|
|
|
|
tree op = USE_FROM_PTR (op_p);
|
|
|
|
|
|
|
|
/* If the operand has a known constant value or it is known to be a
|
|
|
|
copy of some other variable, use the value or copy stored in
|
|
|
|
CONST_AND_COPIES. */
|
2004-09-23 22:15:30 +02:00
|
|
|
val = SSA_NAME_VALUE (op);
|
|
|
|
if (val && TREE_CODE (val) != VALUE_HANDLE)
|
2004-06-29 03:53:04 +02:00
|
|
|
{
|
|
|
|
tree op_type, val_type;
|
|
|
|
|
|
|
|
/* Do not change the base variable in the virtual operand
|
|
|
|
tables. That would make it impossible to reconstruct
|
|
|
|
the renamed virtual operand if we later modify this
|
|
|
|
statement. Also only allow the new value to be an SSA_NAME
|
|
|
|
for propagation into virtual operands. */
|
|
|
|
if (!is_gimple_reg (op)
|
|
|
|
&& (get_virtual_var (val) != get_virtual_var (op)
|
|
|
|
|| TREE_CODE (val) != SSA_NAME))
|
|
|
|
return false;
|
|
|
|
|
2004-09-29 04:50:47 +02:00
|
|
|
/* Do not replace hard register operands in asm statements. */
|
|
|
|
if (TREE_CODE (stmt) == ASM_EXPR
|
|
|
|
&& !may_propagate_copy_into_asm (op))
|
|
|
|
return false;
|
|
|
|
|
2004-06-29 03:53:04 +02:00
|
|
|
/* Get the toplevel type of each operand. */
|
|
|
|
op_type = TREE_TYPE (op);
|
|
|
|
val_type = TREE_TYPE (val);
|
|
|
|
|
|
|
|
/* While both types are pointers, get the type of the object
|
|
|
|
pointed to. */
|
|
|
|
while (POINTER_TYPE_P (op_type) && POINTER_TYPE_P (val_type))
|
|
|
|
{
|
|
|
|
op_type = TREE_TYPE (op_type);
|
|
|
|
val_type = TREE_TYPE (val_type);
|
|
|
|
}
|
|
|
|
|
2004-07-07 22:16:00 +02:00
|
|
|
/* Make sure underlying types match before propagating a constant by
|
|
|
|
converting the constant to the proper type. Note that convert may
|
|
|
|
return a non-gimple expression, in which case we ignore this
|
|
|
|
propagation opportunity. */
|
|
|
|
if (TREE_CODE (val) != SSA_NAME)
|
2004-06-29 03:53:04 +02:00
|
|
|
{
|
2004-07-07 22:16:00 +02:00
|
|
|
if (!lang_hooks.types_compatible_p (op_type, val_type))
|
|
|
|
{
|
|
|
|
val = fold_convert (TREE_TYPE (op), val);
|
|
|
|
if (!is_gimple_min_invariant (val))
|
|
|
|
return false;
|
|
|
|
}
|
2004-06-29 03:53:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Certain operands are not allowed to be copy propagated due
|
|
|
|
to their interaction with exception handling and some GCC
|
|
|
|
extensions. */
|
2004-07-07 22:16:00 +02:00
|
|
|
else if (!may_propagate_copy (op, val))
|
2004-06-29 03:53:04 +02:00
|
|
|
return false;
|
2005-01-22 17:48:23 +01:00
|
|
|
|
|
|
|
/* Do not propagate copies if the propagated value is at a deeper loop
|
|
|
|
depth than the propagatee. Otherwise, this may move loop variant
|
|
|
|
variables outside of their loops and prevent coalescing
|
|
|
|
opportunities. If the value was loop invariant, it will be hoisted
|
|
|
|
by LICM and exposed for copy propagation. */
|
|
|
|
if (loop_depth_of_name (val) > loop_depth_of_name (op))
|
|
|
|
return false;
|
2004-06-29 03:53:04 +02:00
|
|
|
|
|
|
|
/* Dump details. */
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, " Replaced '");
|
|
|
|
print_generic_expr (dump_file, op, dump_flags);
|
|
|
|
fprintf (dump_file, "' with %s '",
|
|
|
|
(TREE_CODE (val) != SSA_NAME ? "constant" : "variable"));
|
|
|
|
print_generic_expr (dump_file, val, dump_flags);
|
|
|
|
fprintf (dump_file, "'\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If VAL is an ADDR_EXPR or a constant of pointer type, note
|
|
|
|
that we may have exposed a new symbol for SSA renaming. */
|
|
|
|
if (TREE_CODE (val) == ADDR_EXPR
|
|
|
|
|| (POINTER_TYPE_P (TREE_TYPE (op))
|
|
|
|
&& is_gimple_min_invariant (val)))
|
|
|
|
may_have_exposed_new_symbols = true;
|
|
|
|
|
|
|
|
propagate_value (op_p, val);
|
|
|
|
|
|
|
|
/* And note that we modified this statement. This is now
|
|
|
|
safe, even if we changed virtual operands since we will
|
|
|
|
rescan the statement and rewrite its operands again. */
|
2004-08-10 20:31:26 +02:00
|
|
|
modify_stmt (stmt);
|
2004-06-29 03:53:04 +02:00
|
|
|
}
|
|
|
|
return may_have_exposed_new_symbols;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* CONST_AND_COPIES is a table which maps an SSA_NAME to the current
|
|
|
|
known value for that SSA_NAME (or NULL if no value is known).
|
|
|
|
|
|
|
|
Propagate values from CONST_AND_COPIES into the uses, vuses and
|
|
|
|
v_may_def_ops of STMT. */
|
|
|
|
|
|
|
|
static bool
|
2004-09-21 05:19:00 +02:00
|
|
|
cprop_into_stmt (tree stmt)
|
2004-06-29 03:53:04 +02:00
|
|
|
{
|
|
|
|
bool may_have_exposed_new_symbols = false;
|
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
|
|
|
use_operand_p op_p;
|
|
|
|
ssa_op_iter iter;
|
2004-09-15 23:47:45 +02:00
|
|
|
tree rhs;
|
2004-06-29 03:53:04 +02:00
|
|
|
|
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
|
|
|
FOR_EACH_SSA_USE_OPERAND (op_p, stmt, iter, SSA_OP_ALL_USES)
|
2004-06-29 03:53:04 +02:00
|
|
|
{
|
|
|
|
if (TREE_CODE (USE_FROM_PTR (op_p)) == SSA_NAME)
|
2004-09-21 05:19:00 +02:00
|
|
|
may_have_exposed_new_symbols |= cprop_operand (stmt, op_p);
|
2004-06-29 03:53:04 +02:00
|
|
|
}
|
|
|
|
|
2004-09-15 23:47:45 +02:00
|
|
|
if (may_have_exposed_new_symbols)
|
|
|
|
{
|
|
|
|
rhs = get_rhs (stmt);
|
|
|
|
if (rhs && TREE_CODE (rhs) == ADDR_EXPR)
|
|
|
|
recompute_tree_invarant_for_addr_expr (rhs);
|
|
|
|
}
|
|
|
|
|
2004-06-29 03:53:04 +02:00
|
|
|
return may_have_exposed_new_symbols;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
/* Optimize the statement pointed by iterator SI.
|
|
|
|
|
|
|
|
We try to perform some simplistic global redundancy elimination and
|
|
|
|
constant propagation:
|
|
|
|
|
|
|
|
1- To detect global redundancy, we keep track of expressions that have
|
|
|
|
been computed in this block and its dominators. If we find that the
|
|
|
|
same expression is computed more than once, we eliminate repeated
|
|
|
|
computations by using the target of the first one.
|
|
|
|
|
|
|
|
2- Constant values and copy assignments. This is used to do very
|
|
|
|
simplistic constant and copy propagation. When a constant or copy
|
|
|
|
assignment is found, we map the value on the RHS of the assignment to
|
|
|
|
the variable in the LHS in the CONST_AND_COPIES table. */
|
|
|
|
|
|
|
|
static void
|
2004-06-29 08:59:35 +02:00
|
|
|
optimize_stmt (struct dom_walk_data *walk_data, basic_block bb,
|
2004-05-13 08:41:07 +02:00
|
|
|
block_stmt_iterator si)
|
|
|
|
{
|
|
|
|
stmt_ann_t ann;
|
|
|
|
tree stmt;
|
|
|
|
bool may_optimize_p;
|
|
|
|
bool may_have_exposed_new_symbols = false;
|
|
|
|
|
|
|
|
stmt = bsi_stmt (si);
|
|
|
|
|
|
|
|
get_stmt_operands (stmt);
|
|
|
|
ann = stmt_ann (stmt);
|
|
|
|
opt_stats.num_stmts++;
|
|
|
|
may_have_exposed_new_symbols = false;
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, "Optimizing statement ");
|
|
|
|
print_generic_stmt (dump_file, stmt, TDF_SLIM);
|
|
|
|
}
|
|
|
|
|
2004-06-10 23:41:08 +02:00
|
|
|
/* Const/copy propagate into USES, VUSES and the RHS of V_MAY_DEFs. */
|
2004-09-21 05:19:00 +02:00
|
|
|
may_have_exposed_new_symbols = cprop_into_stmt (stmt);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* If the statement has been modified with constant replacements,
|
|
|
|
fold its RHS before checking for redundant computations. */
|
|
|
|
if (ann->modified)
|
|
|
|
{
|
|
|
|
/* Try to fold the statement making sure that STMT is kept
|
|
|
|
up to date. */
|
|
|
|
if (fold_stmt (bsi_stmt_ptr (si)))
|
|
|
|
{
|
|
|
|
stmt = bsi_stmt (si);
|
|
|
|
ann = stmt_ann (stmt);
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
{
|
|
|
|
fprintf (dump_file, " Folded to: ");
|
|
|
|
print_generic_stmt (dump_file, stmt, TDF_SLIM);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Constant/copy propagation above may change the set of
|
|
|
|
virtual operands associated with this statement. Folding
|
|
|
|
may remove the need for some virtual operands.
|
|
|
|
|
|
|
|
Indicate we will need to rescan and rewrite the statement. */
|
|
|
|
may_have_exposed_new_symbols = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check for redundant computations. Do this optimization only
|
|
|
|
for assignments that have no volatile ops and conditionals. */
|
|
|
|
may_optimize_p = (!ann->has_volatile_ops
|
|
|
|
&& ((TREE_CODE (stmt) == RETURN_EXPR
|
|
|
|
&& TREE_OPERAND (stmt, 0)
|
|
|
|
&& TREE_CODE (TREE_OPERAND (stmt, 0)) == MODIFY_EXPR
|
|
|
|
&& ! (TREE_SIDE_EFFECTS
|
|
|
|
(TREE_OPERAND (TREE_OPERAND (stmt, 0), 1))))
|
|
|
|
|| (TREE_CODE (stmt) == MODIFY_EXPR
|
|
|
|
&& ! TREE_SIDE_EFFECTS (TREE_OPERAND (stmt, 1)))
|
|
|
|
|| TREE_CODE (stmt) == COND_EXPR
|
|
|
|
|| TREE_CODE (stmt) == SWITCH_EXPR));
|
|
|
|
|
|
|
|
if (may_optimize_p)
|
|
|
|
may_have_exposed_new_symbols
|
|
|
|
|= eliminate_redundant_computations (walk_data, stmt, ann);
|
|
|
|
|
|
|
|
/* Record any additional equivalences created by this statement. */
|
|
|
|
if (TREE_CODE (stmt) == MODIFY_EXPR)
|
|
|
|
record_equivalences_from_stmt (stmt,
|
|
|
|
may_optimize_p,
|
|
|
|
ann);
|
|
|
|
|
2004-09-16 21:06:12 +02:00
|
|
|
register_definitions_for_stmt (stmt);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* If STMT is a COND_EXPR and it was modified, then we may know
|
|
|
|
where it goes. If that is the case, then mark the CFG as altered.
|
|
|
|
|
|
|
|
This will cause us to later call remove_unreachable_blocks and
|
|
|
|
cleanup_tree_cfg when it is safe to do so. It is not safe to
|
|
|
|
clean things up here since removal of edges and such can trigger
|
|
|
|
the removal of PHI nodes, which in turn can release SSA_NAMEs to
|
|
|
|
the manager.
|
|
|
|
|
|
|
|
That's all fine and good, except that once SSA_NAMEs are released
|
|
|
|
to the manager, we must not call create_ssa_name until all references
|
|
|
|
to released SSA_NAMEs have been eliminated.
|
|
|
|
|
|
|
|
All references to the deleted SSA_NAMEs can not be eliminated until
|
|
|
|
we remove unreachable blocks.
|
|
|
|
|
|
|
|
We can not remove unreachable blocks until after we have completed
|
|
|
|
any queued jump threading.
|
|
|
|
|
|
|
|
We can not complete any queued jump threads until we have taken
|
|
|
|
appropriate variables out of SSA form. Taking variables out of
|
|
|
|
SSA form can call create_ssa_name and thus we lose.
|
|
|
|
|
|
|
|
Ultimately I suspect we're going to need to change the interface
|
|
|
|
into the SSA_NAME manager. */
|
|
|
|
|
|
|
|
if (ann->modified)
|
|
|
|
{
|
|
|
|
tree val = NULL;
|
|
|
|
|
|
|
|
if (TREE_CODE (stmt) == COND_EXPR)
|
|
|
|
val = COND_EXPR_COND (stmt);
|
|
|
|
else if (TREE_CODE (stmt) == SWITCH_EXPR)
|
|
|
|
val = SWITCH_COND (stmt);
|
|
|
|
|
2004-06-29 08:59:35 +02:00
|
|
|
if (val && TREE_CODE (val) == INTEGER_CST && find_taken_edge (bb, val))
|
2004-05-13 08:41:07 +02:00
|
|
|
cfg_altered = true;
|
2004-06-29 08:59:35 +02:00
|
|
|
|
|
|
|
/* If we simplified a statement in such a way as to be shown that it
|
|
|
|
cannot trap, update the eh information and the cfg to match. */
|
|
|
|
if (maybe_clean_eh_stmt (stmt))
|
|
|
|
{
|
|
|
|
bitmap_set_bit (need_eh_cleanup, bb->index);
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file, " Flagged to clear EH edges.\n");
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
2004-06-29 08:59:35 +02:00
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
if (may_have_exposed_new_symbols)
|
2004-11-24 00:38:12 +01:00
|
|
|
VEC_safe_push (tree_on_heap, stmts_to_rescan, bsi_stmt (si));
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Replace the RHS of STMT with NEW_RHS. If RHS can be found in the
|
|
|
|
available expression hashtable, then return the LHS from the hash
|
|
|
|
table.
|
|
|
|
|
|
|
|
If INSERT is true, then we also update the available expression
|
|
|
|
hash table to account for the changes made to STMT. */
|
|
|
|
|
|
|
|
static tree
|
2004-09-15 06:38:04 +02:00
|
|
|
update_rhs_and_lookup_avail_expr (tree stmt, tree new_rhs, bool insert)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
|
|
|
tree cached_lhs = NULL;
|
|
|
|
|
|
|
|
/* Remove the old entry from the hash table. */
|
|
|
|
if (insert)
|
|
|
|
{
|
|
|
|
struct expr_hash_elt element;
|
|
|
|
|
|
|
|
initialize_hash_element (stmt, NULL, &element);
|
|
|
|
htab_remove_elt_with_hash (avail_exprs, &element, element.hash);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now update the RHS of the assignment. */
|
|
|
|
TREE_OPERAND (stmt, 1) = new_rhs;
|
|
|
|
|
|
|
|
/* Now lookup the updated statement in the hash table. */
|
2004-09-15 06:38:04 +02:00
|
|
|
cached_lhs = lookup_avail_expr (stmt, insert);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* We have now called lookup_avail_expr twice with two different
|
|
|
|
versions of this same statement, once in optimize_stmt, once here.
|
|
|
|
|
|
|
|
We know the call in optimize_stmt did not find an existing entry
|
|
|
|
in the hash table, so a new entry was created. At the same time
|
2004-11-24 00:38:12 +01:00
|
|
|
this statement was pushed onto the AVAIL_EXPRS_STACK vector.
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
If this call failed to find an existing entry on the hash table,
|
|
|
|
then the new version of this statement was entered into the
|
|
|
|
hash table. And this statement was pushed onto BLOCK_AVAIL_EXPR
|
|
|
|
for the second time. So there are two copies on BLOCK_AVAIL_EXPRs
|
|
|
|
|
|
|
|
If this call succeeded, we still have one copy of this statement
|
2004-11-24 00:38:12 +01:00
|
|
|
on the BLOCK_AVAIL_EXPRs vector.
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
For both cases, we need to pop the most recent entry off the
|
2004-11-24 00:38:12 +01:00
|
|
|
BLOCK_AVAIL_EXPRs vector. For the case where we never found this
|
2004-05-13 08:41:07 +02:00
|
|
|
statement in the hash tables, that will leave precisely one
|
|
|
|
copy of this statement on BLOCK_AVAIL_EXPRs. For the case where
|
|
|
|
we found a copy of this statement in the second hash table lookup
|
|
|
|
we want _no_ copies of this statement in BLOCK_AVAIL_EXPRs. */
|
|
|
|
if (insert)
|
2004-11-24 00:38:12 +01:00
|
|
|
VEC_pop (tree_on_heap, avail_exprs_stack);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
/* And make sure we record the fact that we modified this
|
|
|
|
statement. */
|
2004-08-10 20:31:26 +02:00
|
|
|
modify_stmt (stmt);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
return cached_lhs;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Search for an existing instance of STMT in the AVAIL_EXPRS table. If
|
|
|
|
found, return its LHS. Otherwise insert STMT in the table and return
|
|
|
|
NULL_TREE.
|
|
|
|
|
|
|
|
Also, when an expression is first inserted in the AVAIL_EXPRS table, it
|
|
|
|
is also added to the stack pointed by BLOCK_AVAIL_EXPRS_P, so that they
|
|
|
|
can be removed when we finish processing this block and its children.
|
|
|
|
|
|
|
|
NOTE: This function assumes that STMT is a MODIFY_EXPR node that
|
|
|
|
contains no CALL_EXPR on its RHS and makes no volatile nor
|
|
|
|
aliased references. */
|
|
|
|
|
|
|
|
static tree
|
2004-09-15 06:38:04 +02:00
|
|
|
lookup_avail_expr (tree stmt, bool insert)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
|
|
|
void **slot;
|
|
|
|
tree lhs;
|
|
|
|
tree temp;
|
2005-02-10 18:53:46 +01:00
|
|
|
struct expr_hash_elt *element = xmalloc (sizeof (struct expr_hash_elt));
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
lhs = TREE_CODE (stmt) == MODIFY_EXPR ? TREE_OPERAND (stmt, 0) : NULL;
|
|
|
|
|
|
|
|
initialize_hash_element (stmt, lhs, element);
|
|
|
|
|
|
|
|
/* Don't bother remembering constant assignments and copy operations.
|
|
|
|
Constants and copy operations are handled by the constant/copy propagator
|
|
|
|
in optimize_stmt. */
|
|
|
|
if (TREE_CODE (element->rhs) == SSA_NAME
|
|
|
|
|| is_gimple_min_invariant (element->rhs))
|
|
|
|
{
|
|
|
|
free (element);
|
|
|
|
return NULL_TREE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If this is an equality test against zero, see if we have recorded a
|
|
|
|
nonzero value for the variable in question. */
|
|
|
|
if ((TREE_CODE (element->rhs) == EQ_EXPR
|
|
|
|
|| TREE_CODE (element->rhs) == NE_EXPR)
|
|
|
|
&& TREE_CODE (TREE_OPERAND (element->rhs, 0)) == SSA_NAME
|
|
|
|
&& integer_zerop (TREE_OPERAND (element->rhs, 1)))
|
|
|
|
{
|
|
|
|
int indx = SSA_NAME_VERSION (TREE_OPERAND (element->rhs, 0));
|
|
|
|
|
|
|
|
if (bitmap_bit_p (nonzero_vars, indx))
|
|
|
|
{
|
|
|
|
tree t = element->rhs;
|
|
|
|
free (element);
|
|
|
|
|
|
|
|
if (TREE_CODE (t) == EQ_EXPR)
|
|
|
|
return boolean_false_node;
|
|
|
|
else
|
|
|
|
return boolean_true_node;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Finally try to find the expression in the main expression hash table. */
|
|
|
|
slot = htab_find_slot_with_hash (avail_exprs, element, element->hash,
|
|
|
|
(insert ? INSERT : NO_INSERT));
|
|
|
|
if (slot == NULL)
|
|
|
|
{
|
|
|
|
free (element);
|
|
|
|
return NULL_TREE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (*slot == NULL)
|
|
|
|
{
|
|
|
|
*slot = (void *) element;
|
2004-11-24 00:38:12 +01:00
|
|
|
VEC_safe_push (tree_on_heap, avail_exprs_stack,
|
|
|
|
stmt ? stmt : element->rhs);
|
2004-05-13 08:41:07 +02:00
|
|
|
return NULL_TREE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Extract the LHS of the assignment so that it can be used as the current
|
|
|
|
definition of another variable. */
|
|
|
|
lhs = ((struct expr_hash_elt *)*slot)->lhs;
|
|
|
|
|
|
|
|
/* See if the LHS appears in the CONST_AND_COPIES table. If it does, then
|
|
|
|
use the value from the const_and_copies table. */
|
|
|
|
if (TREE_CODE (lhs) == SSA_NAME)
|
|
|
|
{
|
2004-09-23 22:15:30 +02:00
|
|
|
temp = SSA_NAME_VALUE (lhs);
|
|
|
|
if (temp && TREE_CODE (temp) != VALUE_HANDLE)
|
2004-05-13 08:41:07 +02:00
|
|
|
lhs = temp;
|
|
|
|
}
|
|
|
|
|
|
|
|
free (element);
|
|
|
|
return lhs;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Given a condition COND, record into HI_P, LO_P and INVERTED_P the
|
|
|
|
range of values that result in the conditional having a true value.
|
|
|
|
|
|
|
|
Return true if we are successful in extracting a range from COND and
|
|
|
|
false if we are unsuccessful. */
|
|
|
|
|
|
|
|
static bool
|
|
|
|
extract_range_from_cond (tree cond, tree *hi_p, tree *lo_p, int *inverted_p)
|
|
|
|
{
|
|
|
|
tree op1 = TREE_OPERAND (cond, 1);
|
|
|
|
tree high, low, type;
|
|
|
|
int inverted;
|
2005-02-21 08:27:14 +01:00
|
|
|
|
|
|
|
type = TREE_TYPE (op1);
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
/* Experiments have shown that it's rarely, if ever useful to
|
|
|
|
record ranges for enumerations. Presumably this is due to
|
|
|
|
the fact that they're rarely used directly. They are typically
|
|
|
|
cast into an integer type and used that way. */
|
2005-02-21 08:27:14 +01:00
|
|
|
if (TREE_CODE (type) != INTEGER_TYPE
|
|
|
|
/* We don't know how to deal with types with variable bounds. */
|
|
|
|
|| TREE_CODE (TYPE_MIN_VALUE (type)) != INTEGER_CST
|
|
|
|
|| TREE_CODE (TYPE_MAX_VALUE (type)) != INTEGER_CST)
|
2004-05-13 08:41:07 +02:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
switch (TREE_CODE (cond))
|
|
|
|
{
|
|
|
|
case EQ_EXPR:
|
|
|
|
high = low = op1;
|
|
|
|
inverted = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case NE_EXPR:
|
|
|
|
high = low = op1;
|
|
|
|
inverted = 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GE_EXPR:
|
|
|
|
low = op1;
|
|
|
|
high = TYPE_MAX_VALUE (type);
|
|
|
|
inverted = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case GT_EXPR:
|
|
|
|
high = TYPE_MAX_VALUE (type);
|
2005-01-15 10:46:10 +01:00
|
|
|
if (!tree_int_cst_lt (op1, high))
|
|
|
|
return 0;
|
|
|
|
low = int_const_binop (PLUS_EXPR, op1, integer_one_node, 1);
|
2004-05-13 08:41:07 +02:00
|
|
|
inverted = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LE_EXPR:
|
|
|
|
high = op1;
|
|
|
|
low = TYPE_MIN_VALUE (type);
|
|
|
|
inverted = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case LT_EXPR:
|
|
|
|
low = TYPE_MIN_VALUE (type);
|
2005-01-15 17:47:53 +01:00
|
|
|
if (!tree_int_cst_lt (low, op1))
|
2005-01-15 10:46:10 +01:00
|
|
|
return 0;
|
|
|
|
high = int_const_binop (MINUS_EXPR, op1, integer_one_node, 1);
|
2004-05-13 08:41:07 +02:00
|
|
|
inverted = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
*hi_p = high;
|
|
|
|
*lo_p = low;
|
|
|
|
*inverted_p = inverted;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Record a range created by COND for basic block BB. */
|
|
|
|
|
|
|
|
static void
|
2004-09-19 04:51:15 +02:00
|
|
|
record_range (tree cond, basic_block bb)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
2004-10-30 02:06:22 +02:00
|
|
|
enum tree_code code = TREE_CODE (cond);
|
|
|
|
|
|
|
|
/* We explicitly ignore NE_EXPRs and all the unordered comparisons.
|
|
|
|
They rarely allow for meaningful range optimizations and significantly
|
|
|
|
complicate the implementation. */
|
|
|
|
if ((code == LT_EXPR || code == LE_EXPR || code == GT_EXPR
|
|
|
|
|| code == GE_EXPR || code == EQ_EXPR)
|
2004-05-13 08:41:07 +02:00
|
|
|
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (cond, 1))) == INTEGER_TYPE)
|
|
|
|
{
|
2004-09-22 06:12:01 +02:00
|
|
|
struct vrp_hash_elt *vrp_hash_elt;
|
|
|
|
struct vrp_element *element;
|
|
|
|
varray_type *vrp_records_p;
|
|
|
|
void **slot;
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2004-09-22 06:12:01 +02:00
|
|
|
vrp_hash_elt = xmalloc (sizeof (struct vrp_hash_elt));
|
|
|
|
vrp_hash_elt->var = TREE_OPERAND (cond, 0);
|
|
|
|
vrp_hash_elt->records = NULL;
|
|
|
|
slot = htab_find_slot (vrp_data, vrp_hash_elt, INSERT);
|
2004-05-13 08:41:07 +02:00
|
|
|
|
2004-09-22 06:12:01 +02:00
|
|
|
if (*slot == NULL)
|
2004-09-24 14:17:41 +02:00
|
|
|
*slot = (void *) vrp_hash_elt;
|
2004-10-13 19:27:31 +02:00
|
|
|
else
|
|
|
|
free (vrp_hash_elt);
|
2004-09-22 06:12:01 +02:00
|
|
|
|
2004-09-24 14:17:41 +02:00
|
|
|
vrp_hash_elt = (struct vrp_hash_elt *) *slot;
|
2004-09-22 06:12:01 +02:00
|
|
|
vrp_records_p = &vrp_hash_elt->records;
|
|
|
|
|
|
|
|
element = ggc_alloc (sizeof (struct vrp_element));
|
2004-05-13 08:41:07 +02:00
|
|
|
element->low = NULL;
|
|
|
|
element->high = NULL;
|
|
|
|
element->cond = cond;
|
|
|
|
element->bb = bb;
|
|
|
|
|
|
|
|
if (*vrp_records_p == NULL)
|
2004-09-22 06:12:01 +02:00
|
|
|
VARRAY_GENERIC_PTR_INIT (*vrp_records_p, 2, "vrp records");
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
VARRAY_PUSH_GENERIC_PTR (*vrp_records_p, element);
|
2004-11-24 00:38:12 +01:00
|
|
|
VEC_safe_push (tree_on_heap, vrp_variables_stack, TREE_OPERAND (cond, 0));
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2004-09-22 06:12:01 +02:00
|
|
|
/* Hashing and equality functions for VRP_DATA.
|
|
|
|
|
|
|
|
Since this hash table is addressed by SSA_NAMEs, we can hash on
|
|
|
|
their version number and equality can be determined with a
|
|
|
|
pointer comparison. */
|
|
|
|
|
|
|
|
static hashval_t
|
|
|
|
vrp_hash (const void *p)
|
|
|
|
{
|
|
|
|
tree var = ((struct vrp_hash_elt *)p)->var;
|
|
|
|
|
|
|
|
return SSA_NAME_VERSION (var);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
vrp_eq (const void *p1, const void *p2)
|
|
|
|
{
|
|
|
|
tree var1 = ((struct vrp_hash_elt *)p1)->var;
|
|
|
|
tree var2 = ((struct vrp_hash_elt *)p2)->var;
|
|
|
|
|
|
|
|
return var1 == var2;
|
|
|
|
}
|
|
|
|
|
2004-05-13 08:41:07 +02:00
|
|
|
/* Hashing and equality functions for AVAIL_EXPRS. The table stores
|
|
|
|
MODIFY_EXPR statements. We compute a value number for expressions using
|
|
|
|
the code of the expression and the SSA numbers of its operands. */
|
|
|
|
|
|
|
|
static hashval_t
|
|
|
|
avail_expr_hash (const void *p)
|
|
|
|
{
|
|
|
|
stmt_ann_t ann = ((struct expr_hash_elt *)p)->ann;
|
|
|
|
tree rhs = ((struct expr_hash_elt *)p)->rhs;
|
|
|
|
hashval_t val = 0;
|
|
|
|
size_t i;
|
|
|
|
vuse_optype vuses;
|
|
|
|
|
|
|
|
/* iterative_hash_expr knows how to deal with any expression and
|
|
|
|
deals with commutative operators as well, so just use it instead
|
|
|
|
of duplicating such complexities here. */
|
|
|
|
val = iterative_hash_expr (rhs, val);
|
|
|
|
|
|
|
|
/* If the hash table entry is not associated with a statement, then we
|
|
|
|
can just hash the expression and not worry about virtual operands
|
|
|
|
and such. */
|
|
|
|
if (!ann)
|
|
|
|
return val;
|
|
|
|
|
|
|
|
/* Add the SSA version numbers of every vuse operand. This is important
|
|
|
|
because compound variables like arrays are not renamed in the
|
|
|
|
operands. Rather, the rename is done on the virtual variable
|
|
|
|
representing all the elements of the array. */
|
|
|
|
vuses = VUSE_OPS (ann);
|
|
|
|
for (i = 0; i < NUM_VUSES (vuses); i++)
|
|
|
|
val = iterative_hash_expr (VUSE_OP (vuses, i), val);
|
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2004-06-25 00:46:56 +02:00
|
|
|
static hashval_t
|
|
|
|
real_avail_expr_hash (const void *p)
|
|
|
|
{
|
|
|
|
return ((const struct expr_hash_elt *)p)->hash;
|
|
|
|
}
|
2004-05-13 08:41:07 +02:00
|
|
|
|
|
|
|
static int
|
|
|
|
avail_expr_eq (const void *p1, const void *p2)
|
|
|
|
{
|
|
|
|
stmt_ann_t ann1 = ((struct expr_hash_elt *)p1)->ann;
|
|
|
|
tree rhs1 = ((struct expr_hash_elt *)p1)->rhs;
|
|
|
|
stmt_ann_t ann2 = ((struct expr_hash_elt *)p2)->ann;
|
|
|
|
tree rhs2 = ((struct expr_hash_elt *)p2)->rhs;
|
|
|
|
|
|
|
|
/* If they are the same physical expression, return true. */
|
|
|
|
if (rhs1 == rhs2 && ann1 == ann2)
|
|
|
|
return true;
|
|
|
|
|
|
|
|
/* If their codes are not equal, then quit now. */
|
|
|
|
if (TREE_CODE (rhs1) != TREE_CODE (rhs2))
|
|
|
|
return false;
|
|
|
|
|
|
|
|
/* In case of a collision, both RHS have to be identical and have the
|
|
|
|
same VUSE operands. */
|
|
|
|
if ((TREE_TYPE (rhs1) == TREE_TYPE (rhs2)
|
|
|
|
|| lang_hooks.types_compatible_p (TREE_TYPE (rhs1), TREE_TYPE (rhs2)))
|
|
|
|
&& operand_equal_p (rhs1, rhs2, OEP_PURE_SAME))
|
|
|
|
{
|
|
|
|
vuse_optype ops1 = NULL;
|
|
|
|
vuse_optype ops2 = NULL;
|
|
|
|
size_t num_ops1 = 0;
|
|
|
|
size_t num_ops2 = 0;
|
|
|
|
size_t i;
|
|
|
|
|
|
|
|
if (ann1)
|
|
|
|
{
|
|
|
|
ops1 = VUSE_OPS (ann1);
|
|
|
|
num_ops1 = NUM_VUSES (ops1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ann2)
|
|
|
|
{
|
|
|
|
ops2 = VUSE_OPS (ann2);
|
|
|
|
num_ops2 = NUM_VUSES (ops2);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If the number of virtual uses is different, then we consider
|
|
|
|
them not equal. */
|
|
|
|
if (num_ops1 != num_ops2)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
for (i = 0; i < num_ops1; i++)
|
|
|
|
if (VUSE_OP (ops1, i) != VUSE_OP (ops2, i))
|
|
|
|
return false;
|
|
|
|
|
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 (((struct expr_hash_elt *)p1)->hash
|
|
|
|
== ((struct expr_hash_elt *)p2)->hash);
|
2004-05-13 08:41:07 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
c-typeck.c, [...]: Fix comment typos.
* c-typeck.c, cfgexpand.c, ddg.c, ddg.h, df.c, fold-const.c,
gcov.c, gimplify.c, modulo-sched.c, passes.c, tree-cfg.c,
tree-mudflap.c, tree-nrv.c, tree-outof-ssa.c, tree-ssa-dom.c,
tree-ssa-dse.c, tree-ssa-operands.c, tree-ssa-pre.c,
tree-tailcall.c: Fix comment typos. Follow spelling
conventions.
From-SVN: r83703
2004-06-26 07:03:55 +02:00
|
|
|
/* Given STMT and a pointer to the block local definitions BLOCK_DEFS_P,
|
2004-05-13 08:41:07 +02:00
|
|
|
register register all objects set by this statement into BLOCK_DEFS_P
|
|
|
|
and CURRDEFS. */
|
|
|
|
|
|
|
|
static void
|
2004-09-16 21:06:12 +02:00
|
|
|
register_definitions_for_stmt (tree stmt)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
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 def;
|
|
|
|
ssa_op_iter iter;
|
2004-05-13 08:41:07 +02:00
|
|
|
|
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
|
|
|
FOR_EACH_SSA_TREE_OPERAND (def, stmt, iter, SSA_OP_ALL_DEFS)
|
2004-05-13 08:41:07 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
/* FIXME: We shouldn't be registering new defs if the variable
|
|
|
|
doesn't need to be renamed. */
|
2004-09-16 21:06:12 +02:00
|
|
|
register_new_def (def, &block_defs_stack);
|
2004-05-13 08:41:07 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|