2004-08-26 19:10:50 +02:00
|
|
|
/* Loop transformation code generation
|
function.c (gimplify_parameters): Call build_gimple_modify_stmt instead of calling build2 with a GIMPLE_MODIFY_STMT.
* function.c (gimplify_parameters): Call build_gimple_modify_stmt
instead of calling build2 with a GIMPLE_MODIFY_STMT.
* gimple-low.c (lower_function_body, lower_builtin_setjmp):
Likewise.
* gimplify.c (build_stack_save_restore, gimplify_return_expr,
gimplify_decl_expr, gimplify_self_mod_expr, gimplify_cond_expr,
gimplify_init_ctor_eval_range, gimple_push_cleanup,
gimplify_omp_for, gimplify_omp_atomic_pipeline,
gimplify_omp_atomic_mutex, gimplify_expr, gimplify_one_sizepos,
force_gimple_operand): Likewise.
* ipa-cp.c (constant_val_insert): Likewise.
* lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, replace_uses_equiv_to_x_with_y,
perfect_nestify): Likewise.
* langhooks.c (lhd_omp_assignment): Likewise.
* omp-low.c (lower_rec_input_clauses, lower_reduction_clauses,
lower_copyprivate_clauses, lower_send_clauses,
lower_send_shared_vars, expand_parallel_call,
expand_omp_for_generic, expand_omp_for_static_nochunk,
expand_omp_for_static_chunk, expand_omp_sections,
lower_omp_single_copy, lower_omp_for_lastprivate,
lower_omp_parallel, init_tmp_var, save_tmp_var): Likewise.
* value-prof.c (tree_divmod_fixed_value, tree_mod_pow2,
tree_mod_subtract, tree_ic, tree_stringop_fixed_value):
Likewise.
From-SVN: r122120
2007-02-19 03:45:34 +01:00
|
|
|
Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
|
2004-08-26 19:10:50 +02:00
|
|
|
Contributed by Daniel Berlin <dberlin@dberlin.org>
|
|
|
|
|
|
|
|
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
|
2005-06-25 04:02:01 +02:00
|
|
|
Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
|
|
|
|
02110-1301, USA. */
|
2004-08-26 19:10:50 +02:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "system.h"
|
|
|
|
#include "coretypes.h"
|
|
|
|
#include "tm.h"
|
|
|
|
#include "ggc.h"
|
|
|
|
#include "tree.h"
|
|
|
|
#include "target.h"
|
|
|
|
#include "rtl.h"
|
|
|
|
#include "basic-block.h"
|
|
|
|
#include "diagnostic.h"
|
|
|
|
#include "tree-flow.h"
|
|
|
|
#include "tree-dump.h"
|
|
|
|
#include "timevar.h"
|
|
|
|
#include "cfgloop.h"
|
|
|
|
#include "expr.h"
|
|
|
|
#include "optabs.h"
|
|
|
|
#include "tree-chrec.h"
|
|
|
|
#include "tree-data-ref.h"
|
|
|
|
#include "tree-pass.h"
|
|
|
|
#include "tree-scalar-evolution.h"
|
|
|
|
#include "vec.h"
|
|
|
|
#include "lambda.h"
|
Makefile.in (tree-into-ssa.o, [...]): Depend on vecprim.h.
* Makefile.in (tree-into-ssa.o, tree-outof-ssa.o,
tree-ssa-live.o, tree-ssa-alias.o, function.o, df-problems.o,
global.o, cfglayout.o, lambda-code.o, reg-stack.o,
build/genextract.o): Depend on vecprim.h.
* cfglayout.c, df-problems.c, function.c, genextract.c,
global.c, lambda-code.c, reg-stack.c, tree-into-ssa.c,
tree-outof-ssa.c, tree-ssa-alias.c, tree-ssa-live.c: Include
vecprim.h.
* vecprim.h: New.
From-SVN: r112830
2006-04-10 21:26:18 +02:00
|
|
|
#include "vecprim.h"
|
2004-08-26 19:10:50 +02:00
|
|
|
|
|
|
|
/* This loop nest code generation is based on non-singular matrix
|
|
|
|
math.
|
|
|
|
|
|
|
|
A little terminology and a general sketch of the algorithm. See "A singular
|
c-common.c, [...]: Fix comment typos.
* c-common.c, c-pch.c, defaults.h, lambda-code.c, passes.c,
tree-data-ref.c, tree-flow.h, tree-ssa-operands.c,
tree-ssa-threadupdate.c, tree-vectorizer.c, tree-vectorizer.h,
value-prof.c: Fix comment typos. Follow spelling conventions.
From-SVN: r87288
2004-09-10 12:44:48 +02:00
|
|
|
loop transformation framework based on non-singular matrices" by Wei Li and
|
2004-08-26 19:10:50 +02:00
|
|
|
Keshav Pingali for formal proofs that the various statements below are
|
|
|
|
correct.
|
|
|
|
|
2004-11-01 19:08:02 +01:00
|
|
|
A loop iteration space represents the points traversed by the loop. A point in the
|
2004-08-26 19:10:50 +02:00
|
|
|
iteration space can be represented by a vector of size <loop depth>. You can
|
c-cppbuiltin.c, [...]: Fix comment typos.
* c-cppbuiltin.c, cgraph.c, domwalk.h, except.c, gimplify.c,
lambda-code.c, postreload.c, predict.c, tree-sra.c,
tree-ssa-loop-manip.c, tree.c: Fix comment typos.
From-SVN: r90596
2004-11-13 22:11:04 +01:00
|
|
|
therefore represent the iteration space as an integral combinations of a set
|
2004-08-26 19:10:50 +02:00
|
|
|
of basis vectors.
|
|
|
|
|
|
|
|
A loop iteration space is dense if every integer point between the loop
|
|
|
|
bounds is a point in the iteration space. Every loop with a step of 1
|
|
|
|
therefore has a dense iteration space.
|
|
|
|
|
|
|
|
for i = 1 to 3, step 1 is a dense iteration space.
|
|
|
|
|
|
|
|
A loop iteration space is sparse if it is not dense. That is, the iteration
|
|
|
|
space skips integer points that are within the loop bounds.
|
|
|
|
|
|
|
|
for i = 1 to 3, step 2 is a sparse iteration space, because the integer point
|
|
|
|
2 is skipped.
|
|
|
|
|
|
|
|
Dense source spaces are easy to transform, because they don't skip any
|
|
|
|
points to begin with. Thus we can compute the exact bounds of the target
|
|
|
|
space using min/max and floor/ceil.
|
|
|
|
|
|
|
|
For a dense source space, we take the transformation matrix, decompose it
|
|
|
|
into a lower triangular part (H) and a unimodular part (U).
|
c-common.c, [...]: Fix comment typos.
* c-common.c, c-pch.c, defaults.h, lambda-code.c, passes.c,
tree-data-ref.c, tree-flow.h, tree-ssa-operands.c,
tree-ssa-threadupdate.c, tree-vectorizer.c, tree-vectorizer.h,
value-prof.c: Fix comment typos. Follow spelling conventions.
From-SVN: r87288
2004-09-10 12:44:48 +02:00
|
|
|
We then compute the auxiliary space from the unimodular part (source loop
|
|
|
|
nest . U = auxiliary space) , which has two important properties:
|
2004-08-26 19:10:50 +02:00
|
|
|
1. It traverses the iterations in the same lexicographic order as the source
|
|
|
|
space.
|
|
|
|
2. It is a dense space when the source is a dense space (even if the target
|
|
|
|
space is going to be sparse).
|
|
|
|
|
c-common.c, [...]: Fix comment typos.
* c-common.c, c-pch.c, defaults.h, lambda-code.c, passes.c,
tree-data-ref.c, tree-flow.h, tree-ssa-operands.c,
tree-ssa-threadupdate.c, tree-vectorizer.c, tree-vectorizer.h,
value-prof.c: Fix comment typos. Follow spelling conventions.
From-SVN: r87288
2004-09-10 12:44:48 +02:00
|
|
|
Given the auxiliary space, we use the lower triangular part to compute the
|
2004-08-26 19:10:50 +02:00
|
|
|
bounds in the target space by simple matrix multiplication.
|
|
|
|
The gaps in the target space (IE the new loop step sizes) will be the
|
|
|
|
diagonals of the H matrix.
|
|
|
|
|
|
|
|
Sparse source spaces require another step, because you can't directly compute
|
c-common.c, [...]: Fix comment typos.
* c-common.c, c-pch.c, defaults.h, lambda-code.c, passes.c,
tree-data-ref.c, tree-flow.h, tree-ssa-operands.c,
tree-ssa-threadupdate.c, tree-vectorizer.c, tree-vectorizer.h,
value-prof.c: Fix comment typos. Follow spelling conventions.
From-SVN: r87288
2004-09-10 12:44:48 +02:00
|
|
|
the exact bounds of the auxiliary and target space from the sparse space.
|
2004-08-26 19:10:50 +02:00
|
|
|
Rather than try to come up with a separate algorithm to handle sparse source
|
|
|
|
spaces directly, we just find a legal transformation matrix that gives you
|
|
|
|
the sparse source space, from a dense space, and then transform the dense
|
|
|
|
space.
|
|
|
|
|
|
|
|
For a regular sparse space, you can represent the source space as an integer
|
|
|
|
lattice, and the base space of that lattice will always be dense. Thus, we
|
|
|
|
effectively use the lattice to figure out the transformation from the lattice
|
|
|
|
base space, to the sparse iteration space (IE what transform was applied to
|
|
|
|
the dense space to make it sparse). We then compose this transform with the
|
|
|
|
transformation matrix specified by the user (since our matrix transformations
|
|
|
|
are closed under composition, this is okay). We can then use the base space
|
|
|
|
(which is dense) plus the composed transformation matrix, to compute the rest
|
|
|
|
of the transform using the dense space algorithm above.
|
|
|
|
|
|
|
|
In other words, our sparse source space (B) is decomposed into a dense base
|
|
|
|
space (A), and a matrix (L) that transforms A into B, such that A.L = B.
|
|
|
|
We then compute the composition of L and the user transformation matrix (T),
|
|
|
|
so that T is now a transform from A to the result, instead of from B to the
|
|
|
|
result.
|
|
|
|
IE A.(LT) = result instead of B.T = result
|
|
|
|
Since A is now a dense source space, we can use the dense source space
|
|
|
|
algorithm above to compute the result of applying transform (LT) to A.
|
|
|
|
|
|
|
|
Fourier-Motzkin elimination is used to compute the bounds of the base space
|
|
|
|
of the lattice. */
|
|
|
|
|
tree-vrp.c (execute_vrp): Do not pass loops structure through arguments.
* tree-vrp.c (execute_vrp): Do not pass loops structure through
arguments.
* loop-unswitch.c (unswitch_loops, unswitch_single_loop,
unswitch_loop): Ditto.
* tree-loop-linear.c (linear_transform_loops): Ditto.
* tree-ssa-loop-im.c (determine_lsm, tree_ssa_lim_initialize,
tree_ssa_lim): Ditto.
* tree-ssa-loop-niter.c (estimate_numbers_of_iterations,
free_numbers_of_iterations_estimates): Ditto.
* tree-ssa-loop-unswitch.c (tree_ssa_unswitch_loops,
tree_unswitch_single_loop, tree_unswitch_loop): Ditto.
* cfgloopmanip.c (fix_bb_placement, fix_bb_placements,
remove_path, add_loop, loopify, unloop, fix_loop_placements,
place_new_loop, duplicate_loop, duplicate_subloops,
update_single_exit_for_duplicated_loops, copy_loops_to,
duplicate_loop_to_header_edge, create_preheaders,
force_single_succ_latches, loop_version, fix_loop_structure):
Ditto.
* tree-ssa-loop-manip.c (tree_duplicate_loop_to_header_edge,
tree_unroll_loop): Ditto.
* tree-ssa-loop-ch.c (copy_loop_headers): Ditto.
* tree-scalar-evolution.c (select_loops_exit_conditions,
scev_initialize, scev_analysis): Ditto.
* tree-scalar-evolution.h (scev_initialize): Ditto.
* cfghooks.c (cfg_hook_duplicate_loop_to_header_edge): Ditto.
* cfgloopanal.c (mark_irreducible_loops, mark_loop_exit_edges): Ditto.
* tree-ssa-loop-ivopts.c (tree_ssa_iv_optimize): Ditto.
* modulo-sched.c (sms_schedule): Ditto.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Ditto.
* loop-init.c (loop_optimizer_init, rtl_move_loop_invariants,
rtl_unswitch, rtl_unroll_and_peel_loops, rtl_doloop): Ditto.
* ifcvt.c (if_convert): Ditto.
* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely,
canonicalize_loop_induction_variables,
canonicalize_induction_variables,
tree_unroll_loops_completely, remove_empty_loops): Ditto.
* tree-ssa-loop.c (tree_ssa_loop_init, tree_ssa_loop_im,
tree_ssa_loop_unswitch, tree_vectorize, tree_linear_transform,
tree_ssa_loop_ivcanon, tree_ssa_empty_loop, tree_ssa_loop_bounds,
tree_complete_unroll, tree_ssa_loop_prefetch, tree_ssa_loop_ivopts,
tree_ssa_loop_done): Ditto.
* predict.c (predict_loops, tree_estimate_probability, estimate_loops,
estimate_bb_frequencies): Ditto.
* tree-vectorizer.c (slpeel_tree_duplicate_loop_to_edge_cfg,
slpeel_tree_peel_loop_to_edge, vectorize_loops): Ditto.
* loop-unroll.c (unroll_and_peel_loops, peel_loops_completely,
decide_unrolling_and_peeling, peel_loop_completely,
unroll_loop_constant_iterations, unroll_loop_runtime_iterations,
peel_loop_simple, unroll_loop_stupid): Ditto.
* loop-doloop.c (doloop_optimize_loops): Ditto.
* tree-cfgcleanup.c (cleanup_tree_cfg_loop): Ditto.
* loop-invariant.c (move_loop_invariants): Ditto.
* tree-ssa-dce.c (tree_ssa_dce_loop): Ditto.
* tree-ssa-loop-prefetch.c (loop_prefetch_arrays,
tree_ssa_prefetch_arrays): Ditto.
* lambda-code.c (gcc_loopnest_to_lambda_loopnest, perfect_nestify):
Ditto.
* tree-vect-transform.c (vect_do_peeling_for_loop_bound,
vect_do_peeling_for_alignment, vect_transform_loop): Ditto.
* cfgloop.c (flow_loops_cfg_dump, flow_loops_dump,
mark_single_exit_loops, cancel_loop, cancel_loop_tree,
verify_loop_structure): Ditto.
* tree-flow.h (vectorize_loops, tree_ssa_lim, tree_ssa_unswitch_loops,
canonicalize_induction_variables, tree_unroll_loops_completely,
tree_ssa_prefetch_arrays, remove_empty_loops, tree_ssa_iv_optimize,
estimate_numbers_of_iterations, free_numbers_of_iterations_estimates,
tree_duplicate_loop_to_header_edge, tree_ssa_loop_version,
tree_unroll_loop, linear_transform_loops): Declaration changed.
* basic-block.h: Remove declaration of struct loops.
* cfghooks.h (struct cfg_hooks): Change type of
cfg_hook_duplicate_loop_to_header_edge.
(cfg_hook_duplicate_loop_to_header_edge): Declaration changed.
* tree-vectorizer.h (slpeel_tree_peel_loop_to_edge,
vect_transform_loop): Declaration changed.
* lambda.h (gcc_loopnest_to_lambda_loopnest): Declaration changed.
* cfgloop.h (flow_loops_dump, fix_loop_structure,
mark_irreducible_loops, mark_single_exit_loops, mark_loop_exit_edges,
cancel_loop_tree, create_preheaders, force_single_succ_latches,
verify_loop_structure, duplicate_loop, duplicate_loop_to_header_edge,
loopify, loop_version, remove_path, unswitch_loops,
unroll_and_peel_loops, doloop_optimize_loops, move_loop_invariants):
Declaration changed.
From-SVN: r119189
2006-11-25 11:34:13 +01:00
|
|
|
static bool perfect_nestify (struct loop *, VEC(tree,heap) *,
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
VEC(tree,heap) *, VEC(int,heap) *,
|
|
|
|
VEC(tree,heap) *);
|
2004-08-26 19:10:50 +02:00
|
|
|
/* Lattice stuff that is internal to the code generation algorithm. */
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
/* Lattice base matrix. */
|
|
|
|
lambda_matrix base;
|
|
|
|
/* Lattice dimension. */
|
|
|
|
int dimension;
|
|
|
|
/* Origin vector for the coefficients. */
|
|
|
|
lambda_vector origin;
|
|
|
|
/* Origin matrix for the invariants. */
|
|
|
|
lambda_matrix origin_invariants;
|
|
|
|
/* Number of invariants. */
|
|
|
|
int invariants;
|
|
|
|
} *lambda_lattice;
|
|
|
|
|
|
|
|
#define LATTICE_BASE(T) ((T)->base)
|
|
|
|
#define LATTICE_DIMENSION(T) ((T)->dimension)
|
|
|
|
#define LATTICE_ORIGIN(T) ((T)->origin)
|
|
|
|
#define LATTICE_ORIGIN_INVARIANTS(T) ((T)->origin_invariants)
|
|
|
|
#define LATTICE_INVARIANTS(T) ((T)->invariants)
|
|
|
|
|
|
|
|
static bool lle_equal (lambda_linear_expression, lambda_linear_expression,
|
|
|
|
int, int);
|
|
|
|
static lambda_lattice lambda_lattice_new (int, int);
|
|
|
|
static lambda_lattice lambda_lattice_compute_base (lambda_loopnest);
|
|
|
|
|
|
|
|
static tree find_induction_var_from_exit_cond (struct loop *);
|
2006-05-17 16:25:59 +02:00
|
|
|
static bool can_convert_to_perfect_nest (struct loop *);
|
2004-08-26 19:10:50 +02:00
|
|
|
|
|
|
|
/* Create a new lambda body vector. */
|
|
|
|
|
|
|
|
lambda_body_vector
|
|
|
|
lambda_body_vector_new (int size)
|
|
|
|
{
|
|
|
|
lambda_body_vector ret;
|
|
|
|
|
|
|
|
ret = ggc_alloc (sizeof (*ret));
|
|
|
|
LBV_COEFFICIENTS (ret) = lambda_vector_new (size);
|
|
|
|
LBV_SIZE (ret) = size;
|
|
|
|
LBV_DENOMINATOR (ret) = 1;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Compute the new coefficients for the vector based on the
|
|
|
|
*inverse* of the transformation matrix. */
|
|
|
|
|
|
|
|
lambda_body_vector
|
|
|
|
lambda_body_vector_compute_new (lambda_trans_matrix transform,
|
|
|
|
lambda_body_vector vect)
|
|
|
|
{
|
|
|
|
lambda_body_vector temp;
|
|
|
|
int depth;
|
|
|
|
|
|
|
|
/* Make sure the matrix is square. */
|
2004-09-08 17:28:56 +02:00
|
|
|
gcc_assert (LTM_ROWSIZE (transform) == LTM_COLSIZE (transform));
|
2004-08-26 19:10:50 +02:00
|
|
|
|
|
|
|
depth = LTM_ROWSIZE (transform);
|
|
|
|
|
|
|
|
temp = lambda_body_vector_new (depth);
|
|
|
|
LBV_DENOMINATOR (temp) =
|
|
|
|
LBV_DENOMINATOR (vect) * LTM_DENOMINATOR (transform);
|
|
|
|
lambda_vector_matrix_mult (LBV_COEFFICIENTS (vect), depth,
|
|
|
|
LTM_MATRIX (transform), depth,
|
|
|
|
LBV_COEFFICIENTS (temp));
|
|
|
|
LBV_SIZE (temp) = LBV_SIZE (vect);
|
|
|
|
return temp;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Print out a lambda body vector. */
|
|
|
|
|
|
|
|
void
|
|
|
|
print_lambda_body_vector (FILE * outfile, lambda_body_vector body)
|
|
|
|
{
|
|
|
|
print_lambda_vector (outfile, LBV_COEFFICIENTS (body), LBV_SIZE (body));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return TRUE if two linear expressions are equal. */
|
|
|
|
|
|
|
|
static bool
|
|
|
|
lle_equal (lambda_linear_expression lle1, lambda_linear_expression lle2,
|
|
|
|
int depth, int invariants)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (lle1 == NULL || lle2 == NULL)
|
|
|
|
return false;
|
|
|
|
if (LLE_CONSTANT (lle1) != LLE_CONSTANT (lle2))
|
|
|
|
return false;
|
|
|
|
if (LLE_DENOMINATOR (lle1) != LLE_DENOMINATOR (lle2))
|
|
|
|
return false;
|
|
|
|
for (i = 0; i < depth; i++)
|
|
|
|
if (LLE_COEFFICIENTS (lle1)[i] != LLE_COEFFICIENTS (lle2)[i])
|
|
|
|
return false;
|
|
|
|
for (i = 0; i < invariants; i++)
|
|
|
|
if (LLE_INVARIANT_COEFFICIENTS (lle1)[i] !=
|
|
|
|
LLE_INVARIANT_COEFFICIENTS (lle2)[i])
|
|
|
|
return false;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Create a new linear expression with dimension DIM, and total number
|
|
|
|
of invariants INVARIANTS. */
|
|
|
|
|
|
|
|
lambda_linear_expression
|
|
|
|
lambda_linear_expression_new (int dim, int invariants)
|
|
|
|
{
|
|
|
|
lambda_linear_expression ret;
|
|
|
|
|
|
|
|
ret = ggc_alloc_cleared (sizeof (*ret));
|
|
|
|
|
|
|
|
LLE_COEFFICIENTS (ret) = lambda_vector_new (dim);
|
|
|
|
LLE_CONSTANT (ret) = 0;
|
|
|
|
LLE_INVARIANT_COEFFICIENTS (ret) = lambda_vector_new (invariants);
|
|
|
|
LLE_DENOMINATOR (ret) = 1;
|
|
|
|
LLE_NEXT (ret) = NULL;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Print out a linear expression EXPR, with SIZE coefficients, to OUTFILE.
|
|
|
|
The starting letter used for variable names is START. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
print_linear_expression (FILE * outfile, lambda_vector expr, int size,
|
|
|
|
char start)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
bool first = true;
|
|
|
|
for (i = 0; i < size; i++)
|
|
|
|
{
|
|
|
|
if (expr[i] != 0)
|
|
|
|
{
|
|
|
|
if (first)
|
|
|
|
{
|
|
|
|
if (expr[i] < 0)
|
|
|
|
fprintf (outfile, "-");
|
|
|
|
first = false;
|
|
|
|
}
|
|
|
|
else if (expr[i] > 0)
|
|
|
|
fprintf (outfile, " + ");
|
|
|
|
else
|
|
|
|
fprintf (outfile, " - ");
|
|
|
|
if (abs (expr[i]) == 1)
|
|
|
|
fprintf (outfile, "%c", start + i);
|
|
|
|
else
|
|
|
|
fprintf (outfile, "%d%c", abs (expr[i]), start + i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Print out a lambda linear expression structure, EXPR, to OUTFILE. The
|
|
|
|
depth/number of coefficients is given by DEPTH, the number of invariants is
|
|
|
|
given by INVARIANTS, and the character to start variable names with is given
|
|
|
|
by START. */
|
|
|
|
|
|
|
|
void
|
|
|
|
print_lambda_linear_expression (FILE * outfile,
|
|
|
|
lambda_linear_expression expr,
|
|
|
|
int depth, int invariants, char start)
|
|
|
|
{
|
|
|
|
fprintf (outfile, "\tLinear expression: ");
|
|
|
|
print_linear_expression (outfile, LLE_COEFFICIENTS (expr), depth, start);
|
|
|
|
fprintf (outfile, " constant: %d ", LLE_CONSTANT (expr));
|
|
|
|
fprintf (outfile, " invariants: ");
|
|
|
|
print_linear_expression (outfile, LLE_INVARIANT_COEFFICIENTS (expr),
|
|
|
|
invariants, 'A');
|
|
|
|
fprintf (outfile, " denominator: %d\n", LLE_DENOMINATOR (expr));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Print a lambda loop structure LOOP to OUTFILE. The depth/number of
|
|
|
|
coefficients is given by DEPTH, the number of invariants is
|
|
|
|
given by INVARIANTS, and the character to start variable names with is given
|
c-common.c, [...]: Fix comment formatting.
* c-common.c, c-decl.c, combine.c, defaults.h, fold-const.c,
gimplify.c, gthr-nks.h, hooks.c, lambda-code.c, lambda-mat.c,
stor-layout.c, target.h, tree-cfg.c, tree-chrec.c,
tree-if-conv.c, tree-inline.c, tree-into-ssa.c,
tree-mudflap.c, tree-optimize.c, tree-scalar-evolution.c,
tree-ssa-alias.c, tree-ssa-ccp.c, tree-ssa-dce.c,
tree-ssa-pre.c, tree-vectorizer.c, tree-vectorizer.h, tree.h,
vec.h: Fix comment formatting.
From-SVN: r87105
2004-09-05 18:05:06 +02:00
|
|
|
by START. */
|
2004-08-26 19:10:50 +02:00
|
|
|
|
|
|
|
void
|
|
|
|
print_lambda_loop (FILE * outfile, lambda_loop loop, int depth,
|
|
|
|
int invariants, char start)
|
|
|
|
{
|
|
|
|
int step;
|
|
|
|
lambda_linear_expression expr;
|
|
|
|
|
2004-09-08 17:28:56 +02:00
|
|
|
gcc_assert (loop);
|
2004-08-26 19:10:50 +02:00
|
|
|
|
|
|
|
expr = LL_LINEAR_OFFSET (loop);
|
|
|
|
step = LL_STEP (loop);
|
|
|
|
fprintf (outfile, " step size = %d \n", step);
|
|
|
|
|
|
|
|
if (expr)
|
|
|
|
{
|
|
|
|
fprintf (outfile, " linear offset: \n");
|
|
|
|
print_lambda_linear_expression (outfile, expr, depth, invariants,
|
|
|
|
start);
|
|
|
|
}
|
|
|
|
|
|
|
|
fprintf (outfile, " lower bound: \n");
|
|
|
|
for (expr = LL_LOWER_BOUND (loop); expr != NULL; expr = LLE_NEXT (expr))
|
|
|
|
print_lambda_linear_expression (outfile, expr, depth, invariants, start);
|
|
|
|
fprintf (outfile, " upper bound: \n");
|
|
|
|
for (expr = LL_UPPER_BOUND (loop); expr != NULL; expr = LLE_NEXT (expr))
|
|
|
|
print_lambda_linear_expression (outfile, expr, depth, invariants, start);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Create a new loop nest structure with DEPTH loops, and INVARIANTS as the
|
|
|
|
number of invariants. */
|
|
|
|
|
|
|
|
lambda_loopnest
|
|
|
|
lambda_loopnest_new (int depth, int invariants)
|
|
|
|
{
|
|
|
|
lambda_loopnest ret;
|
|
|
|
ret = ggc_alloc (sizeof (*ret));
|
|
|
|
|
|
|
|
LN_LOOPS (ret) = ggc_alloc_cleared (depth * sizeof (lambda_loop));
|
|
|
|
LN_DEPTH (ret) = depth;
|
|
|
|
LN_INVARIANTS (ret) = invariants;
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Print a lambda loopnest structure, NEST, to OUTFILE. The starting
|
|
|
|
character to use for loop names is given by START. */
|
|
|
|
|
|
|
|
void
|
|
|
|
print_lambda_loopnest (FILE * outfile, lambda_loopnest nest, char start)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < LN_DEPTH (nest); i++)
|
|
|
|
{
|
|
|
|
fprintf (outfile, "Loop %c\n", start + i);
|
|
|
|
print_lambda_loop (outfile, LN_LOOPS (nest)[i], LN_DEPTH (nest),
|
|
|
|
LN_INVARIANTS (nest), 'i');
|
|
|
|
fprintf (outfile, "\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Allocate a new lattice structure of DEPTH x DEPTH, with INVARIANTS number
|
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
|
|
|
of invariants. */
|
2004-08-26 19:10:50 +02:00
|
|
|
|
|
|
|
static lambda_lattice
|
|
|
|
lambda_lattice_new (int depth, int invariants)
|
|
|
|
{
|
|
|
|
lambda_lattice ret;
|
|
|
|
ret = ggc_alloc (sizeof (*ret));
|
|
|
|
LATTICE_BASE (ret) = lambda_matrix_new (depth, depth);
|
|
|
|
LATTICE_ORIGIN (ret) = lambda_vector_new (depth);
|
|
|
|
LATTICE_ORIGIN_INVARIANTS (ret) = lambda_matrix_new (depth, invariants);
|
|
|
|
LATTICE_DIMENSION (ret) = depth;
|
|
|
|
LATTICE_INVARIANTS (ret) = invariants;
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Compute the lattice base for NEST. The lattice base is essentially a
|
|
|
|
non-singular transform from a dense base space to a sparse iteration space.
|
|
|
|
We use it so that we don't have to specially handle the case of a sparse
|
|
|
|
iteration space in other parts of the algorithm. As a result, this routine
|
|
|
|
only does something interesting (IE produce a matrix that isn't the
|
|
|
|
identity matrix) if NEST is a sparse space. */
|
|
|
|
|
|
|
|
static lambda_lattice
|
|
|
|
lambda_lattice_compute_base (lambda_loopnest nest)
|
|
|
|
{
|
|
|
|
lambda_lattice ret;
|
|
|
|
int depth, invariants;
|
|
|
|
lambda_matrix base;
|
|
|
|
|
|
|
|
int i, j, step;
|
|
|
|
lambda_loop loop;
|
|
|
|
lambda_linear_expression expression;
|
|
|
|
|
|
|
|
depth = LN_DEPTH (nest);
|
|
|
|
invariants = LN_INVARIANTS (nest);
|
|
|
|
|
|
|
|
ret = lambda_lattice_new (depth, invariants);
|
|
|
|
base = LATTICE_BASE (ret);
|
|
|
|
for (i = 0; i < depth; i++)
|
|
|
|
{
|
|
|
|
loop = LN_LOOPS (nest)[i];
|
2004-09-08 17:28:56 +02:00
|
|
|
gcc_assert (loop);
|
2004-08-26 19:10:50 +02:00
|
|
|
step = LL_STEP (loop);
|
|
|
|
/* If we have a step of 1, then the base is one, and the
|
|
|
|
origin and invariant coefficients are 0. */
|
|
|
|
if (step == 1)
|
|
|
|
{
|
|
|
|
for (j = 0; j < depth; j++)
|
|
|
|
base[i][j] = 0;
|
|
|
|
base[i][i] = 1;
|
|
|
|
LATTICE_ORIGIN (ret)[i] = 0;
|
|
|
|
for (j = 0; j < invariants; j++)
|
|
|
|
LATTICE_ORIGIN_INVARIANTS (ret)[i][j] = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Otherwise, we need the lower bound expression (which must
|
|
|
|
be an affine function) to determine the base. */
|
|
|
|
expression = LL_LOWER_BOUND (loop);
|
2004-11-01 19:08:02 +01:00
|
|
|
gcc_assert (expression && !LLE_NEXT (expression)
|
2004-09-08 17:28:56 +02:00
|
|
|
&& LLE_DENOMINATOR (expression) == 1);
|
2004-08-26 19:10:50 +02:00
|
|
|
|
|
|
|
/* The lower triangular portion of the base is going to be the
|
|
|
|
coefficient times the step */
|
|
|
|
for (j = 0; j < i; j++)
|
|
|
|
base[i][j] = LLE_COEFFICIENTS (expression)[j]
|
|
|
|
* LL_STEP (LN_LOOPS (nest)[j]);
|
|
|
|
base[i][i] = step;
|
|
|
|
for (j = i + 1; j < depth; j++)
|
|
|
|
base[i][j] = 0;
|
|
|
|
|
|
|
|
/* Origin for this loop is the constant of the lower bound
|
|
|
|
expression. */
|
|
|
|
LATTICE_ORIGIN (ret)[i] = LLE_CONSTANT (expression);
|
|
|
|
|
|
|
|
/* Coefficient for the invariants are equal to the invariant
|
|
|
|
coefficients in the expression. */
|
|
|
|
for (j = 0; j < invariants; j++)
|
|
|
|
LATTICE_ORIGIN_INVARIANTS (ret)[i][j] =
|
|
|
|
LLE_INVARIANT_COEFFICIENTS (expression)[j];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Compute the least common multiple of two numbers A and B . */
|
|
|
|
|
2006-11-12 21:05:49 +01:00
|
|
|
int
|
|
|
|
least_common_multiple (int a, int b)
|
2004-08-26 19:10:50 +02:00
|
|
|
{
|
|
|
|
return (abs (a) * abs (b) / gcd (a, b));
|
|
|
|
}
|
|
|
|
|
2004-10-06 21:40:54 +02:00
|
|
|
/* Perform Fourier-Motzkin elimination to calculate the bounds of the
|
cgraphunit.c, [...]: Fix comment typos.
* cgraphunit.c, dbxout.c, flow.c, gcse.c, gimplify.c,
lambda-code.c, loop.c, machmode.def, mips-tfile.c,
modulo-sched.c, passes.c, postreload-gcse.c, tree-eh.c,
tree-ssa-ccp.c, varasm.c, config/frv/frv.c, config/frv/frv.h,
config/frv/frv.md, config/i386/i386.c, config/i386/i386.h,
config/i386/i386.md, config/rs6000/predicates.md,
config/rs6000/rs6000.c, config/s390/fixdfdi.h,
config/s390/s390.c, config/stormy16/stormy16.c,
config/stormy16/stormy16.md, config/vax/vax.md: Fix comment
typos.
From-SVN: r97362
2005-04-01 05:42:55 +02:00
|
|
|
auxiliary nest.
|
2004-11-01 19:08:02 +01:00
|
|
|
Fourier-Motzkin is a way of reducing systems of linear inequalities so that
|
2004-10-06 21:40:54 +02:00
|
|
|
it is easy to calculate the answer and bounds.
|
|
|
|
A sketch of how it works:
|
|
|
|
Given a system of linear inequalities, ai * xj >= bk, you can always
|
|
|
|
rewrite the constraints so they are all of the form
|
|
|
|
a <= x, or x <= b, or x >= constant for some x in x1 ... xj (and some b
|
|
|
|
in b1 ... bk, and some a in a1...ai)
|
|
|
|
You can then eliminate this x from the non-constant inequalities by
|
|
|
|
rewriting these as a <= b, x >= constant, and delete the x variable.
|
|
|
|
You can then repeat this for any remaining x variables, and then we have
|
|
|
|
an easy to use variable <= constant (or no variables at all) form that we
|
|
|
|
can construct our bounds from.
|
|
|
|
|
|
|
|
In our case, each time we eliminate, we construct part of the bound from
|
|
|
|
the ith variable, then delete the ith variable.
|
|
|
|
|
|
|
|
Remember the constant are in our vector a, our coefficient matrix is A,
|
|
|
|
and our invariant coefficient matrix is B.
|
|
|
|
|
|
|
|
SIZE is the size of the matrices being passed.
|
|
|
|
DEPTH is the loop nest depth.
|
|
|
|
INVARIANTS is the number of loop invariants.
|
|
|
|
A, B, and a are the coefficient matrix, invariant coefficient, and a
|
|
|
|
vector of constants, respectively. */
|
|
|
|
|
|
|
|
static lambda_loopnest
|
|
|
|
compute_nest_using_fourier_motzkin (int size,
|
|
|
|
int depth,
|
|
|
|
int invariants,
|
|
|
|
lambda_matrix A,
|
|
|
|
lambda_matrix B,
|
|
|
|
lambda_vector a)
|
|
|
|
{
|
|
|
|
|
|
|
|
int multiple, f1, f2;
|
|
|
|
int i, j, k;
|
|
|
|
lambda_linear_expression expression;
|
|
|
|
lambda_loop loop;
|
|
|
|
lambda_loopnest auxillary_nest;
|
|
|
|
lambda_matrix swapmatrix, A1, B1;
|
|
|
|
lambda_vector swapvector, a1;
|
|
|
|
int newsize;
|
|
|
|
|
|
|
|
A1 = lambda_matrix_new (128, depth);
|
|
|
|
B1 = lambda_matrix_new (128, invariants);
|
|
|
|
a1 = lambda_vector_new (128);
|
|
|
|
|
|
|
|
auxillary_nest = lambda_loopnest_new (depth, invariants);
|
|
|
|
|
|
|
|
for (i = depth - 1; i >= 0; i--)
|
|
|
|
{
|
|
|
|
loop = lambda_loop_new ();
|
|
|
|
LN_LOOPS (auxillary_nest)[i] = loop;
|
|
|
|
LL_STEP (loop) = 1;
|
|
|
|
|
|
|
|
for (j = 0; j < size; j++)
|
|
|
|
{
|
|
|
|
if (A[j][i] < 0)
|
|
|
|
{
|
|
|
|
/* Any linear expression in the matrix with a coefficient less
|
|
|
|
than 0 becomes part of the new lower bound. */
|
|
|
|
expression = lambda_linear_expression_new (depth, invariants);
|
|
|
|
|
|
|
|
for (k = 0; k < i; k++)
|
|
|
|
LLE_COEFFICIENTS (expression)[k] = A[j][k];
|
|
|
|
|
|
|
|
for (k = 0; k < invariants; k++)
|
|
|
|
LLE_INVARIANT_COEFFICIENTS (expression)[k] = -1 * B[j][k];
|
|
|
|
|
|
|
|
LLE_DENOMINATOR (expression) = -1 * A[j][i];
|
|
|
|
LLE_CONSTANT (expression) = -1 * a[j];
|
|
|
|
|
|
|
|
/* Ignore if identical to the existing lower bound. */
|
|
|
|
if (!lle_equal (LL_LOWER_BOUND (loop),
|
|
|
|
expression, depth, invariants))
|
|
|
|
{
|
|
|
|
LLE_NEXT (expression) = LL_LOWER_BOUND (loop);
|
|
|
|
LL_LOWER_BOUND (loop) = expression;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
else if (A[j][i] > 0)
|
|
|
|
{
|
|
|
|
/* Any linear expression with a coefficient greater than 0
|
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
|
|
|
becomes part of the new upper bound. */
|
2004-10-06 21:40:54 +02:00
|
|
|
expression = lambda_linear_expression_new (depth, invariants);
|
|
|
|
for (k = 0; k < i; k++)
|
|
|
|
LLE_COEFFICIENTS (expression)[k] = -1 * A[j][k];
|
|
|
|
|
|
|
|
for (k = 0; k < invariants; k++)
|
|
|
|
LLE_INVARIANT_COEFFICIENTS (expression)[k] = B[j][k];
|
|
|
|
|
|
|
|
LLE_DENOMINATOR (expression) = A[j][i];
|
|
|
|
LLE_CONSTANT (expression) = a[j];
|
|
|
|
|
|
|
|
/* Ignore if identical to the existing upper bound. */
|
|
|
|
if (!lle_equal (LL_UPPER_BOUND (loop),
|
|
|
|
expression, depth, invariants))
|
|
|
|
{
|
|
|
|
LLE_NEXT (expression) = LL_UPPER_BOUND (loop);
|
|
|
|
LL_UPPER_BOUND (loop) = expression;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* This portion creates a new system of linear inequalities by deleting
|
|
|
|
the i'th variable, reducing the system by one variable. */
|
|
|
|
newsize = 0;
|
|
|
|
for (j = 0; j < size; j++)
|
|
|
|
{
|
|
|
|
/* If the coefficient for the i'th variable is 0, then we can just
|
|
|
|
eliminate the variable straightaway. Otherwise, we have to
|
|
|
|
multiply through by the coefficients we are eliminating. */
|
|
|
|
if (A[j][i] == 0)
|
|
|
|
{
|
|
|
|
lambda_vector_copy (A[j], A1[newsize], depth);
|
|
|
|
lambda_vector_copy (B[j], B1[newsize], invariants);
|
|
|
|
a1[newsize] = a[j];
|
|
|
|
newsize++;
|
|
|
|
}
|
|
|
|
else if (A[j][i] > 0)
|
|
|
|
{
|
|
|
|
for (k = 0; k < size; k++)
|
|
|
|
{
|
|
|
|
if (A[k][i] < 0)
|
|
|
|
{
|
2006-11-12 21:05:49 +01:00
|
|
|
multiple = least_common_multiple (A[j][i], A[k][i]);
|
2004-10-06 21:40:54 +02:00
|
|
|
f1 = multiple / A[j][i];
|
|
|
|
f2 = -1 * multiple / A[k][i];
|
|
|
|
|
|
|
|
lambda_vector_add_mc (A[j], f1, A[k], f2,
|
|
|
|
A1[newsize], depth);
|
|
|
|
lambda_vector_add_mc (B[j], f1, B[k], f2,
|
|
|
|
B1[newsize], invariants);
|
|
|
|
a1[newsize] = f1 * a[j] + f2 * a[k];
|
|
|
|
newsize++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
swapmatrix = A;
|
|
|
|
A = A1;
|
|
|
|
A1 = swapmatrix;
|
|
|
|
|
|
|
|
swapmatrix = B;
|
|
|
|
B = B1;
|
|
|
|
B1 = swapmatrix;
|
|
|
|
|
|
|
|
swapvector = a;
|
|
|
|
a = a1;
|
|
|
|
a1 = swapvector;
|
|
|
|
|
|
|
|
size = newsize;
|
|
|
|
}
|
|
|
|
|
|
|
|
return auxillary_nest;
|
|
|
|
}
|
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
/* Compute the loop bounds for the auxiliary space NEST.
|
2004-11-03 18:32:34 +01:00
|
|
|
Input system used is Ax <= b. TRANS is the unimodular transformation.
|
|
|
|
Given the original nest, this function will
|
|
|
|
1. Convert the nest into matrix form, which consists of a matrix for the
|
|
|
|
coefficients, a matrix for the
|
|
|
|
invariant coefficients, and a vector for the constants.
|
|
|
|
2. Use the matrix form to calculate the lattice base for the nest (which is
|
|
|
|
a dense space)
|
|
|
|
3. Compose the dense space transform with the user specified transform, to
|
|
|
|
get a transform we can easily calculate transformed bounds for.
|
|
|
|
4. Multiply the composed transformation matrix times the matrix form of the
|
|
|
|
loop.
|
|
|
|
5. Transform the newly created matrix (from step 4) back into a loop nest
|
cfgcleanup.c, [...]: Fix comment typos.
* cfgcleanup.c, cfgexpand.c, cgraphunit.c, config/arm/arm.c,
config/fr30/fr30.md, config/i386/i386-interix.h,
config/i386/i386.c, config/i386/i386.md, config/sh/superh.h,
config/sh/superh64.h, config/v850/v850.c, df-core.c,
df-problems.c, df.h, except.c, final.c, haifa-sched.c,
lambda-code.c, libgcc2.h, omp-low.c, optabs.c, predict.c,
reload.c, tree-flow.h, tree-outof-ssa.c, tree-ssa-dce.c,
tree-ssa-pre.c, tree-vect-transform.c: Fix comment typos.
Follow spelling conventions.
* doc/invoke.texi, doc/rtl.texi, doc/tm.texi: Fix typos.
Follow spelling conventions.
From-SVN: r114168
2006-05-28 19:46:46 +02:00
|
|
|
using Fourier-Motzkin elimination to figure out the bounds. */
|
2004-08-26 19:10:50 +02:00
|
|
|
|
|
|
|
static lambda_loopnest
|
|
|
|
lambda_compute_auxillary_space (lambda_loopnest nest,
|
|
|
|
lambda_trans_matrix trans)
|
|
|
|
{
|
2004-10-06 21:40:54 +02:00
|
|
|
lambda_matrix A, B, A1, B1;
|
|
|
|
lambda_vector a, a1;
|
2004-08-26 19:10:50 +02:00
|
|
|
lambda_matrix invertedtrans;
|
2005-03-13 16:54:15 +01:00
|
|
|
int depth, invariants, size;
|
2004-10-06 21:40:54 +02:00
|
|
|
int i, j;
|
2004-08-26 19:10:50 +02:00
|
|
|
lambda_loop loop;
|
|
|
|
lambda_linear_expression expression;
|
|
|
|
lambda_lattice lattice;
|
|
|
|
|
|
|
|
depth = LN_DEPTH (nest);
|
|
|
|
invariants = LN_INVARIANTS (nest);
|
|
|
|
|
|
|
|
/* Unfortunately, we can't know the number of constraints we'll have
|
|
|
|
ahead of time, but this should be enough even in ridiculous loop nest
|
alias.c (true_dependence): Remove 'abort' from comments.
* alias.c (true_dependence): Remove 'abort' from comments. Use
gcc_assert and gcc_unreachable as appropriate.
(canon_true_dependence): Likewise.
* bb-reorder.c (connect_traces): Likewise.
* c-common.c (c_add_case_label): Likewise.
* c-decl.c (finish_function): Likewise.
* caller-save.c (insert_restore, insert_save): Likewise.
* cfg.c (update_bb_profile_for_threading): Likewise.
* cfganal.c (flow_active_insn_p): Likewise.
* cfgexpand.c (add_reg_br_prob_note): Likewise.
* cfgrtl.c (rtl_redirect_edge_and_branch_force, rtl_split_edge,
cfg_layout_merge_blocks): Likewise.
* ifcvt.c (cond_exec_process_insns, merge_if_block,
find_if_block): Likewise.
* integrate.c (allocate_initial_values): Likewise.
* jump.c (reverse_condition, reverse_condition_maybe_unordered,
swap_condition, unsigned_condition, signed_condition,
mark_jump_label, invert_jump_1, rtx_renumbered_equal_p,
reg_or_subregno): Likewise.
* lambda-code.c (lambda_compute_auxillary_space,
lambda_transform_legal_p): Likewise.
* lambda-mat.c (lambda_matrix_inverse_hard): Likewise.
* langhooks.c (lhd_set_decl_assembler_name, lhd_type_promotes_to,
lhd_incomplete_type_error, lhd_expand_expr,
lhd_types_compatible_p, lhd_tree_size): Likewise.
* lcm.c (create_pre_exit, optimize_mode_switching): Likewise.
* local-alloc.c (update_equiv_regs): Likewise.
* loop-unroll.c (peel_loop_completely
unroll_loop_constant_iterations, unroll_loop_runtime_iterations,
peel_loop_simple, unroll_loop_stupid,
analyze_iv_to_split_insn): Likewise.
* loop.c (gen_prefetch, find_and_verify_loops,
basic_induction_var): Likewise.
* modulo-sched.c (normalize_sched_times, check_nodes_order): Likewise.
* value-prof.c (tree_find_values_to_profile): Likewise.
* varasm.c (named_section, default_assemble_integer,
decode_addr_const): Likewise.
From-SVN: r98508
2005-04-21 17:47:33 +02:00
|
|
|
cases. We must not go over this limit. */
|
2004-08-26 19:10:50 +02:00
|
|
|
A = lambda_matrix_new (128, depth);
|
|
|
|
B = lambda_matrix_new (128, invariants);
|
|
|
|
a = lambda_vector_new (128);
|
|
|
|
|
|
|
|
A1 = lambda_matrix_new (128, depth);
|
|
|
|
B1 = lambda_matrix_new (128, invariants);
|
|
|
|
a1 = lambda_vector_new (128);
|
|
|
|
|
|
|
|
/* Store the bounds in the equation matrix A, constant vector a, and
|
|
|
|
invariant matrix B, so that we have Ax <= a + B.
|
|
|
|
This requires a little equation rearranging so that everything is on the
|
|
|
|
correct side of the inequality. */
|
|
|
|
size = 0;
|
|
|
|
for (i = 0; i < depth; i++)
|
|
|
|
{
|
|
|
|
loop = LN_LOOPS (nest)[i];
|
|
|
|
|
|
|
|
/* First we do the lower bound. */
|
|
|
|
if (LL_STEP (loop) > 0)
|
|
|
|
expression = LL_LOWER_BOUND (loop);
|
|
|
|
else
|
|
|
|
expression = LL_UPPER_BOUND (loop);
|
|
|
|
|
|
|
|
for (; expression != NULL; expression = LLE_NEXT (expression))
|
|
|
|
{
|
|
|
|
/* Fill in the coefficient. */
|
|
|
|
for (j = 0; j < i; j++)
|
|
|
|
A[size][j] = LLE_COEFFICIENTS (expression)[j];
|
|
|
|
|
|
|
|
/* And the invariant coefficient. */
|
|
|
|
for (j = 0; j < invariants; j++)
|
|
|
|
B[size][j] = LLE_INVARIANT_COEFFICIENTS (expression)[j];
|
|
|
|
|
|
|
|
/* And the constant. */
|
|
|
|
a[size] = LLE_CONSTANT (expression);
|
|
|
|
|
|
|
|
/* Convert (2x+3y+2+b)/4 <= z to 2x+3y-4z <= -2-b. IE put all
|
|
|
|
constants and single variables on */
|
|
|
|
A[size][i] = -1 * LLE_DENOMINATOR (expression);
|
|
|
|
a[size] *= -1;
|
|
|
|
for (j = 0; j < invariants; j++)
|
|
|
|
B[size][j] *= -1;
|
|
|
|
|
|
|
|
size++;
|
|
|
|
/* Need to increase matrix sizes above. */
|
2004-09-08 17:28:56 +02:00
|
|
|
gcc_assert (size <= 127);
|
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Then do the exact same thing for the upper bounds. */
|
|
|
|
if (LL_STEP (loop) > 0)
|
|
|
|
expression = LL_UPPER_BOUND (loop);
|
|
|
|
else
|
|
|
|
expression = LL_LOWER_BOUND (loop);
|
|
|
|
|
|
|
|
for (; expression != NULL; expression = LLE_NEXT (expression))
|
|
|
|
{
|
|
|
|
/* Fill in the coefficient. */
|
|
|
|
for (j = 0; j < i; j++)
|
|
|
|
A[size][j] = LLE_COEFFICIENTS (expression)[j];
|
|
|
|
|
|
|
|
/* And the invariant coefficient. */
|
|
|
|
for (j = 0; j < invariants; j++)
|
|
|
|
B[size][j] = LLE_INVARIANT_COEFFICIENTS (expression)[j];
|
|
|
|
|
|
|
|
/* And the constant. */
|
|
|
|
a[size] = LLE_CONSTANT (expression);
|
|
|
|
|
|
|
|
/* Convert z <= (2x+3y+2+b)/4 to -2x-3y+4z <= 2+b. */
|
|
|
|
for (j = 0; j < i; j++)
|
|
|
|
A[size][j] *= -1;
|
|
|
|
A[size][i] = LLE_DENOMINATOR (expression);
|
|
|
|
size++;
|
|
|
|
/* Need to increase matrix sizes above. */
|
2004-09-08 17:28:56 +02:00
|
|
|
gcc_assert (size <= 127);
|
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Compute the lattice base x = base * y + origin, where y is the
|
|
|
|
base space. */
|
|
|
|
lattice = lambda_lattice_compute_base (nest);
|
|
|
|
|
|
|
|
/* Ax <= a + B then becomes ALy <= a+B - A*origin. L is the lattice base */
|
|
|
|
|
|
|
|
/* A1 = A * L */
|
|
|
|
lambda_matrix_mult (A, LATTICE_BASE (lattice), A1, size, depth, depth);
|
|
|
|
|
|
|
|
/* a1 = a - A * origin constant. */
|
|
|
|
lambda_matrix_vector_mult (A, size, depth, LATTICE_ORIGIN (lattice), a1);
|
|
|
|
lambda_vector_add_mc (a, 1, a1, -1, a1, size);
|
|
|
|
|
|
|
|
/* B1 = B - A * origin invariant. */
|
|
|
|
lambda_matrix_mult (A, LATTICE_ORIGIN_INVARIANTS (lattice), B1, size, depth,
|
|
|
|
invariants);
|
|
|
|
lambda_matrix_add_mc (B, 1, B1, -1, B1, size, invariants);
|
|
|
|
|
|
|
|
/* Now compute the auxiliary space bounds by first inverting U, multiplying
|
cfgcleanup.c, [...]: Fix comment typos.
* cfgcleanup.c, cfgexpand.c, cgraphunit.c, config/arm/arm.c,
config/fr30/fr30.md, config/i386/i386-interix.h,
config/i386/i386.c, config/i386/i386.md, config/sh/superh.h,
config/sh/superh64.h, config/v850/v850.c, df-core.c,
df-problems.c, df.h, except.c, final.c, haifa-sched.c,
lambda-code.c, libgcc2.h, omp-low.c, optabs.c, predict.c,
reload.c, tree-flow.h, tree-outof-ssa.c, tree-ssa-dce.c,
tree-ssa-pre.c, tree-vect-transform.c: Fix comment typos.
Follow spelling conventions.
* doc/invoke.texi, doc/rtl.texi, doc/tm.texi: Fix typos.
Follow spelling conventions.
From-SVN: r114168
2006-05-28 19:46:46 +02:00
|
|
|
it by A1, then performing Fourier-Motzkin. */
|
2004-08-26 19:10:50 +02:00
|
|
|
|
|
|
|
invertedtrans = lambda_matrix_new (depth, depth);
|
|
|
|
|
|
|
|
/* Compute the inverse of U. */
|
2005-03-13 16:54:15 +01:00
|
|
|
lambda_matrix_inverse (LTM_MATRIX (trans),
|
|
|
|
invertedtrans, depth);
|
2004-08-26 19:10:50 +02:00
|
|
|
|
|
|
|
/* A = A1 inv(U). */
|
|
|
|
lambda_matrix_mult (A1, invertedtrans, A, size, depth, depth);
|
|
|
|
|
2004-10-06 21:40:54 +02:00
|
|
|
return compute_nest_using_fourier_motzkin (size, depth, invariants,
|
|
|
|
A, B1, a1);
|
2004-08-26 19:10:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Compute the loop bounds for the target space, using the bounds of
|
2004-11-03 18:32:34 +01:00
|
|
|
the auxiliary nest AUXILLARY_NEST, and the triangular matrix H.
|
|
|
|
The target space loop bounds are computed by multiplying the triangular
|
cgraphunit.c, [...]: Fix comment typos.
* cgraphunit.c, dbxout.c, flow.c, gcse.c, gimplify.c,
lambda-code.c, loop.c, machmode.def, mips-tfile.c,
modulo-sched.c, passes.c, postreload-gcse.c, tree-eh.c,
tree-ssa-ccp.c, varasm.c, config/frv/frv.c, config/frv/frv.h,
config/frv/frv.md, config/i386/i386.c, config/i386/i386.h,
config/i386/i386.md, config/rs6000/predicates.md,
config/rs6000/rs6000.c, config/s390/fixdfdi.h,
config/s390/s390.c, config/stormy16/stormy16.c,
config/stormy16/stormy16.md, config/vax/vax.md: Fix comment
typos.
From-SVN: r97362
2005-04-01 05:42:55 +02:00
|
|
|
matrix H by the auxiliary nest, to get the new loop bounds. The sign of
|
2004-11-03 18:32:34 +01:00
|
|
|
the loop steps (positive or negative) is then used to swap the bounds if
|
|
|
|
the loop counts downwards.
|
2004-08-26 19:10:50 +02:00
|
|
|
Return the target loopnest. */
|
|
|
|
|
|
|
|
static lambda_loopnest
|
|
|
|
lambda_compute_target_space (lambda_loopnest auxillary_nest,
|
|
|
|
lambda_trans_matrix H, lambda_vector stepsigns)
|
|
|
|
{
|
|
|
|
lambda_matrix inverse, H1;
|
|
|
|
int determinant, i, j;
|
|
|
|
int gcd1, gcd2;
|
|
|
|
int factor;
|
|
|
|
|
|
|
|
lambda_loopnest target_nest;
|
|
|
|
int depth, invariants;
|
|
|
|
lambda_matrix target;
|
|
|
|
|
|
|
|
lambda_loop auxillary_loop, target_loop;
|
|
|
|
lambda_linear_expression expression, auxillary_expr, target_expr, tmp_expr;
|
|
|
|
|
|
|
|
depth = LN_DEPTH (auxillary_nest);
|
|
|
|
invariants = LN_INVARIANTS (auxillary_nest);
|
|
|
|
|
|
|
|
inverse = lambda_matrix_new (depth, depth);
|
|
|
|
determinant = lambda_matrix_inverse (LTM_MATRIX (H), inverse, depth);
|
|
|
|
|
|
|
|
/* H1 is H excluding its diagonal. */
|
|
|
|
H1 = lambda_matrix_new (depth, depth);
|
|
|
|
lambda_matrix_copy (LTM_MATRIX (H), H1, depth, depth);
|
|
|
|
|
|
|
|
for (i = 0; i < depth; i++)
|
|
|
|
H1[i][i] = 0;
|
|
|
|
|
|
|
|
/* Computes the linear offsets of the loop bounds. */
|
|
|
|
target = lambda_matrix_new (depth, depth);
|
|
|
|
lambda_matrix_mult (H1, inverse, target, depth, depth, depth);
|
|
|
|
|
|
|
|
target_nest = lambda_loopnest_new (depth, invariants);
|
|
|
|
|
|
|
|
for (i = 0; i < depth; i++)
|
|
|
|
{
|
|
|
|
|
|
|
|
/* Get a new loop structure. */
|
|
|
|
target_loop = lambda_loop_new ();
|
|
|
|
LN_LOOPS (target_nest)[i] = target_loop;
|
|
|
|
|
|
|
|
/* Computes the gcd of the coefficients of the linear part. */
|
tree-chrec.c (eq_evolutions_p): New.
* tree-chrec.c (eq_evolutions_p): New.
* tree-chrec.h (eq_evolutions_p): Declared.
* tree-data-ref.c: Fix formatting.
(datadep_stats, dependence_stats): New.
(gcd): Moved...
(print_direction_vector): New.
(dump_data_dependence_relation): Use print_direction_vector.
(object_analysis, create_data_ref): Handle COMPONENT_REF.
(compute_subscript_distance): Static.
(initialize_data_dependence_relation): Static. Get the number
of loops surrounding the references from the callers, and initialize
DDR_SIZE_VECT to nb_loops. Use both base_addr_differ_p and
base_object_differ_p analyzers.
(analyze_ziv_subscript, analyze_siv_subscript_cst_affine,
compute_overlap_steps_for_affine_1_2,
analyze_subscript_affine_affine): Count the classified dependences.
Print a message when a test failed.
(can_use_analyze_subscript_affine_affine): New.
(analyze_siv_subscript): Compute the data dependences on symbolic
scevs that verify can_use_analyze_subscript_affine_affine.
(chrec_steps_divide_constant_p): Returns true, false, or unknown.
(analyze_miv_subscript): Update use of chrec_steps_divide_constant_p.
Handle symbolic scevs.
(analyze_overlapping_iterations): Let symbolic affine scevs to be
analyzed.
(subscript_dependence_tester): Moved...
(build_classic_dist_vector, build_classic_dir_vector): Don't use
lambda_vector_clear on newly allocated vectors. Get nb_loops from
DDR_SIZE_VECT instead of getting it in parameter.
(subscript_dependence_tester): ... here. Take as a parameter
loop_nest_depth. Call build_classic_dist_vector and
build_classic_dir_vector.
(compute_affine_dependence): Update subscript_dependence_tester
parameters. Update datadep_stats counters. Call
compute_subscript_distance.
(compute_self_dependence): Save the dist and dir vectors. Call
compute_subscript_distance.
(ddr_p, DEF_VEC_P(ddr_p), DEF_VEC_ALLOC_P(ddr_p,heap)): Moved...
(compute_all_dependences): Reorder parameters as they were before
conversion to VEC. Pass nb_loops and loop_nest_depth. Don't call
compute_subscript_distance. Update the use of
compute_affine_dependence and initialize_data_dependence_relation.
(find_data_references_in_loop): Handle COMPONENT_REF.
(compute_data_dependences_for_loop): Initialize dependence_stats.
Don't call build_classic_dist_vector and build_classic_dir_vector.
Update the parameters of initialize_data_dependence_relation and
compute_all_dependences. Print the statistics from datadep_stats.
(analyze_all_data_dependences): Static. Not used until the pass for
checking the data dependences is contributed.
* tree-data-ref.h (ddr_p, DEF_VEC_P(ddr_p),
DEF_VEC_ALLOC_P(ddr_p,heap)): ... here.
(initialize_data_dependence_relation, compute_affine_dependence,
analyze_all_data_dependences, compute_subscript_distance): Removed.
(print_direction_vector): New.
* lambda.h (gcd): ... here.
(lambda_vector_gcd): Moved here from gcd_vector.
* lambda-code.c (gcd, gcd_vector): Removed.
(lambda_compute_target_space): Use lambda_vector_gcd. Fix formatting.
* Makefile.in (tree-vect-patterns.o): Depends on TREE_DATA_REF_H.
From-SVN: r111312
2006-02-20 21:25:54 +01:00
|
|
|
gcd1 = lambda_vector_gcd (target[i], i);
|
2004-08-26 19:10:50 +02:00
|
|
|
|
c-typeck.c, [...]: Fix comment formatting.
* c-typeck.c, defaults.h, dwarf.h, dwarf2out.c, fold-const.c,
gthr-dce.h, gthr-posix.h, gthr-solaris.h, gthr-win32.h,
lambda-code.c, lambda-mat.c, libgcc2.c, stmt.c,
tree-ssa-pre.c, tree-vn.c, tree.h: Fix comment formatting.
From-SVN: r88102
2004-09-25 16:36:40 +02:00
|
|
|
/* Include the denominator in the GCD. */
|
2004-08-26 19:10:50 +02:00
|
|
|
gcd1 = gcd (gcd1, determinant);
|
|
|
|
|
c-typeck.c, [...]: Fix comment formatting.
* c-typeck.c, defaults.h, dwarf.h, dwarf2out.c, fold-const.c,
gthr-dce.h, gthr-posix.h, gthr-solaris.h, gthr-win32.h,
lambda-code.c, lambda-mat.c, libgcc2.c, stmt.c,
tree-ssa-pre.c, tree-vn.c, tree.h: Fix comment formatting.
From-SVN: r88102
2004-09-25 16:36:40 +02:00
|
|
|
/* Now divide through by the gcd. */
|
2004-08-26 19:10:50 +02:00
|
|
|
for (j = 0; j < i; j++)
|
|
|
|
target[i][j] = target[i][j] / gcd1;
|
|
|
|
|
|
|
|
expression = lambda_linear_expression_new (depth, invariants);
|
|
|
|
lambda_vector_copy (target[i], LLE_COEFFICIENTS (expression), depth);
|
|
|
|
LLE_DENOMINATOR (expression) = determinant / gcd1;
|
|
|
|
LLE_CONSTANT (expression) = 0;
|
|
|
|
lambda_vector_clear (LLE_INVARIANT_COEFFICIENTS (expression),
|
|
|
|
invariants);
|
|
|
|
LL_LINEAR_OFFSET (target_loop) = expression;
|
|
|
|
}
|
|
|
|
|
c-typeck.c, [...]: Fix comment formatting.
* c-typeck.c, defaults.h, dwarf.h, dwarf2out.c, fold-const.c,
gthr-dce.h, gthr-posix.h, gthr-solaris.h, gthr-win32.h,
lambda-code.c, lambda-mat.c, libgcc2.c, stmt.c,
tree-ssa-pre.c, tree-vn.c, tree.h: Fix comment formatting.
From-SVN: r88102
2004-09-25 16:36:40 +02:00
|
|
|
/* For each loop, compute the new bounds from H. */
|
2004-08-26 19:10:50 +02:00
|
|
|
for (i = 0; i < depth; i++)
|
|
|
|
{
|
|
|
|
auxillary_loop = LN_LOOPS (auxillary_nest)[i];
|
|
|
|
target_loop = LN_LOOPS (target_nest)[i];
|
|
|
|
LL_STEP (target_loop) = LTM_MATRIX (H)[i][i];
|
|
|
|
factor = LTM_MATRIX (H)[i][i];
|
|
|
|
|
|
|
|
/* First we do the lower bound. */
|
|
|
|
auxillary_expr = LL_LOWER_BOUND (auxillary_loop);
|
|
|
|
|
|
|
|
for (; auxillary_expr != NULL;
|
|
|
|
auxillary_expr = LLE_NEXT (auxillary_expr))
|
|
|
|
{
|
|
|
|
target_expr = lambda_linear_expression_new (depth, invariants);
|
|
|
|
lambda_vector_matrix_mult (LLE_COEFFICIENTS (auxillary_expr),
|
|
|
|
depth, inverse, depth,
|
|
|
|
LLE_COEFFICIENTS (target_expr));
|
|
|
|
lambda_vector_mult_const (LLE_COEFFICIENTS (target_expr),
|
|
|
|
LLE_COEFFICIENTS (target_expr), depth,
|
|
|
|
factor);
|
|
|
|
|
|
|
|
LLE_CONSTANT (target_expr) = LLE_CONSTANT (auxillary_expr) * factor;
|
|
|
|
lambda_vector_copy (LLE_INVARIANT_COEFFICIENTS (auxillary_expr),
|
|
|
|
LLE_INVARIANT_COEFFICIENTS (target_expr),
|
|
|
|
invariants);
|
|
|
|
lambda_vector_mult_const (LLE_INVARIANT_COEFFICIENTS (target_expr),
|
|
|
|
LLE_INVARIANT_COEFFICIENTS (target_expr),
|
|
|
|
invariants, factor);
|
|
|
|
LLE_DENOMINATOR (target_expr) = LLE_DENOMINATOR (auxillary_expr);
|
|
|
|
|
|
|
|
if (!lambda_vector_zerop (LLE_COEFFICIENTS (target_expr), depth))
|
|
|
|
{
|
|
|
|
LLE_CONSTANT (target_expr) = LLE_CONSTANT (target_expr)
|
|
|
|
* determinant;
|
|
|
|
lambda_vector_mult_const (LLE_INVARIANT_COEFFICIENTS
|
|
|
|
(target_expr),
|
|
|
|
LLE_INVARIANT_COEFFICIENTS
|
|
|
|
(target_expr), invariants,
|
|
|
|
determinant);
|
|
|
|
LLE_DENOMINATOR (target_expr) =
|
|
|
|
LLE_DENOMINATOR (target_expr) * determinant;
|
|
|
|
}
|
|
|
|
/* Find the gcd and divide by it here, rather than doing it
|
|
|
|
at the tree level. */
|
tree-chrec.c (eq_evolutions_p): New.
* tree-chrec.c (eq_evolutions_p): New.
* tree-chrec.h (eq_evolutions_p): Declared.
* tree-data-ref.c: Fix formatting.
(datadep_stats, dependence_stats): New.
(gcd): Moved...
(print_direction_vector): New.
(dump_data_dependence_relation): Use print_direction_vector.
(object_analysis, create_data_ref): Handle COMPONENT_REF.
(compute_subscript_distance): Static.
(initialize_data_dependence_relation): Static. Get the number
of loops surrounding the references from the callers, and initialize
DDR_SIZE_VECT to nb_loops. Use both base_addr_differ_p and
base_object_differ_p analyzers.
(analyze_ziv_subscript, analyze_siv_subscript_cst_affine,
compute_overlap_steps_for_affine_1_2,
analyze_subscript_affine_affine): Count the classified dependences.
Print a message when a test failed.
(can_use_analyze_subscript_affine_affine): New.
(analyze_siv_subscript): Compute the data dependences on symbolic
scevs that verify can_use_analyze_subscript_affine_affine.
(chrec_steps_divide_constant_p): Returns true, false, or unknown.
(analyze_miv_subscript): Update use of chrec_steps_divide_constant_p.
Handle symbolic scevs.
(analyze_overlapping_iterations): Let symbolic affine scevs to be
analyzed.
(subscript_dependence_tester): Moved...
(build_classic_dist_vector, build_classic_dir_vector): Don't use
lambda_vector_clear on newly allocated vectors. Get nb_loops from
DDR_SIZE_VECT instead of getting it in parameter.
(subscript_dependence_tester): ... here. Take as a parameter
loop_nest_depth. Call build_classic_dist_vector and
build_classic_dir_vector.
(compute_affine_dependence): Update subscript_dependence_tester
parameters. Update datadep_stats counters. Call
compute_subscript_distance.
(compute_self_dependence): Save the dist and dir vectors. Call
compute_subscript_distance.
(ddr_p, DEF_VEC_P(ddr_p), DEF_VEC_ALLOC_P(ddr_p,heap)): Moved...
(compute_all_dependences): Reorder parameters as they were before
conversion to VEC. Pass nb_loops and loop_nest_depth. Don't call
compute_subscript_distance. Update the use of
compute_affine_dependence and initialize_data_dependence_relation.
(find_data_references_in_loop): Handle COMPONENT_REF.
(compute_data_dependences_for_loop): Initialize dependence_stats.
Don't call build_classic_dist_vector and build_classic_dir_vector.
Update the parameters of initialize_data_dependence_relation and
compute_all_dependences. Print the statistics from datadep_stats.
(analyze_all_data_dependences): Static. Not used until the pass for
checking the data dependences is contributed.
* tree-data-ref.h (ddr_p, DEF_VEC_P(ddr_p),
DEF_VEC_ALLOC_P(ddr_p,heap)): ... here.
(initialize_data_dependence_relation, compute_affine_dependence,
analyze_all_data_dependences, compute_subscript_distance): Removed.
(print_direction_vector): New.
* lambda.h (gcd): ... here.
(lambda_vector_gcd): Moved here from gcd_vector.
* lambda-code.c (gcd, gcd_vector): Removed.
(lambda_compute_target_space): Use lambda_vector_gcd. Fix formatting.
* Makefile.in (tree-vect-patterns.o): Depends on TREE_DATA_REF_H.
From-SVN: r111312
2006-02-20 21:25:54 +01:00
|
|
|
gcd1 = lambda_vector_gcd (LLE_COEFFICIENTS (target_expr), depth);
|
|
|
|
gcd2 = lambda_vector_gcd (LLE_INVARIANT_COEFFICIENTS (target_expr),
|
|
|
|
invariants);
|
2004-08-26 19:10:50 +02:00
|
|
|
gcd1 = gcd (gcd1, gcd2);
|
|
|
|
gcd1 = gcd (gcd1, LLE_CONSTANT (target_expr));
|
|
|
|
gcd1 = gcd (gcd1, LLE_DENOMINATOR (target_expr));
|
|
|
|
for (j = 0; j < depth; j++)
|
|
|
|
LLE_COEFFICIENTS (target_expr)[j] /= gcd1;
|
|
|
|
for (j = 0; j < invariants; j++)
|
|
|
|
LLE_INVARIANT_COEFFICIENTS (target_expr)[j] /= gcd1;
|
|
|
|
LLE_CONSTANT (target_expr) /= gcd1;
|
|
|
|
LLE_DENOMINATOR (target_expr) /= gcd1;
|
|
|
|
/* Ignore if identical to existing bound. */
|
|
|
|
if (!lle_equal (LL_LOWER_BOUND (target_loop), target_expr, depth,
|
|
|
|
invariants))
|
|
|
|
{
|
|
|
|
LLE_NEXT (target_expr) = LL_LOWER_BOUND (target_loop);
|
|
|
|
LL_LOWER_BOUND (target_loop) = target_expr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Now do the upper bound. */
|
|
|
|
auxillary_expr = LL_UPPER_BOUND (auxillary_loop);
|
|
|
|
|
|
|
|
for (; auxillary_expr != NULL;
|
|
|
|
auxillary_expr = LLE_NEXT (auxillary_expr))
|
|
|
|
{
|
|
|
|
target_expr = lambda_linear_expression_new (depth, invariants);
|
|
|
|
lambda_vector_matrix_mult (LLE_COEFFICIENTS (auxillary_expr),
|
|
|
|
depth, inverse, depth,
|
|
|
|
LLE_COEFFICIENTS (target_expr));
|
|
|
|
lambda_vector_mult_const (LLE_COEFFICIENTS (target_expr),
|
|
|
|
LLE_COEFFICIENTS (target_expr), depth,
|
|
|
|
factor);
|
|
|
|
LLE_CONSTANT (target_expr) = LLE_CONSTANT (auxillary_expr) * factor;
|
|
|
|
lambda_vector_copy (LLE_INVARIANT_COEFFICIENTS (auxillary_expr),
|
|
|
|
LLE_INVARIANT_COEFFICIENTS (target_expr),
|
|
|
|
invariants);
|
|
|
|
lambda_vector_mult_const (LLE_INVARIANT_COEFFICIENTS (target_expr),
|
|
|
|
LLE_INVARIANT_COEFFICIENTS (target_expr),
|
|
|
|
invariants, factor);
|
|
|
|
LLE_DENOMINATOR (target_expr) = LLE_DENOMINATOR (auxillary_expr);
|
|
|
|
|
|
|
|
if (!lambda_vector_zerop (LLE_COEFFICIENTS (target_expr), depth))
|
|
|
|
{
|
|
|
|
LLE_CONSTANT (target_expr) = LLE_CONSTANT (target_expr)
|
|
|
|
* determinant;
|
|
|
|
lambda_vector_mult_const (LLE_INVARIANT_COEFFICIENTS
|
|
|
|
(target_expr),
|
|
|
|
LLE_INVARIANT_COEFFICIENTS
|
|
|
|
(target_expr), invariants,
|
|
|
|
determinant);
|
|
|
|
LLE_DENOMINATOR (target_expr) =
|
|
|
|
LLE_DENOMINATOR (target_expr) * determinant;
|
|
|
|
}
|
|
|
|
/* Find the gcd and divide by it here, instead of at the
|
|
|
|
tree level. */
|
tree-chrec.c (eq_evolutions_p): New.
* tree-chrec.c (eq_evolutions_p): New.
* tree-chrec.h (eq_evolutions_p): Declared.
* tree-data-ref.c: Fix formatting.
(datadep_stats, dependence_stats): New.
(gcd): Moved...
(print_direction_vector): New.
(dump_data_dependence_relation): Use print_direction_vector.
(object_analysis, create_data_ref): Handle COMPONENT_REF.
(compute_subscript_distance): Static.
(initialize_data_dependence_relation): Static. Get the number
of loops surrounding the references from the callers, and initialize
DDR_SIZE_VECT to nb_loops. Use both base_addr_differ_p and
base_object_differ_p analyzers.
(analyze_ziv_subscript, analyze_siv_subscript_cst_affine,
compute_overlap_steps_for_affine_1_2,
analyze_subscript_affine_affine): Count the classified dependences.
Print a message when a test failed.
(can_use_analyze_subscript_affine_affine): New.
(analyze_siv_subscript): Compute the data dependences on symbolic
scevs that verify can_use_analyze_subscript_affine_affine.
(chrec_steps_divide_constant_p): Returns true, false, or unknown.
(analyze_miv_subscript): Update use of chrec_steps_divide_constant_p.
Handle symbolic scevs.
(analyze_overlapping_iterations): Let symbolic affine scevs to be
analyzed.
(subscript_dependence_tester): Moved...
(build_classic_dist_vector, build_classic_dir_vector): Don't use
lambda_vector_clear on newly allocated vectors. Get nb_loops from
DDR_SIZE_VECT instead of getting it in parameter.
(subscript_dependence_tester): ... here. Take as a parameter
loop_nest_depth. Call build_classic_dist_vector and
build_classic_dir_vector.
(compute_affine_dependence): Update subscript_dependence_tester
parameters. Update datadep_stats counters. Call
compute_subscript_distance.
(compute_self_dependence): Save the dist and dir vectors. Call
compute_subscript_distance.
(ddr_p, DEF_VEC_P(ddr_p), DEF_VEC_ALLOC_P(ddr_p,heap)): Moved...
(compute_all_dependences): Reorder parameters as they were before
conversion to VEC. Pass nb_loops and loop_nest_depth. Don't call
compute_subscript_distance. Update the use of
compute_affine_dependence and initialize_data_dependence_relation.
(find_data_references_in_loop): Handle COMPONENT_REF.
(compute_data_dependences_for_loop): Initialize dependence_stats.
Don't call build_classic_dist_vector and build_classic_dir_vector.
Update the parameters of initialize_data_dependence_relation and
compute_all_dependences. Print the statistics from datadep_stats.
(analyze_all_data_dependences): Static. Not used until the pass for
checking the data dependences is contributed.
* tree-data-ref.h (ddr_p, DEF_VEC_P(ddr_p),
DEF_VEC_ALLOC_P(ddr_p,heap)): ... here.
(initialize_data_dependence_relation, compute_affine_dependence,
analyze_all_data_dependences, compute_subscript_distance): Removed.
(print_direction_vector): New.
* lambda.h (gcd): ... here.
(lambda_vector_gcd): Moved here from gcd_vector.
* lambda-code.c (gcd, gcd_vector): Removed.
(lambda_compute_target_space): Use lambda_vector_gcd. Fix formatting.
* Makefile.in (tree-vect-patterns.o): Depends on TREE_DATA_REF_H.
From-SVN: r111312
2006-02-20 21:25:54 +01:00
|
|
|
gcd1 = lambda_vector_gcd (LLE_COEFFICIENTS (target_expr), depth);
|
|
|
|
gcd2 = lambda_vector_gcd (LLE_INVARIANT_COEFFICIENTS (target_expr),
|
|
|
|
invariants);
|
2004-08-26 19:10:50 +02:00
|
|
|
gcd1 = gcd (gcd1, gcd2);
|
|
|
|
gcd1 = gcd (gcd1, LLE_CONSTANT (target_expr));
|
|
|
|
gcd1 = gcd (gcd1, LLE_DENOMINATOR (target_expr));
|
|
|
|
for (j = 0; j < depth; j++)
|
|
|
|
LLE_COEFFICIENTS (target_expr)[j] /= gcd1;
|
|
|
|
for (j = 0; j < invariants; j++)
|
|
|
|
LLE_INVARIANT_COEFFICIENTS (target_expr)[j] /= gcd1;
|
|
|
|
LLE_CONSTANT (target_expr) /= gcd1;
|
|
|
|
LLE_DENOMINATOR (target_expr) /= gcd1;
|
|
|
|
/* Ignore if equal to existing bound. */
|
|
|
|
if (!lle_equal (LL_UPPER_BOUND (target_loop), target_expr, depth,
|
|
|
|
invariants))
|
|
|
|
{
|
|
|
|
LLE_NEXT (target_expr) = LL_UPPER_BOUND (target_loop);
|
|
|
|
LL_UPPER_BOUND (target_loop) = target_expr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (i = 0; i < depth; i++)
|
|
|
|
{
|
|
|
|
target_loop = LN_LOOPS (target_nest)[i];
|
|
|
|
/* If necessary, exchange the upper and lower bounds and negate
|
|
|
|
the step size. */
|
|
|
|
if (stepsigns[i] < 0)
|
|
|
|
{
|
|
|
|
LL_STEP (target_loop) *= -1;
|
|
|
|
tmp_expr = LL_LOWER_BOUND (target_loop);
|
|
|
|
LL_LOWER_BOUND (target_loop) = LL_UPPER_BOUND (target_loop);
|
|
|
|
LL_UPPER_BOUND (target_loop) = tmp_expr;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return target_nest;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Compute the step signs of TRANS, using TRANS and stepsigns. Return the new
|
|
|
|
result. */
|
|
|
|
|
|
|
|
static lambda_vector
|
|
|
|
lambda_compute_step_signs (lambda_trans_matrix trans, lambda_vector stepsigns)
|
|
|
|
{
|
|
|
|
lambda_matrix matrix, H;
|
|
|
|
int size;
|
|
|
|
lambda_vector newsteps;
|
|
|
|
int i, j, factor, minimum_column;
|
|
|
|
int temp;
|
|
|
|
|
|
|
|
matrix = LTM_MATRIX (trans);
|
|
|
|
size = LTM_ROWSIZE (trans);
|
|
|
|
H = lambda_matrix_new (size, size);
|
|
|
|
|
|
|
|
newsteps = lambda_vector_new (size);
|
|
|
|
lambda_vector_copy (stepsigns, newsteps, size);
|
|
|
|
|
|
|
|
lambda_matrix_copy (matrix, H, size, size);
|
|
|
|
|
|
|
|
for (j = 0; j < size; j++)
|
|
|
|
{
|
|
|
|
lambda_vector row;
|
|
|
|
row = H[j];
|
|
|
|
for (i = j; i < size; i++)
|
|
|
|
if (row[i] < 0)
|
|
|
|
lambda_matrix_col_negate (H, size, i);
|
|
|
|
while (lambda_vector_first_nz (row, size, j + 1) < size)
|
|
|
|
{
|
|
|
|
minimum_column = lambda_vector_min_nz (row, size, j);
|
|
|
|
lambda_matrix_col_exchange (H, size, j, minimum_column);
|
|
|
|
|
|
|
|
temp = newsteps[j];
|
|
|
|
newsteps[j] = newsteps[minimum_column];
|
|
|
|
newsteps[minimum_column] = temp;
|
|
|
|
|
|
|
|
for (i = j + 1; i < size; i++)
|
|
|
|
{
|
|
|
|
factor = row[i] / row[j];
|
|
|
|
lambda_matrix_col_add (H, size, j, i, -1 * factor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return newsteps;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Transform NEST according to TRANS, and return the new loopnest.
|
|
|
|
This involves
|
|
|
|
1. Computing a lattice base for the transformation
|
|
|
|
2. Composing the dense base with the specified transformation (TRANS)
|
|
|
|
3. Decomposing the combined transformation into a lower triangular portion,
|
|
|
|
and a unimodular portion.
|
cgraphunit.c, [...]: Fix comment typos.
* cgraphunit.c, dbxout.c, flow.c, gcse.c, gimplify.c,
lambda-code.c, loop.c, machmode.def, mips-tfile.c,
modulo-sched.c, passes.c, postreload-gcse.c, tree-eh.c,
tree-ssa-ccp.c, varasm.c, config/frv/frv.c, config/frv/frv.h,
config/frv/frv.md, config/i386/i386.c, config/i386/i386.h,
config/i386/i386.md, config/rs6000/predicates.md,
config/rs6000/rs6000.c, config/s390/fixdfdi.h,
config/s390/s390.c, config/stormy16/stormy16.c,
config/stormy16/stormy16.md, config/vax/vax.md: Fix comment
typos.
From-SVN: r97362
2005-04-01 05:42:55 +02:00
|
|
|
4. Computing the auxiliary nest using the unimodular portion.
|
|
|
|
5. Computing the target nest using the auxiliary nest and the lower
|
2004-08-26 19:10:50 +02:00
|
|
|
triangular portion. */
|
|
|
|
|
|
|
|
lambda_loopnest
|
|
|
|
lambda_loopnest_transform (lambda_loopnest nest, lambda_trans_matrix trans)
|
|
|
|
{
|
|
|
|
lambda_loopnest auxillary_nest, target_nest;
|
|
|
|
|
|
|
|
int depth, invariants;
|
|
|
|
int i, j;
|
|
|
|
lambda_lattice lattice;
|
|
|
|
lambda_trans_matrix trans1, H, U;
|
|
|
|
lambda_loop loop;
|
|
|
|
lambda_linear_expression expression;
|
|
|
|
lambda_vector origin;
|
|
|
|
lambda_matrix origin_invariants;
|
|
|
|
lambda_vector stepsigns;
|
|
|
|
int f;
|
|
|
|
|
|
|
|
depth = LN_DEPTH (nest);
|
|
|
|
invariants = LN_INVARIANTS (nest);
|
|
|
|
|
|
|
|
/* Keep track of the signs of the loop steps. */
|
|
|
|
stepsigns = lambda_vector_new (depth);
|
|
|
|
for (i = 0; i < depth; i++)
|
|
|
|
{
|
|
|
|
if (LL_STEP (LN_LOOPS (nest)[i]) > 0)
|
|
|
|
stepsigns[i] = 1;
|
|
|
|
else
|
|
|
|
stepsigns[i] = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Compute the lattice base. */
|
|
|
|
lattice = lambda_lattice_compute_base (nest);
|
|
|
|
trans1 = lambda_trans_matrix_new (depth, depth);
|
|
|
|
|
|
|
|
/* Multiply the transformation matrix by the lattice base. */
|
|
|
|
|
|
|
|
lambda_matrix_mult (LTM_MATRIX (trans), LATTICE_BASE (lattice),
|
|
|
|
LTM_MATRIX (trans1), depth, depth, depth);
|
|
|
|
|
|
|
|
/* Compute the Hermite normal form for the new transformation matrix. */
|
|
|
|
H = lambda_trans_matrix_new (depth, depth);
|
|
|
|
U = lambda_trans_matrix_new (depth, depth);
|
|
|
|
lambda_matrix_hermite (LTM_MATRIX (trans1), depth, LTM_MATRIX (H),
|
|
|
|
LTM_MATRIX (U));
|
|
|
|
|
|
|
|
/* Compute the auxiliary loop nest's space from the unimodular
|
|
|
|
portion. */
|
|
|
|
auxillary_nest = lambda_compute_auxillary_space (nest, U);
|
|
|
|
|
|
|
|
/* Compute the loop step signs from the old step signs and the
|
|
|
|
transformation matrix. */
|
|
|
|
stepsigns = lambda_compute_step_signs (trans1, stepsigns);
|
|
|
|
|
|
|
|
/* Compute the target loop nest space from the auxiliary nest and
|
|
|
|
the lower triangular matrix H. */
|
|
|
|
target_nest = lambda_compute_target_space (auxillary_nest, H, stepsigns);
|
|
|
|
origin = lambda_vector_new (depth);
|
|
|
|
origin_invariants = lambda_matrix_new (depth, invariants);
|
|
|
|
lambda_matrix_vector_mult (LTM_MATRIX (trans), depth, depth,
|
|
|
|
LATTICE_ORIGIN (lattice), origin);
|
|
|
|
lambda_matrix_mult (LTM_MATRIX (trans), LATTICE_ORIGIN_INVARIANTS (lattice),
|
|
|
|
origin_invariants, depth, depth, invariants);
|
|
|
|
|
|
|
|
for (i = 0; i < depth; i++)
|
|
|
|
{
|
|
|
|
loop = LN_LOOPS (target_nest)[i];
|
|
|
|
expression = LL_LINEAR_OFFSET (loop);
|
|
|
|
if (lambda_vector_zerop (LLE_COEFFICIENTS (expression), depth))
|
|
|
|
f = 1;
|
|
|
|
else
|
|
|
|
f = LLE_DENOMINATOR (expression);
|
|
|
|
|
|
|
|
LLE_CONSTANT (expression) += f * origin[i];
|
|
|
|
|
|
|
|
for (j = 0; j < invariants; j++)
|
|
|
|
LLE_INVARIANT_COEFFICIENTS (expression)[j] +=
|
|
|
|
f * origin_invariants[i][j];
|
|
|
|
}
|
|
|
|
|
|
|
|
return target_nest;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Convert a gcc tree expression EXPR to a lambda linear expression, and
|
|
|
|
return the new expression. DEPTH is the depth of the loopnest.
|
|
|
|
OUTERINDUCTIONVARS is an array of the induction variables for outer loops
|
|
|
|
in this nest. INVARIANTS is the array of invariants for the loop. EXTRA
|
|
|
|
is the amount we have to add/subtract from the expression because of the
|
|
|
|
type of comparison it is used in. */
|
|
|
|
|
|
|
|
static lambda_linear_expression
|
|
|
|
gcc_tree_to_linear_expression (int depth, tree expr,
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
VEC(tree,heap) *outerinductionvars,
|
|
|
|
VEC(tree,heap) *invariants, int extra)
|
2004-08-26 19:10:50 +02:00
|
|
|
{
|
|
|
|
lambda_linear_expression lle = NULL;
|
|
|
|
switch (TREE_CODE (expr))
|
|
|
|
{
|
|
|
|
case INTEGER_CST:
|
|
|
|
{
|
|
|
|
lle = lambda_linear_expression_new (depth, 2 * depth);
|
|
|
|
LLE_CONSTANT (lle) = TREE_INT_CST_LOW (expr);
|
|
|
|
if (extra != 0)
|
2004-11-01 19:08:02 +01:00
|
|
|
LLE_CONSTANT (lle) += extra;
|
2004-08-26 19:10:50 +02:00
|
|
|
|
|
|
|
LLE_DENOMINATOR (lle) = 1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case SSA_NAME:
|
|
|
|
{
|
|
|
|
tree iv, invar;
|
|
|
|
size_t i;
|
|
|
|
for (i = 0; VEC_iterate (tree, outerinductionvars, i, iv); i++)
|
|
|
|
if (iv != NULL)
|
|
|
|
{
|
|
|
|
if (SSA_NAME_VAR (iv) == SSA_NAME_VAR (expr))
|
|
|
|
{
|
|
|
|
lle = lambda_linear_expression_new (depth, 2 * depth);
|
|
|
|
LLE_COEFFICIENTS (lle)[i] = 1;
|
|
|
|
if (extra != 0)
|
|
|
|
LLE_CONSTANT (lle) = extra;
|
|
|
|
|
|
|
|
LLE_DENOMINATOR (lle) = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for (i = 0; VEC_iterate (tree, invariants, i, invar); i++)
|
|
|
|
if (invar != NULL)
|
|
|
|
{
|
|
|
|
if (SSA_NAME_VAR (invar) == SSA_NAME_VAR (expr))
|
|
|
|
{
|
|
|
|
lle = lambda_linear_expression_new (depth, 2 * depth);
|
|
|
|
LLE_INVARIANT_COEFFICIENTS (lle)[i] = 1;
|
|
|
|
if (extra != 0)
|
|
|
|
LLE_CONSTANT (lle) = extra;
|
|
|
|
LLE_DENOMINATOR (lle) = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return lle;
|
|
|
|
}
|
|
|
|
|
2004-11-01 19:08:02 +01:00
|
|
|
/* Return the depth of the loopnest NEST */
|
|
|
|
|
|
|
|
static int
|
|
|
|
depth_of_nest (struct loop *nest)
|
|
|
|
{
|
|
|
|
size_t depth = 0;
|
|
|
|
while (nest)
|
|
|
|
{
|
|
|
|
depth++;
|
|
|
|
nest = nest->inner;
|
|
|
|
}
|
|
|
|
return depth;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
/* Return true if OP is invariant in LOOP and all outer loops. */
|
|
|
|
|
|
|
|
static bool
|
2004-10-06 21:40:54 +02:00
|
|
|
invariant_in_loop_and_outer_loops (struct loop *loop, tree op)
|
2004-08-26 19:10:50 +02:00
|
|
|
{
|
2004-09-16 18:16:14 +02:00
|
|
|
if (is_gimple_min_invariant (op))
|
|
|
|
return true;
|
2004-08-26 19:10:50 +02:00
|
|
|
if (loop->depth == 0)
|
|
|
|
return true;
|
2004-10-06 21:40:54 +02:00
|
|
|
if (!expr_invariant_in_loop_p (loop, op))
|
|
|
|
return false;
|
|
|
|
if (loop->outer
|
|
|
|
&& !invariant_in_loop_and_outer_loops (loop->outer, op))
|
|
|
|
return false;
|
|
|
|
return true;
|
2004-08-26 19:10:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Generate a lambda loop from a gcc loop LOOP. Return the new lambda loop,
|
|
|
|
or NULL if it could not be converted.
|
|
|
|
DEPTH is the depth of the loop.
|
|
|
|
INVARIANTS is a pointer to the array of loop invariants.
|
|
|
|
The induction variable for this loop should be stored in the parameter
|
|
|
|
OURINDUCTIONVAR.
|
|
|
|
OUTERINDUCTIONVARS is an array of induction variables for outer loops. */
|
|
|
|
|
|
|
|
static lambda_loop
|
|
|
|
gcc_loop_to_lambda_loop (struct loop *loop, int depth,
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
VEC(tree,heap) ** invariants,
|
2004-08-26 19:10:50 +02:00
|
|
|
tree * ourinductionvar,
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
VEC(tree,heap) * outerinductionvars,
|
|
|
|
VEC(tree,heap) ** lboundvars,
|
|
|
|
VEC(tree,heap) ** uboundvars,
|
|
|
|
VEC(int,heap) ** steps)
|
2004-08-26 19:10:50 +02:00
|
|
|
{
|
|
|
|
tree phi;
|
|
|
|
tree exit_cond;
|
|
|
|
tree access_fn, inductionvar;
|
|
|
|
tree step;
|
|
|
|
lambda_loop lloop = NULL;
|
|
|
|
lambda_linear_expression lbound, ubound;
|
|
|
|
tree test;
|
|
|
|
int stepint;
|
|
|
|
int extra = 0;
|
2004-11-01 19:08:02 +01:00
|
|
|
tree lboundvar, uboundvar, uboundresult;
|
2004-08-26 19:10:50 +02:00
|
|
|
|
2004-09-16 18:16:14 +02:00
|
|
|
/* Find out induction var and exit condition. */
|
2004-08-26 19:10:50 +02:00
|
|
|
inductionvar = find_induction_var_from_exit_cond (loop);
|
|
|
|
exit_cond = get_loop_exit_condition (loop);
|
|
|
|
|
|
|
|
if (inductionvar == NULL || exit_cond == NULL)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file,
|
|
|
|
"Unable to convert loop: Cannot determine exit condition or induction variable for loop.\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
test = TREE_OPERAND (exit_cond, 0);
|
|
|
|
|
|
|
|
if (SSA_NAME_DEF_STMT (inductionvar) == NULL_TREE)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file,
|
|
|
|
"Unable to convert loop: Cannot find PHI node for induction variable\n");
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
phi = SSA_NAME_DEF_STMT (inductionvar);
|
|
|
|
if (TREE_CODE (phi) != PHI_NODE)
|
|
|
|
{
|
lambda-code.c (gcc_loop_to_lambda_loop, [...]): Use generic operand interface.
2005-05-03 Andrew MacLeod <amacleod@redhat.com>
* lambda-code.c (gcc_loop_to_lambda_loop,
lambda_loopnest_to_gcc_loopnest, phi_loop_edge_uses_def,
stmt_is_bumper_for_loop, perfect_nest_p, replace_uses_of_x_with_y): Use
generic operand interface.
* tree-data-ref.c (find_data_references_in_loop): Use generic interface.
* tree-dfa.c (collect_dfa_stats_r, mark_new_vars_to_rename): Use
generic operand interface.
* tree-flow-inline.h (delink_imm_use, link_imm_use_to_list,
link_imm_use, link_imm_use_stmt, relink_imm_use, relink_imm_use_stmt,
next_safe_imm_use, has_zero_uses, has_single_use, single_imm_use,
num_imm_uses): Use ssa_use_operand_t.
(get_def_ops, get_use_ops, get_v_may_def_ops, get_vuse_ops,
get_v_must_def_ops): Delete.
(get_def_from_ptr, get_phi_result_ptr): Get def directly now.
(get_use_op_ptr, get_def_op_ptr, get_v_may_def_result_ptr,
get_v_may_def_op_ptr, get_vuse_op_ptr, get_v_must_def_result_ptr,
get_v_must_def_kill_ptr): Delete.
(delink_stmt_imm_use): Move and use new operand interface.
(op_iter_next_use, op_iter_next_def, op_iter_next_tree, op_iter_init,
op_iter_next_tree): Use new operand implementation.
(clear_and_done_ssa_iter): New. Initialize a blank operand iterator.
(op_iter_init_use, op_iter_init_def, op_iter_init_tree): Add iterator
type check.
(op_iter_next_mustdef, op_iter_next_maydef,
op_iter_next_must_and_may_def): Delete. Replace with...
(op_iter_next_maymustdef): New. Combine must and may next operations.
(op_iter_init_maydef, op_iter_init_mustdef,
op_iter_init_must_and_may_def): Use new interface.
(single_ssa_tree_operand ): New. Process single operands only as trees.
(single_ssa_use_operand): New. Process single operands only as uses.
(single_ssa_def_operand): New. Process single operands only as defs.
(zero_ssa_operands): New. Return TRUE if there are zero operands of the
specified types.
(num_ssa_operands): New. Count the number of specified operands.
(compare_ssa_operands_equal): New. Compare two statements' operands.
(single_phi_def): New. Return true if PHI has one def of the specified
operand type.
(op_iter_init_phiuse): New. Initialize the iterator for PHI arguments.
(op_iter_init_phidef): New. Initialize the iterator for the PHI def.
* tree-flow.h (struct immediate_use_iterator_d): Use ssa_use_operand_t.
(struct stmt_ann_d): Operands field no longer require GTY().
(vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Change prototype.
* tree-into-ssa.c (mark_def_sites): Use SSA_OP_VMUSTKILL.
* tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb,
dump_replaceable_exprs, rewrite_trees): Use generic interface.
* tree-phinodes.c (make_phi_node, release_phi_node, resize_phi_node):
Use use_operand_p instead of ssa_imm_use_t *.
* tree-pretty-print.c (dump_vops): check if operands are active before
dumping virtual operands.
* tree-sra.c (sra_walk_function): Use ZERO_SSA_OPERANDS.
* tree-ssa-ccp.c (likely_value): Use ZERO_SSA_OPERANDS.
(ccp_fold): Use new interface.
(ccp_visit_stmt): Remove unused variables and code.
(convert_to_gimple_builtin): Insert statements before calling
mark_new_vars_to_rename.
* tree-ssa-copy.c (stmt_may_generate_copy): Use ZERO_SSA_OPERANDS.
(copy_prop_visit_cond_stmt): Use generic interface.
* tree-ssa-dom.c (struct expr_hash_elt): Use stmt pointer, not the
annotation in table.
(thread_across_edge): Use generic interface.
(initialize_hash_element): Initialzie with stmt, not annotation.
(eliminate_redundant_computations): Use generic interface.
(record_equivalences_from_stmt): Pass stmt, not annotation.
(avail_expr_hash, real_avail_expr_hash, avail_expr_eq): Use generic
interface.
* tree-ssa-dse.c (dse_optimize_stmt): Use ZERO_SSA_OPERANDS.
* tree-ssa-loop-ivopts.c (find_invariants_stmt,
find_interesting_uses_stmt, protect_loop_closed_ssa_form_use): Use
generic operand interface.
* tree-ssa-loop-niter.c (chain_of_csts_start, get_val_for): Use generic
interface.
* tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Use Generic operand
Interface.
* tree-ssa-operands.c (struct opbuild_list_d): New. Operand build type.
(build_defs, build_uses, build_v_may_defs, build_vuses,
build_v_must_defs): Change type to struct opbuild_list_d.
(ops_active): New. Operands active boolean.
(operand_memory, operand_memory_index): New. Operand memory managers.
(allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype,
allocate_vuse_optype, allocate_v_must_def_optype): Delete.
(free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs):
Change from functions to static variable list heads.
(opbuild_initialize_virtual): New. Initialize a virtual build list.
(opbuild_initialize_real): New. Initialize a virtual build list.
(opbuild_free): New. Free a build list.
(opbuild_num_elems): New. Number of items in a list.
(opbuild_append_real): New. Add a real (tree *) operand.
(opbuild_append_virtual): New. Add and sort a virtual (tree) operand.
(opbuild_first): New. Return first element index in a list.
(opbuild_next): New. Return next element in a list.
(opbuild_elem_real): New. Return real element.
(opbuild_elem_virtual): New. Return virtual element.
(opbuild_elem_uid): New. Return UID of virtual element.
(opbuild_clear): New. Reset an operand list.
(opbuild_remove_elem): New. Remove an element form a list.
(ssa_operands_active): New. Return true if operand cache is active.
(init_ssa_operands, fini_ssa_operands): Initialize new implementation.
(ssa_operand_alloc): New. Allocate memory from an operand chunk.
(correct_use_link): Use use_operand_p.
(finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_defs,
finalize_ssa_vuses, finalize_ssa_v_must_defs): New implmentation.
(cleanup_v_may_defs): Use new implmentation.
(finalize_ssa_stmt_operands, start_ssa_stmt_operands): New
implementation.
(append_def, append_use, append_v_may_def, append_vuse,
append_v_must_def): Call opbuild_append routine instead of using varray.
(build_ssa_operands): Simplify to simply use stmt, don't maintain a
global parse_old_ops variable.
(free_ssa_operands): New implementation.
(update_stmt_operands): Move. Change argument to build_ssa_operands.
(copy_virtual_operands): Move. New generic implementation.
(create_ssa_artficial_load_stmt): Move. New implementation.
(swap_tree_operands): Update for new implementation.
(get_expr_operands): Add stmt parameter to calls to swap_tree_operands.
(add_call_clobber_ops, add_call_read_ops): Initialize opbuild list
rather than a varray.
(verify_imm_links): Use use_operand_p.
(dump_immediate_uses_for): If the immediate use variable is a virtual
variable, show the virtual ops in the stmt.
* tree-ssa-operands.h (def_operand_p): No longer a structure.
(NULL_DEF_OPERAND_P): Now a #define.
(def_optype_d, use_optype_d, v_def_use_operand_type, v_may_def_optype_d,
vuse_operand_type, vuse_optype_d, v_must_def_optype_d): Delete.
(def_optype_d, use_optype_d, maydef_optype_d, vuse_optype_d,
mustdef_optype_d): New. Use Linked list representation.
(SSA_OPERAND_MEMORY_SIZE): New. Size of operand memory chunk.
(struct ssa_operand_memory_d): New. Allocated Chunk node.
(struct stmt_operands_d): Change to new pointers that are not GTY.
(STMT_USE_OPS, NUM_USES, SET_USE_OP, STMT_DEF_OPS, NUM_DEFS, SET_DEF_OP,
STMT_V_MAY_DEF_OPS, NUM_V_MAY_DEFS, SET_V_MAY_DEF_RESULT,
SET_V_MAY_DEF_OP, STMT_VUSE_OPS, NUM_VUSES, SET_VUSE_OP,
STMT_V_MUST_DEF_OPS, NUM_V_MUST_DEFS, SET_V_MUST_DEF_RESULT,
SET_V_MUST_DEF_KILL): Delete.
(V_MAY_DEF_OPS, V_MAY_DEF_RESULT_PTR, V_MAY_DEF_RESULT,
V_MAY_DEF_OP_PTR, V_MAY_DEF_OP): Rename to MAYDEF_*.
(V_MUST_DEF_OPS, V_MUST_DEF_RESULT_PTR, V_MUST_DEF_RESULT,
V_MUST_DEF_KILL_PTR, V_MUST_DEF_KILL): Rename to MUSTDEF_*.
(enum ssa_op_iter_type): Operand iterator typechecking values.
(struct ssa_operand_iterator_d): Use linked lists of operands.
(SSA_OP_VMUSTDEFKILL): Rename to SSA_OP_VMUSTKILL.
(FOR_EACH_SSA_MAYDEF_OPERAND, FOR_EACH_SSA_MUSTDEF_OPERAND,
FOR_EACH_SSA_MUST_AND_MAY_DEF_OPERAND): Use op_iter_next_maymustdef.
(FOR_EACH_PHI_ARG): New. Iterate over PHI arguments.
(FOR_EACH_PHI_OR_STMT_USE): New. Iterate over PHI or stmt uses.
(FOR_EACH_PHI_OR_STMT_DEF): New. Iterate over PHI or stmt defs.
(SINGLE_SSA_TREE_OPERAND, SINGLE_SSA_USE_OPERAND,
SINGLE_SSA_DEF_OPERAND, ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS): New.
* tree-ssa-opfinalize.h: New. Function templates for expansion.
(FINALIZE_ALLOC): Expands into alloc_def, alloc_use, alloc_maydef,
alloc_vuse, and alloc_mustdef.
(FINALIZE_FUNC): Expands into finalize_ssa_def_ops,
finalize_ssa_use_ops, finalize_ssa_v_may_def_ops, finalize_ssa_vuse_ops,
and finalize_ssa_v_must_def_ops.
* tree-ssa-pre.c (add_to_sets): Pass tree to vn_add.
(create_value_expr_from): Use stmt not vuse_optype as a parameter. Pass
stmt around.
(compute_avail): Use generic iterator interface.
* tree-ssa-propagate.c (first_vdef): Use generic operand interface.
(stmt_makes_single_load, stmt_makes_single_store): Use
ZERO_SSA_OPERANDS.
* tree-ssa-sink.c (is_hidden_global_store): Use ZERO_SSA_OPERANDS.
(statement_sink_location): Use generic interface.
* tree-ssa.c (verify_ssa): Use %p in fprintf. Use generic interface.
(delete_tree_ssa): Don't call release_defs. Call release_ssa_name and
reset the immediate use link nodes.
(stmt_references_memory_p): Use ZERO_SSA_OPERANDS.
* tree-ssanames.c (make_ssa_name): Use use_operand_p.
* tree-tailcall.c (find_tail_calls): Use ZERO_SSA_OPERANDS.
(eliminate_tail_call): Use generic operand interface.
* tree-vect-analyze.c (vect_analyze_data_refs): Use ZERO_SSA_OPERANDS.
(vect_mark_relevant, vect_mark_stmts_to_be_vectorized): Use generic
interface.
* tree-vect-transform.c (update_vuses_to_preheader): Use generic
interface.
* tree-vectorizer.c (rename_variables_in_bb): Use generic interface.
* tree-vn.c (struct val_expr_pair_d): Cache statment pointer instead of
vuse_optype.
(vn_compute, val_expr_pair_hash, vn_add, vn_lookup, vn_lookup_or_add):
Use statement pointer instead of vuse_optype. Use generic interface.
* tree-vrp.c (maybe_add_assert_expr): Use generic interface.
(stmt_interesting_for_vrp, vrp_visit_stmt): Use ZERO_SSA_OPERANDS.
* tree.h (struct ssa_imm_use_d): Renamed to ssa_use_operand_d.
(tree_ssa_name, phi_arg_d): Use ssa_use_operand_d.
* doc/tree-ssa.texi: Update documentation for operand interface.
From-SVN: r99155
2005-05-03 14:19:56 +02:00
|
|
|
phi = SINGLE_SSA_TREE_OPERAND (phi, SSA_OP_USE);
|
|
|
|
if (!phi)
|
2004-08-26 19:10:50 +02:00
|
|
|
{
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file,
|
|
|
|
"Unable to convert loop: Cannot find PHI node for induction variable\n");
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
phi = SSA_NAME_DEF_STMT (phi);
|
|
|
|
if (TREE_CODE (phi) != PHI_NODE)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file,
|
|
|
|
"Unable to convert loop: Cannot find PHI node for induction variable\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2004-11-01 19:08:02 +01:00
|
|
|
|
2004-09-16 18:16:14 +02:00
|
|
|
/* The induction variable name/version we want to put in the array is the
|
|
|
|
result of the induction variable phi node. */
|
|
|
|
*ourinductionvar = PHI_RESULT (phi);
|
2004-08-26 19:10:50 +02:00
|
|
|
access_fn = instantiate_parameters
|
|
|
|
(loop, analyze_scalar_evolution (loop, PHI_RESULT (phi)));
|
2004-11-01 19:08:02 +01:00
|
|
|
if (access_fn == chrec_dont_know)
|
2004-08-26 19:10:50 +02:00
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file,
|
2004-11-01 19:08:02 +01:00
|
|
|
"Unable to convert loop: Access function for induction variable phi is unknown\n");
|
2004-08-26 19:10:50 +02:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
step = evolution_part_in_loop_num (access_fn, loop->num);
|
|
|
|
if (!step || step == chrec_dont_know)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file,
|
|
|
|
"Unable to convert loop: Cannot determine step of loop.\n");
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
if (TREE_CODE (step) != INTEGER_CST)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file,
|
|
|
|
"Unable to convert loop: Step of loop is not integer.\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
stepint = TREE_INT_CST_LOW (step);
|
|
|
|
|
|
|
|
/* Only want phis for induction vars, which will have two
|
|
|
|
arguments. */
|
|
|
|
if (PHI_NUM_ARGS (phi) != 2)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file,
|
|
|
|
"Unable to convert loop: PHI node for induction variable has >2 arguments\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Another induction variable check. One argument's source should be
|
|
|
|
in the loop, one outside the loop. */
|
|
|
|
if (flow_bb_inside_loop_p (loop, PHI_ARG_EDGE (phi, 0)->src)
|
|
|
|
&& flow_bb_inside_loop_p (loop, PHI_ARG_EDGE (phi, 1)->src))
|
|
|
|
{
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file,
|
|
|
|
"Unable to convert loop: PHI edges both inside loop, or both outside loop.\n");
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (flow_bb_inside_loop_p (loop, PHI_ARG_EDGE (phi, 0)->src))
|
2004-09-16 18:16:14 +02:00
|
|
|
{
|
|
|
|
lboundvar = PHI_ARG_DEF (phi, 1);
|
|
|
|
lbound = gcc_tree_to_linear_expression (depth, lboundvar,
|
|
|
|
outerinductionvars, *invariants,
|
|
|
|
0);
|
|
|
|
}
|
2004-08-26 19:10:50 +02:00
|
|
|
else
|
2004-09-16 18:16:14 +02:00
|
|
|
{
|
|
|
|
lboundvar = PHI_ARG_DEF (phi, 0);
|
|
|
|
lbound = gcc_tree_to_linear_expression (depth, lboundvar,
|
|
|
|
outerinductionvars, *invariants,
|
|
|
|
0);
|
|
|
|
}
|
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
if (!lbound)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file,
|
|
|
|
"Unable to convert loop: Cannot convert lower bound to linear expression\n");
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
2004-09-08 17:28:56 +02:00
|
|
|
/* One part of the test may be a loop invariant tree. */
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
VEC_reserve (tree, heap, *invariants, 1);
|
2004-09-08 17:28:56 +02:00
|
|
|
if (TREE_CODE (TREE_OPERAND (test, 1)) == SSA_NAME
|
2004-10-06 21:40:54 +02:00
|
|
|
&& invariant_in_loop_and_outer_loops (loop, TREE_OPERAND (test, 1)))
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
VEC_quick_push (tree, *invariants, TREE_OPERAND (test, 1));
|
2004-09-08 17:28:56 +02:00
|
|
|
else if (TREE_CODE (TREE_OPERAND (test, 0)) == SSA_NAME
|
2004-10-06 21:40:54 +02:00
|
|
|
&& invariant_in_loop_and_outer_loops (loop, TREE_OPERAND (test, 0)))
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
VEC_quick_push (tree, *invariants, TREE_OPERAND (test, 0));
|
2004-09-08 17:28:56 +02:00
|
|
|
|
|
|
|
/* The non-induction variable part of the test is the upper bound variable.
|
|
|
|
*/
|
|
|
|
if (TREE_OPERAND (test, 0) == inductionvar)
|
|
|
|
uboundvar = TREE_OPERAND (test, 1);
|
|
|
|
else
|
|
|
|
uboundvar = TREE_OPERAND (test, 0);
|
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
|
|
|
|
/* We only size the vectors assuming we have, at max, 2 times as many
|
|
|
|
invariants as we do loops (one for each bound).
|
|
|
|
This is just an arbitrary number, but it has to be matched against the
|
|
|
|
code below. */
|
2004-09-08 17:28:56 +02:00
|
|
|
gcc_assert (VEC_length (tree, *invariants) <= (unsigned int) (2 * depth));
|
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
|
c-common.c, [...]: Fix comment formatting.
* c-common.c, c-decl.c, combine.c, defaults.h, fold-const.c,
gimplify.c, gthr-nks.h, hooks.c, lambda-code.c, lambda-mat.c,
stor-layout.c, target.h, tree-cfg.c, tree-chrec.c,
tree-if-conv.c, tree-inline.c, tree-into-ssa.c,
tree-mudflap.c, tree-optimize.c, tree-scalar-evolution.c,
tree-ssa-alias.c, tree-ssa-ccp.c, tree-ssa-dce.c,
tree-ssa-pre.c, tree-vectorizer.c, tree-vectorizer.h, tree.h,
vec.h: Fix comment formatting.
From-SVN: r87105
2004-09-05 18:05:06 +02:00
|
|
|
/* We might have some leftover. */
|
2004-08-26 19:10:50 +02:00
|
|
|
if (TREE_CODE (test) == LT_EXPR)
|
|
|
|
extra = -1 * stepint;
|
|
|
|
else if (TREE_CODE (test) == NE_EXPR)
|
|
|
|
extra = -1 * stepint;
|
2004-09-08 17:28:56 +02:00
|
|
|
else if (TREE_CODE (test) == GT_EXPR)
|
|
|
|
extra = -1 * stepint;
|
2004-11-01 19:08:02 +01:00
|
|
|
else if (TREE_CODE (test) == EQ_EXPR)
|
|
|
|
extra = 1 * stepint;
|
|
|
|
|
|
|
|
ubound = gcc_tree_to_linear_expression (depth, uboundvar,
|
2004-08-26 19:10:50 +02:00
|
|
|
outerinductionvars,
|
|
|
|
*invariants, extra);
|
tree-vrp.c (build_assert_expr_for, [...]): Use buildN instead of build.
2005-12-02 Richard Guenther <rguenther@suse.de>
* tree-vrp.c (build_assert_expr_for, process_assert_insertions_for,
simplify_cond_using_ranges): Use buildN instead of build.
* tree-tailcall.c (adjust_accumulator_values,
adjust_return_value): Likewise.
* tree-sra.c (generate_one_element_ref, generate_copy_inout,
generate_element_copy, generate_element_zero,
generate_one_element_init): Likewise.
* tree-ssa-forwprop.c (forward_propagate_into_cond_1): Likewise.
* lambda-code.c (gcc_loop_to_lambda_loop, lbv_to_gcc_expression,
lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest,
perfect_nestify): Likewise.
From-SVN: r107894
2005-12-02 15:40:40 +01:00
|
|
|
uboundresult = build2 (PLUS_EXPR, TREE_TYPE (uboundvar), uboundvar,
|
|
|
|
build_int_cst (TREE_TYPE (uboundvar), extra));
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
VEC_safe_push (tree, heap, *uboundvars, uboundresult);
|
|
|
|
VEC_safe_push (tree, heap, *lboundvars, lboundvar);
|
|
|
|
VEC_safe_push (int, heap, *steps, stepint);
|
2004-08-26 19:10:50 +02:00
|
|
|
if (!ubound)
|
|
|
|
{
|
|
|
|
if (dump_file && (dump_flags & TDF_DETAILS))
|
|
|
|
fprintf (dump_file,
|
|
|
|
"Unable to convert loop: Cannot convert upper bound to linear expression\n");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
lloop = lambda_loop_new ();
|
|
|
|
LL_STEP (lloop) = stepint;
|
|
|
|
LL_LOWER_BOUND (lloop) = lbound;
|
|
|
|
LL_UPPER_BOUND (lloop) = ubound;
|
|
|
|
return lloop;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Given a LOOP, find the induction variable it is testing against in the exit
|
|
|
|
condition. Return the induction variable if found, NULL otherwise. */
|
|
|
|
|
|
|
|
static tree
|
|
|
|
find_induction_var_from_exit_cond (struct loop *loop)
|
|
|
|
{
|
|
|
|
tree expr = get_loop_exit_condition (loop);
|
2004-09-08 17:28:56 +02:00
|
|
|
tree ivarop;
|
2004-08-26 19:10:50 +02:00
|
|
|
tree test;
|
|
|
|
if (expr == NULL_TREE)
|
|
|
|
return NULL_TREE;
|
|
|
|
if (TREE_CODE (expr) != COND_EXPR)
|
|
|
|
return NULL_TREE;
|
|
|
|
test = TREE_OPERAND (expr, 0);
|
alias.c (find_base_decl): Remove unreachable case '3' block.
2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com>
Zack Weinberg <zack@codesourcery.com>
* alias.c (find_base_decl): Remove unreachable case '3' block.
* expr.c (safe_from_p): Abort if passed a type.
* tree-gimple.c (recalculate_side_effects): Abort if passed
anything other than an expression.
* tree-ssa-pre.c (phi_translate): Return expr immediately if
is_gimple_min_invariant is true for it. Reorder cases for clarity.
Abort on un-handled tree classes.
(valid_in_set): Likewise.
* tree.c (tree_code_class_strings): New static data.
* tree.h (enum tree_code_class): New.
(tree_code_class_strings): Declare.
(TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P)
(REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P)
(STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros.
(TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS)
(checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update.
* tree.def, c-common.def, objc/objc-tree.def: Use
tree_code_class enumeration constants instead of code letters.
* alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c
* c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c
* emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c
* langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c
* tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c
* tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c
* tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c
* tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c
* tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c
* tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c
* tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c
* config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c
* config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c
Update to match.
* LANGUAGES: Add note about change.
ada:
* ada-tree.def: Use tree_code_class enumeration constants
instead of code letters.
* ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c:
Update for new tree-class enumeration constants.
cp:
* cp-tree.def: Use tree_code_class enumeration constants
instead of code letters.
* call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c
* mangle.c, pt.c, semantics.c, tree.c, typeck.c:
Update for new tree-class enumeration constants.
fortran:
* f95-lang.c, trans-expr.c, trans.c: Update for new tree-class
enumeration constants.
java:
* java-tree.def: Use tree_code_class enumeration constants
instead of code letters.
* java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for
new tree-class enumeration constants.
treelang:
* treetree.c: Update for new tree-class enumeration constants.
From-SVN: r87675
2004-09-17 23:55:02 +02:00
|
|
|
if (!COMPARISON_CLASS_P (test))
|
2004-08-26 19:10:50 +02:00
|
|
|
return NULL_TREE;
|
2004-11-01 19:08:02 +01:00
|
|
|
|
|
|
|
/* Find the side that is invariant in this loop. The ivar must be the other
|
|
|
|
side. */
|
|
|
|
|
|
|
|
if (expr_invariant_in_loop_p (loop, TREE_OPERAND (test, 0)))
|
2004-09-08 17:28:56 +02:00
|
|
|
ivarop = TREE_OPERAND (test, 1);
|
2004-11-01 19:08:02 +01:00
|
|
|
else if (expr_invariant_in_loop_p (loop, TREE_OPERAND (test, 1)))
|
|
|
|
ivarop = TREE_OPERAND (test, 0);
|
|
|
|
else
|
|
|
|
return NULL_TREE;
|
|
|
|
|
2004-09-08 17:28:56 +02:00
|
|
|
if (TREE_CODE (ivarop) != SSA_NAME)
|
2004-08-26 19:10:50 +02:00
|
|
|
return NULL_TREE;
|
2004-09-08 17:28:56 +02:00
|
|
|
return ivarop;
|
2004-08-26 19:10:50 +02:00
|
|
|
}
|
|
|
|
|
vec.h: Update API to separate allocation mechanism from type.
* vec.h: Update API to separate allocation mechanism from type.
(VEC_safe_grow): New.
* vec.c (calculate_allocation): New.
(vec_gc_o_reserve, vec_heap_o_reserve): Adjust.
(vec_gc_free, vec_heap_free): Remove.
* gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust.
(VEC): Likewise.
(mangle_macro_name): New.
(struct macro_def): New.
(struct macro): Add multiple argument values.
(macro_expans_end): New.
(push_macro_expansion): Chain on new macro. Process multiple
args, create follow on expansion. Return follow on argument.
(macro_input): Deal with multiple arguments.
* tree.h: Define VEC(tree,heap) and VEC(tree,gc).
(struct tree_binfo): Adjust.
* basic-block.h: Define VEC(edge,gc).
(struct edge_def): Adjust.
(struct basic_block_def, struct edge_iterator): Likewise.
(ei_container, ei_start_1, ei_last_1): Likewise.
* cfg.c (connect_src, connect_dest): Likewise.
* cfgrtl.c (force_nonfallthru_and_redirect)
* dbxout.c (dbxout_type)
* dwarf2out.c (gen_member_die)
* lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc).
(gcc_tree_to_linear_expression): Adjust.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
* lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Adjust prototypes.
* profile.c (instrument_values): Adjust.
* tree-cfg.c (modified_noreturn_calls): Adjust.
(remove_fallthru_edge): Likewise.
* tree-dump.c (dequeue_and_dump): Adjust.
* tree-flow-inline.h (mark_stmt_modified): Adjust.
* tree-flow.h (modified_noreturn_calls): Adjust.
(tree_on_heap): Remove. (yay!)
(register_new_def): Adjust.
* tree-into-ssa.c: Define VEC(int,heap).
(block_defs_stack): Adjust.
(find_idf, insert_phi_nodes, register_new_def,
rewrite_initialize_block, rewrite_finalize_block,
register_new_update_single, rewrite_update_init_block,
rewrite_update_fini_block, rewrite_blocks,
ssa_rewrite_finalize_block, ssa_register_new_def,
ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise.
* tree-loop-linear.c (linear_transform_loops): Adjust.
* tree-ssa-alias.c: Define VEC(fieldoff_t,heap).
(push_fields_onto_fieldstack, create_overlap_variables_for): Adjust.
* tree-ssa-dom.c (avail_exprs_stack, block_defs_stack,
stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack,
vrp_variables_stack): Adjust declarations.
(tree_ssa_dominator_optimize): Adjust.
(dom_opt_initialize_block, remove_local_expressions_from_table,
restore_nonzero_vars_to_original_value,
restore_vars_to_original_value,
restore_currdefs_to_original_value, dom_opt_finalize_block,
record_var_is_nonzero, record_cond, record_const_or_copy_1,
optimize_stmt, update_rhs_and_lookup_avail_expr,
lookup_avail_expr, record_range): Likewise.
* tree-ssa-pre.c: Define VEC(basic_block,heap).
(compute_antic_aux): Adjust.
(inserted_exprs, create_expression_by_pieces,
insert_into_preds_of_block, eliminate, mark_operand_necessary,
remove_dead_inserted_code, fini_pre): Likewise.
* tree-ssa-propagate.c (interesting_ssa_edges): Adjust.
(varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist.
ssa_prop_init): Likewise.
* tree-ssa.c: Define VEC(bitmap,heap).
(verify_name_tags): Adjust.
* value-prof.c (rtl_divmod_values_to_profile): Adjust.
(insn_prefetch_values_to_profile, rtl_find_values_to_profile,
tree_divmod_values_to_profile, tree_find_values_to_profile,
value_profile_transformations): Likewise.
* value-prof.h: Define VEC(histogram_value,heap).
* varasm.c: Remove alias_pair pointer typedef, define
VEC(alias_pair,gc).
(finish_aliases_1, finish_aliases_2, assemble_alias): Adjust.
* config/pa/pa.c (typedef extern_symbol): Typedef the structure,
not a pointer to it. Create an object vector.
(extern_symbols): Turn into an object vector.
(pa_hpux_asm_output_external, pa_hpux_file_end): Adjust.
* cp/cp-tree.h: Adjust for new VEC API.
Define VEC(tree_pair_s,gc).
(struct save_scope): Adjust.
(struct lang_type_class): Adjust.
(unemitted_tinfo_decls): Adjust.
* cp/class.c (add_method, resort_type_method_vec,
finish_struct_methods, struct find_final_overrider_data,
dfs_find_final_overrider_pre, find_final_overrider,
get_vcall_index, warn_hidden, walk_subobject_offsets,
check_methods, fixup_inline_methods, end_of_class,
warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer,
add_vcall_offset): Adjust.
* cp/decl.c (xref_basetypes, finish_method): Adjust.
* cp/decl2.c (check_classfn): Adjust.
* cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust.
* cp/method.c (do_build_copy_constructor): Adjust.
* cp/name-lookup.c (new_class_binding, store_binding,
store_bindings, store_class_bindings): Adjust.
* cp/name-lookup.h: Define VEC(cxx_saved_binding,gc),
VEC(cp_class_binding,gc).
(struct cp_binding_level): Adjust.
* cp/parser.c: Define VEC(cp_token_position,heap).
(struct cp_lexer): Adjust.
(cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy,
cp_lexer_save_tokens): Adjust.
* cp/pt.c (retrieve_specialization,
check_explicit_specialization): Adjust.
* cp/rtti.c (unemitted_tinfo_decls): Adjust.
(init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init,
get_pseudo_ti_desc): Adjust.
* cp/search.c (dfs_access_in_type, lookup_conversion_operator,
lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible,
dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust.
* cp/semantics.c: Define VEC(deferred_access,gc).
(push_deferring_access_checks): Adjust.
* cp/typeck2.c (abstract_virtuals_error): Adjust.
From-SVN: r98498
2005-04-21 11:18:28 +02:00
|
|
|
DEF_VEC_P(lambda_loop);
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
DEF_VEC_ALLOC_P(lambda_loop,heap);
|
vec.h: Update API to separate allocation mechanism from type.
* vec.h: Update API to separate allocation mechanism from type.
(VEC_safe_grow): New.
* vec.c (calculate_allocation): New.
(vec_gc_o_reserve, vec_heap_o_reserve): Adjust.
(vec_gc_free, vec_heap_free): Remove.
* gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust.
(VEC): Likewise.
(mangle_macro_name): New.
(struct macro_def): New.
(struct macro): Add multiple argument values.
(macro_expans_end): New.
(push_macro_expansion): Chain on new macro. Process multiple
args, create follow on expansion. Return follow on argument.
(macro_input): Deal with multiple arguments.
* tree.h: Define VEC(tree,heap) and VEC(tree,gc).
(struct tree_binfo): Adjust.
* basic-block.h: Define VEC(edge,gc).
(struct edge_def): Adjust.
(struct basic_block_def, struct edge_iterator): Likewise.
(ei_container, ei_start_1, ei_last_1): Likewise.
* cfg.c (connect_src, connect_dest): Likewise.
* cfgrtl.c (force_nonfallthru_and_redirect)
* dbxout.c (dbxout_type)
* dwarf2out.c (gen_member_die)
* lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc).
(gcc_tree_to_linear_expression): Adjust.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
* lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Adjust prototypes.
* profile.c (instrument_values): Adjust.
* tree-cfg.c (modified_noreturn_calls): Adjust.
(remove_fallthru_edge): Likewise.
* tree-dump.c (dequeue_and_dump): Adjust.
* tree-flow-inline.h (mark_stmt_modified): Adjust.
* tree-flow.h (modified_noreturn_calls): Adjust.
(tree_on_heap): Remove. (yay!)
(register_new_def): Adjust.
* tree-into-ssa.c: Define VEC(int,heap).
(block_defs_stack): Adjust.
(find_idf, insert_phi_nodes, register_new_def,
rewrite_initialize_block, rewrite_finalize_block,
register_new_update_single, rewrite_update_init_block,
rewrite_update_fini_block, rewrite_blocks,
ssa_rewrite_finalize_block, ssa_register_new_def,
ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise.
* tree-loop-linear.c (linear_transform_loops): Adjust.
* tree-ssa-alias.c: Define VEC(fieldoff_t,heap).
(push_fields_onto_fieldstack, create_overlap_variables_for): Adjust.
* tree-ssa-dom.c (avail_exprs_stack, block_defs_stack,
stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack,
vrp_variables_stack): Adjust declarations.
(tree_ssa_dominator_optimize): Adjust.
(dom_opt_initialize_block, remove_local_expressions_from_table,
restore_nonzero_vars_to_original_value,
restore_vars_to_original_value,
restore_currdefs_to_original_value, dom_opt_finalize_block,
record_var_is_nonzero, record_cond, record_const_or_copy_1,
optimize_stmt, update_rhs_and_lookup_avail_expr,
lookup_avail_expr, record_range): Likewise.
* tree-ssa-pre.c: Define VEC(basic_block,heap).
(compute_antic_aux): Adjust.
(inserted_exprs, create_expression_by_pieces,
insert_into_preds_of_block, eliminate, mark_operand_necessary,
remove_dead_inserted_code, fini_pre): Likewise.
* tree-ssa-propagate.c (interesting_ssa_edges): Adjust.
(varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist.
ssa_prop_init): Likewise.
* tree-ssa.c: Define VEC(bitmap,heap).
(verify_name_tags): Adjust.
* value-prof.c (rtl_divmod_values_to_profile): Adjust.
(insn_prefetch_values_to_profile, rtl_find_values_to_profile,
tree_divmod_values_to_profile, tree_find_values_to_profile,
value_profile_transformations): Likewise.
* value-prof.h: Define VEC(histogram_value,heap).
* varasm.c: Remove alias_pair pointer typedef, define
VEC(alias_pair,gc).
(finish_aliases_1, finish_aliases_2, assemble_alias): Adjust.
* config/pa/pa.c (typedef extern_symbol): Typedef the structure,
not a pointer to it. Create an object vector.
(extern_symbols): Turn into an object vector.
(pa_hpux_asm_output_external, pa_hpux_file_end): Adjust.
* cp/cp-tree.h: Adjust for new VEC API.
Define VEC(tree_pair_s,gc).
(struct save_scope): Adjust.
(struct lang_type_class): Adjust.
(unemitted_tinfo_decls): Adjust.
* cp/class.c (add_method, resort_type_method_vec,
finish_struct_methods, struct find_final_overrider_data,
dfs_find_final_overrider_pre, find_final_overrider,
get_vcall_index, warn_hidden, walk_subobject_offsets,
check_methods, fixup_inline_methods, end_of_class,
warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer,
add_vcall_offset): Adjust.
* cp/decl.c (xref_basetypes, finish_method): Adjust.
* cp/decl2.c (check_classfn): Adjust.
* cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust.
* cp/method.c (do_build_copy_constructor): Adjust.
* cp/name-lookup.c (new_class_binding, store_binding,
store_bindings, store_class_bindings): Adjust.
* cp/name-lookup.h: Define VEC(cxx_saved_binding,gc),
VEC(cp_class_binding,gc).
(struct cp_binding_level): Adjust.
* cp/parser.c: Define VEC(cp_token_position,heap).
(struct cp_lexer): Adjust.
(cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy,
cp_lexer_save_tokens): Adjust.
* cp/pt.c (retrieve_specialization,
check_explicit_specialization): Adjust.
* cp/rtti.c (unemitted_tinfo_decls): Adjust.
(init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init,
get_pseudo_ti_desc): Adjust.
* cp/search.c (dfs_access_in_type, lookup_conversion_operator,
lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible,
dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust.
* cp/semantics.c: Define VEC(deferred_access,gc).
(push_deferring_access_checks): Adjust.
* cp/typeck2.c (abstract_virtuals_error): Adjust.
From-SVN: r98498
2005-04-21 11:18:28 +02:00
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
/* Generate a lambda loopnest from a gcc loopnest LOOP_NEST.
|
|
|
|
Return the new loop nest.
|
|
|
|
INDUCTIONVARS is a pointer to an array of induction variables for the
|
|
|
|
loopnest that will be filled in during this process.
|
|
|
|
INVARIANTS is a pointer to an array of invariants that will be filled in
|
|
|
|
during this process. */
|
|
|
|
|
|
|
|
lambda_loopnest
|
tree-vrp.c (execute_vrp): Do not pass loops structure through arguments.
* tree-vrp.c (execute_vrp): Do not pass loops structure through
arguments.
* loop-unswitch.c (unswitch_loops, unswitch_single_loop,
unswitch_loop): Ditto.
* tree-loop-linear.c (linear_transform_loops): Ditto.
* tree-ssa-loop-im.c (determine_lsm, tree_ssa_lim_initialize,
tree_ssa_lim): Ditto.
* tree-ssa-loop-niter.c (estimate_numbers_of_iterations,
free_numbers_of_iterations_estimates): Ditto.
* tree-ssa-loop-unswitch.c (tree_ssa_unswitch_loops,
tree_unswitch_single_loop, tree_unswitch_loop): Ditto.
* cfgloopmanip.c (fix_bb_placement, fix_bb_placements,
remove_path, add_loop, loopify, unloop, fix_loop_placements,
place_new_loop, duplicate_loop, duplicate_subloops,
update_single_exit_for_duplicated_loops, copy_loops_to,
duplicate_loop_to_header_edge, create_preheaders,
force_single_succ_latches, loop_version, fix_loop_structure):
Ditto.
* tree-ssa-loop-manip.c (tree_duplicate_loop_to_header_edge,
tree_unroll_loop): Ditto.
* tree-ssa-loop-ch.c (copy_loop_headers): Ditto.
* tree-scalar-evolution.c (select_loops_exit_conditions,
scev_initialize, scev_analysis): Ditto.
* tree-scalar-evolution.h (scev_initialize): Ditto.
* cfghooks.c (cfg_hook_duplicate_loop_to_header_edge): Ditto.
* cfgloopanal.c (mark_irreducible_loops, mark_loop_exit_edges): Ditto.
* tree-ssa-loop-ivopts.c (tree_ssa_iv_optimize): Ditto.
* modulo-sched.c (sms_schedule): Ditto.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Ditto.
* loop-init.c (loop_optimizer_init, rtl_move_loop_invariants,
rtl_unswitch, rtl_unroll_and_peel_loops, rtl_doloop): Ditto.
* ifcvt.c (if_convert): Ditto.
* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely,
canonicalize_loop_induction_variables,
canonicalize_induction_variables,
tree_unroll_loops_completely, remove_empty_loops): Ditto.
* tree-ssa-loop.c (tree_ssa_loop_init, tree_ssa_loop_im,
tree_ssa_loop_unswitch, tree_vectorize, tree_linear_transform,
tree_ssa_loop_ivcanon, tree_ssa_empty_loop, tree_ssa_loop_bounds,
tree_complete_unroll, tree_ssa_loop_prefetch, tree_ssa_loop_ivopts,
tree_ssa_loop_done): Ditto.
* predict.c (predict_loops, tree_estimate_probability, estimate_loops,
estimate_bb_frequencies): Ditto.
* tree-vectorizer.c (slpeel_tree_duplicate_loop_to_edge_cfg,
slpeel_tree_peel_loop_to_edge, vectorize_loops): Ditto.
* loop-unroll.c (unroll_and_peel_loops, peel_loops_completely,
decide_unrolling_and_peeling, peel_loop_completely,
unroll_loop_constant_iterations, unroll_loop_runtime_iterations,
peel_loop_simple, unroll_loop_stupid): Ditto.
* loop-doloop.c (doloop_optimize_loops): Ditto.
* tree-cfgcleanup.c (cleanup_tree_cfg_loop): Ditto.
* loop-invariant.c (move_loop_invariants): Ditto.
* tree-ssa-dce.c (tree_ssa_dce_loop): Ditto.
* tree-ssa-loop-prefetch.c (loop_prefetch_arrays,
tree_ssa_prefetch_arrays): Ditto.
* lambda-code.c (gcc_loopnest_to_lambda_loopnest, perfect_nestify):
Ditto.
* tree-vect-transform.c (vect_do_peeling_for_loop_bound,
vect_do_peeling_for_alignment, vect_transform_loop): Ditto.
* cfgloop.c (flow_loops_cfg_dump, flow_loops_dump,
mark_single_exit_loops, cancel_loop, cancel_loop_tree,
verify_loop_structure): Ditto.
* tree-flow.h (vectorize_loops, tree_ssa_lim, tree_ssa_unswitch_loops,
canonicalize_induction_variables, tree_unroll_loops_completely,
tree_ssa_prefetch_arrays, remove_empty_loops, tree_ssa_iv_optimize,
estimate_numbers_of_iterations, free_numbers_of_iterations_estimates,
tree_duplicate_loop_to_header_edge, tree_ssa_loop_version,
tree_unroll_loop, linear_transform_loops): Declaration changed.
* basic-block.h: Remove declaration of struct loops.
* cfghooks.h (struct cfg_hooks): Change type of
cfg_hook_duplicate_loop_to_header_edge.
(cfg_hook_duplicate_loop_to_header_edge): Declaration changed.
* tree-vectorizer.h (slpeel_tree_peel_loop_to_edge,
vect_transform_loop): Declaration changed.
* lambda.h (gcc_loopnest_to_lambda_loopnest): Declaration changed.
* cfgloop.h (flow_loops_dump, fix_loop_structure,
mark_irreducible_loops, mark_single_exit_loops, mark_loop_exit_edges,
cancel_loop_tree, create_preheaders, force_single_succ_latches,
verify_loop_structure, duplicate_loop, duplicate_loop_to_header_edge,
loopify, loop_version, remove_path, unswitch_loops,
unroll_and_peel_loops, doloop_optimize_loops, move_loop_invariants):
Declaration changed.
From-SVN: r119189
2006-11-25 11:34:13 +01:00
|
|
|
gcc_loopnest_to_lambda_loopnest (struct loop *loop_nest,
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
VEC(tree,heap) **inductionvars,
|
2006-05-17 16:25:59 +02:00
|
|
|
VEC(tree,heap) **invariants)
|
2004-08-26 19:10:50 +02:00
|
|
|
{
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
lambda_loopnest ret = NULL;
|
2006-05-17 16:25:59 +02:00
|
|
|
struct loop *temp = loop_nest;
|
|
|
|
int depth = depth_of_nest (loop_nest);
|
2004-08-26 19:10:50 +02:00
|
|
|
size_t i;
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
VEC(lambda_loop,heap) *loops = NULL;
|
|
|
|
VEC(tree,heap) *uboundvars = NULL;
|
|
|
|
VEC(tree,heap) *lboundvars = NULL;
|
|
|
|
VEC(int,heap) *steps = NULL;
|
2004-08-26 19:10:50 +02:00
|
|
|
lambda_loop newloop;
|
|
|
|
tree inductionvar = NULL;
|
2006-05-17 16:25:59 +02:00
|
|
|
bool perfect_nest = perfect_nest_p (loop_nest);
|
|
|
|
|
|
|
|
if (!perfect_nest && !can_convert_to_perfect_nest (loop_nest))
|
|
|
|
goto fail;
|
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
while (temp)
|
|
|
|
{
|
|
|
|
newloop = gcc_loop_to_lambda_loop (temp, depth, invariants,
|
2004-09-16 18:16:14 +02:00
|
|
|
&inductionvar, *inductionvars,
|
|
|
|
&lboundvars, &uboundvars,
|
|
|
|
&steps);
|
2004-08-26 19:10:50 +02:00
|
|
|
if (!newloop)
|
2006-05-17 16:25:59 +02:00
|
|
|
goto fail;
|
|
|
|
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
VEC_safe_push (tree, heap, *inductionvars, inductionvar);
|
|
|
|
VEC_safe_push (lambda_loop, heap, loops, newloop);
|
2004-08-26 19:10:50 +02:00
|
|
|
temp = temp->inner;
|
|
|
|
}
|
2006-05-17 16:25:59 +02:00
|
|
|
|
|
|
|
if (!perfect_nest)
|
2004-09-16 18:16:14 +02:00
|
|
|
{
|
tree-vrp.c (execute_vrp): Do not pass loops structure through arguments.
* tree-vrp.c (execute_vrp): Do not pass loops structure through
arguments.
* loop-unswitch.c (unswitch_loops, unswitch_single_loop,
unswitch_loop): Ditto.
* tree-loop-linear.c (linear_transform_loops): Ditto.
* tree-ssa-loop-im.c (determine_lsm, tree_ssa_lim_initialize,
tree_ssa_lim): Ditto.
* tree-ssa-loop-niter.c (estimate_numbers_of_iterations,
free_numbers_of_iterations_estimates): Ditto.
* tree-ssa-loop-unswitch.c (tree_ssa_unswitch_loops,
tree_unswitch_single_loop, tree_unswitch_loop): Ditto.
* cfgloopmanip.c (fix_bb_placement, fix_bb_placements,
remove_path, add_loop, loopify, unloop, fix_loop_placements,
place_new_loop, duplicate_loop, duplicate_subloops,
update_single_exit_for_duplicated_loops, copy_loops_to,
duplicate_loop_to_header_edge, create_preheaders,
force_single_succ_latches, loop_version, fix_loop_structure):
Ditto.
* tree-ssa-loop-manip.c (tree_duplicate_loop_to_header_edge,
tree_unroll_loop): Ditto.
* tree-ssa-loop-ch.c (copy_loop_headers): Ditto.
* tree-scalar-evolution.c (select_loops_exit_conditions,
scev_initialize, scev_analysis): Ditto.
* tree-scalar-evolution.h (scev_initialize): Ditto.
* cfghooks.c (cfg_hook_duplicate_loop_to_header_edge): Ditto.
* cfgloopanal.c (mark_irreducible_loops, mark_loop_exit_edges): Ditto.
* tree-ssa-loop-ivopts.c (tree_ssa_iv_optimize): Ditto.
* modulo-sched.c (sms_schedule): Ditto.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Ditto.
* loop-init.c (loop_optimizer_init, rtl_move_loop_invariants,
rtl_unswitch, rtl_unroll_and_peel_loops, rtl_doloop): Ditto.
* ifcvt.c (if_convert): Ditto.
* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely,
canonicalize_loop_induction_variables,
canonicalize_induction_variables,
tree_unroll_loops_completely, remove_empty_loops): Ditto.
* tree-ssa-loop.c (tree_ssa_loop_init, tree_ssa_loop_im,
tree_ssa_loop_unswitch, tree_vectorize, tree_linear_transform,
tree_ssa_loop_ivcanon, tree_ssa_empty_loop, tree_ssa_loop_bounds,
tree_complete_unroll, tree_ssa_loop_prefetch, tree_ssa_loop_ivopts,
tree_ssa_loop_done): Ditto.
* predict.c (predict_loops, tree_estimate_probability, estimate_loops,
estimate_bb_frequencies): Ditto.
* tree-vectorizer.c (slpeel_tree_duplicate_loop_to_edge_cfg,
slpeel_tree_peel_loop_to_edge, vectorize_loops): Ditto.
* loop-unroll.c (unroll_and_peel_loops, peel_loops_completely,
decide_unrolling_and_peeling, peel_loop_completely,
unroll_loop_constant_iterations, unroll_loop_runtime_iterations,
peel_loop_simple, unroll_loop_stupid): Ditto.
* loop-doloop.c (doloop_optimize_loops): Ditto.
* tree-cfgcleanup.c (cleanup_tree_cfg_loop): Ditto.
* loop-invariant.c (move_loop_invariants): Ditto.
* tree-ssa-dce.c (tree_ssa_dce_loop): Ditto.
* tree-ssa-loop-prefetch.c (loop_prefetch_arrays,
tree_ssa_prefetch_arrays): Ditto.
* lambda-code.c (gcc_loopnest_to_lambda_loopnest, perfect_nestify):
Ditto.
* tree-vect-transform.c (vect_do_peeling_for_loop_bound,
vect_do_peeling_for_alignment, vect_transform_loop): Ditto.
* cfgloop.c (flow_loops_cfg_dump, flow_loops_dump,
mark_single_exit_loops, cancel_loop, cancel_loop_tree,
verify_loop_structure): Ditto.
* tree-flow.h (vectorize_loops, tree_ssa_lim, tree_ssa_unswitch_loops,
canonicalize_induction_variables, tree_unroll_loops_completely,
tree_ssa_prefetch_arrays, remove_empty_loops, tree_ssa_iv_optimize,
estimate_numbers_of_iterations, free_numbers_of_iterations_estimates,
tree_duplicate_loop_to_header_edge, tree_ssa_loop_version,
tree_unroll_loop, linear_transform_loops): Declaration changed.
* basic-block.h: Remove declaration of struct loops.
* cfghooks.h (struct cfg_hooks): Change type of
cfg_hook_duplicate_loop_to_header_edge.
(cfg_hook_duplicate_loop_to_header_edge): Declaration changed.
* tree-vectorizer.h (slpeel_tree_peel_loop_to_edge,
vect_transform_loop): Declaration changed.
* lambda.h (gcc_loopnest_to_lambda_loopnest): Declaration changed.
* cfgloop.h (flow_loops_dump, fix_loop_structure,
mark_irreducible_loops, mark_single_exit_loops, mark_loop_exit_edges,
cancel_loop_tree, create_preheaders, force_single_succ_latches,
verify_loop_structure, duplicate_loop, duplicate_loop_to_header_edge,
loopify, loop_version, remove_path, unswitch_loops,
unroll_and_peel_loops, doloop_optimize_loops, move_loop_invariants):
Declaration changed.
From-SVN: r119189
2006-11-25 11:34:13 +01:00
|
|
|
if (!perfect_nestify (loop_nest, lboundvars, uboundvars, steps,
|
|
|
|
*inductionvars))
|
2004-11-01 19:08:02 +01:00
|
|
|
{
|
|
|
|
if (dump_file)
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
fprintf (dump_file,
|
|
|
|
"Not a perfect loop nest and couldn't convert to one.\n");
|
|
|
|
goto fail;
|
2004-11-01 19:08:02 +01:00
|
|
|
}
|
|
|
|
else if (dump_file)
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
fprintf (dump_file,
|
|
|
|
"Successfully converted loop nest to perfect loop nest.\n");
|
2004-09-16 18:16:14 +02:00
|
|
|
}
|
2006-05-17 16:25:59 +02:00
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
ret = lambda_loopnest_new (depth, 2 * depth);
|
2006-05-17 16:25:59 +02:00
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
for (i = 0; VEC_iterate (lambda_loop, loops, i, newloop); i++)
|
|
|
|
LN_LOOPS (ret)[i] = newloop;
|
2006-05-17 16:25:59 +02:00
|
|
|
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
fail:
|
|
|
|
VEC_free (lambda_loop, heap, loops);
|
|
|
|
VEC_free (tree, heap, uboundvars);
|
|
|
|
VEC_free (tree, heap, lboundvars);
|
|
|
|
VEC_free (int, heap, steps);
|
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Convert a lambda body vector LBV to a gcc tree, and return the new tree.
|
|
|
|
STMTS_TO_INSERT is a pointer to a tree where the statements we need to be
|
|
|
|
inserted for us are stored. INDUCTION_VARS is the array of induction
|
2004-11-01 19:08:02 +01:00
|
|
|
variables for the loop this LBV is from. TYPE is the tree type to use for
|
|
|
|
the variables and trees involved. */
|
2004-08-26 19:10:50 +02:00
|
|
|
|
|
|
|
static tree
|
2004-11-01 19:08:02 +01:00
|
|
|
lbv_to_gcc_expression (lambda_body_vector lbv,
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
tree type, VEC(tree,heap) *induction_vars,
|
|
|
|
tree *stmts_to_insert)
|
2004-08-26 19:10:50 +02:00
|
|
|
{
|
|
|
|
tree stmts, stmt, resvar, name;
|
2004-11-01 19:08:02 +01:00
|
|
|
tree iv;
|
2004-08-26 19:10:50 +02:00
|
|
|
size_t i;
|
|
|
|
tree_stmt_iterator tsi;
|
|
|
|
|
|
|
|
/* Create a statement list and a linear expression temporary. */
|
|
|
|
stmts = alloc_stmt_list ();
|
2004-11-01 19:08:02 +01:00
|
|
|
resvar = create_tmp_var (type, "lbvtmp");
|
re PR c++/26757 (C++ front-end producing two DECLs with the same UID)
2006-05-23 Andrew MacLeod <amacleod@redhat.com>
PR c++/26757
* tree-ssa-loop-im.c (determine_invariantness_stmt): Use
add_referenced_var instead of add_referenced_tmp_var.
* tree-complex.c (create_one_component_var): Use add_referenced_var.
* tree-ssa-loop-manip.c (create_iv, tree_unroll_loop): Use
add_referenced_var.
* tree-tailcall.c (adjust_accumulator_values, adjust_return_value,
tree_optimize_tail_calls_1): Use add_referenced_var.
* tree-ssa-loop-ivopts.c (create_new_iv): Use add_referenced_var.
* tree-ssa-alias.c (create_memory_tag, create_global_var, create_sft):
Use add_referenced_var.
* tree-if-conv.c (ifc_temp_var): Use add_referenced_var.
* gimplify.c (force_gimple_operand): Use add_referenced_var.
* tree-ssa-phiopt.c (conditional_replacement, abs_replacement):
Use add_referenced_var.
* tree-dfa.c (struct walk_state): Remove.
(find_referenced_vars): Remove walk state and vars_found hash table.
(make_rename_temp): Use add_referenced_var.
(find_vars_r): Pass less parameters to add_referenced_var.
(referenced_var_p): New. Is var in referenced_var hash table.
(referenced_var_insert): Assert var isn't already in hash table.
(add_referenced_var): Don't need walk_state parameter. Add var if it
isn't already in the hash table.
(add_referenced_tmp_var): Remove.
(find_new_referenced_vars_1): Use add_referenced_var.
* tree-ssa-pre.c (create_expression_by_pieces,
insert_into_preds_of_block, insert_extra_phis, realify_fake_stores):
Use add_referenced_var.
* tree-vect-patterns.c (vect_pattern_recog_1): Use add_referenced_var.
* lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, perfect_nestify): Use
add_referenced_var.
* tree-vect-transform.c (vect_create_addr_base_for_vector_ref,
vect_create_data_ref_ptr, vect_create_destination_var,
vect_init_vector, vect_build_loop_niters,
vect_generate_tmps_on_preheader, vect_update_ivs_after_vectorizer,
vect_gen_niters_for_prolog_loop, vect_create_cond_for_align_checks):
Use add_referenced_var.
* tree-outof-ssa.c (create_temp): Use add_referenced_var.
* tree-flow.h (add_referenced_tmp_var): Remove prototype
(add_referenced_var): Add prototype.
* tree-ssa-structalias.c (get_constraint_for,
intra_create_variable_infos): Use add_referenced_var.
From-SVN: r114018
2006-05-23 16:07:21 +02:00
|
|
|
add_referenced_var (resvar);
|
2004-08-26 19:10:50 +02:00
|
|
|
|
|
|
|
/* Start at 0. */
|
function.c (gimplify_parameters): Call build_gimple_modify_stmt instead of calling build2 with a GIMPLE_MODIFY_STMT.
* function.c (gimplify_parameters): Call build_gimple_modify_stmt
instead of calling build2 with a GIMPLE_MODIFY_STMT.
* gimple-low.c (lower_function_body, lower_builtin_setjmp):
Likewise.
* gimplify.c (build_stack_save_restore, gimplify_return_expr,
gimplify_decl_expr, gimplify_self_mod_expr, gimplify_cond_expr,
gimplify_init_ctor_eval_range, gimple_push_cleanup,
gimplify_omp_for, gimplify_omp_atomic_pipeline,
gimplify_omp_atomic_mutex, gimplify_expr, gimplify_one_sizepos,
force_gimple_operand): Likewise.
* ipa-cp.c (constant_val_insert): Likewise.
* lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, replace_uses_equiv_to_x_with_y,
perfect_nestify): Likewise.
* langhooks.c (lhd_omp_assignment): Likewise.
* omp-low.c (lower_rec_input_clauses, lower_reduction_clauses,
lower_copyprivate_clauses, lower_send_clauses,
lower_send_shared_vars, expand_parallel_call,
expand_omp_for_generic, expand_omp_for_static_nochunk,
expand_omp_for_static_chunk, expand_omp_sections,
lower_omp_single_copy, lower_omp_for_lastprivate,
lower_omp_parallel, init_tmp_var, save_tmp_var): Likewise.
* value-prof.c (tree_divmod_fixed_value, tree_mod_pow2,
tree_mod_subtract, tree_ic, tree_stringop_fixed_value):
Likewise.
From-SVN: r122120
2007-02-19 03:45:34 +01:00
|
|
|
stmt = build_gimple_modify_stmt (resvar,
|
|
|
|
fold_convert (type, integer_zero_node));
|
2004-08-26 19:10:50 +02:00
|
|
|
name = make_ssa_name (resvar, stmt);
|
2006-12-05 18:26:05 +01:00
|
|
|
GIMPLE_STMT_OPERAND (stmt, 0) = name;
|
2004-08-26 19:10:50 +02:00
|
|
|
tsi = tsi_last (stmts);
|
|
|
|
tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
|
|
|
|
|
2004-11-01 19:08:02 +01:00
|
|
|
for (i = 0; VEC_iterate (tree, induction_vars, i, iv); i++)
|
2004-08-26 19:10:50 +02:00
|
|
|
{
|
|
|
|
if (LBV_COEFFICIENTS (lbv)[i] != 0)
|
|
|
|
{
|
|
|
|
tree newname;
|
2004-11-01 19:08:02 +01:00
|
|
|
tree coeffmult;
|
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
/* newname = coefficient * induction_variable */
|
2004-11-01 19:08:02 +01:00
|
|
|
coeffmult = build_int_cst (type, LBV_COEFFICIENTS (lbv)[i]);
|
function.c (gimplify_parameters): Call build_gimple_modify_stmt instead of calling build2 with a GIMPLE_MODIFY_STMT.
* function.c (gimplify_parameters): Call build_gimple_modify_stmt
instead of calling build2 with a GIMPLE_MODIFY_STMT.
* gimple-low.c (lower_function_body, lower_builtin_setjmp):
Likewise.
* gimplify.c (build_stack_save_restore, gimplify_return_expr,
gimplify_decl_expr, gimplify_self_mod_expr, gimplify_cond_expr,
gimplify_init_ctor_eval_range, gimple_push_cleanup,
gimplify_omp_for, gimplify_omp_atomic_pipeline,
gimplify_omp_atomic_mutex, gimplify_expr, gimplify_one_sizepos,
force_gimple_operand): Likewise.
* ipa-cp.c (constant_val_insert): Likewise.
* lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, replace_uses_equiv_to_x_with_y,
perfect_nestify): Likewise.
* langhooks.c (lhd_omp_assignment): Likewise.
* omp-low.c (lower_rec_input_clauses, lower_reduction_clauses,
lower_copyprivate_clauses, lower_send_clauses,
lower_send_shared_vars, expand_parallel_call,
expand_omp_for_generic, expand_omp_for_static_nochunk,
expand_omp_for_static_chunk, expand_omp_sections,
lower_omp_single_copy, lower_omp_for_lastprivate,
lower_omp_parallel, init_tmp_var, save_tmp_var): Likewise.
* value-prof.c (tree_divmod_fixed_value, tree_mod_pow2,
tree_mod_subtract, tree_ic, tree_stringop_fixed_value):
Likewise.
From-SVN: r122120
2007-02-19 03:45:34 +01:00
|
|
|
stmt = build_gimple_modify_stmt (resvar,
|
|
|
|
fold_build2 (MULT_EXPR, type,
|
|
|
|
iv, coeffmult));
|
2004-11-01 19:08:02 +01:00
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
newname = make_ssa_name (resvar, stmt);
|
2006-12-05 18:26:05 +01:00
|
|
|
GIMPLE_STMT_OPERAND (stmt, 0) = newname;
|
2004-11-01 19:08:02 +01:00
|
|
|
fold_stmt (&stmt);
|
2004-08-26 19:10:50 +02:00
|
|
|
tsi = tsi_last (stmts);
|
|
|
|
tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
|
2004-11-01 19:08:02 +01:00
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
/* name = name + newname */
|
function.c (gimplify_parameters): Call build_gimple_modify_stmt instead of calling build2 with a GIMPLE_MODIFY_STMT.
* function.c (gimplify_parameters): Call build_gimple_modify_stmt
instead of calling build2 with a GIMPLE_MODIFY_STMT.
* gimple-low.c (lower_function_body, lower_builtin_setjmp):
Likewise.
* gimplify.c (build_stack_save_restore, gimplify_return_expr,
gimplify_decl_expr, gimplify_self_mod_expr, gimplify_cond_expr,
gimplify_init_ctor_eval_range, gimple_push_cleanup,
gimplify_omp_for, gimplify_omp_atomic_pipeline,
gimplify_omp_atomic_mutex, gimplify_expr, gimplify_one_sizepos,
force_gimple_operand): Likewise.
* ipa-cp.c (constant_val_insert): Likewise.
* lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, replace_uses_equiv_to_x_with_y,
perfect_nestify): Likewise.
* langhooks.c (lhd_omp_assignment): Likewise.
* omp-low.c (lower_rec_input_clauses, lower_reduction_clauses,
lower_copyprivate_clauses, lower_send_clauses,
lower_send_shared_vars, expand_parallel_call,
expand_omp_for_generic, expand_omp_for_static_nochunk,
expand_omp_for_static_chunk, expand_omp_sections,
lower_omp_single_copy, lower_omp_for_lastprivate,
lower_omp_parallel, init_tmp_var, save_tmp_var): Likewise.
* value-prof.c (tree_divmod_fixed_value, tree_mod_pow2,
tree_mod_subtract, tree_ic, tree_stringop_fixed_value):
Likewise.
From-SVN: r122120
2007-02-19 03:45:34 +01:00
|
|
|
stmt = build_gimple_modify_stmt (resvar,
|
|
|
|
build2 (PLUS_EXPR, type,
|
|
|
|
name, newname));
|
2004-08-26 19:10:50 +02:00
|
|
|
name = make_ssa_name (resvar, stmt);
|
2006-12-05 18:26:05 +01:00
|
|
|
GIMPLE_STMT_OPERAND (stmt, 0) = name;
|
2004-11-01 19:08:02 +01:00
|
|
|
fold_stmt (&stmt);
|
2004-08-26 19:10:50 +02:00
|
|
|
tsi = tsi_last (stmts);
|
|
|
|
tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
|
2004-11-01 19:08:02 +01:00
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle any denominator that occurs. */
|
|
|
|
if (LBV_DENOMINATOR (lbv) != 1)
|
|
|
|
{
|
2004-11-01 19:08:02 +01:00
|
|
|
tree denominator = build_int_cst (type, LBV_DENOMINATOR (lbv));
|
function.c (gimplify_parameters): Call build_gimple_modify_stmt instead of calling build2 with a GIMPLE_MODIFY_STMT.
* function.c (gimplify_parameters): Call build_gimple_modify_stmt
instead of calling build2 with a GIMPLE_MODIFY_STMT.
* gimple-low.c (lower_function_body, lower_builtin_setjmp):
Likewise.
* gimplify.c (build_stack_save_restore, gimplify_return_expr,
gimplify_decl_expr, gimplify_self_mod_expr, gimplify_cond_expr,
gimplify_init_ctor_eval_range, gimple_push_cleanup,
gimplify_omp_for, gimplify_omp_atomic_pipeline,
gimplify_omp_atomic_mutex, gimplify_expr, gimplify_one_sizepos,
force_gimple_operand): Likewise.
* ipa-cp.c (constant_val_insert): Likewise.
* lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, replace_uses_equiv_to_x_with_y,
perfect_nestify): Likewise.
* langhooks.c (lhd_omp_assignment): Likewise.
* omp-low.c (lower_rec_input_clauses, lower_reduction_clauses,
lower_copyprivate_clauses, lower_send_clauses,
lower_send_shared_vars, expand_parallel_call,
expand_omp_for_generic, expand_omp_for_static_nochunk,
expand_omp_for_static_chunk, expand_omp_sections,
lower_omp_single_copy, lower_omp_for_lastprivate,
lower_omp_parallel, init_tmp_var, save_tmp_var): Likewise.
* value-prof.c (tree_divmod_fixed_value, tree_mod_pow2,
tree_mod_subtract, tree_ic, tree_stringop_fixed_value):
Likewise.
From-SVN: r122120
2007-02-19 03:45:34 +01:00
|
|
|
stmt = build_gimple_modify_stmt (resvar,
|
|
|
|
build2 (CEIL_DIV_EXPR, type,
|
|
|
|
name, denominator));
|
2004-08-26 19:10:50 +02:00
|
|
|
name = make_ssa_name (resvar, stmt);
|
2006-12-05 18:26:05 +01:00
|
|
|
GIMPLE_STMT_OPERAND (stmt, 0) = name;
|
2004-11-01 19:08:02 +01:00
|
|
|
fold_stmt (&stmt);
|
2004-08-26 19:10:50 +02:00
|
|
|
tsi = tsi_last (stmts);
|
|
|
|
tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
|
|
|
|
}
|
|
|
|
*stmts_to_insert = stmts;
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Convert a linear expression from coefficient and constant form to a
|
|
|
|
gcc tree.
|
|
|
|
Return the tree that represents the final value of the expression.
|
|
|
|
LLE is the linear expression to convert.
|
|
|
|
OFFSET is the linear offset to apply to the expression.
|
2004-11-01 19:08:02 +01:00
|
|
|
TYPE is the tree type to use for the variables and math.
|
2004-08-26 19:10:50 +02:00
|
|
|
INDUCTION_VARS is a vector of induction variables for the loops.
|
|
|
|
INVARIANTS is a vector of the loop nest invariants.
|
|
|
|
WRAP specifies what tree code to wrap the results in, if there is more than
|
|
|
|
one (it is either MAX_EXPR, or MIN_EXPR).
|
|
|
|
STMTS_TO_INSERT Is a pointer to the statement list we fill in with
|
|
|
|
statements that need to be inserted for the linear expression. */
|
|
|
|
|
|
|
|
static tree
|
|
|
|
lle_to_gcc_expression (lambda_linear_expression lle,
|
|
|
|
lambda_linear_expression offset,
|
2004-11-01 19:08:02 +01:00
|
|
|
tree type,
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
VEC(tree,heap) *induction_vars,
|
|
|
|
VEC(tree,heap) *invariants,
|
|
|
|
enum tree_code wrap, tree *stmts_to_insert)
|
2004-08-26 19:10:50 +02:00
|
|
|
{
|
|
|
|
tree stmts, stmt, resvar, name;
|
|
|
|
size_t i;
|
|
|
|
tree_stmt_iterator tsi;
|
2004-11-01 19:08:02 +01:00
|
|
|
tree iv, invar;
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
VEC(tree,heap) *results = NULL;
|
2004-08-26 19:10:50 +02:00
|
|
|
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
gcc_assert (wrap == MAX_EXPR || wrap == MIN_EXPR);
|
2004-08-26 19:10:50 +02:00
|
|
|
name = NULL_TREE;
|
|
|
|
/* Create a statement list and a linear expression temporary. */
|
|
|
|
stmts = alloc_stmt_list ();
|
2004-11-01 19:08:02 +01:00
|
|
|
resvar = create_tmp_var (type, "lletmp");
|
re PR c++/26757 (C++ front-end producing two DECLs with the same UID)
2006-05-23 Andrew MacLeod <amacleod@redhat.com>
PR c++/26757
* tree-ssa-loop-im.c (determine_invariantness_stmt): Use
add_referenced_var instead of add_referenced_tmp_var.
* tree-complex.c (create_one_component_var): Use add_referenced_var.
* tree-ssa-loop-manip.c (create_iv, tree_unroll_loop): Use
add_referenced_var.
* tree-tailcall.c (adjust_accumulator_values, adjust_return_value,
tree_optimize_tail_calls_1): Use add_referenced_var.
* tree-ssa-loop-ivopts.c (create_new_iv): Use add_referenced_var.
* tree-ssa-alias.c (create_memory_tag, create_global_var, create_sft):
Use add_referenced_var.
* tree-if-conv.c (ifc_temp_var): Use add_referenced_var.
* gimplify.c (force_gimple_operand): Use add_referenced_var.
* tree-ssa-phiopt.c (conditional_replacement, abs_replacement):
Use add_referenced_var.
* tree-dfa.c (struct walk_state): Remove.
(find_referenced_vars): Remove walk state and vars_found hash table.
(make_rename_temp): Use add_referenced_var.
(find_vars_r): Pass less parameters to add_referenced_var.
(referenced_var_p): New. Is var in referenced_var hash table.
(referenced_var_insert): Assert var isn't already in hash table.
(add_referenced_var): Don't need walk_state parameter. Add var if it
isn't already in the hash table.
(add_referenced_tmp_var): Remove.
(find_new_referenced_vars_1): Use add_referenced_var.
* tree-ssa-pre.c (create_expression_by_pieces,
insert_into_preds_of_block, insert_extra_phis, realify_fake_stores):
Use add_referenced_var.
* tree-vect-patterns.c (vect_pattern_recog_1): Use add_referenced_var.
* lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, perfect_nestify): Use
add_referenced_var.
* tree-vect-transform.c (vect_create_addr_base_for_vector_ref,
vect_create_data_ref_ptr, vect_create_destination_var,
vect_init_vector, vect_build_loop_niters,
vect_generate_tmps_on_preheader, vect_update_ivs_after_vectorizer,
vect_gen_niters_for_prolog_loop, vect_create_cond_for_align_checks):
Use add_referenced_var.
* tree-outof-ssa.c (create_temp): Use add_referenced_var.
* tree-flow.h (add_referenced_tmp_var): Remove prototype
(add_referenced_var): Add prototype.
* tree-ssa-structalias.c (get_constraint_for,
intra_create_variable_infos): Use add_referenced_var.
From-SVN: r114018
2006-05-23 16:07:21 +02:00
|
|
|
add_referenced_var (resvar);
|
2004-08-26 19:10:50 +02:00
|
|
|
|
|
|
|
/* Build up the linear expressions, and put the variable representing the
|
|
|
|
result in the results array. */
|
|
|
|
for (; lle != NULL; lle = LLE_NEXT (lle))
|
|
|
|
{
|
|
|
|
/* Start at name = 0. */
|
function.c (gimplify_parameters): Call build_gimple_modify_stmt instead of calling build2 with a GIMPLE_MODIFY_STMT.
* function.c (gimplify_parameters): Call build_gimple_modify_stmt
instead of calling build2 with a GIMPLE_MODIFY_STMT.
* gimple-low.c (lower_function_body, lower_builtin_setjmp):
Likewise.
* gimplify.c (build_stack_save_restore, gimplify_return_expr,
gimplify_decl_expr, gimplify_self_mod_expr, gimplify_cond_expr,
gimplify_init_ctor_eval_range, gimple_push_cleanup,
gimplify_omp_for, gimplify_omp_atomic_pipeline,
gimplify_omp_atomic_mutex, gimplify_expr, gimplify_one_sizepos,
force_gimple_operand): Likewise.
* ipa-cp.c (constant_val_insert): Likewise.
* lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, replace_uses_equiv_to_x_with_y,
perfect_nestify): Likewise.
* langhooks.c (lhd_omp_assignment): Likewise.
* omp-low.c (lower_rec_input_clauses, lower_reduction_clauses,
lower_copyprivate_clauses, lower_send_clauses,
lower_send_shared_vars, expand_parallel_call,
expand_omp_for_generic, expand_omp_for_static_nochunk,
expand_omp_for_static_chunk, expand_omp_sections,
lower_omp_single_copy, lower_omp_for_lastprivate,
lower_omp_parallel, init_tmp_var, save_tmp_var): Likewise.
* value-prof.c (tree_divmod_fixed_value, tree_mod_pow2,
tree_mod_subtract, tree_ic, tree_stringop_fixed_value):
Likewise.
From-SVN: r122120
2007-02-19 03:45:34 +01:00
|
|
|
stmt = build_gimple_modify_stmt (resvar,
|
|
|
|
fold_convert (type, integer_zero_node));
|
2004-08-26 19:10:50 +02:00
|
|
|
name = make_ssa_name (resvar, stmt);
|
2006-12-05 18:26:05 +01:00
|
|
|
GIMPLE_STMT_OPERAND (stmt, 0) = name;
|
2004-11-01 19:08:02 +01:00
|
|
|
fold_stmt (&stmt);
|
2004-08-26 19:10:50 +02:00
|
|
|
tsi = tsi_last (stmts);
|
|
|
|
tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
|
|
|
|
|
|
|
|
/* First do the induction variables.
|
|
|
|
at the end, name = name + all the induction variables added
|
|
|
|
together. */
|
2004-11-01 19:08:02 +01:00
|
|
|
for (i = 0; VEC_iterate (tree, induction_vars, i, iv); i++)
|
2004-08-26 19:10:50 +02:00
|
|
|
{
|
|
|
|
if (LLE_COEFFICIENTS (lle)[i] != 0)
|
|
|
|
{
|
|
|
|
tree newname;
|
|
|
|
tree mult;
|
|
|
|
tree coeff;
|
|
|
|
|
|
|
|
/* mult = induction variable * coefficient. */
|
|
|
|
if (LLE_COEFFICIENTS (lle)[i] == 1)
|
|
|
|
{
|
|
|
|
mult = VEC_index (tree, induction_vars, i);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-11-01 19:08:02 +01:00
|
|
|
coeff = build_int_cst (type,
|
2004-08-26 19:10:50 +02:00
|
|
|
LLE_COEFFICIENTS (lle)[i]);
|
builtins.c, [...]: Use fold_buildN instead of fold (buildN (...)).
* builtins.c, c-common.c, c-convert.c, c-decl.c, c-typeck.c,
convert.c, lambda-code.c, predict.c, tree-cfg.c,
tree-complex.c, tree-data-ref.c, tree-if-conv.c,
tree-mudflap.c, tree-scalar-evolution.c, tree-ssa-ccp.c,
tree-ssa-loop-ivcanon.c, tree-ssa-loop-ivopts.c,
tree-ssa-loop-manip.c, tree-ssa-phiopt.c, tree-ssa-pre.c,
tree-vect-analyze.c, tree-vect-transform.c, tree-vectorizer.c,
tree.c: Use fold_buildN instead of fold (buildN (...)).
From-SVN: r101338
2005-06-26 23:21:34 +02:00
|
|
|
mult = fold_build2 (MULT_EXPR, type, iv, coeff);
|
2004-08-26 19:10:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* newname = mult */
|
function.c (gimplify_parameters): Call build_gimple_modify_stmt instead of calling build2 with a GIMPLE_MODIFY_STMT.
* function.c (gimplify_parameters): Call build_gimple_modify_stmt
instead of calling build2 with a GIMPLE_MODIFY_STMT.
* gimple-low.c (lower_function_body, lower_builtin_setjmp):
Likewise.
* gimplify.c (build_stack_save_restore, gimplify_return_expr,
gimplify_decl_expr, gimplify_self_mod_expr, gimplify_cond_expr,
gimplify_init_ctor_eval_range, gimple_push_cleanup,
gimplify_omp_for, gimplify_omp_atomic_pipeline,
gimplify_omp_atomic_mutex, gimplify_expr, gimplify_one_sizepos,
force_gimple_operand): Likewise.
* ipa-cp.c (constant_val_insert): Likewise.
* lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, replace_uses_equiv_to_x_with_y,
perfect_nestify): Likewise.
* langhooks.c (lhd_omp_assignment): Likewise.
* omp-low.c (lower_rec_input_clauses, lower_reduction_clauses,
lower_copyprivate_clauses, lower_send_clauses,
lower_send_shared_vars, expand_parallel_call,
expand_omp_for_generic, expand_omp_for_static_nochunk,
expand_omp_for_static_chunk, expand_omp_sections,
lower_omp_single_copy, lower_omp_for_lastprivate,
lower_omp_parallel, init_tmp_var, save_tmp_var): Likewise.
* value-prof.c (tree_divmod_fixed_value, tree_mod_pow2,
tree_mod_subtract, tree_ic, tree_stringop_fixed_value):
Likewise.
From-SVN: r122120
2007-02-19 03:45:34 +01:00
|
|
|
stmt = build_gimple_modify_stmt (resvar, mult);
|
2004-08-26 19:10:50 +02:00
|
|
|
newname = make_ssa_name (resvar, stmt);
|
2006-12-05 18:26:05 +01:00
|
|
|
GIMPLE_STMT_OPERAND (stmt, 0) = newname;
|
2004-11-01 19:08:02 +01:00
|
|
|
fold_stmt (&stmt);
|
2004-08-26 19:10:50 +02:00
|
|
|
tsi = tsi_last (stmts);
|
|
|
|
tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
|
|
|
|
|
|
|
|
/* name = name + newname */
|
function.c (gimplify_parameters): Call build_gimple_modify_stmt instead of calling build2 with a GIMPLE_MODIFY_STMT.
* function.c (gimplify_parameters): Call build_gimple_modify_stmt
instead of calling build2 with a GIMPLE_MODIFY_STMT.
* gimple-low.c (lower_function_body, lower_builtin_setjmp):
Likewise.
* gimplify.c (build_stack_save_restore, gimplify_return_expr,
gimplify_decl_expr, gimplify_self_mod_expr, gimplify_cond_expr,
gimplify_init_ctor_eval_range, gimple_push_cleanup,
gimplify_omp_for, gimplify_omp_atomic_pipeline,
gimplify_omp_atomic_mutex, gimplify_expr, gimplify_one_sizepos,
force_gimple_operand): Likewise.
* ipa-cp.c (constant_val_insert): Likewise.
* lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, replace_uses_equiv_to_x_with_y,
perfect_nestify): Likewise.
* langhooks.c (lhd_omp_assignment): Likewise.
* omp-low.c (lower_rec_input_clauses, lower_reduction_clauses,
lower_copyprivate_clauses, lower_send_clauses,
lower_send_shared_vars, expand_parallel_call,
expand_omp_for_generic, expand_omp_for_static_nochunk,
expand_omp_for_static_chunk, expand_omp_sections,
lower_omp_single_copy, lower_omp_for_lastprivate,
lower_omp_parallel, init_tmp_var, save_tmp_var): Likewise.
* value-prof.c (tree_divmod_fixed_value, tree_mod_pow2,
tree_mod_subtract, tree_ic, tree_stringop_fixed_value):
Likewise.
From-SVN: r122120
2007-02-19 03:45:34 +01:00
|
|
|
stmt = build_gimple_modify_stmt (resvar,
|
|
|
|
build2 (PLUS_EXPR, type,
|
|
|
|
name, newname));
|
2004-08-26 19:10:50 +02:00
|
|
|
name = make_ssa_name (resvar, stmt);
|
2006-12-05 18:26:05 +01:00
|
|
|
GIMPLE_STMT_OPERAND (stmt, 0) = name;
|
2004-11-01 19:08:02 +01:00
|
|
|
fold_stmt (&stmt);
|
2004-08-26 19:10:50 +02:00
|
|
|
tsi = tsi_last (stmts);
|
|
|
|
tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle our invariants.
|
|
|
|
At the end, we have name = name + result of adding all multiplied
|
|
|
|
invariants. */
|
2004-11-01 19:08:02 +01:00
|
|
|
for (i = 0; VEC_iterate (tree, invariants, i, invar); i++)
|
2004-08-26 19:10:50 +02:00
|
|
|
{
|
|
|
|
if (LLE_INVARIANT_COEFFICIENTS (lle)[i] != 0)
|
|
|
|
{
|
|
|
|
tree newname;
|
|
|
|
tree mult;
|
|
|
|
tree coeff;
|
2004-11-01 19:08:02 +01:00
|
|
|
int invcoeff = LLE_INVARIANT_COEFFICIENTS (lle)[i];
|
2004-08-26 19:10:50 +02:00
|
|
|
/* mult = invariant * coefficient */
|
2004-11-01 19:08:02 +01:00
|
|
|
if (invcoeff == 1)
|
2004-08-26 19:10:50 +02:00
|
|
|
{
|
2004-11-01 19:08:02 +01:00
|
|
|
mult = invar;
|
2004-08-26 19:10:50 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-11-01 19:08:02 +01:00
|
|
|
coeff = build_int_cst (type, invcoeff);
|
builtins.c, [...]: Use fold_buildN instead of fold (buildN (...)).
* builtins.c, c-common.c, c-convert.c, c-decl.c, c-typeck.c,
convert.c, lambda-code.c, predict.c, tree-cfg.c,
tree-complex.c, tree-data-ref.c, tree-if-conv.c,
tree-mudflap.c, tree-scalar-evolution.c, tree-ssa-ccp.c,
tree-ssa-loop-ivcanon.c, tree-ssa-loop-ivopts.c,
tree-ssa-loop-manip.c, tree-ssa-phiopt.c, tree-ssa-pre.c,
tree-vect-analyze.c, tree-vect-transform.c, tree-vectorizer.c,
tree.c: Use fold_buildN instead of fold (buildN (...)).
From-SVN: r101338
2005-06-26 23:21:34 +02:00
|
|
|
mult = fold_build2 (MULT_EXPR, type, invar, coeff);
|
2004-08-26 19:10:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* newname = mult */
|
function.c (gimplify_parameters): Call build_gimple_modify_stmt instead of calling build2 with a GIMPLE_MODIFY_STMT.
* function.c (gimplify_parameters): Call build_gimple_modify_stmt
instead of calling build2 with a GIMPLE_MODIFY_STMT.
* gimple-low.c (lower_function_body, lower_builtin_setjmp):
Likewise.
* gimplify.c (build_stack_save_restore, gimplify_return_expr,
gimplify_decl_expr, gimplify_self_mod_expr, gimplify_cond_expr,
gimplify_init_ctor_eval_range, gimple_push_cleanup,
gimplify_omp_for, gimplify_omp_atomic_pipeline,
gimplify_omp_atomic_mutex, gimplify_expr, gimplify_one_sizepos,
force_gimple_operand): Likewise.
* ipa-cp.c (constant_val_insert): Likewise.
* lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, replace_uses_equiv_to_x_with_y,
perfect_nestify): Likewise.
* langhooks.c (lhd_omp_assignment): Likewise.
* omp-low.c (lower_rec_input_clauses, lower_reduction_clauses,
lower_copyprivate_clauses, lower_send_clauses,
lower_send_shared_vars, expand_parallel_call,
expand_omp_for_generic, expand_omp_for_static_nochunk,
expand_omp_for_static_chunk, expand_omp_sections,
lower_omp_single_copy, lower_omp_for_lastprivate,
lower_omp_parallel, init_tmp_var, save_tmp_var): Likewise.
* value-prof.c (tree_divmod_fixed_value, tree_mod_pow2,
tree_mod_subtract, tree_ic, tree_stringop_fixed_value):
Likewise.
From-SVN: r122120
2007-02-19 03:45:34 +01:00
|
|
|
stmt = build_gimple_modify_stmt (resvar, mult);
|
2004-08-26 19:10:50 +02:00
|
|
|
newname = make_ssa_name (resvar, stmt);
|
2006-12-05 18:26:05 +01:00
|
|
|
GIMPLE_STMT_OPERAND (stmt, 0) = newname;
|
2004-11-01 19:08:02 +01:00
|
|
|
fold_stmt (&stmt);
|
2004-08-26 19:10:50 +02:00
|
|
|
tsi = tsi_last (stmts);
|
|
|
|
tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
|
|
|
|
|
|
|
|
/* name = name + newname */
|
function.c (gimplify_parameters): Call build_gimple_modify_stmt instead of calling build2 with a GIMPLE_MODIFY_STMT.
* function.c (gimplify_parameters): Call build_gimple_modify_stmt
instead of calling build2 with a GIMPLE_MODIFY_STMT.
* gimple-low.c (lower_function_body, lower_builtin_setjmp):
Likewise.
* gimplify.c (build_stack_save_restore, gimplify_return_expr,
gimplify_decl_expr, gimplify_self_mod_expr, gimplify_cond_expr,
gimplify_init_ctor_eval_range, gimple_push_cleanup,
gimplify_omp_for, gimplify_omp_atomic_pipeline,
gimplify_omp_atomic_mutex, gimplify_expr, gimplify_one_sizepos,
force_gimple_operand): Likewise.
* ipa-cp.c (constant_val_insert): Likewise.
* lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, replace_uses_equiv_to_x_with_y,
perfect_nestify): Likewise.
* langhooks.c (lhd_omp_assignment): Likewise.
* omp-low.c (lower_rec_input_clauses, lower_reduction_clauses,
lower_copyprivate_clauses, lower_send_clauses,
lower_send_shared_vars, expand_parallel_call,
expand_omp_for_generic, expand_omp_for_static_nochunk,
expand_omp_for_static_chunk, expand_omp_sections,
lower_omp_single_copy, lower_omp_for_lastprivate,
lower_omp_parallel, init_tmp_var, save_tmp_var): Likewise.
* value-prof.c (tree_divmod_fixed_value, tree_mod_pow2,
tree_mod_subtract, tree_ic, tree_stringop_fixed_value):
Likewise.
From-SVN: r122120
2007-02-19 03:45:34 +01:00
|
|
|
stmt = build_gimple_modify_stmt (resvar,
|
|
|
|
build2 (PLUS_EXPR, type,
|
|
|
|
name, newname));
|
2004-08-26 19:10:50 +02:00
|
|
|
name = make_ssa_name (resvar, stmt);
|
2006-12-05 18:26:05 +01:00
|
|
|
GIMPLE_STMT_OPERAND (stmt, 0) = name;
|
2004-11-01 19:08:02 +01:00
|
|
|
fold_stmt (&stmt);
|
2004-08-26 19:10:50 +02:00
|
|
|
tsi = tsi_last (stmts);
|
|
|
|
tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now handle the constant.
|
|
|
|
name = name + constant. */
|
|
|
|
if (LLE_CONSTANT (lle) != 0)
|
|
|
|
{
|
function.c (gimplify_parameters): Call build_gimple_modify_stmt instead of calling build2 with a GIMPLE_MODIFY_STMT.
* function.c (gimplify_parameters): Call build_gimple_modify_stmt
instead of calling build2 with a GIMPLE_MODIFY_STMT.
* gimple-low.c (lower_function_body, lower_builtin_setjmp):
Likewise.
* gimplify.c (build_stack_save_restore, gimplify_return_expr,
gimplify_decl_expr, gimplify_self_mod_expr, gimplify_cond_expr,
gimplify_init_ctor_eval_range, gimple_push_cleanup,
gimplify_omp_for, gimplify_omp_atomic_pipeline,
gimplify_omp_atomic_mutex, gimplify_expr, gimplify_one_sizepos,
force_gimple_operand): Likewise.
* ipa-cp.c (constant_val_insert): Likewise.
* lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, replace_uses_equiv_to_x_with_y,
perfect_nestify): Likewise.
* langhooks.c (lhd_omp_assignment): Likewise.
* omp-low.c (lower_rec_input_clauses, lower_reduction_clauses,
lower_copyprivate_clauses, lower_send_clauses,
lower_send_shared_vars, expand_parallel_call,
expand_omp_for_generic, expand_omp_for_static_nochunk,
expand_omp_for_static_chunk, expand_omp_sections,
lower_omp_single_copy, lower_omp_for_lastprivate,
lower_omp_parallel, init_tmp_var, save_tmp_var): Likewise.
* value-prof.c (tree_divmod_fixed_value, tree_mod_pow2,
tree_mod_subtract, tree_ic, tree_stringop_fixed_value):
Likewise.
From-SVN: r122120
2007-02-19 03:45:34 +01:00
|
|
|
tree incr = build_int_cst (type, LLE_CONSTANT (lle));
|
|
|
|
stmt = build_gimple_modify_stmt (resvar, build2 (PLUS_EXPR, type,
|
|
|
|
name, incr));
|
2004-08-26 19:10:50 +02:00
|
|
|
name = make_ssa_name (resvar, stmt);
|
2006-12-05 18:26:05 +01:00
|
|
|
GIMPLE_STMT_OPERAND (stmt, 0) = name;
|
2004-11-01 19:08:02 +01:00
|
|
|
fold_stmt (&stmt);
|
2004-08-26 19:10:50 +02:00
|
|
|
tsi = tsi_last (stmts);
|
|
|
|
tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Now handle the offset.
|
|
|
|
name = name + linear offset. */
|
|
|
|
if (LLE_CONSTANT (offset) != 0)
|
|
|
|
{
|
function.c (gimplify_parameters): Call build_gimple_modify_stmt instead of calling build2 with a GIMPLE_MODIFY_STMT.
* function.c (gimplify_parameters): Call build_gimple_modify_stmt
instead of calling build2 with a GIMPLE_MODIFY_STMT.
* gimple-low.c (lower_function_body, lower_builtin_setjmp):
Likewise.
* gimplify.c (build_stack_save_restore, gimplify_return_expr,
gimplify_decl_expr, gimplify_self_mod_expr, gimplify_cond_expr,
gimplify_init_ctor_eval_range, gimple_push_cleanup,
gimplify_omp_for, gimplify_omp_atomic_pipeline,
gimplify_omp_atomic_mutex, gimplify_expr, gimplify_one_sizepos,
force_gimple_operand): Likewise.
* ipa-cp.c (constant_val_insert): Likewise.
* lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, replace_uses_equiv_to_x_with_y,
perfect_nestify): Likewise.
* langhooks.c (lhd_omp_assignment): Likewise.
* omp-low.c (lower_rec_input_clauses, lower_reduction_clauses,
lower_copyprivate_clauses, lower_send_clauses,
lower_send_shared_vars, expand_parallel_call,
expand_omp_for_generic, expand_omp_for_static_nochunk,
expand_omp_for_static_chunk, expand_omp_sections,
lower_omp_single_copy, lower_omp_for_lastprivate,
lower_omp_parallel, init_tmp_var, save_tmp_var): Likewise.
* value-prof.c (tree_divmod_fixed_value, tree_mod_pow2,
tree_mod_subtract, tree_ic, tree_stringop_fixed_value):
Likewise.
From-SVN: r122120
2007-02-19 03:45:34 +01:00
|
|
|
tree incr = build_int_cst (type, LLE_CONSTANT (offset));
|
|
|
|
stmt = build_gimple_modify_stmt (resvar, build2 (PLUS_EXPR, type,
|
|
|
|
name, incr));
|
2004-08-26 19:10:50 +02:00
|
|
|
name = make_ssa_name (resvar, stmt);
|
2006-12-05 18:26:05 +01:00
|
|
|
GIMPLE_STMT_OPERAND (stmt, 0) = name;
|
2004-11-01 19:08:02 +01:00
|
|
|
fold_stmt (&stmt);
|
2004-08-26 19:10:50 +02:00
|
|
|
tsi = tsi_last (stmts);
|
|
|
|
tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Handle any denominator that occurs. */
|
|
|
|
if (LLE_DENOMINATOR (lle) != 1)
|
|
|
|
{
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
stmt = build_int_cst (type, LLE_DENOMINATOR (lle));
|
tree-vrp.c (build_assert_expr_for, [...]): Use buildN instead of build.
2005-12-02 Richard Guenther <rguenther@suse.de>
* tree-vrp.c (build_assert_expr_for, process_assert_insertions_for,
simplify_cond_using_ranges): Use buildN instead of build.
* tree-tailcall.c (adjust_accumulator_values,
adjust_return_value): Likewise.
* tree-sra.c (generate_one_element_ref, generate_copy_inout,
generate_element_copy, generate_element_zero,
generate_one_element_init): Likewise.
* tree-ssa-forwprop.c (forward_propagate_into_cond_1): Likewise.
* lambda-code.c (gcc_loop_to_lambda_loop, lbv_to_gcc_expression,
lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest,
perfect_nestify): Likewise.
From-SVN: r107894
2005-12-02 15:40:40 +01:00
|
|
|
stmt = build2 (wrap == MAX_EXPR ? CEIL_DIV_EXPR : FLOOR_DIV_EXPR,
|
|
|
|
type, name, stmt);
|
function.c (gimplify_parameters): Call build_gimple_modify_stmt instead of calling build2 with a GIMPLE_MODIFY_STMT.
* function.c (gimplify_parameters): Call build_gimple_modify_stmt
instead of calling build2 with a GIMPLE_MODIFY_STMT.
* gimple-low.c (lower_function_body, lower_builtin_setjmp):
Likewise.
* gimplify.c (build_stack_save_restore, gimplify_return_expr,
gimplify_decl_expr, gimplify_self_mod_expr, gimplify_cond_expr,
gimplify_init_ctor_eval_range, gimple_push_cleanup,
gimplify_omp_for, gimplify_omp_atomic_pipeline,
gimplify_omp_atomic_mutex, gimplify_expr, gimplify_one_sizepos,
force_gimple_operand): Likewise.
* ipa-cp.c (constant_val_insert): Likewise.
* lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, replace_uses_equiv_to_x_with_y,
perfect_nestify): Likewise.
* langhooks.c (lhd_omp_assignment): Likewise.
* omp-low.c (lower_rec_input_clauses, lower_reduction_clauses,
lower_copyprivate_clauses, lower_send_clauses,
lower_send_shared_vars, expand_parallel_call,
expand_omp_for_generic, expand_omp_for_static_nochunk,
expand_omp_for_static_chunk, expand_omp_sections,
lower_omp_single_copy, lower_omp_for_lastprivate,
lower_omp_parallel, init_tmp_var, save_tmp_var): Likewise.
* value-prof.c (tree_divmod_fixed_value, tree_mod_pow2,
tree_mod_subtract, tree_ic, tree_stringop_fixed_value):
Likewise.
From-SVN: r122120
2007-02-19 03:45:34 +01:00
|
|
|
stmt = build_gimple_modify_stmt (resvar, stmt);
|
2004-08-26 19:10:50 +02:00
|
|
|
|
|
|
|
/* name = {ceil, floor}(name/denominator) */
|
|
|
|
name = make_ssa_name (resvar, stmt);
|
2006-12-05 18:26:05 +01:00
|
|
|
GIMPLE_STMT_OPERAND (stmt, 0) = name;
|
2004-08-26 19:10:50 +02:00
|
|
|
tsi = tsi_last (stmts);
|
|
|
|
tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
|
|
|
|
}
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
VEC_safe_push (tree, heap, results, name);
|
2004-08-26 19:10:50 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Again, out of laziness, we don't handle this case yet. It's not
|
|
|
|
hard, it just hasn't occurred. */
|
2004-09-08 17:28:56 +02:00
|
|
|
gcc_assert (VEC_length (tree, results) <= 2);
|
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
/* We may need to wrap the results in a MAX_EXPR or MIN_EXPR. */
|
|
|
|
if (VEC_length (tree, results) > 1)
|
|
|
|
{
|
|
|
|
tree op1 = VEC_index (tree, results, 0);
|
|
|
|
tree op2 = VEC_index (tree, results, 1);
|
function.c (gimplify_parameters): Call build_gimple_modify_stmt instead of calling build2 with a GIMPLE_MODIFY_STMT.
* function.c (gimplify_parameters): Call build_gimple_modify_stmt
instead of calling build2 with a GIMPLE_MODIFY_STMT.
* gimple-low.c (lower_function_body, lower_builtin_setjmp):
Likewise.
* gimplify.c (build_stack_save_restore, gimplify_return_expr,
gimplify_decl_expr, gimplify_self_mod_expr, gimplify_cond_expr,
gimplify_init_ctor_eval_range, gimple_push_cleanup,
gimplify_omp_for, gimplify_omp_atomic_pipeline,
gimplify_omp_atomic_mutex, gimplify_expr, gimplify_one_sizepos,
force_gimple_operand): Likewise.
* ipa-cp.c (constant_val_insert): Likewise.
* lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, replace_uses_equiv_to_x_with_y,
perfect_nestify): Likewise.
* langhooks.c (lhd_omp_assignment): Likewise.
* omp-low.c (lower_rec_input_clauses, lower_reduction_clauses,
lower_copyprivate_clauses, lower_send_clauses,
lower_send_shared_vars, expand_parallel_call,
expand_omp_for_generic, expand_omp_for_static_nochunk,
expand_omp_for_static_chunk, expand_omp_sections,
lower_omp_single_copy, lower_omp_for_lastprivate,
lower_omp_parallel, init_tmp_var, save_tmp_var): Likewise.
* value-prof.c (tree_divmod_fixed_value, tree_mod_pow2,
tree_mod_subtract, tree_ic, tree_stringop_fixed_value):
Likewise.
From-SVN: r122120
2007-02-19 03:45:34 +01:00
|
|
|
stmt = build_gimple_modify_stmt (resvar, build2 (wrap, type, op1, op2));
|
2004-08-26 19:10:50 +02:00
|
|
|
name = make_ssa_name (resvar, stmt);
|
2006-12-05 18:26:05 +01:00
|
|
|
GIMPLE_STMT_OPERAND (stmt, 0) = name;
|
2004-08-26 19:10:50 +02:00
|
|
|
tsi = tsi_last (stmts);
|
|
|
|
tsi_link_after (&tsi, stmt, TSI_CONTINUE_LINKING);
|
|
|
|
}
|
|
|
|
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
VEC_free (tree, heap, results);
|
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
*stmts_to_insert = stmts;
|
|
|
|
return name;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Transform a lambda loopnest NEW_LOOPNEST, which had TRANSFORM applied to
|
|
|
|
it, back into gcc code. This changes the
|
|
|
|
loops, their induction variables, and their bodies, so that they
|
|
|
|
match the transformed loopnest.
|
|
|
|
OLD_LOOPNEST is the loopnest before we've replaced it with the new
|
|
|
|
loopnest.
|
|
|
|
OLD_IVS is a vector of induction variables from the old loopnest.
|
|
|
|
INVARIANTS is a vector of loop invariants from the old loopnest.
|
|
|
|
NEW_LOOPNEST is the new lambda loopnest to replace OLD_LOOPNEST with.
|
|
|
|
TRANSFORM is the matrix transform that was applied to OLD_LOOPNEST to get
|
|
|
|
NEW_LOOPNEST. */
|
2004-11-01 19:08:02 +01:00
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
void
|
|
|
|
lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
VEC(tree,heap) *old_ivs,
|
|
|
|
VEC(tree,heap) *invariants,
|
2004-08-26 19:10:50 +02:00
|
|
|
lambda_loopnest new_loopnest,
|
|
|
|
lambda_trans_matrix transform)
|
|
|
|
{
|
|
|
|
struct loop *temp;
|
|
|
|
size_t i = 0;
|
|
|
|
size_t depth = 0;
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
VEC(tree,heap) *new_ivs = NULL;
|
2004-11-01 19:08:02 +01:00
|
|
|
tree oldiv;
|
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
block_stmt_iterator bsi;
|
|
|
|
|
|
|
|
if (dump_file)
|
|
|
|
{
|
|
|
|
transform = lambda_trans_matrix_inverse (transform);
|
|
|
|
fprintf (dump_file, "Inverse of transformation matrix:\n");
|
|
|
|
print_lambda_trans_matrix (dump_file, transform);
|
|
|
|
}
|
2004-11-01 19:08:02 +01:00
|
|
|
depth = depth_of_nest (old_loopnest);
|
2004-08-26 19:10:50 +02:00
|
|
|
temp = old_loopnest;
|
|
|
|
|
|
|
|
while (temp)
|
|
|
|
{
|
|
|
|
lambda_loop newloop;
|
|
|
|
basic_block bb;
|
2004-11-17 03:51:55 +01:00
|
|
|
edge exit;
|
2004-08-26 19:10:50 +02:00
|
|
|
tree ivvar, ivvarinced, exitcond, stmts;
|
|
|
|
enum tree_code testtype;
|
|
|
|
tree newupperbound, newlowerbound;
|
|
|
|
lambda_linear_expression offset;
|
2004-11-01 19:08:02 +01:00
|
|
|
tree type;
|
2005-02-14 15:54:37 +01:00
|
|
|
bool insert_after;
|
2005-04-11 20:55:47 +02:00
|
|
|
tree inc_stmt;
|
2004-11-01 19:08:02 +01:00
|
|
|
|
|
|
|
oldiv = VEC_index (tree, old_ivs, i);
|
|
|
|
type = TREE_TYPE (oldiv);
|
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
/* First, build the new induction variable temporary */
|
|
|
|
|
2004-11-01 19:08:02 +01:00
|
|
|
ivvar = create_tmp_var (type, "lnivtmp");
|
re PR c++/26757 (C++ front-end producing two DECLs with the same UID)
2006-05-23 Andrew MacLeod <amacleod@redhat.com>
PR c++/26757
* tree-ssa-loop-im.c (determine_invariantness_stmt): Use
add_referenced_var instead of add_referenced_tmp_var.
* tree-complex.c (create_one_component_var): Use add_referenced_var.
* tree-ssa-loop-manip.c (create_iv, tree_unroll_loop): Use
add_referenced_var.
* tree-tailcall.c (adjust_accumulator_values, adjust_return_value,
tree_optimize_tail_calls_1): Use add_referenced_var.
* tree-ssa-loop-ivopts.c (create_new_iv): Use add_referenced_var.
* tree-ssa-alias.c (create_memory_tag, create_global_var, create_sft):
Use add_referenced_var.
* tree-if-conv.c (ifc_temp_var): Use add_referenced_var.
* gimplify.c (force_gimple_operand): Use add_referenced_var.
* tree-ssa-phiopt.c (conditional_replacement, abs_replacement):
Use add_referenced_var.
* tree-dfa.c (struct walk_state): Remove.
(find_referenced_vars): Remove walk state and vars_found hash table.
(make_rename_temp): Use add_referenced_var.
(find_vars_r): Pass less parameters to add_referenced_var.
(referenced_var_p): New. Is var in referenced_var hash table.
(referenced_var_insert): Assert var isn't already in hash table.
(add_referenced_var): Don't need walk_state parameter. Add var if it
isn't already in the hash table.
(add_referenced_tmp_var): Remove.
(find_new_referenced_vars_1): Use add_referenced_var.
* tree-ssa-pre.c (create_expression_by_pieces,
insert_into_preds_of_block, insert_extra_phis, realify_fake_stores):
Use add_referenced_var.
* tree-vect-patterns.c (vect_pattern_recog_1): Use add_referenced_var.
* lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, perfect_nestify): Use
add_referenced_var.
* tree-vect-transform.c (vect_create_addr_base_for_vector_ref,
vect_create_data_ref_ptr, vect_create_destination_var,
vect_init_vector, vect_build_loop_niters,
vect_generate_tmps_on_preheader, vect_update_ivs_after_vectorizer,
vect_gen_niters_for_prolog_loop, vect_create_cond_for_align_checks):
Use add_referenced_var.
* tree-outof-ssa.c (create_temp): Use add_referenced_var.
* tree-flow.h (add_referenced_tmp_var): Remove prototype
(add_referenced_var): Add prototype.
* tree-ssa-structalias.c (get_constraint_for,
intra_create_variable_infos): Use add_referenced_var.
From-SVN: r114018
2006-05-23 16:07:21 +02:00
|
|
|
add_referenced_var (ivvar);
|
2004-08-26 19:10:50 +02:00
|
|
|
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
VEC_safe_push (tree, heap, new_ivs, ivvar);
|
2004-08-26 19:10:50 +02:00
|
|
|
|
|
|
|
newloop = LN_LOOPS (new_loopnest)[i];
|
|
|
|
|
|
|
|
/* Linear offset is a bit tricky to handle. Punt on the unhandled
|
c-common.c, [...]: Fix comment formatting.
* c-common.c, c-decl.c, combine.c, defaults.h, fold-const.c,
gimplify.c, gthr-nks.h, hooks.c, lambda-code.c, lambda-mat.c,
stor-layout.c, target.h, tree-cfg.c, tree-chrec.c,
tree-if-conv.c, tree-inline.c, tree-into-ssa.c,
tree-mudflap.c, tree-optimize.c, tree-scalar-evolution.c,
tree-ssa-alias.c, tree-ssa-ccp.c, tree-ssa-dce.c,
tree-ssa-pre.c, tree-vectorizer.c, tree-vectorizer.h, tree.h,
vec.h: Fix comment formatting.
From-SVN: r87105
2004-09-05 18:05:06 +02:00
|
|
|
cases for now. */
|
2004-08-26 19:10:50 +02:00
|
|
|
offset = LL_LINEAR_OFFSET (newloop);
|
2004-11-01 19:08:02 +01:00
|
|
|
|
2004-09-08 17:28:56 +02:00
|
|
|
gcc_assert (LLE_DENOMINATOR (offset) == 1 &&
|
|
|
|
lambda_vector_zerop (LLE_COEFFICIENTS (offset), depth));
|
2004-11-01 19:08:02 +01:00
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
/* Now build the new lower bounds, and insert the statements
|
c-common.c, [...]: Fix comment formatting.
* c-common.c, c-decl.c, combine.c, defaults.h, fold-const.c,
gimplify.c, gthr-nks.h, hooks.c, lambda-code.c, lambda-mat.c,
stor-layout.c, target.h, tree-cfg.c, tree-chrec.c,
tree-if-conv.c, tree-inline.c, tree-into-ssa.c,
tree-mudflap.c, tree-optimize.c, tree-scalar-evolution.c,
tree-ssa-alias.c, tree-ssa-ccp.c, tree-ssa-dce.c,
tree-ssa-pre.c, tree-vectorizer.c, tree-vectorizer.h, tree.h,
vec.h: Fix comment formatting.
From-SVN: r87105
2004-09-05 18:05:06 +02:00
|
|
|
necessary to generate it on the loop preheader. */
|
2004-08-26 19:10:50 +02:00
|
|
|
newlowerbound = lle_to_gcc_expression (LL_LOWER_BOUND (newloop),
|
|
|
|
LL_LINEAR_OFFSET (newloop),
|
2004-11-01 19:08:02 +01:00
|
|
|
type,
|
2004-08-26 19:10:50 +02:00
|
|
|
new_ivs,
|
|
|
|
invariants, MAX_EXPR, &stmts);
|
|
|
|
bsi_insert_on_edge (loop_preheader_edge (temp), stmts);
|
2004-11-16 01:08:04 +01:00
|
|
|
bsi_commit_edge_inserts ();
|
2004-08-26 19:10:50 +02:00
|
|
|
/* Build the new upper bound and insert its statements in the
|
|
|
|
basic block of the exit condition */
|
|
|
|
newupperbound = lle_to_gcc_expression (LL_UPPER_BOUND (newloop),
|
|
|
|
LL_LINEAR_OFFSET (newloop),
|
2004-11-01 19:08:02 +01:00
|
|
|
type,
|
2004-08-26 19:10:50 +02:00
|
|
|
new_ivs,
|
|
|
|
invariants, MIN_EXPR, &stmts);
|
tree-loop-linear.c (linear_transform_loops): Use single_exit accessor functions.
* tree-loop-linear.c (linear_transform_loops): Use single_exit accessor
functions.
* tree-ssa-loop-niter.c (loop_only_exit_p): Ditto.
* cfgloopmanip.c (update_single_exits_after_duplication,
update_single_exit_for_duplicated_loop, loop_version): Ditto.
* tree-scalar-evolution.c (get_loop_exit_condition,
get_exit_conditions_rec, loop_closed_phi_def,
number_of_iterations_in_loop, scev_const_prop): Ditto.
* tree-ssa-loop-ivopts.c (single_dom_exit): Ditto.
* modulo-sched.c (generate_prolog_epilog, loop_canon_p, sms_schedule):
Ditto.
* tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables):
Ditto.
* tree-vectorizer.c (slpeel_update_phis_for_duplicate_loop,
slpeel_update_phi_nodes_for_guard1, slpeel_update_phi_nodes_for_guard2,
slpeel_make_loop_iterate_ntimes,
slpeel_tree_duplicate_loop_to_edge_cfg, slpeel_can_duplicate_loop_p,
slpeel_verify_cfg_after_peeling, slpeel_tree_peel_loop_to_edge):
Ditto.
* tree-if-conv.c (if_convertible_loop_p): Ditto.
* tree-vect-analyze.c (vect_analyze_operations, vect_stmt_relevant_p,
vect_analyze_loop_form): Ditto.
* lambda-code.c (lambda_loopnest_to_gcc_loopnest, exit_phi_for_loop_p,
can_convert_to_perfect_nest, perfect_nestify): Ditto.
* tree-vect-transform.c (vect_create_epilog_for_reduction,
vect_update_ivs_after_vectorizer, vect_do_peeling_for_loop_bound,
vect_transform_loop): Ditto.
* cfgloop.c (mark_single_exit_loops, verify_loop_structure): Ditto.
(single_exit, set_single_exit): New functions.
* cfgloop.h (struct loop): Rename single_exit field to single_exit_.
(single_exit, set_single_exit): Declare.
* doc/loop.texi: Undocument single_exit field. Document single_exit
accessor function.
From-SVN: r119075
2006-11-22 00:54:16 +01:00
|
|
|
exit = single_exit (temp);
|
2004-08-26 19:10:50 +02:00
|
|
|
exitcond = get_loop_exit_condition (temp);
|
|
|
|
bb = bb_for_stmt (exitcond);
|
|
|
|
bsi = bsi_start (bb);
|
|
|
|
bsi_insert_after (&bsi, stmts, BSI_NEW_STMT);
|
|
|
|
|
2005-02-14 15:54:37 +01:00
|
|
|
/* Create the new iv. */
|
2004-08-26 19:10:50 +02:00
|
|
|
|
2005-02-14 15:54:37 +01:00
|
|
|
standard_iv_increment_position (temp, &bsi, &insert_after);
|
2004-08-26 19:10:50 +02:00
|
|
|
create_iv (newlowerbound,
|
2004-11-01 19:08:02 +01:00
|
|
|
build_int_cst (type, LL_STEP (newloop)),
|
2005-02-14 15:54:37 +01:00
|
|
|
ivvar, temp, &bsi, insert_after, &ivvar,
|
2005-04-11 20:55:47 +02:00
|
|
|
NULL);
|
|
|
|
|
|
|
|
/* Unfortunately, the incremented ivvar that create_iv inserted may not
|
|
|
|
dominate the block containing the exit condition.
|
|
|
|
So we simply create our own incremented iv to use in the new exit
|
|
|
|
test, and let redundancy elimination sort it out. */
|
tree-vrp.c (build_assert_expr_for, [...]): Use buildN instead of build.
2005-12-02 Richard Guenther <rguenther@suse.de>
* tree-vrp.c (build_assert_expr_for, process_assert_insertions_for,
simplify_cond_using_ranges): Use buildN instead of build.
* tree-tailcall.c (adjust_accumulator_values,
adjust_return_value): Likewise.
* tree-sra.c (generate_one_element_ref, generate_copy_inout,
generate_element_copy, generate_element_zero,
generate_one_element_init): Likewise.
* tree-ssa-forwprop.c (forward_propagate_into_cond_1): Likewise.
* lambda-code.c (gcc_loop_to_lambda_loop, lbv_to_gcc_expression,
lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest,
perfect_nestify): Likewise.
From-SVN: r107894
2005-12-02 15:40:40 +01:00
|
|
|
inc_stmt = build2 (PLUS_EXPR, type,
|
|
|
|
ivvar, build_int_cst (type, LL_STEP (newloop)));
|
function.c (gimplify_parameters): Call build_gimple_modify_stmt instead of calling build2 with a GIMPLE_MODIFY_STMT.
* function.c (gimplify_parameters): Call build_gimple_modify_stmt
instead of calling build2 with a GIMPLE_MODIFY_STMT.
* gimple-low.c (lower_function_body, lower_builtin_setjmp):
Likewise.
* gimplify.c (build_stack_save_restore, gimplify_return_expr,
gimplify_decl_expr, gimplify_self_mod_expr, gimplify_cond_expr,
gimplify_init_ctor_eval_range, gimple_push_cleanup,
gimplify_omp_for, gimplify_omp_atomic_pipeline,
gimplify_omp_atomic_mutex, gimplify_expr, gimplify_one_sizepos,
force_gimple_operand): Likewise.
* ipa-cp.c (constant_val_insert): Likewise.
* lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, replace_uses_equiv_to_x_with_y,
perfect_nestify): Likewise.
* langhooks.c (lhd_omp_assignment): Likewise.
* omp-low.c (lower_rec_input_clauses, lower_reduction_clauses,
lower_copyprivate_clauses, lower_send_clauses,
lower_send_shared_vars, expand_parallel_call,
expand_omp_for_generic, expand_omp_for_static_nochunk,
expand_omp_for_static_chunk, expand_omp_sections,
lower_omp_single_copy, lower_omp_for_lastprivate,
lower_omp_parallel, init_tmp_var, save_tmp_var): Likewise.
* value-prof.c (tree_divmod_fixed_value, tree_mod_pow2,
tree_mod_subtract, tree_ic, tree_stringop_fixed_value):
Likewise.
From-SVN: r122120
2007-02-19 03:45:34 +01:00
|
|
|
inc_stmt = build_gimple_modify_stmt (SSA_NAME_VAR (ivvar), inc_stmt);
|
2005-04-11 20:55:47 +02:00
|
|
|
ivvarinced = make_ssa_name (SSA_NAME_VAR (ivvar), inc_stmt);
|
2006-12-05 18:26:05 +01:00
|
|
|
GIMPLE_STMT_OPERAND (inc_stmt, 0) = ivvarinced;
|
2005-04-11 20:55:47 +02:00
|
|
|
bsi = bsi_for_stmt (exitcond);
|
|
|
|
bsi_insert_before (&bsi, inc_stmt, BSI_SAME_STMT);
|
2004-08-26 19:10:50 +02:00
|
|
|
|
|
|
|
/* Replace the exit condition with the new upper bound
|
|
|
|
comparison. */
|
2004-11-01 19:08:02 +01:00
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
testtype = LL_STEP (newloop) >= 0 ? LE_EXPR : GE_EXPR;
|
2004-11-01 19:08:02 +01:00
|
|
|
|
2004-11-17 03:51:55 +01:00
|
|
|
/* We want to build a conditional where true means exit the loop, and
|
|
|
|
false means continue the loop.
|
|
|
|
So swap the testtype if this isn't the way things are.*/
|
|
|
|
|
|
|
|
if (exit->flags & EDGE_FALSE_VALUE)
|
2004-11-01 19:08:02 +01:00
|
|
|
testtype = swap_tree_comparison (testtype);
|
2004-11-17 03:51:55 +01:00
|
|
|
|
tree-vrp.c (build_assert_expr_for, [...]): Use buildN instead of build.
2005-12-02 Richard Guenther <rguenther@suse.de>
* tree-vrp.c (build_assert_expr_for, process_assert_insertions_for,
simplify_cond_using_ranges): Use buildN instead of build.
* tree-tailcall.c (adjust_accumulator_values,
adjust_return_value): Likewise.
* tree-sra.c (generate_one_element_ref, generate_copy_inout,
generate_element_copy, generate_element_zero,
generate_one_element_init): Likewise.
* tree-ssa-forwprop.c (forward_propagate_into_cond_1): Likewise.
* lambda-code.c (gcc_loop_to_lambda_loop, lbv_to_gcc_expression,
lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest,
perfect_nestify): Likewise.
From-SVN: r107894
2005-12-02 15:40:40 +01:00
|
|
|
COND_EXPR_COND (exitcond) = build2 (testtype,
|
|
|
|
boolean_type_node,
|
|
|
|
newupperbound, ivvarinced);
|
lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt.
2005-04-05 Andrew MacLeod <amacleod@redhat.com>
* lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt.
Use immediate use iterator.
(stmt_is_bumper_for_loop): Use immediate use iterator.
* predict.c (strip_builtin_expect): Use update_stmt.
* tree-cfg.c (update_modified_stmts): New. Call update_stmt_if_modified
on all elements of a STATEMENT_LIST.
(bsi_insert_before, bsi_insert_after): Call update_modified_stmts.
(bsi_remove): Remove imm_use links and mark the stmt as modified.
(bsi_replace): Mark stmt as modified and the update it.
* tree-complex.c (update_complex_assignment): Call mark_stmt_modified.
(expand_complex_libcal): Call update_stmt.
(expand_complex_comparison): Call mark_stmt_modified.
(expand_complex_operations_1): Call update_stmt_if_modified.
(expand_vector_operations_1): Call mark_stmt_modified.
* tree-dfa.c (compute_immediate_uses, free_df_for_stmt, free_df,
compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt,
add_immediate_use, redirect_immediate_use,
redirect_immediate_uses, dump_immediate_uses, debug_immediate_uses,
dump_immediate_uses_for, debug_immediate_uses_for): Delete.
(mark_new_vars_to_rename): Call update_stmt.
* tree-dump.c (dump_option_value_in): Add "stmtaddr".
* tree-flow-inline.h (modify_stmt): Rename to mark_stmt_modified.
Ignore PHI nodes.
(unmodify_stmt): Delete.
(update_stmt): New. Force an update of a stmt.
(update_stmt_if_modified): update a stmt if it is out of date.
(get_stmt_operands): Verify stmt is NOT modified.
(stmt_modified_p): Update comment.
(delink_imm_use): Remove a use node from its immuse list.
(link_imm_use_to_list): Link a use node to a specific list.
(link_imm_use): Link a node to the correct list.
(set_ssa_use_from_ptr): Set a use node to a specific value, and insert
it in the correct list, if appropriate.
(link_imm_use_stmt): Link a use node, and set the stmt pointer.
(relink_imm_use): Link a use node in place of another node in a list.
(relink_imm_use_stmt): LInk a node in place of another node, and set
the stmt pointer.
(end_safe_imm_use_traverse): New. Terminate a safe immuse iterator.
(end_safe_imm_use_p): New. Check for the end of a safe immuse iterator.
(first_safe_imm_use): New. Initialize a safe immuse iterator.
(next_safe_imm_use): New. Proceed to next safe immuse iterator value.
(end_readonly_imm_use_p): New. Check for end of a fast immuse iterator.
(first_readonly_imm_use): New. Initialize a fast immuse iterator.
(next_readonly_imm_use): New. Get the next fast immuse iterator value.
(has_zero_uses): New. Return true if there are no uses of a var.
(has_single_use): New. Return true if there is only a single use of a
variable.
(single_imm_use): New. Return the simgle immediate use.
(num_imm_uses): New. Return the number of immediate uses.
(get_v_must_def_ops): Use is now a pointer.
(use_operand_p, get_v_may_def_op_ptr, get_vuse_op_ptr,
get_v_must_def_kill_ptr, get_phi_arg_def_ptr): Return the address of
the use node.
(get_immediate_uses, num_immediate_uses, immediate_use): Delete.
(delink_stmt_imm_use): Delink all immuses from a stmt.
(phi_arg_index_from_use): New. Return a phi arg index for a use.
* tree-flow.h (struct dataflow_d): Delete.
(immediate_use_iterator_d): New. Immediate use iterator struct.
(FOR_EACH_IMM_USE_FAST): New. Macro for read only immuse iteration.
(FOR_EACH_IMM_USE_SAFE): New. Macro for write-safe immuse iteration.
(BREAK_FROM_SAFE_IMM_USE): New. Macro for earlyu exit from write-safe
iteration.
(struct stmt_ann_d): Remove dataflow_t from struct.
* tree-if-conv.c (tree_if_conversion). Don't call free_df.
(if_convertible_phi_p): Use FAST immuse iterator.
(if_convertible_loop_p): Don't call compute_immediate_uses.
(replace_phi_with_cond_modify_expr): Call update_stmt.
* tree-into-ssa.c (mark_def_sites, ssa_mark_def_sites): Call
update_stmt_if_modified.
(rewrite_all_into_ssa): Initialize ssa operands.
* tree-loop-linear.c (linear_transform_loops): Don't call free_df or
compute_immediate_uses.
* tree-optimize.c (execute_todo): Call verify_ssa whenever the
ssa_property is available.
(execute_one_pass): Change parameters passed to execute_todo.
* tree-outof-ssa.c (rewrite_trees): Don't call modify_stmt.
(remove_ssa_form): Call fini_ssa_operands.
(insert_backedge_copies): Delete call to modify_stmt.
* tree-phinodes.c (make_phi_node): Initialize use nodes.
(release_phi_node): Delink any use nodes before releasing.
(resize_phi_node): Relink any use nodes.
(remove_phi_arg_num): Delink the use node.
(remove_phi_node): Release the ssa_name AFTER releasing the phi node.
(remove_all_phi_nodes_for): Release phi node first.
* tree-pretty-print.c (dump_generic_node): Print stmt address.
* tree-sra.c (mark_all_v_defs): Call update_stmt_if_modified.
(scalarize_use, scalarize_copy): Call update_stmt.
* tree-ssa-alias.c (compute_may_aliases): Update all modified stmts.
(compute_points_to_and_addr_escape): Call mark_stmt_modified.
* tree-ssa-cpp.c (need_imm_uses_for): Delete.
(ccp_initialize): Remove call to compute_immediate_uses.
(substitute_and_fold, execute_fold_all_builtins): Call update_stmt.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Update all modified
stmts.
(simplify_cond_and_lookup_avail_expr): Call mark_stmt_modified.
(simplify_switch_and_lookup_avail_expr): Call mark_stmt_modified.
(eliminate_redundant_computations): Call mark_stmt_modified.
(cprop_operand): Call mark_stmt_modified.
(optimize_stmt): Call update_stmt_if_modified and mark_stmt_modified.
* tree-ssa-dse.c (fix_phi_uses, fix_stmt_v_may_defs): Delete.
(dse_optimize_stmt): Use new immuse interface.
(tree_ssa_dse): Remove calls to compute_immediate_uses and free_df.
* tree-ssa-forwprop.c (need_imm_uses_for): Delete.
(substitute_single_use_vars): Use new immuse interface.
(tree_ssa_forward_propagate_single_use_vars): Remove calls to free_df
and compute_immediate_uses.
* tree-ssa-loop-im.c (single_reachable_address): Use new immuse
interface.
(rewrite_mem_refs): Call update_stmt.
(determine_lsm): Remove call to compute_imm_uses and free_df.
* tree-ssa-loop-ivcanon.c (create_canonical_iv): Call update_stmt.
(try_unroll_loop_completely): Call update_stmt.
* tree-ssa-loop-ivopts.c (rewrite_address_base): Call update_stmt.
(rewrite_use_compare): Call update_stmt.
(compute_phi_arg_on_exit): Insert each stmt before trying to process.
(rewrite_use) : Call update_stmt.
* tree-ssa-loop-manip.c (verify_loop_closed_ssa): Add arg to call.
* tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Call
update_stmt.
* tree-ssa-operands.c (NULL_USE_OPERAND_P): Remove declaration.
(allocate_use_optype, allocate_vuse_optype): Adjust allocation size.
(free_uses, free_vuses, free_v_may_defs, free_v_must_defs): Delink
use nodes.
(initialize_vuse_operand): New. Initialize a vuse operand.
(initialize_v_may_def_operand): New. Initialize a maydef operand.
(initialize_v_must_def_operand): New. Initialize a mustdef operand.
(finalize_ssa_defs): Use stmt parameter.
(correct_use_link): Ensure a use node is in the correct list, and has
the correct stmt pointer.
(finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_vuses,
finalize_ssa_v_must_defs): Also initialize use nodes.
(finalize_ssa_stmt_operands): Pass extra stmt operands.
(build_ssa_operands): Seperate parsing from final operand construction.
(parse_ssa_operands): New. Parse entry point for operand building.
(swap_tree_operands): New. Swap 2 tree operands.
(update_stmt_operands): Ranamed from get_stmt_operands. Always builds
operands.
(get_expr_operands): Call swap_tree_operands when needed.
(copy_virtual_operands): Use initialize routines for virtual use ops.
(create_ssa_artficial_load_stmt): Add extra stmt parameter.
(verify_abort): New. Issue imm_use error.
(verify_imm_links): New Verify imm_use links for a var.
(dump_immediate_uses_for): New. Dump imm_uses for a var to file.
(dump_immediate_uses): New. Dump imm_uses for all vars to file.
(debug_immediate_uses): New. Dump imm_uses for all vars to stderr.
(debug_immediate_uses_for): New. Dump imm_uses for a var to stderr.
* tree-ssa-operands.h (struct use_operand_ptr): Delete.
(NULL_USE_OPERAND_P) Define.
(use_optype_d, v_def_use_operand_type, vuse_optype_d): Add immediate
use node.
(struct vuse_operand_type): New struct.
(SET_USE): Call set_ssa_use_from_ptr.
(USE_STMT): Define.
(PHI_ARG_INDEX_FROM_USE): Define.
* tree-ssa-phiopt.c (replace_phi_edge_with_variable): Set the phi
argument via SET_USE, not PHI_ARG_DEF_TREE.
* tree-ssa-pre.c (eliminate): Call update_stmt.
* tree-ssa-propagate.c (cfg_blocks_get): Use imm_use iterators. Don't
call free_df.
* tree-ssa-sink.c (all_immediate_uses_same_place): Use imm_use iterator.
(nearest_common_dominator_of_uses): Use imm_use iterator.
(statement_sink_location): Use imm_use iterator and interface.
(execute_sink_code): Don't call compute_immediate_uses or free-df.
* tree-ssa-threadupdate.c (create_edge_and_update_destination_phis): Use
PHI_ARG_DEF, not PHI_ARG_DEF_TREE.
* tree-ssa.c (verify_use, verify_phi_args): Verify some imm_use info.
(verify_ssa): Ensure no stmt is marked modify after optimization pass
if new parameter is true.
(init_tree_ssa): Don't initialize operand cache here.
(delete_tree_ssa): Don't destroy operand cache here.
(propagate_into_addr): Pass in a use pointer, return true if anything
was changed.
(replace_immediate_uses): Use imm_use iterator, call update_stmt.
(check_phi_redundancy): Use imm_use iterator.
(kill_redundant_phi_nodes): Don't call compute_immediate_uses or
free_df.
* tree-ssanames.c (make_ssa_name): Initialize imm_use node.
(release_ssa_name): Delink node and all elements in its imm_use list.
* tree-tailcall.c (adjust_return_value): Call update_stmt.
* tree-vect-analyze.c (vect_stmt_relevant_p): Use imm_use iterator.
* tree-vectorizer.c (need_imm_uses_for): Delete.
(vectorize_loops): Dont call compute_immediate_uses or free_df.
* tree.h (struct ssa_imm_use_d): Define.
(SSA_NAME_IMM_USE_NODE): Define.
(struct tree_ssa_name): Add imm_use node.
(PHI_DF): Delete.
(PHI_ARG_IMM_USE_NODE): Define.
(struct phi_arg_d): Add imm_use node.
(struct tree_phi_node): Remove struct dataflow_d element.
(TDF_STMTADDR): Define.
From-SVN: r97648
2005-04-05 21:05:20 +02:00
|
|
|
update_stmt (exitcond);
|
2004-08-26 19:10:50 +02:00
|
|
|
VEC_replace (tree, new_ivs, i, ivvar);
|
|
|
|
|
|
|
|
i++;
|
|
|
|
temp = temp->inner;
|
|
|
|
}
|
2004-11-01 19:08:02 +01:00
|
|
|
|
2004-09-16 18:16:14 +02:00
|
|
|
/* Rewrite uses of the old ivs so that they are now specified in terms of
|
|
|
|
the new ivs. */
|
2004-11-01 19:08:02 +01:00
|
|
|
|
|
|
|
for (i = 0; VEC_iterate (tree, old_ivs, i, oldiv); i++)
|
2004-09-16 18:16:14 +02:00
|
|
|
{
|
lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt.
2005-04-05 Andrew MacLeod <amacleod@redhat.com>
* lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt.
Use immediate use iterator.
(stmt_is_bumper_for_loop): Use immediate use iterator.
* predict.c (strip_builtin_expect): Use update_stmt.
* tree-cfg.c (update_modified_stmts): New. Call update_stmt_if_modified
on all elements of a STATEMENT_LIST.
(bsi_insert_before, bsi_insert_after): Call update_modified_stmts.
(bsi_remove): Remove imm_use links and mark the stmt as modified.
(bsi_replace): Mark stmt as modified and the update it.
* tree-complex.c (update_complex_assignment): Call mark_stmt_modified.
(expand_complex_libcal): Call update_stmt.
(expand_complex_comparison): Call mark_stmt_modified.
(expand_complex_operations_1): Call update_stmt_if_modified.
(expand_vector_operations_1): Call mark_stmt_modified.
* tree-dfa.c (compute_immediate_uses, free_df_for_stmt, free_df,
compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt,
add_immediate_use, redirect_immediate_use,
redirect_immediate_uses, dump_immediate_uses, debug_immediate_uses,
dump_immediate_uses_for, debug_immediate_uses_for): Delete.
(mark_new_vars_to_rename): Call update_stmt.
* tree-dump.c (dump_option_value_in): Add "stmtaddr".
* tree-flow-inline.h (modify_stmt): Rename to mark_stmt_modified.
Ignore PHI nodes.
(unmodify_stmt): Delete.
(update_stmt): New. Force an update of a stmt.
(update_stmt_if_modified): update a stmt if it is out of date.
(get_stmt_operands): Verify stmt is NOT modified.
(stmt_modified_p): Update comment.
(delink_imm_use): Remove a use node from its immuse list.
(link_imm_use_to_list): Link a use node to a specific list.
(link_imm_use): Link a node to the correct list.
(set_ssa_use_from_ptr): Set a use node to a specific value, and insert
it in the correct list, if appropriate.
(link_imm_use_stmt): Link a use node, and set the stmt pointer.
(relink_imm_use): Link a use node in place of another node in a list.
(relink_imm_use_stmt): LInk a node in place of another node, and set
the stmt pointer.
(end_safe_imm_use_traverse): New. Terminate a safe immuse iterator.
(end_safe_imm_use_p): New. Check for the end of a safe immuse iterator.
(first_safe_imm_use): New. Initialize a safe immuse iterator.
(next_safe_imm_use): New. Proceed to next safe immuse iterator value.
(end_readonly_imm_use_p): New. Check for end of a fast immuse iterator.
(first_readonly_imm_use): New. Initialize a fast immuse iterator.
(next_readonly_imm_use): New. Get the next fast immuse iterator value.
(has_zero_uses): New. Return true if there are no uses of a var.
(has_single_use): New. Return true if there is only a single use of a
variable.
(single_imm_use): New. Return the simgle immediate use.
(num_imm_uses): New. Return the number of immediate uses.
(get_v_must_def_ops): Use is now a pointer.
(use_operand_p, get_v_may_def_op_ptr, get_vuse_op_ptr,
get_v_must_def_kill_ptr, get_phi_arg_def_ptr): Return the address of
the use node.
(get_immediate_uses, num_immediate_uses, immediate_use): Delete.
(delink_stmt_imm_use): Delink all immuses from a stmt.
(phi_arg_index_from_use): New. Return a phi arg index for a use.
* tree-flow.h (struct dataflow_d): Delete.
(immediate_use_iterator_d): New. Immediate use iterator struct.
(FOR_EACH_IMM_USE_FAST): New. Macro for read only immuse iteration.
(FOR_EACH_IMM_USE_SAFE): New. Macro for write-safe immuse iteration.
(BREAK_FROM_SAFE_IMM_USE): New. Macro for earlyu exit from write-safe
iteration.
(struct stmt_ann_d): Remove dataflow_t from struct.
* tree-if-conv.c (tree_if_conversion). Don't call free_df.
(if_convertible_phi_p): Use FAST immuse iterator.
(if_convertible_loop_p): Don't call compute_immediate_uses.
(replace_phi_with_cond_modify_expr): Call update_stmt.
* tree-into-ssa.c (mark_def_sites, ssa_mark_def_sites): Call
update_stmt_if_modified.
(rewrite_all_into_ssa): Initialize ssa operands.
* tree-loop-linear.c (linear_transform_loops): Don't call free_df or
compute_immediate_uses.
* tree-optimize.c (execute_todo): Call verify_ssa whenever the
ssa_property is available.
(execute_one_pass): Change parameters passed to execute_todo.
* tree-outof-ssa.c (rewrite_trees): Don't call modify_stmt.
(remove_ssa_form): Call fini_ssa_operands.
(insert_backedge_copies): Delete call to modify_stmt.
* tree-phinodes.c (make_phi_node): Initialize use nodes.
(release_phi_node): Delink any use nodes before releasing.
(resize_phi_node): Relink any use nodes.
(remove_phi_arg_num): Delink the use node.
(remove_phi_node): Release the ssa_name AFTER releasing the phi node.
(remove_all_phi_nodes_for): Release phi node first.
* tree-pretty-print.c (dump_generic_node): Print stmt address.
* tree-sra.c (mark_all_v_defs): Call update_stmt_if_modified.
(scalarize_use, scalarize_copy): Call update_stmt.
* tree-ssa-alias.c (compute_may_aliases): Update all modified stmts.
(compute_points_to_and_addr_escape): Call mark_stmt_modified.
* tree-ssa-cpp.c (need_imm_uses_for): Delete.
(ccp_initialize): Remove call to compute_immediate_uses.
(substitute_and_fold, execute_fold_all_builtins): Call update_stmt.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Update all modified
stmts.
(simplify_cond_and_lookup_avail_expr): Call mark_stmt_modified.
(simplify_switch_and_lookup_avail_expr): Call mark_stmt_modified.
(eliminate_redundant_computations): Call mark_stmt_modified.
(cprop_operand): Call mark_stmt_modified.
(optimize_stmt): Call update_stmt_if_modified and mark_stmt_modified.
* tree-ssa-dse.c (fix_phi_uses, fix_stmt_v_may_defs): Delete.
(dse_optimize_stmt): Use new immuse interface.
(tree_ssa_dse): Remove calls to compute_immediate_uses and free_df.
* tree-ssa-forwprop.c (need_imm_uses_for): Delete.
(substitute_single_use_vars): Use new immuse interface.
(tree_ssa_forward_propagate_single_use_vars): Remove calls to free_df
and compute_immediate_uses.
* tree-ssa-loop-im.c (single_reachable_address): Use new immuse
interface.
(rewrite_mem_refs): Call update_stmt.
(determine_lsm): Remove call to compute_imm_uses and free_df.
* tree-ssa-loop-ivcanon.c (create_canonical_iv): Call update_stmt.
(try_unroll_loop_completely): Call update_stmt.
* tree-ssa-loop-ivopts.c (rewrite_address_base): Call update_stmt.
(rewrite_use_compare): Call update_stmt.
(compute_phi_arg_on_exit): Insert each stmt before trying to process.
(rewrite_use) : Call update_stmt.
* tree-ssa-loop-manip.c (verify_loop_closed_ssa): Add arg to call.
* tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Call
update_stmt.
* tree-ssa-operands.c (NULL_USE_OPERAND_P): Remove declaration.
(allocate_use_optype, allocate_vuse_optype): Adjust allocation size.
(free_uses, free_vuses, free_v_may_defs, free_v_must_defs): Delink
use nodes.
(initialize_vuse_operand): New. Initialize a vuse operand.
(initialize_v_may_def_operand): New. Initialize a maydef operand.
(initialize_v_must_def_operand): New. Initialize a mustdef operand.
(finalize_ssa_defs): Use stmt parameter.
(correct_use_link): Ensure a use node is in the correct list, and has
the correct stmt pointer.
(finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_vuses,
finalize_ssa_v_must_defs): Also initialize use nodes.
(finalize_ssa_stmt_operands): Pass extra stmt operands.
(build_ssa_operands): Seperate parsing from final operand construction.
(parse_ssa_operands): New. Parse entry point for operand building.
(swap_tree_operands): New. Swap 2 tree operands.
(update_stmt_operands): Ranamed from get_stmt_operands. Always builds
operands.
(get_expr_operands): Call swap_tree_operands when needed.
(copy_virtual_operands): Use initialize routines for virtual use ops.
(create_ssa_artficial_load_stmt): Add extra stmt parameter.
(verify_abort): New. Issue imm_use error.
(verify_imm_links): New Verify imm_use links for a var.
(dump_immediate_uses_for): New. Dump imm_uses for a var to file.
(dump_immediate_uses): New. Dump imm_uses for all vars to file.
(debug_immediate_uses): New. Dump imm_uses for all vars to stderr.
(debug_immediate_uses_for): New. Dump imm_uses for a var to stderr.
* tree-ssa-operands.h (struct use_operand_ptr): Delete.
(NULL_USE_OPERAND_P) Define.
(use_optype_d, v_def_use_operand_type, vuse_optype_d): Add immediate
use node.
(struct vuse_operand_type): New struct.
(SET_USE): Call set_ssa_use_from_ptr.
(USE_STMT): Define.
(PHI_ARG_INDEX_FROM_USE): Define.
* tree-ssa-phiopt.c (replace_phi_edge_with_variable): Set the phi
argument via SET_USE, not PHI_ARG_DEF_TREE.
* tree-ssa-pre.c (eliminate): Call update_stmt.
* tree-ssa-propagate.c (cfg_blocks_get): Use imm_use iterators. Don't
call free_df.
* tree-ssa-sink.c (all_immediate_uses_same_place): Use imm_use iterator.
(nearest_common_dominator_of_uses): Use imm_use iterator.
(statement_sink_location): Use imm_use iterator and interface.
(execute_sink_code): Don't call compute_immediate_uses or free-df.
* tree-ssa-threadupdate.c (create_edge_and_update_destination_phis): Use
PHI_ARG_DEF, not PHI_ARG_DEF_TREE.
* tree-ssa.c (verify_use, verify_phi_args): Verify some imm_use info.
(verify_ssa): Ensure no stmt is marked modify after optimization pass
if new parameter is true.
(init_tree_ssa): Don't initialize operand cache here.
(delete_tree_ssa): Don't destroy operand cache here.
(propagate_into_addr): Pass in a use pointer, return true if anything
was changed.
(replace_immediate_uses): Use imm_use iterator, call update_stmt.
(check_phi_redundancy): Use imm_use iterator.
(kill_redundant_phi_nodes): Don't call compute_immediate_uses or
free_df.
* tree-ssanames.c (make_ssa_name): Initialize imm_use node.
(release_ssa_name): Delink node and all elements in its imm_use list.
* tree-tailcall.c (adjust_return_value): Call update_stmt.
* tree-vect-analyze.c (vect_stmt_relevant_p): Use imm_use iterator.
* tree-vectorizer.c (need_imm_uses_for): Delete.
(vectorize_loops): Dont call compute_immediate_uses or free_df.
* tree.h (struct ssa_imm_use_d): Define.
(SSA_NAME_IMM_USE_NODE): Define.
(struct tree_ssa_name): Add imm_use node.
(PHI_DF): Delete.
(PHI_ARG_IMM_USE_NODE): Define.
(struct phi_arg_d): Add imm_use node.
(struct tree_phi_node): Remove struct dataflow_d element.
(TDF_STMTADDR): Define.
From-SVN: r97648
2005-04-05 21:05:20 +02:00
|
|
|
imm_use_iterator imm_iter;
|
2006-04-27 22:22:17 +02:00
|
|
|
use_operand_p use_p;
|
lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt.
2005-04-05 Andrew MacLeod <amacleod@redhat.com>
* lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt.
Use immediate use iterator.
(stmt_is_bumper_for_loop): Use immediate use iterator.
* predict.c (strip_builtin_expect): Use update_stmt.
* tree-cfg.c (update_modified_stmts): New. Call update_stmt_if_modified
on all elements of a STATEMENT_LIST.
(bsi_insert_before, bsi_insert_after): Call update_modified_stmts.
(bsi_remove): Remove imm_use links and mark the stmt as modified.
(bsi_replace): Mark stmt as modified and the update it.
* tree-complex.c (update_complex_assignment): Call mark_stmt_modified.
(expand_complex_libcal): Call update_stmt.
(expand_complex_comparison): Call mark_stmt_modified.
(expand_complex_operations_1): Call update_stmt_if_modified.
(expand_vector_operations_1): Call mark_stmt_modified.
* tree-dfa.c (compute_immediate_uses, free_df_for_stmt, free_df,
compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt,
add_immediate_use, redirect_immediate_use,
redirect_immediate_uses, dump_immediate_uses, debug_immediate_uses,
dump_immediate_uses_for, debug_immediate_uses_for): Delete.
(mark_new_vars_to_rename): Call update_stmt.
* tree-dump.c (dump_option_value_in): Add "stmtaddr".
* tree-flow-inline.h (modify_stmt): Rename to mark_stmt_modified.
Ignore PHI nodes.
(unmodify_stmt): Delete.
(update_stmt): New. Force an update of a stmt.
(update_stmt_if_modified): update a stmt if it is out of date.
(get_stmt_operands): Verify stmt is NOT modified.
(stmt_modified_p): Update comment.
(delink_imm_use): Remove a use node from its immuse list.
(link_imm_use_to_list): Link a use node to a specific list.
(link_imm_use): Link a node to the correct list.
(set_ssa_use_from_ptr): Set a use node to a specific value, and insert
it in the correct list, if appropriate.
(link_imm_use_stmt): Link a use node, and set the stmt pointer.
(relink_imm_use): Link a use node in place of another node in a list.
(relink_imm_use_stmt): LInk a node in place of another node, and set
the stmt pointer.
(end_safe_imm_use_traverse): New. Terminate a safe immuse iterator.
(end_safe_imm_use_p): New. Check for the end of a safe immuse iterator.
(first_safe_imm_use): New. Initialize a safe immuse iterator.
(next_safe_imm_use): New. Proceed to next safe immuse iterator value.
(end_readonly_imm_use_p): New. Check for end of a fast immuse iterator.
(first_readonly_imm_use): New. Initialize a fast immuse iterator.
(next_readonly_imm_use): New. Get the next fast immuse iterator value.
(has_zero_uses): New. Return true if there are no uses of a var.
(has_single_use): New. Return true if there is only a single use of a
variable.
(single_imm_use): New. Return the simgle immediate use.
(num_imm_uses): New. Return the number of immediate uses.
(get_v_must_def_ops): Use is now a pointer.
(use_operand_p, get_v_may_def_op_ptr, get_vuse_op_ptr,
get_v_must_def_kill_ptr, get_phi_arg_def_ptr): Return the address of
the use node.
(get_immediate_uses, num_immediate_uses, immediate_use): Delete.
(delink_stmt_imm_use): Delink all immuses from a stmt.
(phi_arg_index_from_use): New. Return a phi arg index for a use.
* tree-flow.h (struct dataflow_d): Delete.
(immediate_use_iterator_d): New. Immediate use iterator struct.
(FOR_EACH_IMM_USE_FAST): New. Macro for read only immuse iteration.
(FOR_EACH_IMM_USE_SAFE): New. Macro for write-safe immuse iteration.
(BREAK_FROM_SAFE_IMM_USE): New. Macro for earlyu exit from write-safe
iteration.
(struct stmt_ann_d): Remove dataflow_t from struct.
* tree-if-conv.c (tree_if_conversion). Don't call free_df.
(if_convertible_phi_p): Use FAST immuse iterator.
(if_convertible_loop_p): Don't call compute_immediate_uses.
(replace_phi_with_cond_modify_expr): Call update_stmt.
* tree-into-ssa.c (mark_def_sites, ssa_mark_def_sites): Call
update_stmt_if_modified.
(rewrite_all_into_ssa): Initialize ssa operands.
* tree-loop-linear.c (linear_transform_loops): Don't call free_df or
compute_immediate_uses.
* tree-optimize.c (execute_todo): Call verify_ssa whenever the
ssa_property is available.
(execute_one_pass): Change parameters passed to execute_todo.
* tree-outof-ssa.c (rewrite_trees): Don't call modify_stmt.
(remove_ssa_form): Call fini_ssa_operands.
(insert_backedge_copies): Delete call to modify_stmt.
* tree-phinodes.c (make_phi_node): Initialize use nodes.
(release_phi_node): Delink any use nodes before releasing.
(resize_phi_node): Relink any use nodes.
(remove_phi_arg_num): Delink the use node.
(remove_phi_node): Release the ssa_name AFTER releasing the phi node.
(remove_all_phi_nodes_for): Release phi node first.
* tree-pretty-print.c (dump_generic_node): Print stmt address.
* tree-sra.c (mark_all_v_defs): Call update_stmt_if_modified.
(scalarize_use, scalarize_copy): Call update_stmt.
* tree-ssa-alias.c (compute_may_aliases): Update all modified stmts.
(compute_points_to_and_addr_escape): Call mark_stmt_modified.
* tree-ssa-cpp.c (need_imm_uses_for): Delete.
(ccp_initialize): Remove call to compute_immediate_uses.
(substitute_and_fold, execute_fold_all_builtins): Call update_stmt.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Update all modified
stmts.
(simplify_cond_and_lookup_avail_expr): Call mark_stmt_modified.
(simplify_switch_and_lookup_avail_expr): Call mark_stmt_modified.
(eliminate_redundant_computations): Call mark_stmt_modified.
(cprop_operand): Call mark_stmt_modified.
(optimize_stmt): Call update_stmt_if_modified and mark_stmt_modified.
* tree-ssa-dse.c (fix_phi_uses, fix_stmt_v_may_defs): Delete.
(dse_optimize_stmt): Use new immuse interface.
(tree_ssa_dse): Remove calls to compute_immediate_uses and free_df.
* tree-ssa-forwprop.c (need_imm_uses_for): Delete.
(substitute_single_use_vars): Use new immuse interface.
(tree_ssa_forward_propagate_single_use_vars): Remove calls to free_df
and compute_immediate_uses.
* tree-ssa-loop-im.c (single_reachable_address): Use new immuse
interface.
(rewrite_mem_refs): Call update_stmt.
(determine_lsm): Remove call to compute_imm_uses and free_df.
* tree-ssa-loop-ivcanon.c (create_canonical_iv): Call update_stmt.
(try_unroll_loop_completely): Call update_stmt.
* tree-ssa-loop-ivopts.c (rewrite_address_base): Call update_stmt.
(rewrite_use_compare): Call update_stmt.
(compute_phi_arg_on_exit): Insert each stmt before trying to process.
(rewrite_use) : Call update_stmt.
* tree-ssa-loop-manip.c (verify_loop_closed_ssa): Add arg to call.
* tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Call
update_stmt.
* tree-ssa-operands.c (NULL_USE_OPERAND_P): Remove declaration.
(allocate_use_optype, allocate_vuse_optype): Adjust allocation size.
(free_uses, free_vuses, free_v_may_defs, free_v_must_defs): Delink
use nodes.
(initialize_vuse_operand): New. Initialize a vuse operand.
(initialize_v_may_def_operand): New. Initialize a maydef operand.
(initialize_v_must_def_operand): New. Initialize a mustdef operand.
(finalize_ssa_defs): Use stmt parameter.
(correct_use_link): Ensure a use node is in the correct list, and has
the correct stmt pointer.
(finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_vuses,
finalize_ssa_v_must_defs): Also initialize use nodes.
(finalize_ssa_stmt_operands): Pass extra stmt operands.
(build_ssa_operands): Seperate parsing from final operand construction.
(parse_ssa_operands): New. Parse entry point for operand building.
(swap_tree_operands): New. Swap 2 tree operands.
(update_stmt_operands): Ranamed from get_stmt_operands. Always builds
operands.
(get_expr_operands): Call swap_tree_operands when needed.
(copy_virtual_operands): Use initialize routines for virtual use ops.
(create_ssa_artficial_load_stmt): Add extra stmt parameter.
(verify_abort): New. Issue imm_use error.
(verify_imm_links): New Verify imm_use links for a var.
(dump_immediate_uses_for): New. Dump imm_uses for a var to file.
(dump_immediate_uses): New. Dump imm_uses for all vars to file.
(debug_immediate_uses): New. Dump imm_uses for all vars to stderr.
(debug_immediate_uses_for): New. Dump imm_uses for a var to stderr.
* tree-ssa-operands.h (struct use_operand_ptr): Delete.
(NULL_USE_OPERAND_P) Define.
(use_optype_d, v_def_use_operand_type, vuse_optype_d): Add immediate
use node.
(struct vuse_operand_type): New struct.
(SET_USE): Call set_ssa_use_from_ptr.
(USE_STMT): Define.
(PHI_ARG_INDEX_FROM_USE): Define.
* tree-ssa-phiopt.c (replace_phi_edge_with_variable): Set the phi
argument via SET_USE, not PHI_ARG_DEF_TREE.
* tree-ssa-pre.c (eliminate): Call update_stmt.
* tree-ssa-propagate.c (cfg_blocks_get): Use imm_use iterators. Don't
call free_df.
* tree-ssa-sink.c (all_immediate_uses_same_place): Use imm_use iterator.
(nearest_common_dominator_of_uses): Use imm_use iterator.
(statement_sink_location): Use imm_use iterator and interface.
(execute_sink_code): Don't call compute_immediate_uses or free-df.
* tree-ssa-threadupdate.c (create_edge_and_update_destination_phis): Use
PHI_ARG_DEF, not PHI_ARG_DEF_TREE.
* tree-ssa.c (verify_use, verify_phi_args): Verify some imm_use info.
(verify_ssa): Ensure no stmt is marked modify after optimization pass
if new parameter is true.
(init_tree_ssa): Don't initialize operand cache here.
(delete_tree_ssa): Don't destroy operand cache here.
(propagate_into_addr): Pass in a use pointer, return true if anything
was changed.
(replace_immediate_uses): Use imm_use iterator, call update_stmt.
(check_phi_redundancy): Use imm_use iterator.
(kill_redundant_phi_nodes): Don't call compute_immediate_uses or
free_df.
* tree-ssanames.c (make_ssa_name): Initialize imm_use node.
(release_ssa_name): Delink node and all elements in its imm_use list.
* tree-tailcall.c (adjust_return_value): Call update_stmt.
* tree-vect-analyze.c (vect_stmt_relevant_p): Use imm_use iterator.
* tree-vectorizer.c (need_imm_uses_for): Delete.
(vectorize_loops): Dont call compute_immediate_uses or free_df.
* tree.h (struct ssa_imm_use_d): Define.
(SSA_NAME_IMM_USE_NODE): Define.
(struct tree_ssa_name): Add imm_use node.
(PHI_DF): Delete.
(PHI_ARG_IMM_USE_NODE): Define.
(struct phi_arg_d): Add imm_use node.
(struct tree_phi_node): Remove struct dataflow_d element.
(TDF_STMTADDR): Define.
From-SVN: r97648
2005-04-05 21:05:20 +02:00
|
|
|
tree oldiv_def;
|
|
|
|
tree oldiv_stmt = SSA_NAME_DEF_STMT (oldiv);
|
2006-04-27 22:22:17 +02:00
|
|
|
tree stmt;
|
lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt.
2005-04-05 Andrew MacLeod <amacleod@redhat.com>
* lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt.
Use immediate use iterator.
(stmt_is_bumper_for_loop): Use immediate use iterator.
* predict.c (strip_builtin_expect): Use update_stmt.
* tree-cfg.c (update_modified_stmts): New. Call update_stmt_if_modified
on all elements of a STATEMENT_LIST.
(bsi_insert_before, bsi_insert_after): Call update_modified_stmts.
(bsi_remove): Remove imm_use links and mark the stmt as modified.
(bsi_replace): Mark stmt as modified and the update it.
* tree-complex.c (update_complex_assignment): Call mark_stmt_modified.
(expand_complex_libcal): Call update_stmt.
(expand_complex_comparison): Call mark_stmt_modified.
(expand_complex_operations_1): Call update_stmt_if_modified.
(expand_vector_operations_1): Call mark_stmt_modified.
* tree-dfa.c (compute_immediate_uses, free_df_for_stmt, free_df,
compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt,
add_immediate_use, redirect_immediate_use,
redirect_immediate_uses, dump_immediate_uses, debug_immediate_uses,
dump_immediate_uses_for, debug_immediate_uses_for): Delete.
(mark_new_vars_to_rename): Call update_stmt.
* tree-dump.c (dump_option_value_in): Add "stmtaddr".
* tree-flow-inline.h (modify_stmt): Rename to mark_stmt_modified.
Ignore PHI nodes.
(unmodify_stmt): Delete.
(update_stmt): New. Force an update of a stmt.
(update_stmt_if_modified): update a stmt if it is out of date.
(get_stmt_operands): Verify stmt is NOT modified.
(stmt_modified_p): Update comment.
(delink_imm_use): Remove a use node from its immuse list.
(link_imm_use_to_list): Link a use node to a specific list.
(link_imm_use): Link a node to the correct list.
(set_ssa_use_from_ptr): Set a use node to a specific value, and insert
it in the correct list, if appropriate.
(link_imm_use_stmt): Link a use node, and set the stmt pointer.
(relink_imm_use): Link a use node in place of another node in a list.
(relink_imm_use_stmt): LInk a node in place of another node, and set
the stmt pointer.
(end_safe_imm_use_traverse): New. Terminate a safe immuse iterator.
(end_safe_imm_use_p): New. Check for the end of a safe immuse iterator.
(first_safe_imm_use): New. Initialize a safe immuse iterator.
(next_safe_imm_use): New. Proceed to next safe immuse iterator value.
(end_readonly_imm_use_p): New. Check for end of a fast immuse iterator.
(first_readonly_imm_use): New. Initialize a fast immuse iterator.
(next_readonly_imm_use): New. Get the next fast immuse iterator value.
(has_zero_uses): New. Return true if there are no uses of a var.
(has_single_use): New. Return true if there is only a single use of a
variable.
(single_imm_use): New. Return the simgle immediate use.
(num_imm_uses): New. Return the number of immediate uses.
(get_v_must_def_ops): Use is now a pointer.
(use_operand_p, get_v_may_def_op_ptr, get_vuse_op_ptr,
get_v_must_def_kill_ptr, get_phi_arg_def_ptr): Return the address of
the use node.
(get_immediate_uses, num_immediate_uses, immediate_use): Delete.
(delink_stmt_imm_use): Delink all immuses from a stmt.
(phi_arg_index_from_use): New. Return a phi arg index for a use.
* tree-flow.h (struct dataflow_d): Delete.
(immediate_use_iterator_d): New. Immediate use iterator struct.
(FOR_EACH_IMM_USE_FAST): New. Macro for read only immuse iteration.
(FOR_EACH_IMM_USE_SAFE): New. Macro for write-safe immuse iteration.
(BREAK_FROM_SAFE_IMM_USE): New. Macro for earlyu exit from write-safe
iteration.
(struct stmt_ann_d): Remove dataflow_t from struct.
* tree-if-conv.c (tree_if_conversion). Don't call free_df.
(if_convertible_phi_p): Use FAST immuse iterator.
(if_convertible_loop_p): Don't call compute_immediate_uses.
(replace_phi_with_cond_modify_expr): Call update_stmt.
* tree-into-ssa.c (mark_def_sites, ssa_mark_def_sites): Call
update_stmt_if_modified.
(rewrite_all_into_ssa): Initialize ssa operands.
* tree-loop-linear.c (linear_transform_loops): Don't call free_df or
compute_immediate_uses.
* tree-optimize.c (execute_todo): Call verify_ssa whenever the
ssa_property is available.
(execute_one_pass): Change parameters passed to execute_todo.
* tree-outof-ssa.c (rewrite_trees): Don't call modify_stmt.
(remove_ssa_form): Call fini_ssa_operands.
(insert_backedge_copies): Delete call to modify_stmt.
* tree-phinodes.c (make_phi_node): Initialize use nodes.
(release_phi_node): Delink any use nodes before releasing.
(resize_phi_node): Relink any use nodes.
(remove_phi_arg_num): Delink the use node.
(remove_phi_node): Release the ssa_name AFTER releasing the phi node.
(remove_all_phi_nodes_for): Release phi node first.
* tree-pretty-print.c (dump_generic_node): Print stmt address.
* tree-sra.c (mark_all_v_defs): Call update_stmt_if_modified.
(scalarize_use, scalarize_copy): Call update_stmt.
* tree-ssa-alias.c (compute_may_aliases): Update all modified stmts.
(compute_points_to_and_addr_escape): Call mark_stmt_modified.
* tree-ssa-cpp.c (need_imm_uses_for): Delete.
(ccp_initialize): Remove call to compute_immediate_uses.
(substitute_and_fold, execute_fold_all_builtins): Call update_stmt.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Update all modified
stmts.
(simplify_cond_and_lookup_avail_expr): Call mark_stmt_modified.
(simplify_switch_and_lookup_avail_expr): Call mark_stmt_modified.
(eliminate_redundant_computations): Call mark_stmt_modified.
(cprop_operand): Call mark_stmt_modified.
(optimize_stmt): Call update_stmt_if_modified and mark_stmt_modified.
* tree-ssa-dse.c (fix_phi_uses, fix_stmt_v_may_defs): Delete.
(dse_optimize_stmt): Use new immuse interface.
(tree_ssa_dse): Remove calls to compute_immediate_uses and free_df.
* tree-ssa-forwprop.c (need_imm_uses_for): Delete.
(substitute_single_use_vars): Use new immuse interface.
(tree_ssa_forward_propagate_single_use_vars): Remove calls to free_df
and compute_immediate_uses.
* tree-ssa-loop-im.c (single_reachable_address): Use new immuse
interface.
(rewrite_mem_refs): Call update_stmt.
(determine_lsm): Remove call to compute_imm_uses and free_df.
* tree-ssa-loop-ivcanon.c (create_canonical_iv): Call update_stmt.
(try_unroll_loop_completely): Call update_stmt.
* tree-ssa-loop-ivopts.c (rewrite_address_base): Call update_stmt.
(rewrite_use_compare): Call update_stmt.
(compute_phi_arg_on_exit): Insert each stmt before trying to process.
(rewrite_use) : Call update_stmt.
* tree-ssa-loop-manip.c (verify_loop_closed_ssa): Add arg to call.
* tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Call
update_stmt.
* tree-ssa-operands.c (NULL_USE_OPERAND_P): Remove declaration.
(allocate_use_optype, allocate_vuse_optype): Adjust allocation size.
(free_uses, free_vuses, free_v_may_defs, free_v_must_defs): Delink
use nodes.
(initialize_vuse_operand): New. Initialize a vuse operand.
(initialize_v_may_def_operand): New. Initialize a maydef operand.
(initialize_v_must_def_operand): New. Initialize a mustdef operand.
(finalize_ssa_defs): Use stmt parameter.
(correct_use_link): Ensure a use node is in the correct list, and has
the correct stmt pointer.
(finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_vuses,
finalize_ssa_v_must_defs): Also initialize use nodes.
(finalize_ssa_stmt_operands): Pass extra stmt operands.
(build_ssa_operands): Seperate parsing from final operand construction.
(parse_ssa_operands): New. Parse entry point for operand building.
(swap_tree_operands): New. Swap 2 tree operands.
(update_stmt_operands): Ranamed from get_stmt_operands. Always builds
operands.
(get_expr_operands): Call swap_tree_operands when needed.
(copy_virtual_operands): Use initialize routines for virtual use ops.
(create_ssa_artficial_load_stmt): Add extra stmt parameter.
(verify_abort): New. Issue imm_use error.
(verify_imm_links): New Verify imm_use links for a var.
(dump_immediate_uses_for): New. Dump imm_uses for a var to file.
(dump_immediate_uses): New. Dump imm_uses for all vars to file.
(debug_immediate_uses): New. Dump imm_uses for all vars to stderr.
(debug_immediate_uses_for): New. Dump imm_uses for a var to stderr.
* tree-ssa-operands.h (struct use_operand_ptr): Delete.
(NULL_USE_OPERAND_P) Define.
(use_optype_d, v_def_use_operand_type, vuse_optype_d): Add immediate
use node.
(struct vuse_operand_type): New struct.
(SET_USE): Call set_ssa_use_from_ptr.
(USE_STMT): Define.
(PHI_ARG_INDEX_FROM_USE): Define.
* tree-ssa-phiopt.c (replace_phi_edge_with_variable): Set the phi
argument via SET_USE, not PHI_ARG_DEF_TREE.
* tree-ssa-pre.c (eliminate): Call update_stmt.
* tree-ssa-propagate.c (cfg_blocks_get): Use imm_use iterators. Don't
call free_df.
* tree-ssa-sink.c (all_immediate_uses_same_place): Use imm_use iterator.
(nearest_common_dominator_of_uses): Use imm_use iterator.
(statement_sink_location): Use imm_use iterator and interface.
(execute_sink_code): Don't call compute_immediate_uses or free-df.
* tree-ssa-threadupdate.c (create_edge_and_update_destination_phis): Use
PHI_ARG_DEF, not PHI_ARG_DEF_TREE.
* tree-ssa.c (verify_use, verify_phi_args): Verify some imm_use info.
(verify_ssa): Ensure no stmt is marked modify after optimization pass
if new parameter is true.
(init_tree_ssa): Don't initialize operand cache here.
(delete_tree_ssa): Don't destroy operand cache here.
(propagate_into_addr): Pass in a use pointer, return true if anything
was changed.
(replace_immediate_uses): Use imm_use iterator, call update_stmt.
(check_phi_redundancy): Use imm_use iterator.
(kill_redundant_phi_nodes): Don't call compute_immediate_uses or
free_df.
* tree-ssanames.c (make_ssa_name): Initialize imm_use node.
(release_ssa_name): Delink node and all elements in its imm_use list.
* tree-tailcall.c (adjust_return_value): Call update_stmt.
* tree-vect-analyze.c (vect_stmt_relevant_p): Use imm_use iterator.
* tree-vectorizer.c (need_imm_uses_for): Delete.
(vectorize_loops): Dont call compute_immediate_uses or free_df.
* tree.h (struct ssa_imm_use_d): Define.
(SSA_NAME_IMM_USE_NODE): Define.
(struct tree_ssa_name): Add imm_use node.
(PHI_DF): Delete.
(PHI_ARG_IMM_USE_NODE): Define.
(struct phi_arg_d): Add imm_use node.
(struct tree_phi_node): Remove struct dataflow_d element.
(TDF_STMTADDR): Define.
From-SVN: r97648
2005-04-05 21:05:20 +02:00
|
|
|
|
|
|
|
if (TREE_CODE (oldiv_stmt) == PHI_NODE)
|
lambda-code.c (gcc_loop_to_lambda_loop, [...]): Use generic operand interface.
2005-05-03 Andrew MacLeod <amacleod@redhat.com>
* lambda-code.c (gcc_loop_to_lambda_loop,
lambda_loopnest_to_gcc_loopnest, phi_loop_edge_uses_def,
stmt_is_bumper_for_loop, perfect_nest_p, replace_uses_of_x_with_y): Use
generic operand interface.
* tree-data-ref.c (find_data_references_in_loop): Use generic interface.
* tree-dfa.c (collect_dfa_stats_r, mark_new_vars_to_rename): Use
generic operand interface.
* tree-flow-inline.h (delink_imm_use, link_imm_use_to_list,
link_imm_use, link_imm_use_stmt, relink_imm_use, relink_imm_use_stmt,
next_safe_imm_use, has_zero_uses, has_single_use, single_imm_use,
num_imm_uses): Use ssa_use_operand_t.
(get_def_ops, get_use_ops, get_v_may_def_ops, get_vuse_ops,
get_v_must_def_ops): Delete.
(get_def_from_ptr, get_phi_result_ptr): Get def directly now.
(get_use_op_ptr, get_def_op_ptr, get_v_may_def_result_ptr,
get_v_may_def_op_ptr, get_vuse_op_ptr, get_v_must_def_result_ptr,
get_v_must_def_kill_ptr): Delete.
(delink_stmt_imm_use): Move and use new operand interface.
(op_iter_next_use, op_iter_next_def, op_iter_next_tree, op_iter_init,
op_iter_next_tree): Use new operand implementation.
(clear_and_done_ssa_iter): New. Initialize a blank operand iterator.
(op_iter_init_use, op_iter_init_def, op_iter_init_tree): Add iterator
type check.
(op_iter_next_mustdef, op_iter_next_maydef,
op_iter_next_must_and_may_def): Delete. Replace with...
(op_iter_next_maymustdef): New. Combine must and may next operations.
(op_iter_init_maydef, op_iter_init_mustdef,
op_iter_init_must_and_may_def): Use new interface.
(single_ssa_tree_operand ): New. Process single operands only as trees.
(single_ssa_use_operand): New. Process single operands only as uses.
(single_ssa_def_operand): New. Process single operands only as defs.
(zero_ssa_operands): New. Return TRUE if there are zero operands of the
specified types.
(num_ssa_operands): New. Count the number of specified operands.
(compare_ssa_operands_equal): New. Compare two statements' operands.
(single_phi_def): New. Return true if PHI has one def of the specified
operand type.
(op_iter_init_phiuse): New. Initialize the iterator for PHI arguments.
(op_iter_init_phidef): New. Initialize the iterator for the PHI def.
* tree-flow.h (struct immediate_use_iterator_d): Use ssa_use_operand_t.
(struct stmt_ann_d): Operands field no longer require GTY().
(vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Change prototype.
* tree-into-ssa.c (mark_def_sites): Use SSA_OP_VMUSTKILL.
* tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb,
dump_replaceable_exprs, rewrite_trees): Use generic interface.
* tree-phinodes.c (make_phi_node, release_phi_node, resize_phi_node):
Use use_operand_p instead of ssa_imm_use_t *.
* tree-pretty-print.c (dump_vops): check if operands are active before
dumping virtual operands.
* tree-sra.c (sra_walk_function): Use ZERO_SSA_OPERANDS.
* tree-ssa-ccp.c (likely_value): Use ZERO_SSA_OPERANDS.
(ccp_fold): Use new interface.
(ccp_visit_stmt): Remove unused variables and code.
(convert_to_gimple_builtin): Insert statements before calling
mark_new_vars_to_rename.
* tree-ssa-copy.c (stmt_may_generate_copy): Use ZERO_SSA_OPERANDS.
(copy_prop_visit_cond_stmt): Use generic interface.
* tree-ssa-dom.c (struct expr_hash_elt): Use stmt pointer, not the
annotation in table.
(thread_across_edge): Use generic interface.
(initialize_hash_element): Initialzie with stmt, not annotation.
(eliminate_redundant_computations): Use generic interface.
(record_equivalences_from_stmt): Pass stmt, not annotation.
(avail_expr_hash, real_avail_expr_hash, avail_expr_eq): Use generic
interface.
* tree-ssa-dse.c (dse_optimize_stmt): Use ZERO_SSA_OPERANDS.
* tree-ssa-loop-ivopts.c (find_invariants_stmt,
find_interesting_uses_stmt, protect_loop_closed_ssa_form_use): Use
generic operand interface.
* tree-ssa-loop-niter.c (chain_of_csts_start, get_val_for): Use generic
interface.
* tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Use Generic operand
Interface.
* tree-ssa-operands.c (struct opbuild_list_d): New. Operand build type.
(build_defs, build_uses, build_v_may_defs, build_vuses,
build_v_must_defs): Change type to struct opbuild_list_d.
(ops_active): New. Operands active boolean.
(operand_memory, operand_memory_index): New. Operand memory managers.
(allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype,
allocate_vuse_optype, allocate_v_must_def_optype): Delete.
(free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs):
Change from functions to static variable list heads.
(opbuild_initialize_virtual): New. Initialize a virtual build list.
(opbuild_initialize_real): New. Initialize a virtual build list.
(opbuild_free): New. Free a build list.
(opbuild_num_elems): New. Number of items in a list.
(opbuild_append_real): New. Add a real (tree *) operand.
(opbuild_append_virtual): New. Add and sort a virtual (tree) operand.
(opbuild_first): New. Return first element index in a list.
(opbuild_next): New. Return next element in a list.
(opbuild_elem_real): New. Return real element.
(opbuild_elem_virtual): New. Return virtual element.
(opbuild_elem_uid): New. Return UID of virtual element.
(opbuild_clear): New. Reset an operand list.
(opbuild_remove_elem): New. Remove an element form a list.
(ssa_operands_active): New. Return true if operand cache is active.
(init_ssa_operands, fini_ssa_operands): Initialize new implementation.
(ssa_operand_alloc): New. Allocate memory from an operand chunk.
(correct_use_link): Use use_operand_p.
(finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_defs,
finalize_ssa_vuses, finalize_ssa_v_must_defs): New implmentation.
(cleanup_v_may_defs): Use new implmentation.
(finalize_ssa_stmt_operands, start_ssa_stmt_operands): New
implementation.
(append_def, append_use, append_v_may_def, append_vuse,
append_v_must_def): Call opbuild_append routine instead of using varray.
(build_ssa_operands): Simplify to simply use stmt, don't maintain a
global parse_old_ops variable.
(free_ssa_operands): New implementation.
(update_stmt_operands): Move. Change argument to build_ssa_operands.
(copy_virtual_operands): Move. New generic implementation.
(create_ssa_artficial_load_stmt): Move. New implementation.
(swap_tree_operands): Update for new implementation.
(get_expr_operands): Add stmt parameter to calls to swap_tree_operands.
(add_call_clobber_ops, add_call_read_ops): Initialize opbuild list
rather than a varray.
(verify_imm_links): Use use_operand_p.
(dump_immediate_uses_for): If the immediate use variable is a virtual
variable, show the virtual ops in the stmt.
* tree-ssa-operands.h (def_operand_p): No longer a structure.
(NULL_DEF_OPERAND_P): Now a #define.
(def_optype_d, use_optype_d, v_def_use_operand_type, v_may_def_optype_d,
vuse_operand_type, vuse_optype_d, v_must_def_optype_d): Delete.
(def_optype_d, use_optype_d, maydef_optype_d, vuse_optype_d,
mustdef_optype_d): New. Use Linked list representation.
(SSA_OPERAND_MEMORY_SIZE): New. Size of operand memory chunk.
(struct ssa_operand_memory_d): New. Allocated Chunk node.
(struct stmt_operands_d): Change to new pointers that are not GTY.
(STMT_USE_OPS, NUM_USES, SET_USE_OP, STMT_DEF_OPS, NUM_DEFS, SET_DEF_OP,
STMT_V_MAY_DEF_OPS, NUM_V_MAY_DEFS, SET_V_MAY_DEF_RESULT,
SET_V_MAY_DEF_OP, STMT_VUSE_OPS, NUM_VUSES, SET_VUSE_OP,
STMT_V_MUST_DEF_OPS, NUM_V_MUST_DEFS, SET_V_MUST_DEF_RESULT,
SET_V_MUST_DEF_KILL): Delete.
(V_MAY_DEF_OPS, V_MAY_DEF_RESULT_PTR, V_MAY_DEF_RESULT,
V_MAY_DEF_OP_PTR, V_MAY_DEF_OP): Rename to MAYDEF_*.
(V_MUST_DEF_OPS, V_MUST_DEF_RESULT_PTR, V_MUST_DEF_RESULT,
V_MUST_DEF_KILL_PTR, V_MUST_DEF_KILL): Rename to MUSTDEF_*.
(enum ssa_op_iter_type): Operand iterator typechecking values.
(struct ssa_operand_iterator_d): Use linked lists of operands.
(SSA_OP_VMUSTDEFKILL): Rename to SSA_OP_VMUSTKILL.
(FOR_EACH_SSA_MAYDEF_OPERAND, FOR_EACH_SSA_MUSTDEF_OPERAND,
FOR_EACH_SSA_MUST_AND_MAY_DEF_OPERAND): Use op_iter_next_maymustdef.
(FOR_EACH_PHI_ARG): New. Iterate over PHI arguments.
(FOR_EACH_PHI_OR_STMT_USE): New. Iterate over PHI or stmt uses.
(FOR_EACH_PHI_OR_STMT_DEF): New. Iterate over PHI or stmt defs.
(SINGLE_SSA_TREE_OPERAND, SINGLE_SSA_USE_OPERAND,
SINGLE_SSA_DEF_OPERAND, ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS): New.
* tree-ssa-opfinalize.h: New. Function templates for expansion.
(FINALIZE_ALLOC): Expands into alloc_def, alloc_use, alloc_maydef,
alloc_vuse, and alloc_mustdef.
(FINALIZE_FUNC): Expands into finalize_ssa_def_ops,
finalize_ssa_use_ops, finalize_ssa_v_may_def_ops, finalize_ssa_vuse_ops,
and finalize_ssa_v_must_def_ops.
* tree-ssa-pre.c (add_to_sets): Pass tree to vn_add.
(create_value_expr_from): Use stmt not vuse_optype as a parameter. Pass
stmt around.
(compute_avail): Use generic iterator interface.
* tree-ssa-propagate.c (first_vdef): Use generic operand interface.
(stmt_makes_single_load, stmt_makes_single_store): Use
ZERO_SSA_OPERANDS.
* tree-ssa-sink.c (is_hidden_global_store): Use ZERO_SSA_OPERANDS.
(statement_sink_location): Use generic interface.
* tree-ssa.c (verify_ssa): Use %p in fprintf. Use generic interface.
(delete_tree_ssa): Don't call release_defs. Call release_ssa_name and
reset the immediate use link nodes.
(stmt_references_memory_p): Use ZERO_SSA_OPERANDS.
* tree-ssanames.c (make_ssa_name): Use use_operand_p.
* tree-tailcall.c (find_tail_calls): Use ZERO_SSA_OPERANDS.
(eliminate_tail_call): Use generic operand interface.
* tree-vect-analyze.c (vect_analyze_data_refs): Use ZERO_SSA_OPERANDS.
(vect_mark_relevant, vect_mark_stmts_to_be_vectorized): Use generic
interface.
* tree-vect-transform.c (update_vuses_to_preheader): Use generic
interface.
* tree-vectorizer.c (rename_variables_in_bb): Use generic interface.
* tree-vn.c (struct val_expr_pair_d): Cache statment pointer instead of
vuse_optype.
(vn_compute, val_expr_pair_hash, vn_add, vn_lookup, vn_lookup_or_add):
Use statement pointer instead of vuse_optype. Use generic interface.
* tree-vrp.c (maybe_add_assert_expr): Use generic interface.
(stmt_interesting_for_vrp, vrp_visit_stmt): Use ZERO_SSA_OPERANDS.
* tree.h (struct ssa_imm_use_d): Renamed to ssa_use_operand_d.
(tree_ssa_name, phi_arg_d): Use ssa_use_operand_d.
* doc/tree-ssa.texi: Update documentation for operand interface.
From-SVN: r99155
2005-05-03 14:19:56 +02:00
|
|
|
oldiv_def = PHI_RESULT (oldiv_stmt);
|
lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt.
2005-04-05 Andrew MacLeod <amacleod@redhat.com>
* lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt.
Use immediate use iterator.
(stmt_is_bumper_for_loop): Use immediate use iterator.
* predict.c (strip_builtin_expect): Use update_stmt.
* tree-cfg.c (update_modified_stmts): New. Call update_stmt_if_modified
on all elements of a STATEMENT_LIST.
(bsi_insert_before, bsi_insert_after): Call update_modified_stmts.
(bsi_remove): Remove imm_use links and mark the stmt as modified.
(bsi_replace): Mark stmt as modified and the update it.
* tree-complex.c (update_complex_assignment): Call mark_stmt_modified.
(expand_complex_libcal): Call update_stmt.
(expand_complex_comparison): Call mark_stmt_modified.
(expand_complex_operations_1): Call update_stmt_if_modified.
(expand_vector_operations_1): Call mark_stmt_modified.
* tree-dfa.c (compute_immediate_uses, free_df_for_stmt, free_df,
compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt,
add_immediate_use, redirect_immediate_use,
redirect_immediate_uses, dump_immediate_uses, debug_immediate_uses,
dump_immediate_uses_for, debug_immediate_uses_for): Delete.
(mark_new_vars_to_rename): Call update_stmt.
* tree-dump.c (dump_option_value_in): Add "stmtaddr".
* tree-flow-inline.h (modify_stmt): Rename to mark_stmt_modified.
Ignore PHI nodes.
(unmodify_stmt): Delete.
(update_stmt): New. Force an update of a stmt.
(update_stmt_if_modified): update a stmt if it is out of date.
(get_stmt_operands): Verify stmt is NOT modified.
(stmt_modified_p): Update comment.
(delink_imm_use): Remove a use node from its immuse list.
(link_imm_use_to_list): Link a use node to a specific list.
(link_imm_use): Link a node to the correct list.
(set_ssa_use_from_ptr): Set a use node to a specific value, and insert
it in the correct list, if appropriate.
(link_imm_use_stmt): Link a use node, and set the stmt pointer.
(relink_imm_use): Link a use node in place of another node in a list.
(relink_imm_use_stmt): LInk a node in place of another node, and set
the stmt pointer.
(end_safe_imm_use_traverse): New. Terminate a safe immuse iterator.
(end_safe_imm_use_p): New. Check for the end of a safe immuse iterator.
(first_safe_imm_use): New. Initialize a safe immuse iterator.
(next_safe_imm_use): New. Proceed to next safe immuse iterator value.
(end_readonly_imm_use_p): New. Check for end of a fast immuse iterator.
(first_readonly_imm_use): New. Initialize a fast immuse iterator.
(next_readonly_imm_use): New. Get the next fast immuse iterator value.
(has_zero_uses): New. Return true if there are no uses of a var.
(has_single_use): New. Return true if there is only a single use of a
variable.
(single_imm_use): New. Return the simgle immediate use.
(num_imm_uses): New. Return the number of immediate uses.
(get_v_must_def_ops): Use is now a pointer.
(use_operand_p, get_v_may_def_op_ptr, get_vuse_op_ptr,
get_v_must_def_kill_ptr, get_phi_arg_def_ptr): Return the address of
the use node.
(get_immediate_uses, num_immediate_uses, immediate_use): Delete.
(delink_stmt_imm_use): Delink all immuses from a stmt.
(phi_arg_index_from_use): New. Return a phi arg index for a use.
* tree-flow.h (struct dataflow_d): Delete.
(immediate_use_iterator_d): New. Immediate use iterator struct.
(FOR_EACH_IMM_USE_FAST): New. Macro for read only immuse iteration.
(FOR_EACH_IMM_USE_SAFE): New. Macro for write-safe immuse iteration.
(BREAK_FROM_SAFE_IMM_USE): New. Macro for earlyu exit from write-safe
iteration.
(struct stmt_ann_d): Remove dataflow_t from struct.
* tree-if-conv.c (tree_if_conversion). Don't call free_df.
(if_convertible_phi_p): Use FAST immuse iterator.
(if_convertible_loop_p): Don't call compute_immediate_uses.
(replace_phi_with_cond_modify_expr): Call update_stmt.
* tree-into-ssa.c (mark_def_sites, ssa_mark_def_sites): Call
update_stmt_if_modified.
(rewrite_all_into_ssa): Initialize ssa operands.
* tree-loop-linear.c (linear_transform_loops): Don't call free_df or
compute_immediate_uses.
* tree-optimize.c (execute_todo): Call verify_ssa whenever the
ssa_property is available.
(execute_one_pass): Change parameters passed to execute_todo.
* tree-outof-ssa.c (rewrite_trees): Don't call modify_stmt.
(remove_ssa_form): Call fini_ssa_operands.
(insert_backedge_copies): Delete call to modify_stmt.
* tree-phinodes.c (make_phi_node): Initialize use nodes.
(release_phi_node): Delink any use nodes before releasing.
(resize_phi_node): Relink any use nodes.
(remove_phi_arg_num): Delink the use node.
(remove_phi_node): Release the ssa_name AFTER releasing the phi node.
(remove_all_phi_nodes_for): Release phi node first.
* tree-pretty-print.c (dump_generic_node): Print stmt address.
* tree-sra.c (mark_all_v_defs): Call update_stmt_if_modified.
(scalarize_use, scalarize_copy): Call update_stmt.
* tree-ssa-alias.c (compute_may_aliases): Update all modified stmts.
(compute_points_to_and_addr_escape): Call mark_stmt_modified.
* tree-ssa-cpp.c (need_imm_uses_for): Delete.
(ccp_initialize): Remove call to compute_immediate_uses.
(substitute_and_fold, execute_fold_all_builtins): Call update_stmt.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Update all modified
stmts.
(simplify_cond_and_lookup_avail_expr): Call mark_stmt_modified.
(simplify_switch_and_lookup_avail_expr): Call mark_stmt_modified.
(eliminate_redundant_computations): Call mark_stmt_modified.
(cprop_operand): Call mark_stmt_modified.
(optimize_stmt): Call update_stmt_if_modified and mark_stmt_modified.
* tree-ssa-dse.c (fix_phi_uses, fix_stmt_v_may_defs): Delete.
(dse_optimize_stmt): Use new immuse interface.
(tree_ssa_dse): Remove calls to compute_immediate_uses and free_df.
* tree-ssa-forwprop.c (need_imm_uses_for): Delete.
(substitute_single_use_vars): Use new immuse interface.
(tree_ssa_forward_propagate_single_use_vars): Remove calls to free_df
and compute_immediate_uses.
* tree-ssa-loop-im.c (single_reachable_address): Use new immuse
interface.
(rewrite_mem_refs): Call update_stmt.
(determine_lsm): Remove call to compute_imm_uses and free_df.
* tree-ssa-loop-ivcanon.c (create_canonical_iv): Call update_stmt.
(try_unroll_loop_completely): Call update_stmt.
* tree-ssa-loop-ivopts.c (rewrite_address_base): Call update_stmt.
(rewrite_use_compare): Call update_stmt.
(compute_phi_arg_on_exit): Insert each stmt before trying to process.
(rewrite_use) : Call update_stmt.
* tree-ssa-loop-manip.c (verify_loop_closed_ssa): Add arg to call.
* tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Call
update_stmt.
* tree-ssa-operands.c (NULL_USE_OPERAND_P): Remove declaration.
(allocate_use_optype, allocate_vuse_optype): Adjust allocation size.
(free_uses, free_vuses, free_v_may_defs, free_v_must_defs): Delink
use nodes.
(initialize_vuse_operand): New. Initialize a vuse operand.
(initialize_v_may_def_operand): New. Initialize a maydef operand.
(initialize_v_must_def_operand): New. Initialize a mustdef operand.
(finalize_ssa_defs): Use stmt parameter.
(correct_use_link): Ensure a use node is in the correct list, and has
the correct stmt pointer.
(finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_vuses,
finalize_ssa_v_must_defs): Also initialize use nodes.
(finalize_ssa_stmt_operands): Pass extra stmt operands.
(build_ssa_operands): Seperate parsing from final operand construction.
(parse_ssa_operands): New. Parse entry point for operand building.
(swap_tree_operands): New. Swap 2 tree operands.
(update_stmt_operands): Ranamed from get_stmt_operands. Always builds
operands.
(get_expr_operands): Call swap_tree_operands when needed.
(copy_virtual_operands): Use initialize routines for virtual use ops.
(create_ssa_artficial_load_stmt): Add extra stmt parameter.
(verify_abort): New. Issue imm_use error.
(verify_imm_links): New Verify imm_use links for a var.
(dump_immediate_uses_for): New. Dump imm_uses for a var to file.
(dump_immediate_uses): New. Dump imm_uses for all vars to file.
(debug_immediate_uses): New. Dump imm_uses for all vars to stderr.
(debug_immediate_uses_for): New. Dump imm_uses for a var to stderr.
* tree-ssa-operands.h (struct use_operand_ptr): Delete.
(NULL_USE_OPERAND_P) Define.
(use_optype_d, v_def_use_operand_type, vuse_optype_d): Add immediate
use node.
(struct vuse_operand_type): New struct.
(SET_USE): Call set_ssa_use_from_ptr.
(USE_STMT): Define.
(PHI_ARG_INDEX_FROM_USE): Define.
* tree-ssa-phiopt.c (replace_phi_edge_with_variable): Set the phi
argument via SET_USE, not PHI_ARG_DEF_TREE.
* tree-ssa-pre.c (eliminate): Call update_stmt.
* tree-ssa-propagate.c (cfg_blocks_get): Use imm_use iterators. Don't
call free_df.
* tree-ssa-sink.c (all_immediate_uses_same_place): Use imm_use iterator.
(nearest_common_dominator_of_uses): Use imm_use iterator.
(statement_sink_location): Use imm_use iterator and interface.
(execute_sink_code): Don't call compute_immediate_uses or free-df.
* tree-ssa-threadupdate.c (create_edge_and_update_destination_phis): Use
PHI_ARG_DEF, not PHI_ARG_DEF_TREE.
* tree-ssa.c (verify_use, verify_phi_args): Verify some imm_use info.
(verify_ssa): Ensure no stmt is marked modify after optimization pass
if new parameter is true.
(init_tree_ssa): Don't initialize operand cache here.
(delete_tree_ssa): Don't destroy operand cache here.
(propagate_into_addr): Pass in a use pointer, return true if anything
was changed.
(replace_immediate_uses): Use imm_use iterator, call update_stmt.
(check_phi_redundancy): Use imm_use iterator.
(kill_redundant_phi_nodes): Don't call compute_immediate_uses or
free_df.
* tree-ssanames.c (make_ssa_name): Initialize imm_use node.
(release_ssa_name): Delink node and all elements in its imm_use list.
* tree-tailcall.c (adjust_return_value): Call update_stmt.
* tree-vect-analyze.c (vect_stmt_relevant_p): Use imm_use iterator.
* tree-vectorizer.c (need_imm_uses_for): Delete.
(vectorize_loops): Dont call compute_immediate_uses or free_df.
* tree.h (struct ssa_imm_use_d): Define.
(SSA_NAME_IMM_USE_NODE): Define.
(struct tree_ssa_name): Add imm_use node.
(PHI_DF): Delete.
(PHI_ARG_IMM_USE_NODE): Define.
(struct phi_arg_d): Add imm_use node.
(struct tree_phi_node): Remove struct dataflow_d element.
(TDF_STMTADDR): Define.
From-SVN: r97648
2005-04-05 21:05:20 +02:00
|
|
|
else
|
lambda-code.c (gcc_loop_to_lambda_loop, [...]): Use generic operand interface.
2005-05-03 Andrew MacLeod <amacleod@redhat.com>
* lambda-code.c (gcc_loop_to_lambda_loop,
lambda_loopnest_to_gcc_loopnest, phi_loop_edge_uses_def,
stmt_is_bumper_for_loop, perfect_nest_p, replace_uses_of_x_with_y): Use
generic operand interface.
* tree-data-ref.c (find_data_references_in_loop): Use generic interface.
* tree-dfa.c (collect_dfa_stats_r, mark_new_vars_to_rename): Use
generic operand interface.
* tree-flow-inline.h (delink_imm_use, link_imm_use_to_list,
link_imm_use, link_imm_use_stmt, relink_imm_use, relink_imm_use_stmt,
next_safe_imm_use, has_zero_uses, has_single_use, single_imm_use,
num_imm_uses): Use ssa_use_operand_t.
(get_def_ops, get_use_ops, get_v_may_def_ops, get_vuse_ops,
get_v_must_def_ops): Delete.
(get_def_from_ptr, get_phi_result_ptr): Get def directly now.
(get_use_op_ptr, get_def_op_ptr, get_v_may_def_result_ptr,
get_v_may_def_op_ptr, get_vuse_op_ptr, get_v_must_def_result_ptr,
get_v_must_def_kill_ptr): Delete.
(delink_stmt_imm_use): Move and use new operand interface.
(op_iter_next_use, op_iter_next_def, op_iter_next_tree, op_iter_init,
op_iter_next_tree): Use new operand implementation.
(clear_and_done_ssa_iter): New. Initialize a blank operand iterator.
(op_iter_init_use, op_iter_init_def, op_iter_init_tree): Add iterator
type check.
(op_iter_next_mustdef, op_iter_next_maydef,
op_iter_next_must_and_may_def): Delete. Replace with...
(op_iter_next_maymustdef): New. Combine must and may next operations.
(op_iter_init_maydef, op_iter_init_mustdef,
op_iter_init_must_and_may_def): Use new interface.
(single_ssa_tree_operand ): New. Process single operands only as trees.
(single_ssa_use_operand): New. Process single operands only as uses.
(single_ssa_def_operand): New. Process single operands only as defs.
(zero_ssa_operands): New. Return TRUE if there are zero operands of the
specified types.
(num_ssa_operands): New. Count the number of specified operands.
(compare_ssa_operands_equal): New. Compare two statements' operands.
(single_phi_def): New. Return true if PHI has one def of the specified
operand type.
(op_iter_init_phiuse): New. Initialize the iterator for PHI arguments.
(op_iter_init_phidef): New. Initialize the iterator for the PHI def.
* tree-flow.h (struct immediate_use_iterator_d): Use ssa_use_operand_t.
(struct stmt_ann_d): Operands field no longer require GTY().
(vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Change prototype.
* tree-into-ssa.c (mark_def_sites): Use SSA_OP_VMUSTKILL.
* tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb,
dump_replaceable_exprs, rewrite_trees): Use generic interface.
* tree-phinodes.c (make_phi_node, release_phi_node, resize_phi_node):
Use use_operand_p instead of ssa_imm_use_t *.
* tree-pretty-print.c (dump_vops): check if operands are active before
dumping virtual operands.
* tree-sra.c (sra_walk_function): Use ZERO_SSA_OPERANDS.
* tree-ssa-ccp.c (likely_value): Use ZERO_SSA_OPERANDS.
(ccp_fold): Use new interface.
(ccp_visit_stmt): Remove unused variables and code.
(convert_to_gimple_builtin): Insert statements before calling
mark_new_vars_to_rename.
* tree-ssa-copy.c (stmt_may_generate_copy): Use ZERO_SSA_OPERANDS.
(copy_prop_visit_cond_stmt): Use generic interface.
* tree-ssa-dom.c (struct expr_hash_elt): Use stmt pointer, not the
annotation in table.
(thread_across_edge): Use generic interface.
(initialize_hash_element): Initialzie with stmt, not annotation.
(eliminate_redundant_computations): Use generic interface.
(record_equivalences_from_stmt): Pass stmt, not annotation.
(avail_expr_hash, real_avail_expr_hash, avail_expr_eq): Use generic
interface.
* tree-ssa-dse.c (dse_optimize_stmt): Use ZERO_SSA_OPERANDS.
* tree-ssa-loop-ivopts.c (find_invariants_stmt,
find_interesting_uses_stmt, protect_loop_closed_ssa_form_use): Use
generic operand interface.
* tree-ssa-loop-niter.c (chain_of_csts_start, get_val_for): Use generic
interface.
* tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Use Generic operand
Interface.
* tree-ssa-operands.c (struct opbuild_list_d): New. Operand build type.
(build_defs, build_uses, build_v_may_defs, build_vuses,
build_v_must_defs): Change type to struct opbuild_list_d.
(ops_active): New. Operands active boolean.
(operand_memory, operand_memory_index): New. Operand memory managers.
(allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype,
allocate_vuse_optype, allocate_v_must_def_optype): Delete.
(free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs):
Change from functions to static variable list heads.
(opbuild_initialize_virtual): New. Initialize a virtual build list.
(opbuild_initialize_real): New. Initialize a virtual build list.
(opbuild_free): New. Free a build list.
(opbuild_num_elems): New. Number of items in a list.
(opbuild_append_real): New. Add a real (tree *) operand.
(opbuild_append_virtual): New. Add and sort a virtual (tree) operand.
(opbuild_first): New. Return first element index in a list.
(opbuild_next): New. Return next element in a list.
(opbuild_elem_real): New. Return real element.
(opbuild_elem_virtual): New. Return virtual element.
(opbuild_elem_uid): New. Return UID of virtual element.
(opbuild_clear): New. Reset an operand list.
(opbuild_remove_elem): New. Remove an element form a list.
(ssa_operands_active): New. Return true if operand cache is active.
(init_ssa_operands, fini_ssa_operands): Initialize new implementation.
(ssa_operand_alloc): New. Allocate memory from an operand chunk.
(correct_use_link): Use use_operand_p.
(finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_defs,
finalize_ssa_vuses, finalize_ssa_v_must_defs): New implmentation.
(cleanup_v_may_defs): Use new implmentation.
(finalize_ssa_stmt_operands, start_ssa_stmt_operands): New
implementation.
(append_def, append_use, append_v_may_def, append_vuse,
append_v_must_def): Call opbuild_append routine instead of using varray.
(build_ssa_operands): Simplify to simply use stmt, don't maintain a
global parse_old_ops variable.
(free_ssa_operands): New implementation.
(update_stmt_operands): Move. Change argument to build_ssa_operands.
(copy_virtual_operands): Move. New generic implementation.
(create_ssa_artficial_load_stmt): Move. New implementation.
(swap_tree_operands): Update for new implementation.
(get_expr_operands): Add stmt parameter to calls to swap_tree_operands.
(add_call_clobber_ops, add_call_read_ops): Initialize opbuild list
rather than a varray.
(verify_imm_links): Use use_operand_p.
(dump_immediate_uses_for): If the immediate use variable is a virtual
variable, show the virtual ops in the stmt.
* tree-ssa-operands.h (def_operand_p): No longer a structure.
(NULL_DEF_OPERAND_P): Now a #define.
(def_optype_d, use_optype_d, v_def_use_operand_type, v_may_def_optype_d,
vuse_operand_type, vuse_optype_d, v_must_def_optype_d): Delete.
(def_optype_d, use_optype_d, maydef_optype_d, vuse_optype_d,
mustdef_optype_d): New. Use Linked list representation.
(SSA_OPERAND_MEMORY_SIZE): New. Size of operand memory chunk.
(struct ssa_operand_memory_d): New. Allocated Chunk node.
(struct stmt_operands_d): Change to new pointers that are not GTY.
(STMT_USE_OPS, NUM_USES, SET_USE_OP, STMT_DEF_OPS, NUM_DEFS, SET_DEF_OP,
STMT_V_MAY_DEF_OPS, NUM_V_MAY_DEFS, SET_V_MAY_DEF_RESULT,
SET_V_MAY_DEF_OP, STMT_VUSE_OPS, NUM_VUSES, SET_VUSE_OP,
STMT_V_MUST_DEF_OPS, NUM_V_MUST_DEFS, SET_V_MUST_DEF_RESULT,
SET_V_MUST_DEF_KILL): Delete.
(V_MAY_DEF_OPS, V_MAY_DEF_RESULT_PTR, V_MAY_DEF_RESULT,
V_MAY_DEF_OP_PTR, V_MAY_DEF_OP): Rename to MAYDEF_*.
(V_MUST_DEF_OPS, V_MUST_DEF_RESULT_PTR, V_MUST_DEF_RESULT,
V_MUST_DEF_KILL_PTR, V_MUST_DEF_KILL): Rename to MUSTDEF_*.
(enum ssa_op_iter_type): Operand iterator typechecking values.
(struct ssa_operand_iterator_d): Use linked lists of operands.
(SSA_OP_VMUSTDEFKILL): Rename to SSA_OP_VMUSTKILL.
(FOR_EACH_SSA_MAYDEF_OPERAND, FOR_EACH_SSA_MUSTDEF_OPERAND,
FOR_EACH_SSA_MUST_AND_MAY_DEF_OPERAND): Use op_iter_next_maymustdef.
(FOR_EACH_PHI_ARG): New. Iterate over PHI arguments.
(FOR_EACH_PHI_OR_STMT_USE): New. Iterate over PHI or stmt uses.
(FOR_EACH_PHI_OR_STMT_DEF): New. Iterate over PHI or stmt defs.
(SINGLE_SSA_TREE_OPERAND, SINGLE_SSA_USE_OPERAND,
SINGLE_SSA_DEF_OPERAND, ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS): New.
* tree-ssa-opfinalize.h: New. Function templates for expansion.
(FINALIZE_ALLOC): Expands into alloc_def, alloc_use, alloc_maydef,
alloc_vuse, and alloc_mustdef.
(FINALIZE_FUNC): Expands into finalize_ssa_def_ops,
finalize_ssa_use_ops, finalize_ssa_v_may_def_ops, finalize_ssa_vuse_ops,
and finalize_ssa_v_must_def_ops.
* tree-ssa-pre.c (add_to_sets): Pass tree to vn_add.
(create_value_expr_from): Use stmt not vuse_optype as a parameter. Pass
stmt around.
(compute_avail): Use generic iterator interface.
* tree-ssa-propagate.c (first_vdef): Use generic operand interface.
(stmt_makes_single_load, stmt_makes_single_store): Use
ZERO_SSA_OPERANDS.
* tree-ssa-sink.c (is_hidden_global_store): Use ZERO_SSA_OPERANDS.
(statement_sink_location): Use generic interface.
* tree-ssa.c (verify_ssa): Use %p in fprintf. Use generic interface.
(delete_tree_ssa): Don't call release_defs. Call release_ssa_name and
reset the immediate use link nodes.
(stmt_references_memory_p): Use ZERO_SSA_OPERANDS.
* tree-ssanames.c (make_ssa_name): Use use_operand_p.
* tree-tailcall.c (find_tail_calls): Use ZERO_SSA_OPERANDS.
(eliminate_tail_call): Use generic operand interface.
* tree-vect-analyze.c (vect_analyze_data_refs): Use ZERO_SSA_OPERANDS.
(vect_mark_relevant, vect_mark_stmts_to_be_vectorized): Use generic
interface.
* tree-vect-transform.c (update_vuses_to_preheader): Use generic
interface.
* tree-vectorizer.c (rename_variables_in_bb): Use generic interface.
* tree-vn.c (struct val_expr_pair_d): Cache statment pointer instead of
vuse_optype.
(vn_compute, val_expr_pair_hash, vn_add, vn_lookup, vn_lookup_or_add):
Use statement pointer instead of vuse_optype. Use generic interface.
* tree-vrp.c (maybe_add_assert_expr): Use generic interface.
(stmt_interesting_for_vrp, vrp_visit_stmt): Use ZERO_SSA_OPERANDS.
* tree.h (struct ssa_imm_use_d): Renamed to ssa_use_operand_d.
(tree_ssa_name, phi_arg_d): Use ssa_use_operand_d.
* doc/tree-ssa.texi: Update documentation for operand interface.
From-SVN: r99155
2005-05-03 14:19:56 +02:00
|
|
|
oldiv_def = SINGLE_SSA_TREE_OPERAND (oldiv_stmt, SSA_OP_DEF);
|
|
|
|
gcc_assert (oldiv_def != NULL_TREE);
|
lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt.
2005-04-05 Andrew MacLeod <amacleod@redhat.com>
* lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt.
Use immediate use iterator.
(stmt_is_bumper_for_loop): Use immediate use iterator.
* predict.c (strip_builtin_expect): Use update_stmt.
* tree-cfg.c (update_modified_stmts): New. Call update_stmt_if_modified
on all elements of a STATEMENT_LIST.
(bsi_insert_before, bsi_insert_after): Call update_modified_stmts.
(bsi_remove): Remove imm_use links and mark the stmt as modified.
(bsi_replace): Mark stmt as modified and the update it.
* tree-complex.c (update_complex_assignment): Call mark_stmt_modified.
(expand_complex_libcal): Call update_stmt.
(expand_complex_comparison): Call mark_stmt_modified.
(expand_complex_operations_1): Call update_stmt_if_modified.
(expand_vector_operations_1): Call mark_stmt_modified.
* tree-dfa.c (compute_immediate_uses, free_df_for_stmt, free_df,
compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt,
add_immediate_use, redirect_immediate_use,
redirect_immediate_uses, dump_immediate_uses, debug_immediate_uses,
dump_immediate_uses_for, debug_immediate_uses_for): Delete.
(mark_new_vars_to_rename): Call update_stmt.
* tree-dump.c (dump_option_value_in): Add "stmtaddr".
* tree-flow-inline.h (modify_stmt): Rename to mark_stmt_modified.
Ignore PHI nodes.
(unmodify_stmt): Delete.
(update_stmt): New. Force an update of a stmt.
(update_stmt_if_modified): update a stmt if it is out of date.
(get_stmt_operands): Verify stmt is NOT modified.
(stmt_modified_p): Update comment.
(delink_imm_use): Remove a use node from its immuse list.
(link_imm_use_to_list): Link a use node to a specific list.
(link_imm_use): Link a node to the correct list.
(set_ssa_use_from_ptr): Set a use node to a specific value, and insert
it in the correct list, if appropriate.
(link_imm_use_stmt): Link a use node, and set the stmt pointer.
(relink_imm_use): Link a use node in place of another node in a list.
(relink_imm_use_stmt): LInk a node in place of another node, and set
the stmt pointer.
(end_safe_imm_use_traverse): New. Terminate a safe immuse iterator.
(end_safe_imm_use_p): New. Check for the end of a safe immuse iterator.
(first_safe_imm_use): New. Initialize a safe immuse iterator.
(next_safe_imm_use): New. Proceed to next safe immuse iterator value.
(end_readonly_imm_use_p): New. Check for end of a fast immuse iterator.
(first_readonly_imm_use): New. Initialize a fast immuse iterator.
(next_readonly_imm_use): New. Get the next fast immuse iterator value.
(has_zero_uses): New. Return true if there are no uses of a var.
(has_single_use): New. Return true if there is only a single use of a
variable.
(single_imm_use): New. Return the simgle immediate use.
(num_imm_uses): New. Return the number of immediate uses.
(get_v_must_def_ops): Use is now a pointer.
(use_operand_p, get_v_may_def_op_ptr, get_vuse_op_ptr,
get_v_must_def_kill_ptr, get_phi_arg_def_ptr): Return the address of
the use node.
(get_immediate_uses, num_immediate_uses, immediate_use): Delete.
(delink_stmt_imm_use): Delink all immuses from a stmt.
(phi_arg_index_from_use): New. Return a phi arg index for a use.
* tree-flow.h (struct dataflow_d): Delete.
(immediate_use_iterator_d): New. Immediate use iterator struct.
(FOR_EACH_IMM_USE_FAST): New. Macro for read only immuse iteration.
(FOR_EACH_IMM_USE_SAFE): New. Macro for write-safe immuse iteration.
(BREAK_FROM_SAFE_IMM_USE): New. Macro for earlyu exit from write-safe
iteration.
(struct stmt_ann_d): Remove dataflow_t from struct.
* tree-if-conv.c (tree_if_conversion). Don't call free_df.
(if_convertible_phi_p): Use FAST immuse iterator.
(if_convertible_loop_p): Don't call compute_immediate_uses.
(replace_phi_with_cond_modify_expr): Call update_stmt.
* tree-into-ssa.c (mark_def_sites, ssa_mark_def_sites): Call
update_stmt_if_modified.
(rewrite_all_into_ssa): Initialize ssa operands.
* tree-loop-linear.c (linear_transform_loops): Don't call free_df or
compute_immediate_uses.
* tree-optimize.c (execute_todo): Call verify_ssa whenever the
ssa_property is available.
(execute_one_pass): Change parameters passed to execute_todo.
* tree-outof-ssa.c (rewrite_trees): Don't call modify_stmt.
(remove_ssa_form): Call fini_ssa_operands.
(insert_backedge_copies): Delete call to modify_stmt.
* tree-phinodes.c (make_phi_node): Initialize use nodes.
(release_phi_node): Delink any use nodes before releasing.
(resize_phi_node): Relink any use nodes.
(remove_phi_arg_num): Delink the use node.
(remove_phi_node): Release the ssa_name AFTER releasing the phi node.
(remove_all_phi_nodes_for): Release phi node first.
* tree-pretty-print.c (dump_generic_node): Print stmt address.
* tree-sra.c (mark_all_v_defs): Call update_stmt_if_modified.
(scalarize_use, scalarize_copy): Call update_stmt.
* tree-ssa-alias.c (compute_may_aliases): Update all modified stmts.
(compute_points_to_and_addr_escape): Call mark_stmt_modified.
* tree-ssa-cpp.c (need_imm_uses_for): Delete.
(ccp_initialize): Remove call to compute_immediate_uses.
(substitute_and_fold, execute_fold_all_builtins): Call update_stmt.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Update all modified
stmts.
(simplify_cond_and_lookup_avail_expr): Call mark_stmt_modified.
(simplify_switch_and_lookup_avail_expr): Call mark_stmt_modified.
(eliminate_redundant_computations): Call mark_stmt_modified.
(cprop_operand): Call mark_stmt_modified.
(optimize_stmt): Call update_stmt_if_modified and mark_stmt_modified.
* tree-ssa-dse.c (fix_phi_uses, fix_stmt_v_may_defs): Delete.
(dse_optimize_stmt): Use new immuse interface.
(tree_ssa_dse): Remove calls to compute_immediate_uses and free_df.
* tree-ssa-forwprop.c (need_imm_uses_for): Delete.
(substitute_single_use_vars): Use new immuse interface.
(tree_ssa_forward_propagate_single_use_vars): Remove calls to free_df
and compute_immediate_uses.
* tree-ssa-loop-im.c (single_reachable_address): Use new immuse
interface.
(rewrite_mem_refs): Call update_stmt.
(determine_lsm): Remove call to compute_imm_uses and free_df.
* tree-ssa-loop-ivcanon.c (create_canonical_iv): Call update_stmt.
(try_unroll_loop_completely): Call update_stmt.
* tree-ssa-loop-ivopts.c (rewrite_address_base): Call update_stmt.
(rewrite_use_compare): Call update_stmt.
(compute_phi_arg_on_exit): Insert each stmt before trying to process.
(rewrite_use) : Call update_stmt.
* tree-ssa-loop-manip.c (verify_loop_closed_ssa): Add arg to call.
* tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Call
update_stmt.
* tree-ssa-operands.c (NULL_USE_OPERAND_P): Remove declaration.
(allocate_use_optype, allocate_vuse_optype): Adjust allocation size.
(free_uses, free_vuses, free_v_may_defs, free_v_must_defs): Delink
use nodes.
(initialize_vuse_operand): New. Initialize a vuse operand.
(initialize_v_may_def_operand): New. Initialize a maydef operand.
(initialize_v_must_def_operand): New. Initialize a mustdef operand.
(finalize_ssa_defs): Use stmt parameter.
(correct_use_link): Ensure a use node is in the correct list, and has
the correct stmt pointer.
(finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_vuses,
finalize_ssa_v_must_defs): Also initialize use nodes.
(finalize_ssa_stmt_operands): Pass extra stmt operands.
(build_ssa_operands): Seperate parsing from final operand construction.
(parse_ssa_operands): New. Parse entry point for operand building.
(swap_tree_operands): New. Swap 2 tree operands.
(update_stmt_operands): Ranamed from get_stmt_operands. Always builds
operands.
(get_expr_operands): Call swap_tree_operands when needed.
(copy_virtual_operands): Use initialize routines for virtual use ops.
(create_ssa_artficial_load_stmt): Add extra stmt parameter.
(verify_abort): New. Issue imm_use error.
(verify_imm_links): New Verify imm_use links for a var.
(dump_immediate_uses_for): New. Dump imm_uses for a var to file.
(dump_immediate_uses): New. Dump imm_uses for all vars to file.
(debug_immediate_uses): New. Dump imm_uses for all vars to stderr.
(debug_immediate_uses_for): New. Dump imm_uses for a var to stderr.
* tree-ssa-operands.h (struct use_operand_ptr): Delete.
(NULL_USE_OPERAND_P) Define.
(use_optype_d, v_def_use_operand_type, vuse_optype_d): Add immediate
use node.
(struct vuse_operand_type): New struct.
(SET_USE): Call set_ssa_use_from_ptr.
(USE_STMT): Define.
(PHI_ARG_INDEX_FROM_USE): Define.
* tree-ssa-phiopt.c (replace_phi_edge_with_variable): Set the phi
argument via SET_USE, not PHI_ARG_DEF_TREE.
* tree-ssa-pre.c (eliminate): Call update_stmt.
* tree-ssa-propagate.c (cfg_blocks_get): Use imm_use iterators. Don't
call free_df.
* tree-ssa-sink.c (all_immediate_uses_same_place): Use imm_use iterator.
(nearest_common_dominator_of_uses): Use imm_use iterator.
(statement_sink_location): Use imm_use iterator and interface.
(execute_sink_code): Don't call compute_immediate_uses or free-df.
* tree-ssa-threadupdate.c (create_edge_and_update_destination_phis): Use
PHI_ARG_DEF, not PHI_ARG_DEF_TREE.
* tree-ssa.c (verify_use, verify_phi_args): Verify some imm_use info.
(verify_ssa): Ensure no stmt is marked modify after optimization pass
if new parameter is true.
(init_tree_ssa): Don't initialize operand cache here.
(delete_tree_ssa): Don't destroy operand cache here.
(propagate_into_addr): Pass in a use pointer, return true if anything
was changed.
(replace_immediate_uses): Use imm_use iterator, call update_stmt.
(check_phi_redundancy): Use imm_use iterator.
(kill_redundant_phi_nodes): Don't call compute_immediate_uses or
free_df.
* tree-ssanames.c (make_ssa_name): Initialize imm_use node.
(release_ssa_name): Delink node and all elements in its imm_use list.
* tree-tailcall.c (adjust_return_value): Call update_stmt.
* tree-vect-analyze.c (vect_stmt_relevant_p): Use imm_use iterator.
* tree-vectorizer.c (need_imm_uses_for): Delete.
(vectorize_loops): Dont call compute_immediate_uses or free_df.
* tree.h (struct ssa_imm_use_d): Define.
(SSA_NAME_IMM_USE_NODE): Define.
(struct tree_ssa_name): Add imm_use node.
(PHI_DF): Delete.
(PHI_ARG_IMM_USE_NODE): Define.
(struct phi_arg_d): Add imm_use node.
(struct tree_phi_node): Remove struct dataflow_d element.
(TDF_STMTADDR): Define.
From-SVN: r97648
2005-04-05 21:05:20 +02:00
|
|
|
|
2006-04-27 22:22:17 +02:00
|
|
|
FOR_EACH_IMM_USE_STMT (stmt, imm_iter, oldiv_def)
|
|
|
|
{
|
|
|
|
tree newiv, stmts;
|
|
|
|
lambda_body_vector lbv, newlbv;
|
|
|
|
|
2004-11-01 19:08:02 +01:00
|
|
|
gcc_assert (TREE_CODE (stmt) != PHI_NODE);
|
2006-04-27 22:22:17 +02:00
|
|
|
|
|
|
|
/* Compute the new expression for the induction
|
|
|
|
variable. */
|
|
|
|
depth = VEC_length (tree, new_ivs);
|
|
|
|
lbv = lambda_body_vector_new (depth);
|
|
|
|
LBV_COEFFICIENTS (lbv)[i] = 1;
|
|
|
|
|
|
|
|
newlbv = lambda_body_vector_compute_new (transform, lbv);
|
|
|
|
|
|
|
|
newiv = lbv_to_gcc_expression (newlbv, TREE_TYPE (oldiv),
|
|
|
|
new_ivs, &stmts);
|
|
|
|
bsi = bsi_for_stmt (stmt);
|
|
|
|
/* Insert the statements to build that
|
|
|
|
expression. */
|
|
|
|
bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
|
|
|
|
|
|
|
|
FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter)
|
|
|
|
propagate_value (use_p, newiv);
|
|
|
|
update_stmt (stmt);
|
2004-09-16 18:16:14 +02:00
|
|
|
}
|
|
|
|
}
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
VEC_free (tree, heap, new_ivs);
|
2004-08-26 19:10:50 +02:00
|
|
|
}
|
|
|
|
|
2004-09-16 18:16:14 +02:00
|
|
|
/* Return TRUE if this is not interesting statement from the perspective of
|
|
|
|
determining if we have a perfect loop nest. */
|
|
|
|
|
|
|
|
static bool
|
|
|
|
not_interesting_stmt (tree stmt)
|
|
|
|
{
|
|
|
|
/* Note that COND_EXPR's aren't interesting because if they were exiting the
|
|
|
|
loop, we would have already failed the number of exits tests. */
|
|
|
|
if (TREE_CODE (stmt) == LABEL_EXPR
|
|
|
|
|| TREE_CODE (stmt) == GOTO_EXPR
|
|
|
|
|| TREE_CODE (stmt) == COND_EXPR)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return TRUE if PHI uses DEF for it's in-the-loop edge for LOOP. */
|
|
|
|
|
|
|
|
static bool
|
|
|
|
phi_loop_edge_uses_def (struct loop *loop, tree phi, tree def)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < PHI_NUM_ARGS (phi); i++)
|
|
|
|
if (flow_bb_inside_loop_p (loop, PHI_ARG_EDGE (phi, i)->src))
|
|
|
|
if (PHI_ARG_DEF (phi, i) == def)
|
|
|
|
return true;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return TRUE if STMT is a use of PHI_RESULT. */
|
|
|
|
|
|
|
|
static bool
|
|
|
|
stmt_uses_phi_result (tree stmt, tree phi_result)
|
|
|
|
{
|
lambda-code.c (gcc_loop_to_lambda_loop, [...]): Use generic operand interface.
2005-05-03 Andrew MacLeod <amacleod@redhat.com>
* lambda-code.c (gcc_loop_to_lambda_loop,
lambda_loopnest_to_gcc_loopnest, phi_loop_edge_uses_def,
stmt_is_bumper_for_loop, perfect_nest_p, replace_uses_of_x_with_y): Use
generic operand interface.
* tree-data-ref.c (find_data_references_in_loop): Use generic interface.
* tree-dfa.c (collect_dfa_stats_r, mark_new_vars_to_rename): Use
generic operand interface.
* tree-flow-inline.h (delink_imm_use, link_imm_use_to_list,
link_imm_use, link_imm_use_stmt, relink_imm_use, relink_imm_use_stmt,
next_safe_imm_use, has_zero_uses, has_single_use, single_imm_use,
num_imm_uses): Use ssa_use_operand_t.
(get_def_ops, get_use_ops, get_v_may_def_ops, get_vuse_ops,
get_v_must_def_ops): Delete.
(get_def_from_ptr, get_phi_result_ptr): Get def directly now.
(get_use_op_ptr, get_def_op_ptr, get_v_may_def_result_ptr,
get_v_may_def_op_ptr, get_vuse_op_ptr, get_v_must_def_result_ptr,
get_v_must_def_kill_ptr): Delete.
(delink_stmt_imm_use): Move and use new operand interface.
(op_iter_next_use, op_iter_next_def, op_iter_next_tree, op_iter_init,
op_iter_next_tree): Use new operand implementation.
(clear_and_done_ssa_iter): New. Initialize a blank operand iterator.
(op_iter_init_use, op_iter_init_def, op_iter_init_tree): Add iterator
type check.
(op_iter_next_mustdef, op_iter_next_maydef,
op_iter_next_must_and_may_def): Delete. Replace with...
(op_iter_next_maymustdef): New. Combine must and may next operations.
(op_iter_init_maydef, op_iter_init_mustdef,
op_iter_init_must_and_may_def): Use new interface.
(single_ssa_tree_operand ): New. Process single operands only as trees.
(single_ssa_use_operand): New. Process single operands only as uses.
(single_ssa_def_operand): New. Process single operands only as defs.
(zero_ssa_operands): New. Return TRUE if there are zero operands of the
specified types.
(num_ssa_operands): New. Count the number of specified operands.
(compare_ssa_operands_equal): New. Compare two statements' operands.
(single_phi_def): New. Return true if PHI has one def of the specified
operand type.
(op_iter_init_phiuse): New. Initialize the iterator for PHI arguments.
(op_iter_init_phidef): New. Initialize the iterator for the PHI def.
* tree-flow.h (struct immediate_use_iterator_d): Use ssa_use_operand_t.
(struct stmt_ann_d): Operands field no longer require GTY().
(vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Change prototype.
* tree-into-ssa.c (mark_def_sites): Use SSA_OP_VMUSTKILL.
* tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb,
dump_replaceable_exprs, rewrite_trees): Use generic interface.
* tree-phinodes.c (make_phi_node, release_phi_node, resize_phi_node):
Use use_operand_p instead of ssa_imm_use_t *.
* tree-pretty-print.c (dump_vops): check if operands are active before
dumping virtual operands.
* tree-sra.c (sra_walk_function): Use ZERO_SSA_OPERANDS.
* tree-ssa-ccp.c (likely_value): Use ZERO_SSA_OPERANDS.
(ccp_fold): Use new interface.
(ccp_visit_stmt): Remove unused variables and code.
(convert_to_gimple_builtin): Insert statements before calling
mark_new_vars_to_rename.
* tree-ssa-copy.c (stmt_may_generate_copy): Use ZERO_SSA_OPERANDS.
(copy_prop_visit_cond_stmt): Use generic interface.
* tree-ssa-dom.c (struct expr_hash_elt): Use stmt pointer, not the
annotation in table.
(thread_across_edge): Use generic interface.
(initialize_hash_element): Initialzie with stmt, not annotation.
(eliminate_redundant_computations): Use generic interface.
(record_equivalences_from_stmt): Pass stmt, not annotation.
(avail_expr_hash, real_avail_expr_hash, avail_expr_eq): Use generic
interface.
* tree-ssa-dse.c (dse_optimize_stmt): Use ZERO_SSA_OPERANDS.
* tree-ssa-loop-ivopts.c (find_invariants_stmt,
find_interesting_uses_stmt, protect_loop_closed_ssa_form_use): Use
generic operand interface.
* tree-ssa-loop-niter.c (chain_of_csts_start, get_val_for): Use generic
interface.
* tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Use Generic operand
Interface.
* tree-ssa-operands.c (struct opbuild_list_d): New. Operand build type.
(build_defs, build_uses, build_v_may_defs, build_vuses,
build_v_must_defs): Change type to struct opbuild_list_d.
(ops_active): New. Operands active boolean.
(operand_memory, operand_memory_index): New. Operand memory managers.
(allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype,
allocate_vuse_optype, allocate_v_must_def_optype): Delete.
(free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs):
Change from functions to static variable list heads.
(opbuild_initialize_virtual): New. Initialize a virtual build list.
(opbuild_initialize_real): New. Initialize a virtual build list.
(opbuild_free): New. Free a build list.
(opbuild_num_elems): New. Number of items in a list.
(opbuild_append_real): New. Add a real (tree *) operand.
(opbuild_append_virtual): New. Add and sort a virtual (tree) operand.
(opbuild_first): New. Return first element index in a list.
(opbuild_next): New. Return next element in a list.
(opbuild_elem_real): New. Return real element.
(opbuild_elem_virtual): New. Return virtual element.
(opbuild_elem_uid): New. Return UID of virtual element.
(opbuild_clear): New. Reset an operand list.
(opbuild_remove_elem): New. Remove an element form a list.
(ssa_operands_active): New. Return true if operand cache is active.
(init_ssa_operands, fini_ssa_operands): Initialize new implementation.
(ssa_operand_alloc): New. Allocate memory from an operand chunk.
(correct_use_link): Use use_operand_p.
(finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_defs,
finalize_ssa_vuses, finalize_ssa_v_must_defs): New implmentation.
(cleanup_v_may_defs): Use new implmentation.
(finalize_ssa_stmt_operands, start_ssa_stmt_operands): New
implementation.
(append_def, append_use, append_v_may_def, append_vuse,
append_v_must_def): Call opbuild_append routine instead of using varray.
(build_ssa_operands): Simplify to simply use stmt, don't maintain a
global parse_old_ops variable.
(free_ssa_operands): New implementation.
(update_stmt_operands): Move. Change argument to build_ssa_operands.
(copy_virtual_operands): Move. New generic implementation.
(create_ssa_artficial_load_stmt): Move. New implementation.
(swap_tree_operands): Update for new implementation.
(get_expr_operands): Add stmt parameter to calls to swap_tree_operands.
(add_call_clobber_ops, add_call_read_ops): Initialize opbuild list
rather than a varray.
(verify_imm_links): Use use_operand_p.
(dump_immediate_uses_for): If the immediate use variable is a virtual
variable, show the virtual ops in the stmt.
* tree-ssa-operands.h (def_operand_p): No longer a structure.
(NULL_DEF_OPERAND_P): Now a #define.
(def_optype_d, use_optype_d, v_def_use_operand_type, v_may_def_optype_d,
vuse_operand_type, vuse_optype_d, v_must_def_optype_d): Delete.
(def_optype_d, use_optype_d, maydef_optype_d, vuse_optype_d,
mustdef_optype_d): New. Use Linked list representation.
(SSA_OPERAND_MEMORY_SIZE): New. Size of operand memory chunk.
(struct ssa_operand_memory_d): New. Allocated Chunk node.
(struct stmt_operands_d): Change to new pointers that are not GTY.
(STMT_USE_OPS, NUM_USES, SET_USE_OP, STMT_DEF_OPS, NUM_DEFS, SET_DEF_OP,
STMT_V_MAY_DEF_OPS, NUM_V_MAY_DEFS, SET_V_MAY_DEF_RESULT,
SET_V_MAY_DEF_OP, STMT_VUSE_OPS, NUM_VUSES, SET_VUSE_OP,
STMT_V_MUST_DEF_OPS, NUM_V_MUST_DEFS, SET_V_MUST_DEF_RESULT,
SET_V_MUST_DEF_KILL): Delete.
(V_MAY_DEF_OPS, V_MAY_DEF_RESULT_PTR, V_MAY_DEF_RESULT,
V_MAY_DEF_OP_PTR, V_MAY_DEF_OP): Rename to MAYDEF_*.
(V_MUST_DEF_OPS, V_MUST_DEF_RESULT_PTR, V_MUST_DEF_RESULT,
V_MUST_DEF_KILL_PTR, V_MUST_DEF_KILL): Rename to MUSTDEF_*.
(enum ssa_op_iter_type): Operand iterator typechecking values.
(struct ssa_operand_iterator_d): Use linked lists of operands.
(SSA_OP_VMUSTDEFKILL): Rename to SSA_OP_VMUSTKILL.
(FOR_EACH_SSA_MAYDEF_OPERAND, FOR_EACH_SSA_MUSTDEF_OPERAND,
FOR_EACH_SSA_MUST_AND_MAY_DEF_OPERAND): Use op_iter_next_maymustdef.
(FOR_EACH_PHI_ARG): New. Iterate over PHI arguments.
(FOR_EACH_PHI_OR_STMT_USE): New. Iterate over PHI or stmt uses.
(FOR_EACH_PHI_OR_STMT_DEF): New. Iterate over PHI or stmt defs.
(SINGLE_SSA_TREE_OPERAND, SINGLE_SSA_USE_OPERAND,
SINGLE_SSA_DEF_OPERAND, ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS): New.
* tree-ssa-opfinalize.h: New. Function templates for expansion.
(FINALIZE_ALLOC): Expands into alloc_def, alloc_use, alloc_maydef,
alloc_vuse, and alloc_mustdef.
(FINALIZE_FUNC): Expands into finalize_ssa_def_ops,
finalize_ssa_use_ops, finalize_ssa_v_may_def_ops, finalize_ssa_vuse_ops,
and finalize_ssa_v_must_def_ops.
* tree-ssa-pre.c (add_to_sets): Pass tree to vn_add.
(create_value_expr_from): Use stmt not vuse_optype as a parameter. Pass
stmt around.
(compute_avail): Use generic iterator interface.
* tree-ssa-propagate.c (first_vdef): Use generic operand interface.
(stmt_makes_single_load, stmt_makes_single_store): Use
ZERO_SSA_OPERANDS.
* tree-ssa-sink.c (is_hidden_global_store): Use ZERO_SSA_OPERANDS.
(statement_sink_location): Use generic interface.
* tree-ssa.c (verify_ssa): Use %p in fprintf. Use generic interface.
(delete_tree_ssa): Don't call release_defs. Call release_ssa_name and
reset the immediate use link nodes.
(stmt_references_memory_p): Use ZERO_SSA_OPERANDS.
* tree-ssanames.c (make_ssa_name): Use use_operand_p.
* tree-tailcall.c (find_tail_calls): Use ZERO_SSA_OPERANDS.
(eliminate_tail_call): Use generic operand interface.
* tree-vect-analyze.c (vect_analyze_data_refs): Use ZERO_SSA_OPERANDS.
(vect_mark_relevant, vect_mark_stmts_to_be_vectorized): Use generic
interface.
* tree-vect-transform.c (update_vuses_to_preheader): Use generic
interface.
* tree-vectorizer.c (rename_variables_in_bb): Use generic interface.
* tree-vn.c (struct val_expr_pair_d): Cache statment pointer instead of
vuse_optype.
(vn_compute, val_expr_pair_hash, vn_add, vn_lookup, vn_lookup_or_add):
Use statement pointer instead of vuse_optype. Use generic interface.
* tree-vrp.c (maybe_add_assert_expr): Use generic interface.
(stmt_interesting_for_vrp, vrp_visit_stmt): Use ZERO_SSA_OPERANDS.
* tree.h (struct ssa_imm_use_d): Renamed to ssa_use_operand_d.
(tree_ssa_name, phi_arg_d): Use ssa_use_operand_d.
* doc/tree-ssa.texi: Update documentation for operand interface.
From-SVN: r99155
2005-05-03 14:19:56 +02:00
|
|
|
tree use = SINGLE_SSA_TREE_OPERAND (stmt, SSA_OP_USE);
|
2004-09-16 18:16:14 +02:00
|
|
|
|
|
|
|
/* This is conservatively true, because we only want SIMPLE bumpers
|
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
|
|
|
of the form x +- constant for our pass. */
|
lambda-code.c (gcc_loop_to_lambda_loop, [...]): Use generic operand interface.
2005-05-03 Andrew MacLeod <amacleod@redhat.com>
* lambda-code.c (gcc_loop_to_lambda_loop,
lambda_loopnest_to_gcc_loopnest, phi_loop_edge_uses_def,
stmt_is_bumper_for_loop, perfect_nest_p, replace_uses_of_x_with_y): Use
generic operand interface.
* tree-data-ref.c (find_data_references_in_loop): Use generic interface.
* tree-dfa.c (collect_dfa_stats_r, mark_new_vars_to_rename): Use
generic operand interface.
* tree-flow-inline.h (delink_imm_use, link_imm_use_to_list,
link_imm_use, link_imm_use_stmt, relink_imm_use, relink_imm_use_stmt,
next_safe_imm_use, has_zero_uses, has_single_use, single_imm_use,
num_imm_uses): Use ssa_use_operand_t.
(get_def_ops, get_use_ops, get_v_may_def_ops, get_vuse_ops,
get_v_must_def_ops): Delete.
(get_def_from_ptr, get_phi_result_ptr): Get def directly now.
(get_use_op_ptr, get_def_op_ptr, get_v_may_def_result_ptr,
get_v_may_def_op_ptr, get_vuse_op_ptr, get_v_must_def_result_ptr,
get_v_must_def_kill_ptr): Delete.
(delink_stmt_imm_use): Move and use new operand interface.
(op_iter_next_use, op_iter_next_def, op_iter_next_tree, op_iter_init,
op_iter_next_tree): Use new operand implementation.
(clear_and_done_ssa_iter): New. Initialize a blank operand iterator.
(op_iter_init_use, op_iter_init_def, op_iter_init_tree): Add iterator
type check.
(op_iter_next_mustdef, op_iter_next_maydef,
op_iter_next_must_and_may_def): Delete. Replace with...
(op_iter_next_maymustdef): New. Combine must and may next operations.
(op_iter_init_maydef, op_iter_init_mustdef,
op_iter_init_must_and_may_def): Use new interface.
(single_ssa_tree_operand ): New. Process single operands only as trees.
(single_ssa_use_operand): New. Process single operands only as uses.
(single_ssa_def_operand): New. Process single operands only as defs.
(zero_ssa_operands): New. Return TRUE if there are zero operands of the
specified types.
(num_ssa_operands): New. Count the number of specified operands.
(compare_ssa_operands_equal): New. Compare two statements' operands.
(single_phi_def): New. Return true if PHI has one def of the specified
operand type.
(op_iter_init_phiuse): New. Initialize the iterator for PHI arguments.
(op_iter_init_phidef): New. Initialize the iterator for the PHI def.
* tree-flow.h (struct immediate_use_iterator_d): Use ssa_use_operand_t.
(struct stmt_ann_d): Operands field no longer require GTY().
(vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Change prototype.
* tree-into-ssa.c (mark_def_sites): Use SSA_OP_VMUSTKILL.
* tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb,
dump_replaceable_exprs, rewrite_trees): Use generic interface.
* tree-phinodes.c (make_phi_node, release_phi_node, resize_phi_node):
Use use_operand_p instead of ssa_imm_use_t *.
* tree-pretty-print.c (dump_vops): check if operands are active before
dumping virtual operands.
* tree-sra.c (sra_walk_function): Use ZERO_SSA_OPERANDS.
* tree-ssa-ccp.c (likely_value): Use ZERO_SSA_OPERANDS.
(ccp_fold): Use new interface.
(ccp_visit_stmt): Remove unused variables and code.
(convert_to_gimple_builtin): Insert statements before calling
mark_new_vars_to_rename.
* tree-ssa-copy.c (stmt_may_generate_copy): Use ZERO_SSA_OPERANDS.
(copy_prop_visit_cond_stmt): Use generic interface.
* tree-ssa-dom.c (struct expr_hash_elt): Use stmt pointer, not the
annotation in table.
(thread_across_edge): Use generic interface.
(initialize_hash_element): Initialzie with stmt, not annotation.
(eliminate_redundant_computations): Use generic interface.
(record_equivalences_from_stmt): Pass stmt, not annotation.
(avail_expr_hash, real_avail_expr_hash, avail_expr_eq): Use generic
interface.
* tree-ssa-dse.c (dse_optimize_stmt): Use ZERO_SSA_OPERANDS.
* tree-ssa-loop-ivopts.c (find_invariants_stmt,
find_interesting_uses_stmt, protect_loop_closed_ssa_form_use): Use
generic operand interface.
* tree-ssa-loop-niter.c (chain_of_csts_start, get_val_for): Use generic
interface.
* tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Use Generic operand
Interface.
* tree-ssa-operands.c (struct opbuild_list_d): New. Operand build type.
(build_defs, build_uses, build_v_may_defs, build_vuses,
build_v_must_defs): Change type to struct opbuild_list_d.
(ops_active): New. Operands active boolean.
(operand_memory, operand_memory_index): New. Operand memory managers.
(allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype,
allocate_vuse_optype, allocate_v_must_def_optype): Delete.
(free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs):
Change from functions to static variable list heads.
(opbuild_initialize_virtual): New. Initialize a virtual build list.
(opbuild_initialize_real): New. Initialize a virtual build list.
(opbuild_free): New. Free a build list.
(opbuild_num_elems): New. Number of items in a list.
(opbuild_append_real): New. Add a real (tree *) operand.
(opbuild_append_virtual): New. Add and sort a virtual (tree) operand.
(opbuild_first): New. Return first element index in a list.
(opbuild_next): New. Return next element in a list.
(opbuild_elem_real): New. Return real element.
(opbuild_elem_virtual): New. Return virtual element.
(opbuild_elem_uid): New. Return UID of virtual element.
(opbuild_clear): New. Reset an operand list.
(opbuild_remove_elem): New. Remove an element form a list.
(ssa_operands_active): New. Return true if operand cache is active.
(init_ssa_operands, fini_ssa_operands): Initialize new implementation.
(ssa_operand_alloc): New. Allocate memory from an operand chunk.
(correct_use_link): Use use_operand_p.
(finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_defs,
finalize_ssa_vuses, finalize_ssa_v_must_defs): New implmentation.
(cleanup_v_may_defs): Use new implmentation.
(finalize_ssa_stmt_operands, start_ssa_stmt_operands): New
implementation.
(append_def, append_use, append_v_may_def, append_vuse,
append_v_must_def): Call opbuild_append routine instead of using varray.
(build_ssa_operands): Simplify to simply use stmt, don't maintain a
global parse_old_ops variable.
(free_ssa_operands): New implementation.
(update_stmt_operands): Move. Change argument to build_ssa_operands.
(copy_virtual_operands): Move. New generic implementation.
(create_ssa_artficial_load_stmt): Move. New implementation.
(swap_tree_operands): Update for new implementation.
(get_expr_operands): Add stmt parameter to calls to swap_tree_operands.
(add_call_clobber_ops, add_call_read_ops): Initialize opbuild list
rather than a varray.
(verify_imm_links): Use use_operand_p.
(dump_immediate_uses_for): If the immediate use variable is a virtual
variable, show the virtual ops in the stmt.
* tree-ssa-operands.h (def_operand_p): No longer a structure.
(NULL_DEF_OPERAND_P): Now a #define.
(def_optype_d, use_optype_d, v_def_use_operand_type, v_may_def_optype_d,
vuse_operand_type, vuse_optype_d, v_must_def_optype_d): Delete.
(def_optype_d, use_optype_d, maydef_optype_d, vuse_optype_d,
mustdef_optype_d): New. Use Linked list representation.
(SSA_OPERAND_MEMORY_SIZE): New. Size of operand memory chunk.
(struct ssa_operand_memory_d): New. Allocated Chunk node.
(struct stmt_operands_d): Change to new pointers that are not GTY.
(STMT_USE_OPS, NUM_USES, SET_USE_OP, STMT_DEF_OPS, NUM_DEFS, SET_DEF_OP,
STMT_V_MAY_DEF_OPS, NUM_V_MAY_DEFS, SET_V_MAY_DEF_RESULT,
SET_V_MAY_DEF_OP, STMT_VUSE_OPS, NUM_VUSES, SET_VUSE_OP,
STMT_V_MUST_DEF_OPS, NUM_V_MUST_DEFS, SET_V_MUST_DEF_RESULT,
SET_V_MUST_DEF_KILL): Delete.
(V_MAY_DEF_OPS, V_MAY_DEF_RESULT_PTR, V_MAY_DEF_RESULT,
V_MAY_DEF_OP_PTR, V_MAY_DEF_OP): Rename to MAYDEF_*.
(V_MUST_DEF_OPS, V_MUST_DEF_RESULT_PTR, V_MUST_DEF_RESULT,
V_MUST_DEF_KILL_PTR, V_MUST_DEF_KILL): Rename to MUSTDEF_*.
(enum ssa_op_iter_type): Operand iterator typechecking values.
(struct ssa_operand_iterator_d): Use linked lists of operands.
(SSA_OP_VMUSTDEFKILL): Rename to SSA_OP_VMUSTKILL.
(FOR_EACH_SSA_MAYDEF_OPERAND, FOR_EACH_SSA_MUSTDEF_OPERAND,
FOR_EACH_SSA_MUST_AND_MAY_DEF_OPERAND): Use op_iter_next_maymustdef.
(FOR_EACH_PHI_ARG): New. Iterate over PHI arguments.
(FOR_EACH_PHI_OR_STMT_USE): New. Iterate over PHI or stmt uses.
(FOR_EACH_PHI_OR_STMT_DEF): New. Iterate over PHI or stmt defs.
(SINGLE_SSA_TREE_OPERAND, SINGLE_SSA_USE_OPERAND,
SINGLE_SSA_DEF_OPERAND, ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS): New.
* tree-ssa-opfinalize.h: New. Function templates for expansion.
(FINALIZE_ALLOC): Expands into alloc_def, alloc_use, alloc_maydef,
alloc_vuse, and alloc_mustdef.
(FINALIZE_FUNC): Expands into finalize_ssa_def_ops,
finalize_ssa_use_ops, finalize_ssa_v_may_def_ops, finalize_ssa_vuse_ops,
and finalize_ssa_v_must_def_ops.
* tree-ssa-pre.c (add_to_sets): Pass tree to vn_add.
(create_value_expr_from): Use stmt not vuse_optype as a parameter. Pass
stmt around.
(compute_avail): Use generic iterator interface.
* tree-ssa-propagate.c (first_vdef): Use generic operand interface.
(stmt_makes_single_load, stmt_makes_single_store): Use
ZERO_SSA_OPERANDS.
* tree-ssa-sink.c (is_hidden_global_store): Use ZERO_SSA_OPERANDS.
(statement_sink_location): Use generic interface.
* tree-ssa.c (verify_ssa): Use %p in fprintf. Use generic interface.
(delete_tree_ssa): Don't call release_defs. Call release_ssa_name and
reset the immediate use link nodes.
(stmt_references_memory_p): Use ZERO_SSA_OPERANDS.
* tree-ssanames.c (make_ssa_name): Use use_operand_p.
* tree-tailcall.c (find_tail_calls): Use ZERO_SSA_OPERANDS.
(eliminate_tail_call): Use generic operand interface.
* tree-vect-analyze.c (vect_analyze_data_refs): Use ZERO_SSA_OPERANDS.
(vect_mark_relevant, vect_mark_stmts_to_be_vectorized): Use generic
interface.
* tree-vect-transform.c (update_vuses_to_preheader): Use generic
interface.
* tree-vectorizer.c (rename_variables_in_bb): Use generic interface.
* tree-vn.c (struct val_expr_pair_d): Cache statment pointer instead of
vuse_optype.
(vn_compute, val_expr_pair_hash, vn_add, vn_lookup, vn_lookup_or_add):
Use statement pointer instead of vuse_optype. Use generic interface.
* tree-vrp.c (maybe_add_assert_expr): Use generic interface.
(stmt_interesting_for_vrp, vrp_visit_stmt): Use ZERO_SSA_OPERANDS.
* tree.h (struct ssa_imm_use_d): Renamed to ssa_use_operand_d.
(tree_ssa_name, phi_arg_d): Use ssa_use_operand_d.
* doc/tree-ssa.texi: Update documentation for operand interface.
From-SVN: r99155
2005-05-03 14:19:56 +02:00
|
|
|
return (use == phi_result);
|
2004-09-16 18:16:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* STMT is a bumper stmt for LOOP if the version it defines is used in the
|
|
|
|
in-loop-edge in a phi node, and the operand it uses is the result of that
|
|
|
|
phi node.
|
|
|
|
I.E. i_29 = i_3 + 1
|
|
|
|
i_3 = PHI (0, i_29); */
|
|
|
|
|
|
|
|
static bool
|
|
|
|
stmt_is_bumper_for_loop (struct loop *loop, tree stmt)
|
|
|
|
{
|
|
|
|
tree use;
|
|
|
|
tree def;
|
lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt.
2005-04-05 Andrew MacLeod <amacleod@redhat.com>
* lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt.
Use immediate use iterator.
(stmt_is_bumper_for_loop): Use immediate use iterator.
* predict.c (strip_builtin_expect): Use update_stmt.
* tree-cfg.c (update_modified_stmts): New. Call update_stmt_if_modified
on all elements of a STATEMENT_LIST.
(bsi_insert_before, bsi_insert_after): Call update_modified_stmts.
(bsi_remove): Remove imm_use links and mark the stmt as modified.
(bsi_replace): Mark stmt as modified and the update it.
* tree-complex.c (update_complex_assignment): Call mark_stmt_modified.
(expand_complex_libcal): Call update_stmt.
(expand_complex_comparison): Call mark_stmt_modified.
(expand_complex_operations_1): Call update_stmt_if_modified.
(expand_vector_operations_1): Call mark_stmt_modified.
* tree-dfa.c (compute_immediate_uses, free_df_for_stmt, free_df,
compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt,
add_immediate_use, redirect_immediate_use,
redirect_immediate_uses, dump_immediate_uses, debug_immediate_uses,
dump_immediate_uses_for, debug_immediate_uses_for): Delete.
(mark_new_vars_to_rename): Call update_stmt.
* tree-dump.c (dump_option_value_in): Add "stmtaddr".
* tree-flow-inline.h (modify_stmt): Rename to mark_stmt_modified.
Ignore PHI nodes.
(unmodify_stmt): Delete.
(update_stmt): New. Force an update of a stmt.
(update_stmt_if_modified): update a stmt if it is out of date.
(get_stmt_operands): Verify stmt is NOT modified.
(stmt_modified_p): Update comment.
(delink_imm_use): Remove a use node from its immuse list.
(link_imm_use_to_list): Link a use node to a specific list.
(link_imm_use): Link a node to the correct list.
(set_ssa_use_from_ptr): Set a use node to a specific value, and insert
it in the correct list, if appropriate.
(link_imm_use_stmt): Link a use node, and set the stmt pointer.
(relink_imm_use): Link a use node in place of another node in a list.
(relink_imm_use_stmt): LInk a node in place of another node, and set
the stmt pointer.
(end_safe_imm_use_traverse): New. Terminate a safe immuse iterator.
(end_safe_imm_use_p): New. Check for the end of a safe immuse iterator.
(first_safe_imm_use): New. Initialize a safe immuse iterator.
(next_safe_imm_use): New. Proceed to next safe immuse iterator value.
(end_readonly_imm_use_p): New. Check for end of a fast immuse iterator.
(first_readonly_imm_use): New. Initialize a fast immuse iterator.
(next_readonly_imm_use): New. Get the next fast immuse iterator value.
(has_zero_uses): New. Return true if there are no uses of a var.
(has_single_use): New. Return true if there is only a single use of a
variable.
(single_imm_use): New. Return the simgle immediate use.
(num_imm_uses): New. Return the number of immediate uses.
(get_v_must_def_ops): Use is now a pointer.
(use_operand_p, get_v_may_def_op_ptr, get_vuse_op_ptr,
get_v_must_def_kill_ptr, get_phi_arg_def_ptr): Return the address of
the use node.
(get_immediate_uses, num_immediate_uses, immediate_use): Delete.
(delink_stmt_imm_use): Delink all immuses from a stmt.
(phi_arg_index_from_use): New. Return a phi arg index for a use.
* tree-flow.h (struct dataflow_d): Delete.
(immediate_use_iterator_d): New. Immediate use iterator struct.
(FOR_EACH_IMM_USE_FAST): New. Macro for read only immuse iteration.
(FOR_EACH_IMM_USE_SAFE): New. Macro for write-safe immuse iteration.
(BREAK_FROM_SAFE_IMM_USE): New. Macro for earlyu exit from write-safe
iteration.
(struct stmt_ann_d): Remove dataflow_t from struct.
* tree-if-conv.c (tree_if_conversion). Don't call free_df.
(if_convertible_phi_p): Use FAST immuse iterator.
(if_convertible_loop_p): Don't call compute_immediate_uses.
(replace_phi_with_cond_modify_expr): Call update_stmt.
* tree-into-ssa.c (mark_def_sites, ssa_mark_def_sites): Call
update_stmt_if_modified.
(rewrite_all_into_ssa): Initialize ssa operands.
* tree-loop-linear.c (linear_transform_loops): Don't call free_df or
compute_immediate_uses.
* tree-optimize.c (execute_todo): Call verify_ssa whenever the
ssa_property is available.
(execute_one_pass): Change parameters passed to execute_todo.
* tree-outof-ssa.c (rewrite_trees): Don't call modify_stmt.
(remove_ssa_form): Call fini_ssa_operands.
(insert_backedge_copies): Delete call to modify_stmt.
* tree-phinodes.c (make_phi_node): Initialize use nodes.
(release_phi_node): Delink any use nodes before releasing.
(resize_phi_node): Relink any use nodes.
(remove_phi_arg_num): Delink the use node.
(remove_phi_node): Release the ssa_name AFTER releasing the phi node.
(remove_all_phi_nodes_for): Release phi node first.
* tree-pretty-print.c (dump_generic_node): Print stmt address.
* tree-sra.c (mark_all_v_defs): Call update_stmt_if_modified.
(scalarize_use, scalarize_copy): Call update_stmt.
* tree-ssa-alias.c (compute_may_aliases): Update all modified stmts.
(compute_points_to_and_addr_escape): Call mark_stmt_modified.
* tree-ssa-cpp.c (need_imm_uses_for): Delete.
(ccp_initialize): Remove call to compute_immediate_uses.
(substitute_and_fold, execute_fold_all_builtins): Call update_stmt.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Update all modified
stmts.
(simplify_cond_and_lookup_avail_expr): Call mark_stmt_modified.
(simplify_switch_and_lookup_avail_expr): Call mark_stmt_modified.
(eliminate_redundant_computations): Call mark_stmt_modified.
(cprop_operand): Call mark_stmt_modified.
(optimize_stmt): Call update_stmt_if_modified and mark_stmt_modified.
* tree-ssa-dse.c (fix_phi_uses, fix_stmt_v_may_defs): Delete.
(dse_optimize_stmt): Use new immuse interface.
(tree_ssa_dse): Remove calls to compute_immediate_uses and free_df.
* tree-ssa-forwprop.c (need_imm_uses_for): Delete.
(substitute_single_use_vars): Use new immuse interface.
(tree_ssa_forward_propagate_single_use_vars): Remove calls to free_df
and compute_immediate_uses.
* tree-ssa-loop-im.c (single_reachable_address): Use new immuse
interface.
(rewrite_mem_refs): Call update_stmt.
(determine_lsm): Remove call to compute_imm_uses and free_df.
* tree-ssa-loop-ivcanon.c (create_canonical_iv): Call update_stmt.
(try_unroll_loop_completely): Call update_stmt.
* tree-ssa-loop-ivopts.c (rewrite_address_base): Call update_stmt.
(rewrite_use_compare): Call update_stmt.
(compute_phi_arg_on_exit): Insert each stmt before trying to process.
(rewrite_use) : Call update_stmt.
* tree-ssa-loop-manip.c (verify_loop_closed_ssa): Add arg to call.
* tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Call
update_stmt.
* tree-ssa-operands.c (NULL_USE_OPERAND_P): Remove declaration.
(allocate_use_optype, allocate_vuse_optype): Adjust allocation size.
(free_uses, free_vuses, free_v_may_defs, free_v_must_defs): Delink
use nodes.
(initialize_vuse_operand): New. Initialize a vuse operand.
(initialize_v_may_def_operand): New. Initialize a maydef operand.
(initialize_v_must_def_operand): New. Initialize a mustdef operand.
(finalize_ssa_defs): Use stmt parameter.
(correct_use_link): Ensure a use node is in the correct list, and has
the correct stmt pointer.
(finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_vuses,
finalize_ssa_v_must_defs): Also initialize use nodes.
(finalize_ssa_stmt_operands): Pass extra stmt operands.
(build_ssa_operands): Seperate parsing from final operand construction.
(parse_ssa_operands): New. Parse entry point for operand building.
(swap_tree_operands): New. Swap 2 tree operands.
(update_stmt_operands): Ranamed from get_stmt_operands. Always builds
operands.
(get_expr_operands): Call swap_tree_operands when needed.
(copy_virtual_operands): Use initialize routines for virtual use ops.
(create_ssa_artficial_load_stmt): Add extra stmt parameter.
(verify_abort): New. Issue imm_use error.
(verify_imm_links): New Verify imm_use links for a var.
(dump_immediate_uses_for): New. Dump imm_uses for a var to file.
(dump_immediate_uses): New. Dump imm_uses for all vars to file.
(debug_immediate_uses): New. Dump imm_uses for all vars to stderr.
(debug_immediate_uses_for): New. Dump imm_uses for a var to stderr.
* tree-ssa-operands.h (struct use_operand_ptr): Delete.
(NULL_USE_OPERAND_P) Define.
(use_optype_d, v_def_use_operand_type, vuse_optype_d): Add immediate
use node.
(struct vuse_operand_type): New struct.
(SET_USE): Call set_ssa_use_from_ptr.
(USE_STMT): Define.
(PHI_ARG_INDEX_FROM_USE): Define.
* tree-ssa-phiopt.c (replace_phi_edge_with_variable): Set the phi
argument via SET_USE, not PHI_ARG_DEF_TREE.
* tree-ssa-pre.c (eliminate): Call update_stmt.
* tree-ssa-propagate.c (cfg_blocks_get): Use imm_use iterators. Don't
call free_df.
* tree-ssa-sink.c (all_immediate_uses_same_place): Use imm_use iterator.
(nearest_common_dominator_of_uses): Use imm_use iterator.
(statement_sink_location): Use imm_use iterator and interface.
(execute_sink_code): Don't call compute_immediate_uses or free-df.
* tree-ssa-threadupdate.c (create_edge_and_update_destination_phis): Use
PHI_ARG_DEF, not PHI_ARG_DEF_TREE.
* tree-ssa.c (verify_use, verify_phi_args): Verify some imm_use info.
(verify_ssa): Ensure no stmt is marked modify after optimization pass
if new parameter is true.
(init_tree_ssa): Don't initialize operand cache here.
(delete_tree_ssa): Don't destroy operand cache here.
(propagate_into_addr): Pass in a use pointer, return true if anything
was changed.
(replace_immediate_uses): Use imm_use iterator, call update_stmt.
(check_phi_redundancy): Use imm_use iterator.
(kill_redundant_phi_nodes): Don't call compute_immediate_uses or
free_df.
* tree-ssanames.c (make_ssa_name): Initialize imm_use node.
(release_ssa_name): Delink node and all elements in its imm_use list.
* tree-tailcall.c (adjust_return_value): Call update_stmt.
* tree-vect-analyze.c (vect_stmt_relevant_p): Use imm_use iterator.
* tree-vectorizer.c (need_imm_uses_for): Delete.
(vectorize_loops): Dont call compute_immediate_uses or free_df.
* tree.h (struct ssa_imm_use_d): Define.
(SSA_NAME_IMM_USE_NODE): Define.
(struct tree_ssa_name): Add imm_use node.
(PHI_DF): Delete.
(PHI_ARG_IMM_USE_NODE): Define.
(struct phi_arg_d): Add imm_use node.
(struct tree_phi_node): Remove struct dataflow_d element.
(TDF_STMTADDR): Define.
From-SVN: r97648
2005-04-05 21:05:20 +02:00
|
|
|
imm_use_iterator iter;
|
|
|
|
use_operand_p use_p;
|
2004-09-16 18:16:14 +02:00
|
|
|
|
lambda-code.c (gcc_loop_to_lambda_loop, [...]): Use generic operand interface.
2005-05-03 Andrew MacLeod <amacleod@redhat.com>
* lambda-code.c (gcc_loop_to_lambda_loop,
lambda_loopnest_to_gcc_loopnest, phi_loop_edge_uses_def,
stmt_is_bumper_for_loop, perfect_nest_p, replace_uses_of_x_with_y): Use
generic operand interface.
* tree-data-ref.c (find_data_references_in_loop): Use generic interface.
* tree-dfa.c (collect_dfa_stats_r, mark_new_vars_to_rename): Use
generic operand interface.
* tree-flow-inline.h (delink_imm_use, link_imm_use_to_list,
link_imm_use, link_imm_use_stmt, relink_imm_use, relink_imm_use_stmt,
next_safe_imm_use, has_zero_uses, has_single_use, single_imm_use,
num_imm_uses): Use ssa_use_operand_t.
(get_def_ops, get_use_ops, get_v_may_def_ops, get_vuse_ops,
get_v_must_def_ops): Delete.
(get_def_from_ptr, get_phi_result_ptr): Get def directly now.
(get_use_op_ptr, get_def_op_ptr, get_v_may_def_result_ptr,
get_v_may_def_op_ptr, get_vuse_op_ptr, get_v_must_def_result_ptr,
get_v_must_def_kill_ptr): Delete.
(delink_stmt_imm_use): Move and use new operand interface.
(op_iter_next_use, op_iter_next_def, op_iter_next_tree, op_iter_init,
op_iter_next_tree): Use new operand implementation.
(clear_and_done_ssa_iter): New. Initialize a blank operand iterator.
(op_iter_init_use, op_iter_init_def, op_iter_init_tree): Add iterator
type check.
(op_iter_next_mustdef, op_iter_next_maydef,
op_iter_next_must_and_may_def): Delete. Replace with...
(op_iter_next_maymustdef): New. Combine must and may next operations.
(op_iter_init_maydef, op_iter_init_mustdef,
op_iter_init_must_and_may_def): Use new interface.
(single_ssa_tree_operand ): New. Process single operands only as trees.
(single_ssa_use_operand): New. Process single operands only as uses.
(single_ssa_def_operand): New. Process single operands only as defs.
(zero_ssa_operands): New. Return TRUE if there are zero operands of the
specified types.
(num_ssa_operands): New. Count the number of specified operands.
(compare_ssa_operands_equal): New. Compare two statements' operands.
(single_phi_def): New. Return true if PHI has one def of the specified
operand type.
(op_iter_init_phiuse): New. Initialize the iterator for PHI arguments.
(op_iter_init_phidef): New. Initialize the iterator for the PHI def.
* tree-flow.h (struct immediate_use_iterator_d): Use ssa_use_operand_t.
(struct stmt_ann_d): Operands field no longer require GTY().
(vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Change prototype.
* tree-into-ssa.c (mark_def_sites): Use SSA_OP_VMUSTKILL.
* tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb,
dump_replaceable_exprs, rewrite_trees): Use generic interface.
* tree-phinodes.c (make_phi_node, release_phi_node, resize_phi_node):
Use use_operand_p instead of ssa_imm_use_t *.
* tree-pretty-print.c (dump_vops): check if operands are active before
dumping virtual operands.
* tree-sra.c (sra_walk_function): Use ZERO_SSA_OPERANDS.
* tree-ssa-ccp.c (likely_value): Use ZERO_SSA_OPERANDS.
(ccp_fold): Use new interface.
(ccp_visit_stmt): Remove unused variables and code.
(convert_to_gimple_builtin): Insert statements before calling
mark_new_vars_to_rename.
* tree-ssa-copy.c (stmt_may_generate_copy): Use ZERO_SSA_OPERANDS.
(copy_prop_visit_cond_stmt): Use generic interface.
* tree-ssa-dom.c (struct expr_hash_elt): Use stmt pointer, not the
annotation in table.
(thread_across_edge): Use generic interface.
(initialize_hash_element): Initialzie with stmt, not annotation.
(eliminate_redundant_computations): Use generic interface.
(record_equivalences_from_stmt): Pass stmt, not annotation.
(avail_expr_hash, real_avail_expr_hash, avail_expr_eq): Use generic
interface.
* tree-ssa-dse.c (dse_optimize_stmt): Use ZERO_SSA_OPERANDS.
* tree-ssa-loop-ivopts.c (find_invariants_stmt,
find_interesting_uses_stmt, protect_loop_closed_ssa_form_use): Use
generic operand interface.
* tree-ssa-loop-niter.c (chain_of_csts_start, get_val_for): Use generic
interface.
* tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Use Generic operand
Interface.
* tree-ssa-operands.c (struct opbuild_list_d): New. Operand build type.
(build_defs, build_uses, build_v_may_defs, build_vuses,
build_v_must_defs): Change type to struct opbuild_list_d.
(ops_active): New. Operands active boolean.
(operand_memory, operand_memory_index): New. Operand memory managers.
(allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype,
allocate_vuse_optype, allocate_v_must_def_optype): Delete.
(free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs):
Change from functions to static variable list heads.
(opbuild_initialize_virtual): New. Initialize a virtual build list.
(opbuild_initialize_real): New. Initialize a virtual build list.
(opbuild_free): New. Free a build list.
(opbuild_num_elems): New. Number of items in a list.
(opbuild_append_real): New. Add a real (tree *) operand.
(opbuild_append_virtual): New. Add and sort a virtual (tree) operand.
(opbuild_first): New. Return first element index in a list.
(opbuild_next): New. Return next element in a list.
(opbuild_elem_real): New. Return real element.
(opbuild_elem_virtual): New. Return virtual element.
(opbuild_elem_uid): New. Return UID of virtual element.
(opbuild_clear): New. Reset an operand list.
(opbuild_remove_elem): New. Remove an element form a list.
(ssa_operands_active): New. Return true if operand cache is active.
(init_ssa_operands, fini_ssa_operands): Initialize new implementation.
(ssa_operand_alloc): New. Allocate memory from an operand chunk.
(correct_use_link): Use use_operand_p.
(finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_defs,
finalize_ssa_vuses, finalize_ssa_v_must_defs): New implmentation.
(cleanup_v_may_defs): Use new implmentation.
(finalize_ssa_stmt_operands, start_ssa_stmt_operands): New
implementation.
(append_def, append_use, append_v_may_def, append_vuse,
append_v_must_def): Call opbuild_append routine instead of using varray.
(build_ssa_operands): Simplify to simply use stmt, don't maintain a
global parse_old_ops variable.
(free_ssa_operands): New implementation.
(update_stmt_operands): Move. Change argument to build_ssa_operands.
(copy_virtual_operands): Move. New generic implementation.
(create_ssa_artficial_load_stmt): Move. New implementation.
(swap_tree_operands): Update for new implementation.
(get_expr_operands): Add stmt parameter to calls to swap_tree_operands.
(add_call_clobber_ops, add_call_read_ops): Initialize opbuild list
rather than a varray.
(verify_imm_links): Use use_operand_p.
(dump_immediate_uses_for): If the immediate use variable is a virtual
variable, show the virtual ops in the stmt.
* tree-ssa-operands.h (def_operand_p): No longer a structure.
(NULL_DEF_OPERAND_P): Now a #define.
(def_optype_d, use_optype_d, v_def_use_operand_type, v_may_def_optype_d,
vuse_operand_type, vuse_optype_d, v_must_def_optype_d): Delete.
(def_optype_d, use_optype_d, maydef_optype_d, vuse_optype_d,
mustdef_optype_d): New. Use Linked list representation.
(SSA_OPERAND_MEMORY_SIZE): New. Size of operand memory chunk.
(struct ssa_operand_memory_d): New. Allocated Chunk node.
(struct stmt_operands_d): Change to new pointers that are not GTY.
(STMT_USE_OPS, NUM_USES, SET_USE_OP, STMT_DEF_OPS, NUM_DEFS, SET_DEF_OP,
STMT_V_MAY_DEF_OPS, NUM_V_MAY_DEFS, SET_V_MAY_DEF_RESULT,
SET_V_MAY_DEF_OP, STMT_VUSE_OPS, NUM_VUSES, SET_VUSE_OP,
STMT_V_MUST_DEF_OPS, NUM_V_MUST_DEFS, SET_V_MUST_DEF_RESULT,
SET_V_MUST_DEF_KILL): Delete.
(V_MAY_DEF_OPS, V_MAY_DEF_RESULT_PTR, V_MAY_DEF_RESULT,
V_MAY_DEF_OP_PTR, V_MAY_DEF_OP): Rename to MAYDEF_*.
(V_MUST_DEF_OPS, V_MUST_DEF_RESULT_PTR, V_MUST_DEF_RESULT,
V_MUST_DEF_KILL_PTR, V_MUST_DEF_KILL): Rename to MUSTDEF_*.
(enum ssa_op_iter_type): Operand iterator typechecking values.
(struct ssa_operand_iterator_d): Use linked lists of operands.
(SSA_OP_VMUSTDEFKILL): Rename to SSA_OP_VMUSTKILL.
(FOR_EACH_SSA_MAYDEF_OPERAND, FOR_EACH_SSA_MUSTDEF_OPERAND,
FOR_EACH_SSA_MUST_AND_MAY_DEF_OPERAND): Use op_iter_next_maymustdef.
(FOR_EACH_PHI_ARG): New. Iterate over PHI arguments.
(FOR_EACH_PHI_OR_STMT_USE): New. Iterate over PHI or stmt uses.
(FOR_EACH_PHI_OR_STMT_DEF): New. Iterate over PHI or stmt defs.
(SINGLE_SSA_TREE_OPERAND, SINGLE_SSA_USE_OPERAND,
SINGLE_SSA_DEF_OPERAND, ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS): New.
* tree-ssa-opfinalize.h: New. Function templates for expansion.
(FINALIZE_ALLOC): Expands into alloc_def, alloc_use, alloc_maydef,
alloc_vuse, and alloc_mustdef.
(FINALIZE_FUNC): Expands into finalize_ssa_def_ops,
finalize_ssa_use_ops, finalize_ssa_v_may_def_ops, finalize_ssa_vuse_ops,
and finalize_ssa_v_must_def_ops.
* tree-ssa-pre.c (add_to_sets): Pass tree to vn_add.
(create_value_expr_from): Use stmt not vuse_optype as a parameter. Pass
stmt around.
(compute_avail): Use generic iterator interface.
* tree-ssa-propagate.c (first_vdef): Use generic operand interface.
(stmt_makes_single_load, stmt_makes_single_store): Use
ZERO_SSA_OPERANDS.
* tree-ssa-sink.c (is_hidden_global_store): Use ZERO_SSA_OPERANDS.
(statement_sink_location): Use generic interface.
* tree-ssa.c (verify_ssa): Use %p in fprintf. Use generic interface.
(delete_tree_ssa): Don't call release_defs. Call release_ssa_name and
reset the immediate use link nodes.
(stmt_references_memory_p): Use ZERO_SSA_OPERANDS.
* tree-ssanames.c (make_ssa_name): Use use_operand_p.
* tree-tailcall.c (find_tail_calls): Use ZERO_SSA_OPERANDS.
(eliminate_tail_call): Use generic operand interface.
* tree-vect-analyze.c (vect_analyze_data_refs): Use ZERO_SSA_OPERANDS.
(vect_mark_relevant, vect_mark_stmts_to_be_vectorized): Use generic
interface.
* tree-vect-transform.c (update_vuses_to_preheader): Use generic
interface.
* tree-vectorizer.c (rename_variables_in_bb): Use generic interface.
* tree-vn.c (struct val_expr_pair_d): Cache statment pointer instead of
vuse_optype.
(vn_compute, val_expr_pair_hash, vn_add, vn_lookup, vn_lookup_or_add):
Use statement pointer instead of vuse_optype. Use generic interface.
* tree-vrp.c (maybe_add_assert_expr): Use generic interface.
(stmt_interesting_for_vrp, vrp_visit_stmt): Use ZERO_SSA_OPERANDS.
* tree.h (struct ssa_imm_use_d): Renamed to ssa_use_operand_d.
(tree_ssa_name, phi_arg_d): Use ssa_use_operand_d.
* doc/tree-ssa.texi: Update documentation for operand interface.
From-SVN: r99155
2005-05-03 14:19:56 +02:00
|
|
|
def = SINGLE_SSA_TREE_OPERAND (stmt, SSA_OP_DEF);
|
|
|
|
if (!def)
|
2004-09-16 18:16:14 +02:00
|
|
|
return false;
|
lambda-code.c (gcc_loop_to_lambda_loop, [...]): Use generic operand interface.
2005-05-03 Andrew MacLeod <amacleod@redhat.com>
* lambda-code.c (gcc_loop_to_lambda_loop,
lambda_loopnest_to_gcc_loopnest, phi_loop_edge_uses_def,
stmt_is_bumper_for_loop, perfect_nest_p, replace_uses_of_x_with_y): Use
generic operand interface.
* tree-data-ref.c (find_data_references_in_loop): Use generic interface.
* tree-dfa.c (collect_dfa_stats_r, mark_new_vars_to_rename): Use
generic operand interface.
* tree-flow-inline.h (delink_imm_use, link_imm_use_to_list,
link_imm_use, link_imm_use_stmt, relink_imm_use, relink_imm_use_stmt,
next_safe_imm_use, has_zero_uses, has_single_use, single_imm_use,
num_imm_uses): Use ssa_use_operand_t.
(get_def_ops, get_use_ops, get_v_may_def_ops, get_vuse_ops,
get_v_must_def_ops): Delete.
(get_def_from_ptr, get_phi_result_ptr): Get def directly now.
(get_use_op_ptr, get_def_op_ptr, get_v_may_def_result_ptr,
get_v_may_def_op_ptr, get_vuse_op_ptr, get_v_must_def_result_ptr,
get_v_must_def_kill_ptr): Delete.
(delink_stmt_imm_use): Move and use new operand interface.
(op_iter_next_use, op_iter_next_def, op_iter_next_tree, op_iter_init,
op_iter_next_tree): Use new operand implementation.
(clear_and_done_ssa_iter): New. Initialize a blank operand iterator.
(op_iter_init_use, op_iter_init_def, op_iter_init_tree): Add iterator
type check.
(op_iter_next_mustdef, op_iter_next_maydef,
op_iter_next_must_and_may_def): Delete. Replace with...
(op_iter_next_maymustdef): New. Combine must and may next operations.
(op_iter_init_maydef, op_iter_init_mustdef,
op_iter_init_must_and_may_def): Use new interface.
(single_ssa_tree_operand ): New. Process single operands only as trees.
(single_ssa_use_operand): New. Process single operands only as uses.
(single_ssa_def_operand): New. Process single operands only as defs.
(zero_ssa_operands): New. Return TRUE if there are zero operands of the
specified types.
(num_ssa_operands): New. Count the number of specified operands.
(compare_ssa_operands_equal): New. Compare two statements' operands.
(single_phi_def): New. Return true if PHI has one def of the specified
operand type.
(op_iter_init_phiuse): New. Initialize the iterator for PHI arguments.
(op_iter_init_phidef): New. Initialize the iterator for the PHI def.
* tree-flow.h (struct immediate_use_iterator_d): Use ssa_use_operand_t.
(struct stmt_ann_d): Operands field no longer require GTY().
(vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Change prototype.
* tree-into-ssa.c (mark_def_sites): Use SSA_OP_VMUSTKILL.
* tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb,
dump_replaceable_exprs, rewrite_trees): Use generic interface.
* tree-phinodes.c (make_phi_node, release_phi_node, resize_phi_node):
Use use_operand_p instead of ssa_imm_use_t *.
* tree-pretty-print.c (dump_vops): check if operands are active before
dumping virtual operands.
* tree-sra.c (sra_walk_function): Use ZERO_SSA_OPERANDS.
* tree-ssa-ccp.c (likely_value): Use ZERO_SSA_OPERANDS.
(ccp_fold): Use new interface.
(ccp_visit_stmt): Remove unused variables and code.
(convert_to_gimple_builtin): Insert statements before calling
mark_new_vars_to_rename.
* tree-ssa-copy.c (stmt_may_generate_copy): Use ZERO_SSA_OPERANDS.
(copy_prop_visit_cond_stmt): Use generic interface.
* tree-ssa-dom.c (struct expr_hash_elt): Use stmt pointer, not the
annotation in table.
(thread_across_edge): Use generic interface.
(initialize_hash_element): Initialzie with stmt, not annotation.
(eliminate_redundant_computations): Use generic interface.
(record_equivalences_from_stmt): Pass stmt, not annotation.
(avail_expr_hash, real_avail_expr_hash, avail_expr_eq): Use generic
interface.
* tree-ssa-dse.c (dse_optimize_stmt): Use ZERO_SSA_OPERANDS.
* tree-ssa-loop-ivopts.c (find_invariants_stmt,
find_interesting_uses_stmt, protect_loop_closed_ssa_form_use): Use
generic operand interface.
* tree-ssa-loop-niter.c (chain_of_csts_start, get_val_for): Use generic
interface.
* tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Use Generic operand
Interface.
* tree-ssa-operands.c (struct opbuild_list_d): New. Operand build type.
(build_defs, build_uses, build_v_may_defs, build_vuses,
build_v_must_defs): Change type to struct opbuild_list_d.
(ops_active): New. Operands active boolean.
(operand_memory, operand_memory_index): New. Operand memory managers.
(allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype,
allocate_vuse_optype, allocate_v_must_def_optype): Delete.
(free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs):
Change from functions to static variable list heads.
(opbuild_initialize_virtual): New. Initialize a virtual build list.
(opbuild_initialize_real): New. Initialize a virtual build list.
(opbuild_free): New. Free a build list.
(opbuild_num_elems): New. Number of items in a list.
(opbuild_append_real): New. Add a real (tree *) operand.
(opbuild_append_virtual): New. Add and sort a virtual (tree) operand.
(opbuild_first): New. Return first element index in a list.
(opbuild_next): New. Return next element in a list.
(opbuild_elem_real): New. Return real element.
(opbuild_elem_virtual): New. Return virtual element.
(opbuild_elem_uid): New. Return UID of virtual element.
(opbuild_clear): New. Reset an operand list.
(opbuild_remove_elem): New. Remove an element form a list.
(ssa_operands_active): New. Return true if operand cache is active.
(init_ssa_operands, fini_ssa_operands): Initialize new implementation.
(ssa_operand_alloc): New. Allocate memory from an operand chunk.
(correct_use_link): Use use_operand_p.
(finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_defs,
finalize_ssa_vuses, finalize_ssa_v_must_defs): New implmentation.
(cleanup_v_may_defs): Use new implmentation.
(finalize_ssa_stmt_operands, start_ssa_stmt_operands): New
implementation.
(append_def, append_use, append_v_may_def, append_vuse,
append_v_must_def): Call opbuild_append routine instead of using varray.
(build_ssa_operands): Simplify to simply use stmt, don't maintain a
global parse_old_ops variable.
(free_ssa_operands): New implementation.
(update_stmt_operands): Move. Change argument to build_ssa_operands.
(copy_virtual_operands): Move. New generic implementation.
(create_ssa_artficial_load_stmt): Move. New implementation.
(swap_tree_operands): Update for new implementation.
(get_expr_operands): Add stmt parameter to calls to swap_tree_operands.
(add_call_clobber_ops, add_call_read_ops): Initialize opbuild list
rather than a varray.
(verify_imm_links): Use use_operand_p.
(dump_immediate_uses_for): If the immediate use variable is a virtual
variable, show the virtual ops in the stmt.
* tree-ssa-operands.h (def_operand_p): No longer a structure.
(NULL_DEF_OPERAND_P): Now a #define.
(def_optype_d, use_optype_d, v_def_use_operand_type, v_may_def_optype_d,
vuse_operand_type, vuse_optype_d, v_must_def_optype_d): Delete.
(def_optype_d, use_optype_d, maydef_optype_d, vuse_optype_d,
mustdef_optype_d): New. Use Linked list representation.
(SSA_OPERAND_MEMORY_SIZE): New. Size of operand memory chunk.
(struct ssa_operand_memory_d): New. Allocated Chunk node.
(struct stmt_operands_d): Change to new pointers that are not GTY.
(STMT_USE_OPS, NUM_USES, SET_USE_OP, STMT_DEF_OPS, NUM_DEFS, SET_DEF_OP,
STMT_V_MAY_DEF_OPS, NUM_V_MAY_DEFS, SET_V_MAY_DEF_RESULT,
SET_V_MAY_DEF_OP, STMT_VUSE_OPS, NUM_VUSES, SET_VUSE_OP,
STMT_V_MUST_DEF_OPS, NUM_V_MUST_DEFS, SET_V_MUST_DEF_RESULT,
SET_V_MUST_DEF_KILL): Delete.
(V_MAY_DEF_OPS, V_MAY_DEF_RESULT_PTR, V_MAY_DEF_RESULT,
V_MAY_DEF_OP_PTR, V_MAY_DEF_OP): Rename to MAYDEF_*.
(V_MUST_DEF_OPS, V_MUST_DEF_RESULT_PTR, V_MUST_DEF_RESULT,
V_MUST_DEF_KILL_PTR, V_MUST_DEF_KILL): Rename to MUSTDEF_*.
(enum ssa_op_iter_type): Operand iterator typechecking values.
(struct ssa_operand_iterator_d): Use linked lists of operands.
(SSA_OP_VMUSTDEFKILL): Rename to SSA_OP_VMUSTKILL.
(FOR_EACH_SSA_MAYDEF_OPERAND, FOR_EACH_SSA_MUSTDEF_OPERAND,
FOR_EACH_SSA_MUST_AND_MAY_DEF_OPERAND): Use op_iter_next_maymustdef.
(FOR_EACH_PHI_ARG): New. Iterate over PHI arguments.
(FOR_EACH_PHI_OR_STMT_USE): New. Iterate over PHI or stmt uses.
(FOR_EACH_PHI_OR_STMT_DEF): New. Iterate over PHI or stmt defs.
(SINGLE_SSA_TREE_OPERAND, SINGLE_SSA_USE_OPERAND,
SINGLE_SSA_DEF_OPERAND, ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS): New.
* tree-ssa-opfinalize.h: New. Function templates for expansion.
(FINALIZE_ALLOC): Expands into alloc_def, alloc_use, alloc_maydef,
alloc_vuse, and alloc_mustdef.
(FINALIZE_FUNC): Expands into finalize_ssa_def_ops,
finalize_ssa_use_ops, finalize_ssa_v_may_def_ops, finalize_ssa_vuse_ops,
and finalize_ssa_v_must_def_ops.
* tree-ssa-pre.c (add_to_sets): Pass tree to vn_add.
(create_value_expr_from): Use stmt not vuse_optype as a parameter. Pass
stmt around.
(compute_avail): Use generic iterator interface.
* tree-ssa-propagate.c (first_vdef): Use generic operand interface.
(stmt_makes_single_load, stmt_makes_single_store): Use
ZERO_SSA_OPERANDS.
* tree-ssa-sink.c (is_hidden_global_store): Use ZERO_SSA_OPERANDS.
(statement_sink_location): Use generic interface.
* tree-ssa.c (verify_ssa): Use %p in fprintf. Use generic interface.
(delete_tree_ssa): Don't call release_defs. Call release_ssa_name and
reset the immediate use link nodes.
(stmt_references_memory_p): Use ZERO_SSA_OPERANDS.
* tree-ssanames.c (make_ssa_name): Use use_operand_p.
* tree-tailcall.c (find_tail_calls): Use ZERO_SSA_OPERANDS.
(eliminate_tail_call): Use generic operand interface.
* tree-vect-analyze.c (vect_analyze_data_refs): Use ZERO_SSA_OPERANDS.
(vect_mark_relevant, vect_mark_stmts_to_be_vectorized): Use generic
interface.
* tree-vect-transform.c (update_vuses_to_preheader): Use generic
interface.
* tree-vectorizer.c (rename_variables_in_bb): Use generic interface.
* tree-vn.c (struct val_expr_pair_d): Cache statment pointer instead of
vuse_optype.
(vn_compute, val_expr_pair_hash, vn_add, vn_lookup, vn_lookup_or_add):
Use statement pointer instead of vuse_optype. Use generic interface.
* tree-vrp.c (maybe_add_assert_expr): Use generic interface.
(stmt_interesting_for_vrp, vrp_visit_stmt): Use ZERO_SSA_OPERANDS.
* tree.h (struct ssa_imm_use_d): Renamed to ssa_use_operand_d.
(tree_ssa_name, phi_arg_d): Use ssa_use_operand_d.
* doc/tree-ssa.texi: Update documentation for operand interface.
From-SVN: r99155
2005-05-03 14:19:56 +02:00
|
|
|
|
lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt.
2005-04-05 Andrew MacLeod <amacleod@redhat.com>
* lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt.
Use immediate use iterator.
(stmt_is_bumper_for_loop): Use immediate use iterator.
* predict.c (strip_builtin_expect): Use update_stmt.
* tree-cfg.c (update_modified_stmts): New. Call update_stmt_if_modified
on all elements of a STATEMENT_LIST.
(bsi_insert_before, bsi_insert_after): Call update_modified_stmts.
(bsi_remove): Remove imm_use links and mark the stmt as modified.
(bsi_replace): Mark stmt as modified and the update it.
* tree-complex.c (update_complex_assignment): Call mark_stmt_modified.
(expand_complex_libcal): Call update_stmt.
(expand_complex_comparison): Call mark_stmt_modified.
(expand_complex_operations_1): Call update_stmt_if_modified.
(expand_vector_operations_1): Call mark_stmt_modified.
* tree-dfa.c (compute_immediate_uses, free_df_for_stmt, free_df,
compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt,
add_immediate_use, redirect_immediate_use,
redirect_immediate_uses, dump_immediate_uses, debug_immediate_uses,
dump_immediate_uses_for, debug_immediate_uses_for): Delete.
(mark_new_vars_to_rename): Call update_stmt.
* tree-dump.c (dump_option_value_in): Add "stmtaddr".
* tree-flow-inline.h (modify_stmt): Rename to mark_stmt_modified.
Ignore PHI nodes.
(unmodify_stmt): Delete.
(update_stmt): New. Force an update of a stmt.
(update_stmt_if_modified): update a stmt if it is out of date.
(get_stmt_operands): Verify stmt is NOT modified.
(stmt_modified_p): Update comment.
(delink_imm_use): Remove a use node from its immuse list.
(link_imm_use_to_list): Link a use node to a specific list.
(link_imm_use): Link a node to the correct list.
(set_ssa_use_from_ptr): Set a use node to a specific value, and insert
it in the correct list, if appropriate.
(link_imm_use_stmt): Link a use node, and set the stmt pointer.
(relink_imm_use): Link a use node in place of another node in a list.
(relink_imm_use_stmt): LInk a node in place of another node, and set
the stmt pointer.
(end_safe_imm_use_traverse): New. Terminate a safe immuse iterator.
(end_safe_imm_use_p): New. Check for the end of a safe immuse iterator.
(first_safe_imm_use): New. Initialize a safe immuse iterator.
(next_safe_imm_use): New. Proceed to next safe immuse iterator value.
(end_readonly_imm_use_p): New. Check for end of a fast immuse iterator.
(first_readonly_imm_use): New. Initialize a fast immuse iterator.
(next_readonly_imm_use): New. Get the next fast immuse iterator value.
(has_zero_uses): New. Return true if there are no uses of a var.
(has_single_use): New. Return true if there is only a single use of a
variable.
(single_imm_use): New. Return the simgle immediate use.
(num_imm_uses): New. Return the number of immediate uses.
(get_v_must_def_ops): Use is now a pointer.
(use_operand_p, get_v_may_def_op_ptr, get_vuse_op_ptr,
get_v_must_def_kill_ptr, get_phi_arg_def_ptr): Return the address of
the use node.
(get_immediate_uses, num_immediate_uses, immediate_use): Delete.
(delink_stmt_imm_use): Delink all immuses from a stmt.
(phi_arg_index_from_use): New. Return a phi arg index for a use.
* tree-flow.h (struct dataflow_d): Delete.
(immediate_use_iterator_d): New. Immediate use iterator struct.
(FOR_EACH_IMM_USE_FAST): New. Macro for read only immuse iteration.
(FOR_EACH_IMM_USE_SAFE): New. Macro for write-safe immuse iteration.
(BREAK_FROM_SAFE_IMM_USE): New. Macro for earlyu exit from write-safe
iteration.
(struct stmt_ann_d): Remove dataflow_t from struct.
* tree-if-conv.c (tree_if_conversion). Don't call free_df.
(if_convertible_phi_p): Use FAST immuse iterator.
(if_convertible_loop_p): Don't call compute_immediate_uses.
(replace_phi_with_cond_modify_expr): Call update_stmt.
* tree-into-ssa.c (mark_def_sites, ssa_mark_def_sites): Call
update_stmt_if_modified.
(rewrite_all_into_ssa): Initialize ssa operands.
* tree-loop-linear.c (linear_transform_loops): Don't call free_df or
compute_immediate_uses.
* tree-optimize.c (execute_todo): Call verify_ssa whenever the
ssa_property is available.
(execute_one_pass): Change parameters passed to execute_todo.
* tree-outof-ssa.c (rewrite_trees): Don't call modify_stmt.
(remove_ssa_form): Call fini_ssa_operands.
(insert_backedge_copies): Delete call to modify_stmt.
* tree-phinodes.c (make_phi_node): Initialize use nodes.
(release_phi_node): Delink any use nodes before releasing.
(resize_phi_node): Relink any use nodes.
(remove_phi_arg_num): Delink the use node.
(remove_phi_node): Release the ssa_name AFTER releasing the phi node.
(remove_all_phi_nodes_for): Release phi node first.
* tree-pretty-print.c (dump_generic_node): Print stmt address.
* tree-sra.c (mark_all_v_defs): Call update_stmt_if_modified.
(scalarize_use, scalarize_copy): Call update_stmt.
* tree-ssa-alias.c (compute_may_aliases): Update all modified stmts.
(compute_points_to_and_addr_escape): Call mark_stmt_modified.
* tree-ssa-cpp.c (need_imm_uses_for): Delete.
(ccp_initialize): Remove call to compute_immediate_uses.
(substitute_and_fold, execute_fold_all_builtins): Call update_stmt.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Update all modified
stmts.
(simplify_cond_and_lookup_avail_expr): Call mark_stmt_modified.
(simplify_switch_and_lookup_avail_expr): Call mark_stmt_modified.
(eliminate_redundant_computations): Call mark_stmt_modified.
(cprop_operand): Call mark_stmt_modified.
(optimize_stmt): Call update_stmt_if_modified and mark_stmt_modified.
* tree-ssa-dse.c (fix_phi_uses, fix_stmt_v_may_defs): Delete.
(dse_optimize_stmt): Use new immuse interface.
(tree_ssa_dse): Remove calls to compute_immediate_uses and free_df.
* tree-ssa-forwprop.c (need_imm_uses_for): Delete.
(substitute_single_use_vars): Use new immuse interface.
(tree_ssa_forward_propagate_single_use_vars): Remove calls to free_df
and compute_immediate_uses.
* tree-ssa-loop-im.c (single_reachable_address): Use new immuse
interface.
(rewrite_mem_refs): Call update_stmt.
(determine_lsm): Remove call to compute_imm_uses and free_df.
* tree-ssa-loop-ivcanon.c (create_canonical_iv): Call update_stmt.
(try_unroll_loop_completely): Call update_stmt.
* tree-ssa-loop-ivopts.c (rewrite_address_base): Call update_stmt.
(rewrite_use_compare): Call update_stmt.
(compute_phi_arg_on_exit): Insert each stmt before trying to process.
(rewrite_use) : Call update_stmt.
* tree-ssa-loop-manip.c (verify_loop_closed_ssa): Add arg to call.
* tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Call
update_stmt.
* tree-ssa-operands.c (NULL_USE_OPERAND_P): Remove declaration.
(allocate_use_optype, allocate_vuse_optype): Adjust allocation size.
(free_uses, free_vuses, free_v_may_defs, free_v_must_defs): Delink
use nodes.
(initialize_vuse_operand): New. Initialize a vuse operand.
(initialize_v_may_def_operand): New. Initialize a maydef operand.
(initialize_v_must_def_operand): New. Initialize a mustdef operand.
(finalize_ssa_defs): Use stmt parameter.
(correct_use_link): Ensure a use node is in the correct list, and has
the correct stmt pointer.
(finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_vuses,
finalize_ssa_v_must_defs): Also initialize use nodes.
(finalize_ssa_stmt_operands): Pass extra stmt operands.
(build_ssa_operands): Seperate parsing from final operand construction.
(parse_ssa_operands): New. Parse entry point for operand building.
(swap_tree_operands): New. Swap 2 tree operands.
(update_stmt_operands): Ranamed from get_stmt_operands. Always builds
operands.
(get_expr_operands): Call swap_tree_operands when needed.
(copy_virtual_operands): Use initialize routines for virtual use ops.
(create_ssa_artficial_load_stmt): Add extra stmt parameter.
(verify_abort): New. Issue imm_use error.
(verify_imm_links): New Verify imm_use links for a var.
(dump_immediate_uses_for): New. Dump imm_uses for a var to file.
(dump_immediate_uses): New. Dump imm_uses for all vars to file.
(debug_immediate_uses): New. Dump imm_uses for all vars to stderr.
(debug_immediate_uses_for): New. Dump imm_uses for a var to stderr.
* tree-ssa-operands.h (struct use_operand_ptr): Delete.
(NULL_USE_OPERAND_P) Define.
(use_optype_d, v_def_use_operand_type, vuse_optype_d): Add immediate
use node.
(struct vuse_operand_type): New struct.
(SET_USE): Call set_ssa_use_from_ptr.
(USE_STMT): Define.
(PHI_ARG_INDEX_FROM_USE): Define.
* tree-ssa-phiopt.c (replace_phi_edge_with_variable): Set the phi
argument via SET_USE, not PHI_ARG_DEF_TREE.
* tree-ssa-pre.c (eliminate): Call update_stmt.
* tree-ssa-propagate.c (cfg_blocks_get): Use imm_use iterators. Don't
call free_df.
* tree-ssa-sink.c (all_immediate_uses_same_place): Use imm_use iterator.
(nearest_common_dominator_of_uses): Use imm_use iterator.
(statement_sink_location): Use imm_use iterator and interface.
(execute_sink_code): Don't call compute_immediate_uses or free-df.
* tree-ssa-threadupdate.c (create_edge_and_update_destination_phis): Use
PHI_ARG_DEF, not PHI_ARG_DEF_TREE.
* tree-ssa.c (verify_use, verify_phi_args): Verify some imm_use info.
(verify_ssa): Ensure no stmt is marked modify after optimization pass
if new parameter is true.
(init_tree_ssa): Don't initialize operand cache here.
(delete_tree_ssa): Don't destroy operand cache here.
(propagate_into_addr): Pass in a use pointer, return true if anything
was changed.
(replace_immediate_uses): Use imm_use iterator, call update_stmt.
(check_phi_redundancy): Use imm_use iterator.
(kill_redundant_phi_nodes): Don't call compute_immediate_uses or
free_df.
* tree-ssanames.c (make_ssa_name): Initialize imm_use node.
(release_ssa_name): Delink node and all elements in its imm_use list.
* tree-tailcall.c (adjust_return_value): Call update_stmt.
* tree-vect-analyze.c (vect_stmt_relevant_p): Use imm_use iterator.
* tree-vectorizer.c (need_imm_uses_for): Delete.
(vectorize_loops): Dont call compute_immediate_uses or free_df.
* tree.h (struct ssa_imm_use_d): Define.
(SSA_NAME_IMM_USE_NODE): Define.
(struct tree_ssa_name): Add imm_use node.
(PHI_DF): Delete.
(PHI_ARG_IMM_USE_NODE): Define.
(struct phi_arg_d): Add imm_use node.
(struct tree_phi_node): Remove struct dataflow_d element.
(TDF_STMTADDR): Define.
From-SVN: r97648
2005-04-05 21:05:20 +02:00
|
|
|
FOR_EACH_IMM_USE_FAST (use_p, iter, def)
|
2004-09-16 18:16:14 +02:00
|
|
|
{
|
lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt.
2005-04-05 Andrew MacLeod <amacleod@redhat.com>
* lambda-code.c (lambda_loopnest_to_gcc_loopnest): Use update_stmt.
Use immediate use iterator.
(stmt_is_bumper_for_loop): Use immediate use iterator.
* predict.c (strip_builtin_expect): Use update_stmt.
* tree-cfg.c (update_modified_stmts): New. Call update_stmt_if_modified
on all elements of a STATEMENT_LIST.
(bsi_insert_before, bsi_insert_after): Call update_modified_stmts.
(bsi_remove): Remove imm_use links and mark the stmt as modified.
(bsi_replace): Mark stmt as modified and the update it.
* tree-complex.c (update_complex_assignment): Call mark_stmt_modified.
(expand_complex_libcal): Call update_stmt.
(expand_complex_comparison): Call mark_stmt_modified.
(expand_complex_operations_1): Call update_stmt_if_modified.
(expand_vector_operations_1): Call mark_stmt_modified.
* tree-dfa.c (compute_immediate_uses, free_df_for_stmt, free_df,
compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt,
add_immediate_use, redirect_immediate_use,
redirect_immediate_uses, dump_immediate_uses, debug_immediate_uses,
dump_immediate_uses_for, debug_immediate_uses_for): Delete.
(mark_new_vars_to_rename): Call update_stmt.
* tree-dump.c (dump_option_value_in): Add "stmtaddr".
* tree-flow-inline.h (modify_stmt): Rename to mark_stmt_modified.
Ignore PHI nodes.
(unmodify_stmt): Delete.
(update_stmt): New. Force an update of a stmt.
(update_stmt_if_modified): update a stmt if it is out of date.
(get_stmt_operands): Verify stmt is NOT modified.
(stmt_modified_p): Update comment.
(delink_imm_use): Remove a use node from its immuse list.
(link_imm_use_to_list): Link a use node to a specific list.
(link_imm_use): Link a node to the correct list.
(set_ssa_use_from_ptr): Set a use node to a specific value, and insert
it in the correct list, if appropriate.
(link_imm_use_stmt): Link a use node, and set the stmt pointer.
(relink_imm_use): Link a use node in place of another node in a list.
(relink_imm_use_stmt): LInk a node in place of another node, and set
the stmt pointer.
(end_safe_imm_use_traverse): New. Terminate a safe immuse iterator.
(end_safe_imm_use_p): New. Check for the end of a safe immuse iterator.
(first_safe_imm_use): New. Initialize a safe immuse iterator.
(next_safe_imm_use): New. Proceed to next safe immuse iterator value.
(end_readonly_imm_use_p): New. Check for end of a fast immuse iterator.
(first_readonly_imm_use): New. Initialize a fast immuse iterator.
(next_readonly_imm_use): New. Get the next fast immuse iterator value.
(has_zero_uses): New. Return true if there are no uses of a var.
(has_single_use): New. Return true if there is only a single use of a
variable.
(single_imm_use): New. Return the simgle immediate use.
(num_imm_uses): New. Return the number of immediate uses.
(get_v_must_def_ops): Use is now a pointer.
(use_operand_p, get_v_may_def_op_ptr, get_vuse_op_ptr,
get_v_must_def_kill_ptr, get_phi_arg_def_ptr): Return the address of
the use node.
(get_immediate_uses, num_immediate_uses, immediate_use): Delete.
(delink_stmt_imm_use): Delink all immuses from a stmt.
(phi_arg_index_from_use): New. Return a phi arg index for a use.
* tree-flow.h (struct dataflow_d): Delete.
(immediate_use_iterator_d): New. Immediate use iterator struct.
(FOR_EACH_IMM_USE_FAST): New. Macro for read only immuse iteration.
(FOR_EACH_IMM_USE_SAFE): New. Macro for write-safe immuse iteration.
(BREAK_FROM_SAFE_IMM_USE): New. Macro for earlyu exit from write-safe
iteration.
(struct stmt_ann_d): Remove dataflow_t from struct.
* tree-if-conv.c (tree_if_conversion). Don't call free_df.
(if_convertible_phi_p): Use FAST immuse iterator.
(if_convertible_loop_p): Don't call compute_immediate_uses.
(replace_phi_with_cond_modify_expr): Call update_stmt.
* tree-into-ssa.c (mark_def_sites, ssa_mark_def_sites): Call
update_stmt_if_modified.
(rewrite_all_into_ssa): Initialize ssa operands.
* tree-loop-linear.c (linear_transform_loops): Don't call free_df or
compute_immediate_uses.
* tree-optimize.c (execute_todo): Call verify_ssa whenever the
ssa_property is available.
(execute_one_pass): Change parameters passed to execute_todo.
* tree-outof-ssa.c (rewrite_trees): Don't call modify_stmt.
(remove_ssa_form): Call fini_ssa_operands.
(insert_backedge_copies): Delete call to modify_stmt.
* tree-phinodes.c (make_phi_node): Initialize use nodes.
(release_phi_node): Delink any use nodes before releasing.
(resize_phi_node): Relink any use nodes.
(remove_phi_arg_num): Delink the use node.
(remove_phi_node): Release the ssa_name AFTER releasing the phi node.
(remove_all_phi_nodes_for): Release phi node first.
* tree-pretty-print.c (dump_generic_node): Print stmt address.
* tree-sra.c (mark_all_v_defs): Call update_stmt_if_modified.
(scalarize_use, scalarize_copy): Call update_stmt.
* tree-ssa-alias.c (compute_may_aliases): Update all modified stmts.
(compute_points_to_and_addr_escape): Call mark_stmt_modified.
* tree-ssa-cpp.c (need_imm_uses_for): Delete.
(ccp_initialize): Remove call to compute_immediate_uses.
(substitute_and_fold, execute_fold_all_builtins): Call update_stmt.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Update all modified
stmts.
(simplify_cond_and_lookup_avail_expr): Call mark_stmt_modified.
(simplify_switch_and_lookup_avail_expr): Call mark_stmt_modified.
(eliminate_redundant_computations): Call mark_stmt_modified.
(cprop_operand): Call mark_stmt_modified.
(optimize_stmt): Call update_stmt_if_modified and mark_stmt_modified.
* tree-ssa-dse.c (fix_phi_uses, fix_stmt_v_may_defs): Delete.
(dse_optimize_stmt): Use new immuse interface.
(tree_ssa_dse): Remove calls to compute_immediate_uses and free_df.
* tree-ssa-forwprop.c (need_imm_uses_for): Delete.
(substitute_single_use_vars): Use new immuse interface.
(tree_ssa_forward_propagate_single_use_vars): Remove calls to free_df
and compute_immediate_uses.
* tree-ssa-loop-im.c (single_reachable_address): Use new immuse
interface.
(rewrite_mem_refs): Call update_stmt.
(determine_lsm): Remove call to compute_imm_uses and free_df.
* tree-ssa-loop-ivcanon.c (create_canonical_iv): Call update_stmt.
(try_unroll_loop_completely): Call update_stmt.
* tree-ssa-loop-ivopts.c (rewrite_address_base): Call update_stmt.
(rewrite_use_compare): Call update_stmt.
(compute_phi_arg_on_exit): Insert each stmt before trying to process.
(rewrite_use) : Call update_stmt.
* tree-ssa-loop-manip.c (verify_loop_closed_ssa): Add arg to call.
* tree-ssa-loop-unswitch.c (tree_unswitch_single_loop): Call
update_stmt.
* tree-ssa-operands.c (NULL_USE_OPERAND_P): Remove declaration.
(allocate_use_optype, allocate_vuse_optype): Adjust allocation size.
(free_uses, free_vuses, free_v_may_defs, free_v_must_defs): Delink
use nodes.
(initialize_vuse_operand): New. Initialize a vuse operand.
(initialize_v_may_def_operand): New. Initialize a maydef operand.
(initialize_v_must_def_operand): New. Initialize a mustdef operand.
(finalize_ssa_defs): Use stmt parameter.
(correct_use_link): Ensure a use node is in the correct list, and has
the correct stmt pointer.
(finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_vuses,
finalize_ssa_v_must_defs): Also initialize use nodes.
(finalize_ssa_stmt_operands): Pass extra stmt operands.
(build_ssa_operands): Seperate parsing from final operand construction.
(parse_ssa_operands): New. Parse entry point for operand building.
(swap_tree_operands): New. Swap 2 tree operands.
(update_stmt_operands): Ranamed from get_stmt_operands. Always builds
operands.
(get_expr_operands): Call swap_tree_operands when needed.
(copy_virtual_operands): Use initialize routines for virtual use ops.
(create_ssa_artficial_load_stmt): Add extra stmt parameter.
(verify_abort): New. Issue imm_use error.
(verify_imm_links): New Verify imm_use links for a var.
(dump_immediate_uses_for): New. Dump imm_uses for a var to file.
(dump_immediate_uses): New. Dump imm_uses for all vars to file.
(debug_immediate_uses): New. Dump imm_uses for all vars to stderr.
(debug_immediate_uses_for): New. Dump imm_uses for a var to stderr.
* tree-ssa-operands.h (struct use_operand_ptr): Delete.
(NULL_USE_OPERAND_P) Define.
(use_optype_d, v_def_use_operand_type, vuse_optype_d): Add immediate
use node.
(struct vuse_operand_type): New struct.
(SET_USE): Call set_ssa_use_from_ptr.
(USE_STMT): Define.
(PHI_ARG_INDEX_FROM_USE): Define.
* tree-ssa-phiopt.c (replace_phi_edge_with_variable): Set the phi
argument via SET_USE, not PHI_ARG_DEF_TREE.
* tree-ssa-pre.c (eliminate): Call update_stmt.
* tree-ssa-propagate.c (cfg_blocks_get): Use imm_use iterators. Don't
call free_df.
* tree-ssa-sink.c (all_immediate_uses_same_place): Use imm_use iterator.
(nearest_common_dominator_of_uses): Use imm_use iterator.
(statement_sink_location): Use imm_use iterator and interface.
(execute_sink_code): Don't call compute_immediate_uses or free-df.
* tree-ssa-threadupdate.c (create_edge_and_update_destination_phis): Use
PHI_ARG_DEF, not PHI_ARG_DEF_TREE.
* tree-ssa.c (verify_use, verify_phi_args): Verify some imm_use info.
(verify_ssa): Ensure no stmt is marked modify after optimization pass
if new parameter is true.
(init_tree_ssa): Don't initialize operand cache here.
(delete_tree_ssa): Don't destroy operand cache here.
(propagate_into_addr): Pass in a use pointer, return true if anything
was changed.
(replace_immediate_uses): Use imm_use iterator, call update_stmt.
(check_phi_redundancy): Use imm_use iterator.
(kill_redundant_phi_nodes): Don't call compute_immediate_uses or
free_df.
* tree-ssanames.c (make_ssa_name): Initialize imm_use node.
(release_ssa_name): Delink node and all elements in its imm_use list.
* tree-tailcall.c (adjust_return_value): Call update_stmt.
* tree-vect-analyze.c (vect_stmt_relevant_p): Use imm_use iterator.
* tree-vectorizer.c (need_imm_uses_for): Delete.
(vectorize_loops): Dont call compute_immediate_uses or free_df.
* tree.h (struct ssa_imm_use_d): Define.
(SSA_NAME_IMM_USE_NODE): Define.
(struct tree_ssa_name): Add imm_use node.
(PHI_DF): Delete.
(PHI_ARG_IMM_USE_NODE): Define.
(struct phi_arg_d): Add imm_use node.
(struct tree_phi_node): Remove struct dataflow_d element.
(TDF_STMTADDR): Define.
From-SVN: r97648
2005-04-05 21:05:20 +02:00
|
|
|
use = USE_STMT (use_p);
|
2004-09-16 18:16:14 +02:00
|
|
|
if (TREE_CODE (use) == PHI_NODE)
|
|
|
|
{
|
|
|
|
if (phi_loop_edge_uses_def (loop, use, def))
|
|
|
|
if (stmt_uses_phi_result (stmt, PHI_RESULT (use)))
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
2004-11-01 19:08:02 +01:00
|
|
|
|
|
|
|
|
2004-09-16 18:16:14 +02:00
|
|
|
/* Return true if LOOP is a perfect loop nest.
|
|
|
|
Perfect loop nests are those loop nests where all code occurs in the
|
|
|
|
innermost loop body.
|
|
|
|
If S is a program statement, then
|
|
|
|
|
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
|
|
|
i.e.
|
2004-09-16 18:16:14 +02:00
|
|
|
DO I = 1, 20
|
|
|
|
S1
|
|
|
|
DO J = 1, 20
|
|
|
|
...
|
|
|
|
END DO
|
|
|
|
END DO
|
|
|
|
is not a perfect loop nest because of S1.
|
|
|
|
|
|
|
|
DO I = 1, 20
|
|
|
|
DO J = 1, 20
|
|
|
|
S1
|
|
|
|
...
|
|
|
|
END DO
|
|
|
|
END DO
|
|
|
|
is a perfect loop nest.
|
|
|
|
|
|
|
|
Since we don't have high level loops anymore, we basically have to walk our
|
|
|
|
statements and ignore those that are there because the loop needs them (IE
|
|
|
|
the induction variable increment, and jump back to the top of the loop). */
|
|
|
|
|
|
|
|
bool
|
|
|
|
perfect_nest_p (struct loop *loop)
|
|
|
|
{
|
|
|
|
basic_block *bbs;
|
|
|
|
size_t i;
|
|
|
|
tree exit_cond;
|
|
|
|
|
|
|
|
if (!loop->inner)
|
|
|
|
return true;
|
|
|
|
bbs = get_loop_body (loop);
|
|
|
|
exit_cond = get_loop_exit_condition (loop);
|
|
|
|
for (i = 0; i < loop->num_nodes; i++)
|
|
|
|
{
|
|
|
|
if (bbs[i]->loop_father == loop)
|
|
|
|
{
|
|
|
|
block_stmt_iterator bsi;
|
|
|
|
for (bsi = bsi_start (bbs[i]); !bsi_end_p (bsi); bsi_next (&bsi))
|
|
|
|
{
|
|
|
|
tree stmt = bsi_stmt (bsi);
|
|
|
|
if (stmt == exit_cond
|
|
|
|
|| not_interesting_stmt (stmt)
|
|
|
|
|| stmt_is_bumper_for_loop (loop, stmt))
|
|
|
|
continue;
|
|
|
|
free (bbs);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
free (bbs);
|
|
|
|
/* See if the inner loops are perfectly nested as well. */
|
|
|
|
if (loop->inner)
|
|
|
|
return perfect_nest_p (loop->inner);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2006-11-15 10:35:34 +01:00
|
|
|
/* Replace the USES of X in STMT, or uses with the same step as X with Y.
|
|
|
|
YINIT is the initial value of Y, REPLACEMENTS is a hash table to
|
|
|
|
avoid creating duplicate temporaries and FIRSTBSI is statement
|
|
|
|
iterator where new temporaries should be inserted at the beginning
|
|
|
|
of body basic block. */
|
2004-09-16 18:16:14 +02:00
|
|
|
|
|
|
|
static void
|
2005-06-10 21:23:26 +02:00
|
|
|
replace_uses_equiv_to_x_with_y (struct loop *loop, tree stmt, tree x,
|
2006-11-15 10:35:34 +01:00
|
|
|
int xstep, tree y, tree yinit,
|
|
|
|
htab_t replacements,
|
|
|
|
block_stmt_iterator *firstbsi)
|
2004-09-16 18:16:14 +02:00
|
|
|
{
|
lambda-code.c (gcc_loop_to_lambda_loop, [...]): Use generic operand interface.
2005-05-03 Andrew MacLeod <amacleod@redhat.com>
* lambda-code.c (gcc_loop_to_lambda_loop,
lambda_loopnest_to_gcc_loopnest, phi_loop_edge_uses_def,
stmt_is_bumper_for_loop, perfect_nest_p, replace_uses_of_x_with_y): Use
generic operand interface.
* tree-data-ref.c (find_data_references_in_loop): Use generic interface.
* tree-dfa.c (collect_dfa_stats_r, mark_new_vars_to_rename): Use
generic operand interface.
* tree-flow-inline.h (delink_imm_use, link_imm_use_to_list,
link_imm_use, link_imm_use_stmt, relink_imm_use, relink_imm_use_stmt,
next_safe_imm_use, has_zero_uses, has_single_use, single_imm_use,
num_imm_uses): Use ssa_use_operand_t.
(get_def_ops, get_use_ops, get_v_may_def_ops, get_vuse_ops,
get_v_must_def_ops): Delete.
(get_def_from_ptr, get_phi_result_ptr): Get def directly now.
(get_use_op_ptr, get_def_op_ptr, get_v_may_def_result_ptr,
get_v_may_def_op_ptr, get_vuse_op_ptr, get_v_must_def_result_ptr,
get_v_must_def_kill_ptr): Delete.
(delink_stmt_imm_use): Move and use new operand interface.
(op_iter_next_use, op_iter_next_def, op_iter_next_tree, op_iter_init,
op_iter_next_tree): Use new operand implementation.
(clear_and_done_ssa_iter): New. Initialize a blank operand iterator.
(op_iter_init_use, op_iter_init_def, op_iter_init_tree): Add iterator
type check.
(op_iter_next_mustdef, op_iter_next_maydef,
op_iter_next_must_and_may_def): Delete. Replace with...
(op_iter_next_maymustdef): New. Combine must and may next operations.
(op_iter_init_maydef, op_iter_init_mustdef,
op_iter_init_must_and_may_def): Use new interface.
(single_ssa_tree_operand ): New. Process single operands only as trees.
(single_ssa_use_operand): New. Process single operands only as uses.
(single_ssa_def_operand): New. Process single operands only as defs.
(zero_ssa_operands): New. Return TRUE if there are zero operands of the
specified types.
(num_ssa_operands): New. Count the number of specified operands.
(compare_ssa_operands_equal): New. Compare two statements' operands.
(single_phi_def): New. Return true if PHI has one def of the specified
operand type.
(op_iter_init_phiuse): New. Initialize the iterator for PHI arguments.
(op_iter_init_phidef): New. Initialize the iterator for the PHI def.
* tree-flow.h (struct immediate_use_iterator_d): Use ssa_use_operand_t.
(struct stmt_ann_d): Operands field no longer require GTY().
(vn_compute, vn_lookup_or_add, vn_add, vn_lookup): Change prototype.
* tree-into-ssa.c (mark_def_sites): Use SSA_OP_VMUSTKILL.
* tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb,
dump_replaceable_exprs, rewrite_trees): Use generic interface.
* tree-phinodes.c (make_phi_node, release_phi_node, resize_phi_node):
Use use_operand_p instead of ssa_imm_use_t *.
* tree-pretty-print.c (dump_vops): check if operands are active before
dumping virtual operands.
* tree-sra.c (sra_walk_function): Use ZERO_SSA_OPERANDS.
* tree-ssa-ccp.c (likely_value): Use ZERO_SSA_OPERANDS.
(ccp_fold): Use new interface.
(ccp_visit_stmt): Remove unused variables and code.
(convert_to_gimple_builtin): Insert statements before calling
mark_new_vars_to_rename.
* tree-ssa-copy.c (stmt_may_generate_copy): Use ZERO_SSA_OPERANDS.
(copy_prop_visit_cond_stmt): Use generic interface.
* tree-ssa-dom.c (struct expr_hash_elt): Use stmt pointer, not the
annotation in table.
(thread_across_edge): Use generic interface.
(initialize_hash_element): Initialzie with stmt, not annotation.
(eliminate_redundant_computations): Use generic interface.
(record_equivalences_from_stmt): Pass stmt, not annotation.
(avail_expr_hash, real_avail_expr_hash, avail_expr_eq): Use generic
interface.
* tree-ssa-dse.c (dse_optimize_stmt): Use ZERO_SSA_OPERANDS.
* tree-ssa-loop-ivopts.c (find_invariants_stmt,
find_interesting_uses_stmt, protect_loop_closed_ssa_form_use): Use
generic operand interface.
* tree-ssa-loop-niter.c (chain_of_csts_start, get_val_for): Use generic
interface.
* tree-ssa-loop-unswitch.c (tree_may_unswitch_on): Use Generic operand
Interface.
* tree-ssa-operands.c (struct opbuild_list_d): New. Operand build type.
(build_defs, build_uses, build_v_may_defs, build_vuses,
build_v_must_defs): Change type to struct opbuild_list_d.
(ops_active): New. Operands active boolean.
(operand_memory, operand_memory_index): New. Operand memory managers.
(allocate_def_optype, allocate_use_optype, allocate_v_may_def_optype,
allocate_vuse_optype, allocate_v_must_def_optype): Delete.
(free_uses, free_defs, free_vuses, free_v_may_defs, free_v_must_defs):
Change from functions to static variable list heads.
(opbuild_initialize_virtual): New. Initialize a virtual build list.
(opbuild_initialize_real): New. Initialize a virtual build list.
(opbuild_free): New. Free a build list.
(opbuild_num_elems): New. Number of items in a list.
(opbuild_append_real): New. Add a real (tree *) operand.
(opbuild_append_virtual): New. Add and sort a virtual (tree) operand.
(opbuild_first): New. Return first element index in a list.
(opbuild_next): New. Return next element in a list.
(opbuild_elem_real): New. Return real element.
(opbuild_elem_virtual): New. Return virtual element.
(opbuild_elem_uid): New. Return UID of virtual element.
(opbuild_clear): New. Reset an operand list.
(opbuild_remove_elem): New. Remove an element form a list.
(ssa_operands_active): New. Return true if operand cache is active.
(init_ssa_operands, fini_ssa_operands): Initialize new implementation.
(ssa_operand_alloc): New. Allocate memory from an operand chunk.
(correct_use_link): Use use_operand_p.
(finalize_ssa_uses, finalize_ssa_v_may_defs, finalize_ssa_defs,
finalize_ssa_vuses, finalize_ssa_v_must_defs): New implmentation.
(cleanup_v_may_defs): Use new implmentation.
(finalize_ssa_stmt_operands, start_ssa_stmt_operands): New
implementation.
(append_def, append_use, append_v_may_def, append_vuse,
append_v_must_def): Call opbuild_append routine instead of using varray.
(build_ssa_operands): Simplify to simply use stmt, don't maintain a
global parse_old_ops variable.
(free_ssa_operands): New implementation.
(update_stmt_operands): Move. Change argument to build_ssa_operands.
(copy_virtual_operands): Move. New generic implementation.
(create_ssa_artficial_load_stmt): Move. New implementation.
(swap_tree_operands): Update for new implementation.
(get_expr_operands): Add stmt parameter to calls to swap_tree_operands.
(add_call_clobber_ops, add_call_read_ops): Initialize opbuild list
rather than a varray.
(verify_imm_links): Use use_operand_p.
(dump_immediate_uses_for): If the immediate use variable is a virtual
variable, show the virtual ops in the stmt.
* tree-ssa-operands.h (def_operand_p): No longer a structure.
(NULL_DEF_OPERAND_P): Now a #define.
(def_optype_d, use_optype_d, v_def_use_operand_type, v_may_def_optype_d,
vuse_operand_type, vuse_optype_d, v_must_def_optype_d): Delete.
(def_optype_d, use_optype_d, maydef_optype_d, vuse_optype_d,
mustdef_optype_d): New. Use Linked list representation.
(SSA_OPERAND_MEMORY_SIZE): New. Size of operand memory chunk.
(struct ssa_operand_memory_d): New. Allocated Chunk node.
(struct stmt_operands_d): Change to new pointers that are not GTY.
(STMT_USE_OPS, NUM_USES, SET_USE_OP, STMT_DEF_OPS, NUM_DEFS, SET_DEF_OP,
STMT_V_MAY_DEF_OPS, NUM_V_MAY_DEFS, SET_V_MAY_DEF_RESULT,
SET_V_MAY_DEF_OP, STMT_VUSE_OPS, NUM_VUSES, SET_VUSE_OP,
STMT_V_MUST_DEF_OPS, NUM_V_MUST_DEFS, SET_V_MUST_DEF_RESULT,
SET_V_MUST_DEF_KILL): Delete.
(V_MAY_DEF_OPS, V_MAY_DEF_RESULT_PTR, V_MAY_DEF_RESULT,
V_MAY_DEF_OP_PTR, V_MAY_DEF_OP): Rename to MAYDEF_*.
(V_MUST_DEF_OPS, V_MUST_DEF_RESULT_PTR, V_MUST_DEF_RESULT,
V_MUST_DEF_KILL_PTR, V_MUST_DEF_KILL): Rename to MUSTDEF_*.
(enum ssa_op_iter_type): Operand iterator typechecking values.
(struct ssa_operand_iterator_d): Use linked lists of operands.
(SSA_OP_VMUSTDEFKILL): Rename to SSA_OP_VMUSTKILL.
(FOR_EACH_SSA_MAYDEF_OPERAND, FOR_EACH_SSA_MUSTDEF_OPERAND,
FOR_EACH_SSA_MUST_AND_MAY_DEF_OPERAND): Use op_iter_next_maymustdef.
(FOR_EACH_PHI_ARG): New. Iterate over PHI arguments.
(FOR_EACH_PHI_OR_STMT_USE): New. Iterate over PHI or stmt uses.
(FOR_EACH_PHI_OR_STMT_DEF): New. Iterate over PHI or stmt defs.
(SINGLE_SSA_TREE_OPERAND, SINGLE_SSA_USE_OPERAND,
SINGLE_SSA_DEF_OPERAND, ZERO_SSA_OPERANDS, NUM_SSA_OPERANDS): New.
* tree-ssa-opfinalize.h: New. Function templates for expansion.
(FINALIZE_ALLOC): Expands into alloc_def, alloc_use, alloc_maydef,
alloc_vuse, and alloc_mustdef.
(FINALIZE_FUNC): Expands into finalize_ssa_def_ops,
finalize_ssa_use_ops, finalize_ssa_v_may_def_ops, finalize_ssa_vuse_ops,
and finalize_ssa_v_must_def_ops.
* tree-ssa-pre.c (add_to_sets): Pass tree to vn_add.
(create_value_expr_from): Use stmt not vuse_optype as a parameter. Pass
stmt around.
(compute_avail): Use generic iterator interface.
* tree-ssa-propagate.c (first_vdef): Use generic operand interface.
(stmt_makes_single_load, stmt_makes_single_store): Use
ZERO_SSA_OPERANDS.
* tree-ssa-sink.c (is_hidden_global_store): Use ZERO_SSA_OPERANDS.
(statement_sink_location): Use generic interface.
* tree-ssa.c (verify_ssa): Use %p in fprintf. Use generic interface.
(delete_tree_ssa): Don't call release_defs. Call release_ssa_name and
reset the immediate use link nodes.
(stmt_references_memory_p): Use ZERO_SSA_OPERANDS.
* tree-ssanames.c (make_ssa_name): Use use_operand_p.
* tree-tailcall.c (find_tail_calls): Use ZERO_SSA_OPERANDS.
(eliminate_tail_call): Use generic operand interface.
* tree-vect-analyze.c (vect_analyze_data_refs): Use ZERO_SSA_OPERANDS.
(vect_mark_relevant, vect_mark_stmts_to_be_vectorized): Use generic
interface.
* tree-vect-transform.c (update_vuses_to_preheader): Use generic
interface.
* tree-vectorizer.c (rename_variables_in_bb): Use generic interface.
* tree-vn.c (struct val_expr_pair_d): Cache statment pointer instead of
vuse_optype.
(vn_compute, val_expr_pair_hash, vn_add, vn_lookup, vn_lookup_or_add):
Use statement pointer instead of vuse_optype. Use generic interface.
* tree-vrp.c (maybe_add_assert_expr): Use generic interface.
(stmt_interesting_for_vrp, vrp_visit_stmt): Use ZERO_SSA_OPERANDS.
* tree.h (struct ssa_imm_use_d): Renamed to ssa_use_operand_d.
(tree_ssa_name, phi_arg_d): Use ssa_use_operand_d.
* doc/tree-ssa.texi: Update documentation for operand interface.
From-SVN: r99155
2005-05-03 14:19:56 +02:00
|
|
|
ssa_op_iter iter;
|
|
|
|
use_operand_p use_p;
|
|
|
|
|
|
|
|
FOR_EACH_SSA_USE_OPERAND (use_p, stmt, iter, SSA_OP_USE)
|
2004-09-16 18:16:14 +02:00
|
|
|
{
|
2005-06-10 21:23:26 +02:00
|
|
|
tree use = USE_FROM_PTR (use_p);
|
|
|
|
tree step = NULL_TREE;
|
2006-11-15 10:35:34 +01:00
|
|
|
tree scev, init, val, var, setstmt;
|
|
|
|
struct tree_map *h, in;
|
|
|
|
void **loc;
|
2006-05-17 16:25:59 +02:00
|
|
|
|
2006-11-15 10:35:34 +01:00
|
|
|
/* Replace uses of X with Y right away. */
|
|
|
|
if (use == x)
|
|
|
|
{
|
|
|
|
SET_USE (use_p, y);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
scev = instantiate_parameters (loop,
|
|
|
|
analyze_scalar_evolution (loop, use));
|
|
|
|
|
|
|
|
if (scev == NULL || scev == chrec_dont_know)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
step = evolution_part_in_loop_num (scev, loop->num);
|
|
|
|
if (step == NULL
|
|
|
|
|| step == chrec_dont_know
|
|
|
|
|| TREE_CODE (step) != INTEGER_CST
|
|
|
|
|| int_cst_value (step) != xstep)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* Use REPLACEMENTS hash table to cache already created
|
|
|
|
temporaries. */
|
|
|
|
in.hash = htab_hash_pointer (use);
|
2007-02-25 19:47:05 +01:00
|
|
|
in.base.from = use;
|
2006-11-15 10:35:34 +01:00
|
|
|
h = htab_find_with_hash (replacements, &in, in.hash);
|
|
|
|
if (h != NULL)
|
|
|
|
{
|
|
|
|
SET_USE (use_p, h->to);
|
|
|
|
continue;
|
|
|
|
}
|
2006-05-17 16:25:59 +02:00
|
|
|
|
2006-11-15 10:35:34 +01:00
|
|
|
/* USE which has the same step as X should be replaced
|
|
|
|
with a temporary set to Y + YINIT - INIT. */
|
|
|
|
init = initial_condition_in_loop_num (scev, loop->num);
|
|
|
|
gcc_assert (init != NULL && init != chrec_dont_know);
|
|
|
|
if (TREE_TYPE (use) == TREE_TYPE (y))
|
|
|
|
{
|
|
|
|
val = fold_build2 (MINUS_EXPR, TREE_TYPE (y), init, yinit);
|
|
|
|
val = fold_build2 (PLUS_EXPR, TREE_TYPE (y), y, val);
|
|
|
|
if (val == y)
|
|
|
|
{
|
|
|
|
/* If X has the same type as USE, the same step
|
|
|
|
and same initial value, it can be replaced by Y. */
|
|
|
|
SET_USE (use_p, y);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
val = fold_build2 (MINUS_EXPR, TREE_TYPE (y), y, yinit);
|
|
|
|
val = fold_convert (TREE_TYPE (use), val);
|
|
|
|
val = fold_build2 (PLUS_EXPR, TREE_TYPE (use), val, init);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Create a temporary variable and insert it at the beginning
|
|
|
|
of the loop body basic block, right after the PHI node
|
|
|
|
which sets Y. */
|
|
|
|
var = create_tmp_var (TREE_TYPE (use), "perfecttmp");
|
|
|
|
add_referenced_var (var);
|
|
|
|
val = force_gimple_operand_bsi (firstbsi, val, false, NULL);
|
function.c (gimplify_parameters): Call build_gimple_modify_stmt instead of calling build2 with a GIMPLE_MODIFY_STMT.
* function.c (gimplify_parameters): Call build_gimple_modify_stmt
instead of calling build2 with a GIMPLE_MODIFY_STMT.
* gimple-low.c (lower_function_body, lower_builtin_setjmp):
Likewise.
* gimplify.c (build_stack_save_restore, gimplify_return_expr,
gimplify_decl_expr, gimplify_self_mod_expr, gimplify_cond_expr,
gimplify_init_ctor_eval_range, gimple_push_cleanup,
gimplify_omp_for, gimplify_omp_atomic_pipeline,
gimplify_omp_atomic_mutex, gimplify_expr, gimplify_one_sizepos,
force_gimple_operand): Likewise.
* ipa-cp.c (constant_val_insert): Likewise.
* lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, replace_uses_equiv_to_x_with_y,
perfect_nestify): Likewise.
* langhooks.c (lhd_omp_assignment): Likewise.
* omp-low.c (lower_rec_input_clauses, lower_reduction_clauses,
lower_copyprivate_clauses, lower_send_clauses,
lower_send_shared_vars, expand_parallel_call,
expand_omp_for_generic, expand_omp_for_static_nochunk,
expand_omp_for_static_chunk, expand_omp_sections,
lower_omp_single_copy, lower_omp_for_lastprivate,
lower_omp_parallel, init_tmp_var, save_tmp_var): Likewise.
* value-prof.c (tree_divmod_fixed_value, tree_mod_pow2,
tree_mod_subtract, tree_ic, tree_stringop_fixed_value):
Likewise.
From-SVN: r122120
2007-02-19 03:45:34 +01:00
|
|
|
setstmt = build_gimple_modify_stmt (var, val);
|
2006-11-15 10:35:34 +01:00
|
|
|
var = make_ssa_name (var, setstmt);
|
2006-12-05 18:26:05 +01:00
|
|
|
GIMPLE_STMT_OPERAND (setstmt, 0) = var;
|
2006-11-15 10:35:34 +01:00
|
|
|
bsi_insert_before (firstbsi, setstmt, BSI_SAME_STMT);
|
|
|
|
update_stmt (setstmt);
|
|
|
|
SET_USE (use_p, var);
|
|
|
|
h = ggc_alloc (sizeof (struct tree_map));
|
|
|
|
h->hash = in.hash;
|
2007-02-25 19:47:05 +01:00
|
|
|
h->base.from = use;
|
2006-11-15 10:35:34 +01:00
|
|
|
h->to = var;
|
|
|
|
loc = htab_find_slot_with_hash (replacements, h, in.hash, INSERT);
|
|
|
|
gcc_assert ((*(struct tree_map **)loc) == NULL);
|
|
|
|
*(struct tree_map **) loc = h;
|
2004-09-16 18:16:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-10 21:23:26 +02:00
|
|
|
/* Return true if STMT is an exit PHI for LOOP */
|
|
|
|
|
|
|
|
static bool
|
|
|
|
exit_phi_for_loop_p (struct loop *loop, tree stmt)
|
|
|
|
{
|
|
|
|
|
|
|
|
if (TREE_CODE (stmt) != PHI_NODE
|
|
|
|
|| PHI_NUM_ARGS (stmt) != 1
|
tree-loop-linear.c (linear_transform_loops): Use single_exit accessor functions.
* tree-loop-linear.c (linear_transform_loops): Use single_exit accessor
functions.
* tree-ssa-loop-niter.c (loop_only_exit_p): Ditto.
* cfgloopmanip.c (update_single_exits_after_duplication,
update_single_exit_for_duplicated_loop, loop_version): Ditto.
* tree-scalar-evolution.c (get_loop_exit_condition,
get_exit_conditions_rec, loop_closed_phi_def,
number_of_iterations_in_loop, scev_const_prop): Ditto.
* tree-ssa-loop-ivopts.c (single_dom_exit): Ditto.
* modulo-sched.c (generate_prolog_epilog, loop_canon_p, sms_schedule):
Ditto.
* tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables):
Ditto.
* tree-vectorizer.c (slpeel_update_phis_for_duplicate_loop,
slpeel_update_phi_nodes_for_guard1, slpeel_update_phi_nodes_for_guard2,
slpeel_make_loop_iterate_ntimes,
slpeel_tree_duplicate_loop_to_edge_cfg, slpeel_can_duplicate_loop_p,
slpeel_verify_cfg_after_peeling, slpeel_tree_peel_loop_to_edge):
Ditto.
* tree-if-conv.c (if_convertible_loop_p): Ditto.
* tree-vect-analyze.c (vect_analyze_operations, vect_stmt_relevant_p,
vect_analyze_loop_form): Ditto.
* lambda-code.c (lambda_loopnest_to_gcc_loopnest, exit_phi_for_loop_p,
can_convert_to_perfect_nest, perfect_nestify): Ditto.
* tree-vect-transform.c (vect_create_epilog_for_reduction,
vect_update_ivs_after_vectorizer, vect_do_peeling_for_loop_bound,
vect_transform_loop): Ditto.
* cfgloop.c (mark_single_exit_loops, verify_loop_structure): Ditto.
(single_exit, set_single_exit): New functions.
* cfgloop.h (struct loop): Rename single_exit field to single_exit_.
(single_exit, set_single_exit): Declare.
* doc/loop.texi: Undocument single_exit field. Document single_exit
accessor function.
From-SVN: r119075
2006-11-22 00:54:16 +01:00
|
|
|
|| bb_for_stmt (stmt) != single_exit (loop)->dest)
|
2005-06-10 21:23:26 +02:00
|
|
|
return false;
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2006-01-04 17:34:52 +01:00
|
|
|
/* Return true if STMT can be put back into the loop INNER, by
|
|
|
|
copying it to the beginning of that loop and changing the uses. */
|
2005-06-10 21:23:26 +02:00
|
|
|
|
|
|
|
static bool
|
|
|
|
can_put_in_inner_loop (struct loop *inner, tree stmt)
|
|
|
|
{
|
|
|
|
imm_use_iterator imm_iter;
|
|
|
|
use_operand_p use_p;
|
|
|
|
|
2006-12-05 18:26:05 +01:00
|
|
|
gcc_assert (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT);
|
2005-06-10 21:23:26 +02:00
|
|
|
if (!ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS)
|
2006-12-05 18:26:05 +01:00
|
|
|
|| !expr_invariant_in_loop_p (inner, GIMPLE_STMT_OPERAND (stmt, 1)))
|
2005-06-10 21:23:26 +02:00
|
|
|
return false;
|
|
|
|
|
2006-12-05 18:26:05 +01:00
|
|
|
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, GIMPLE_STMT_OPERAND (stmt, 0))
|
2005-06-10 21:23:26 +02:00
|
|
|
{
|
|
|
|
if (!exit_phi_for_loop_p (inner, USE_STMT (use_p)))
|
|
|
|
{
|
|
|
|
basic_block immbb = bb_for_stmt (USE_STMT (use_p));
|
|
|
|
|
|
|
|
if (!flow_bb_inside_loop_p (inner, immbb))
|
|
|
|
return false;
|
2006-01-04 17:34:52 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return true if STMT can be put *after* the inner loop of LOOP. */
|
|
|
|
static bool
|
|
|
|
can_put_after_inner_loop (struct loop *loop, tree stmt)
|
|
|
|
{
|
|
|
|
imm_use_iterator imm_iter;
|
|
|
|
use_operand_p use_p;
|
|
|
|
|
|
|
|
if (!ZERO_SSA_OPERANDS (stmt, SSA_OP_ALL_VIRTUALS))
|
|
|
|
return false;
|
|
|
|
|
2006-12-05 18:26:05 +01:00
|
|
|
FOR_EACH_IMM_USE_FAST (use_p, imm_iter, GIMPLE_STMT_OPERAND (stmt, 0))
|
2006-01-04 17:34:52 +01:00
|
|
|
{
|
|
|
|
if (!exit_phi_for_loop_p (loop, USE_STMT (use_p)))
|
|
|
|
{
|
|
|
|
basic_block immbb = bb_for_stmt (USE_STMT (use_p));
|
|
|
|
|
|
|
|
if (!dominated_by_p (CDI_DOMINATORS,
|
|
|
|
immbb,
|
|
|
|
loop->inner->header)
|
|
|
|
&& !can_put_in_inner_loop (loop->inner, stmt))
|
2005-06-10 21:23:26 +02:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-01-04 17:34:52 +01:00
|
|
|
|
2006-05-17 16:25:59 +02:00
|
|
|
/* Return TRUE if LOOP is an imperfect nest that we can convert to a
|
|
|
|
perfect one. At the moment, we only handle imperfect nests of
|
|
|
|
depth 2, where all of the statements occur after the inner loop. */
|
2004-09-16 18:16:14 +02:00
|
|
|
|
|
|
|
static bool
|
2006-05-17 16:25:59 +02:00
|
|
|
can_convert_to_perfect_nest (struct loop *loop)
|
2004-09-16 18:16:14 +02:00
|
|
|
{
|
|
|
|
basic_block *bbs;
|
2004-12-19 20:00:35 +01:00
|
|
|
tree exit_condition, phi;
|
2004-09-16 18:16:14 +02:00
|
|
|
size_t i;
|
|
|
|
block_stmt_iterator bsi;
|
2004-12-19 20:00:35 +01:00
|
|
|
basic_block exitdest;
|
2004-09-16 18:16:14 +02:00
|
|
|
|
|
|
|
/* Can't handle triply nested+ loops yet. */
|
|
|
|
if (!loop->inner || loop->inner->inner)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
bbs = get_loop_body (loop);
|
|
|
|
exit_condition = get_loop_exit_condition (loop);
|
|
|
|
for (i = 0; i < loop->num_nodes; i++)
|
|
|
|
{
|
|
|
|
if (bbs[i]->loop_father == loop)
|
|
|
|
{
|
|
|
|
for (bsi = bsi_start (bbs[i]); !bsi_end_p (bsi); bsi_next (&bsi))
|
|
|
|
{
|
|
|
|
tree stmt = bsi_stmt (bsi);
|
2006-05-17 16:25:59 +02:00
|
|
|
|
2004-09-16 18:16:14 +02:00
|
|
|
if (stmt == exit_condition
|
|
|
|
|| not_interesting_stmt (stmt)
|
|
|
|
|| stmt_is_bumper_for_loop (loop, stmt))
|
|
|
|
continue;
|
2006-05-17 16:25:59 +02:00
|
|
|
|
2006-02-27 18:38:14 +01:00
|
|
|
/* If this is a scalar operation that can be put back
|
|
|
|
into the inner loop, or after the inner loop, through
|
|
|
|
copying, then do so. This works on the theory that
|
|
|
|
any amount of scalar code we have to reduplicate
|
|
|
|
into or after the loops is less expensive that the
|
|
|
|
win we get from rearranging the memory walk
|
|
|
|
the loop is doing so that it has better
|
|
|
|
cache behavior. */
|
2006-12-05 18:26:05 +01:00
|
|
|
if (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT)
|
2006-05-17 16:25:59 +02:00
|
|
|
{
|
|
|
|
use_operand_p use_a, use_b;
|
|
|
|
imm_use_iterator imm_iter;
|
|
|
|
ssa_op_iter op_iter, op_iter1;
|
2006-12-05 18:26:05 +01:00
|
|
|
tree op0 = GIMPLE_STMT_OPERAND (stmt, 0);
|
2006-05-17 16:25:59 +02:00
|
|
|
tree scev = instantiate_parameters
|
|
|
|
(loop, analyze_scalar_evolution (loop, op0));
|
|
|
|
|
|
|
|
/* If the IV is simple, it can be duplicated. */
|
|
|
|
if (!automatically_generated_chrec_p (scev))
|
|
|
|
{
|
|
|
|
tree step = evolution_part_in_loop_num (scev, loop->num);
|
|
|
|
if (step && step != chrec_dont_know
|
|
|
|
&& TREE_CODE (step) == INTEGER_CST)
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The statement should not define a variable used
|
|
|
|
in the inner loop. */
|
|
|
|
if (TREE_CODE (op0) == SSA_NAME)
|
|
|
|
FOR_EACH_IMM_USE_FAST (use_a, imm_iter, op0)
|
|
|
|
if (bb_for_stmt (USE_STMT (use_a))->loop_father
|
|
|
|
== loop->inner)
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
FOR_EACH_SSA_USE_OPERAND (use_a, stmt, op_iter, SSA_OP_USE)
|
|
|
|
{
|
|
|
|
tree node, op = USE_FROM_PTR (use_a);
|
|
|
|
|
|
|
|
/* The variables should not be used in both loops. */
|
|
|
|
FOR_EACH_IMM_USE_FAST (use_b, imm_iter, op)
|
|
|
|
if (bb_for_stmt (USE_STMT (use_b))->loop_father
|
|
|
|
== loop->inner)
|
|
|
|
goto fail;
|
|
|
|
|
|
|
|
/* The statement should not use the value of a
|
|
|
|
scalar that was modified in the loop. */
|
|
|
|
node = SSA_NAME_DEF_STMT (op);
|
|
|
|
if (TREE_CODE (node) == PHI_NODE)
|
|
|
|
FOR_EACH_PHI_ARG (use_b, node, op_iter1, SSA_OP_USE)
|
|
|
|
{
|
|
|
|
tree arg = USE_FROM_PTR (use_b);
|
|
|
|
|
|
|
|
if (TREE_CODE (arg) == SSA_NAME)
|
|
|
|
{
|
|
|
|
tree arg_stmt = SSA_NAME_DEF_STMT (arg);
|
|
|
|
|
|
|
|
if (bb_for_stmt (arg_stmt)->loop_father
|
|
|
|
== loop->inner)
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (can_put_in_inner_loop (loop->inner, stmt)
|
|
|
|
|| can_put_after_inner_loop (loop, stmt))
|
|
|
|
continue;
|
|
|
|
}
|
2005-06-10 21:23:26 +02:00
|
|
|
|
|
|
|
/* Otherwise, if the bb of a statement we care about isn't
|
|
|
|
dominated by the header of the inner loop, then we can't
|
|
|
|
handle this case right now. This test ensures that the
|
|
|
|
statement comes completely *after* the inner loop. */
|
2004-09-16 18:16:14 +02:00
|
|
|
if (!dominated_by_p (CDI_DOMINATORS,
|
|
|
|
bb_for_stmt (stmt),
|
|
|
|
loop->inner->header))
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
goto fail;
|
2004-09-16 18:16:14 +02:00
|
|
|
}
|
|
|
|
}
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
}
|
2004-12-19 20:00:35 +01:00
|
|
|
|
|
|
|
/* We also need to make sure the loop exit only has simple copy phis in it,
|
|
|
|
otherwise we don't know how to transform it into a perfect nest right
|
|
|
|
now. */
|
tree-loop-linear.c (linear_transform_loops): Use single_exit accessor functions.
* tree-loop-linear.c (linear_transform_loops): Use single_exit accessor
functions.
* tree-ssa-loop-niter.c (loop_only_exit_p): Ditto.
* cfgloopmanip.c (update_single_exits_after_duplication,
update_single_exit_for_duplicated_loop, loop_version): Ditto.
* tree-scalar-evolution.c (get_loop_exit_condition,
get_exit_conditions_rec, loop_closed_phi_def,
number_of_iterations_in_loop, scev_const_prop): Ditto.
* tree-ssa-loop-ivopts.c (single_dom_exit): Ditto.
* modulo-sched.c (generate_prolog_epilog, loop_canon_p, sms_schedule):
Ditto.
* tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables):
Ditto.
* tree-vectorizer.c (slpeel_update_phis_for_duplicate_loop,
slpeel_update_phi_nodes_for_guard1, slpeel_update_phi_nodes_for_guard2,
slpeel_make_loop_iterate_ntimes,
slpeel_tree_duplicate_loop_to_edge_cfg, slpeel_can_duplicate_loop_p,
slpeel_verify_cfg_after_peeling, slpeel_tree_peel_loop_to_edge):
Ditto.
* tree-if-conv.c (if_convertible_loop_p): Ditto.
* tree-vect-analyze.c (vect_analyze_operations, vect_stmt_relevant_p,
vect_analyze_loop_form): Ditto.
* lambda-code.c (lambda_loopnest_to_gcc_loopnest, exit_phi_for_loop_p,
can_convert_to_perfect_nest, perfect_nestify): Ditto.
* tree-vect-transform.c (vect_create_epilog_for_reduction,
vect_update_ivs_after_vectorizer, vect_do_peeling_for_loop_bound,
vect_transform_loop): Ditto.
* cfgloop.c (mark_single_exit_loops, verify_loop_structure): Ditto.
(single_exit, set_single_exit): New functions.
* cfgloop.h (struct loop): Rename single_exit field to single_exit_.
(single_exit, set_single_exit): Declare.
* doc/loop.texi: Undocument single_exit field. Document single_exit
accessor function.
From-SVN: r119075
2006-11-22 00:54:16 +01:00
|
|
|
exitdest = single_exit (loop)->dest;
|
2004-12-19 20:00:35 +01:00
|
|
|
|
|
|
|
for (phi = phi_nodes (exitdest); phi; phi = PHI_CHAIN (phi))
|
|
|
|
if (PHI_NUM_ARGS (phi) != 1)
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
goto fail;
|
|
|
|
|
|
|
|
free (bbs);
|
2004-09-16 18:16:14 +02:00
|
|
|
return true;
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
|
|
|
|
fail:
|
|
|
|
free (bbs);
|
|
|
|
return false;
|
2004-09-16 18:16:14 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Transform the loop nest into a perfect nest, if possible.
|
|
|
|
LOOP is the loop nest to transform into a perfect nest
|
|
|
|
LBOUNDS are the lower bounds for the loops to transform
|
|
|
|
UBOUNDS are the upper bounds for the loops to transform
|
|
|
|
STEPS is the STEPS for the loops to transform.
|
|
|
|
LOOPIVS is the induction variables for the loops to transform.
|
|
|
|
|
|
|
|
Basically, for the case of
|
|
|
|
|
|
|
|
FOR (i = 0; i < 50; i++)
|
|
|
|
{
|
|
|
|
FOR (j =0; j < 50; j++)
|
|
|
|
{
|
|
|
|
<whatever>
|
|
|
|
}
|
|
|
|
<some code>
|
|
|
|
}
|
|
|
|
|
|
|
|
This function will transform it into a perfect loop nest by splitting the
|
|
|
|
outer loop into two loops, like so:
|
|
|
|
|
|
|
|
FOR (i = 0; i < 50; i++)
|
|
|
|
{
|
|
|
|
FOR (j = 0; j < 50; j++)
|
|
|
|
{
|
|
|
|
<whatever>
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
FOR (i = 0; i < 50; i ++)
|
|
|
|
{
|
|
|
|
<some code>
|
|
|
|
}
|
|
|
|
|
|
|
|
Return FALSE if we can't make this loop into a perfect nest. */
|
2005-06-10 21:23:26 +02:00
|
|
|
|
2004-09-16 18:16:14 +02:00
|
|
|
static bool
|
tree-vrp.c (execute_vrp): Do not pass loops structure through arguments.
* tree-vrp.c (execute_vrp): Do not pass loops structure through
arguments.
* loop-unswitch.c (unswitch_loops, unswitch_single_loop,
unswitch_loop): Ditto.
* tree-loop-linear.c (linear_transform_loops): Ditto.
* tree-ssa-loop-im.c (determine_lsm, tree_ssa_lim_initialize,
tree_ssa_lim): Ditto.
* tree-ssa-loop-niter.c (estimate_numbers_of_iterations,
free_numbers_of_iterations_estimates): Ditto.
* tree-ssa-loop-unswitch.c (tree_ssa_unswitch_loops,
tree_unswitch_single_loop, tree_unswitch_loop): Ditto.
* cfgloopmanip.c (fix_bb_placement, fix_bb_placements,
remove_path, add_loop, loopify, unloop, fix_loop_placements,
place_new_loop, duplicate_loop, duplicate_subloops,
update_single_exit_for_duplicated_loops, copy_loops_to,
duplicate_loop_to_header_edge, create_preheaders,
force_single_succ_latches, loop_version, fix_loop_structure):
Ditto.
* tree-ssa-loop-manip.c (tree_duplicate_loop_to_header_edge,
tree_unroll_loop): Ditto.
* tree-ssa-loop-ch.c (copy_loop_headers): Ditto.
* tree-scalar-evolution.c (select_loops_exit_conditions,
scev_initialize, scev_analysis): Ditto.
* tree-scalar-evolution.h (scev_initialize): Ditto.
* cfghooks.c (cfg_hook_duplicate_loop_to_header_edge): Ditto.
* cfgloopanal.c (mark_irreducible_loops, mark_loop_exit_edges): Ditto.
* tree-ssa-loop-ivopts.c (tree_ssa_iv_optimize): Ditto.
* modulo-sched.c (sms_schedule): Ditto.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Ditto.
* loop-init.c (loop_optimizer_init, rtl_move_loop_invariants,
rtl_unswitch, rtl_unroll_and_peel_loops, rtl_doloop): Ditto.
* ifcvt.c (if_convert): Ditto.
* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely,
canonicalize_loop_induction_variables,
canonicalize_induction_variables,
tree_unroll_loops_completely, remove_empty_loops): Ditto.
* tree-ssa-loop.c (tree_ssa_loop_init, tree_ssa_loop_im,
tree_ssa_loop_unswitch, tree_vectorize, tree_linear_transform,
tree_ssa_loop_ivcanon, tree_ssa_empty_loop, tree_ssa_loop_bounds,
tree_complete_unroll, tree_ssa_loop_prefetch, tree_ssa_loop_ivopts,
tree_ssa_loop_done): Ditto.
* predict.c (predict_loops, tree_estimate_probability, estimate_loops,
estimate_bb_frequencies): Ditto.
* tree-vectorizer.c (slpeel_tree_duplicate_loop_to_edge_cfg,
slpeel_tree_peel_loop_to_edge, vectorize_loops): Ditto.
* loop-unroll.c (unroll_and_peel_loops, peel_loops_completely,
decide_unrolling_and_peeling, peel_loop_completely,
unroll_loop_constant_iterations, unroll_loop_runtime_iterations,
peel_loop_simple, unroll_loop_stupid): Ditto.
* loop-doloop.c (doloop_optimize_loops): Ditto.
* tree-cfgcleanup.c (cleanup_tree_cfg_loop): Ditto.
* loop-invariant.c (move_loop_invariants): Ditto.
* tree-ssa-dce.c (tree_ssa_dce_loop): Ditto.
* tree-ssa-loop-prefetch.c (loop_prefetch_arrays,
tree_ssa_prefetch_arrays): Ditto.
* lambda-code.c (gcc_loopnest_to_lambda_loopnest, perfect_nestify):
Ditto.
* tree-vect-transform.c (vect_do_peeling_for_loop_bound,
vect_do_peeling_for_alignment, vect_transform_loop): Ditto.
* cfgloop.c (flow_loops_cfg_dump, flow_loops_dump,
mark_single_exit_loops, cancel_loop, cancel_loop_tree,
verify_loop_structure): Ditto.
* tree-flow.h (vectorize_loops, tree_ssa_lim, tree_ssa_unswitch_loops,
canonicalize_induction_variables, tree_unroll_loops_completely,
tree_ssa_prefetch_arrays, remove_empty_loops, tree_ssa_iv_optimize,
estimate_numbers_of_iterations, free_numbers_of_iterations_estimates,
tree_duplicate_loop_to_header_edge, tree_ssa_loop_version,
tree_unroll_loop, linear_transform_loops): Declaration changed.
* basic-block.h: Remove declaration of struct loops.
* cfghooks.h (struct cfg_hooks): Change type of
cfg_hook_duplicate_loop_to_header_edge.
(cfg_hook_duplicate_loop_to_header_edge): Declaration changed.
* tree-vectorizer.h (slpeel_tree_peel_loop_to_edge,
vect_transform_loop): Declaration changed.
* lambda.h (gcc_loopnest_to_lambda_loopnest): Declaration changed.
* cfgloop.h (flow_loops_dump, fix_loop_structure,
mark_irreducible_loops, mark_single_exit_loops, mark_loop_exit_edges,
cancel_loop_tree, create_preheaders, force_single_succ_latches,
verify_loop_structure, duplicate_loop, duplicate_loop_to_header_edge,
loopify, loop_version, remove_path, unswitch_loops,
unroll_and_peel_loops, doloop_optimize_loops, move_loop_invariants):
Declaration changed.
From-SVN: r119189
2006-11-25 11:34:13 +01:00
|
|
|
perfect_nestify (struct loop *loop,
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
VEC(tree,heap) *lbounds,
|
|
|
|
VEC(tree,heap) *ubounds,
|
|
|
|
VEC(int,heap) *steps,
|
|
|
|
VEC(tree,heap) *loopivs)
|
2004-09-16 18:16:14 +02:00
|
|
|
{
|
|
|
|
basic_block *bbs;
|
|
|
|
tree exit_condition;
|
|
|
|
tree then_label, else_label, cond_stmt;
|
|
|
|
basic_block preheaderbb, headerbb, bodybb, latchbb, olddest;
|
2005-06-10 21:23:26 +02:00
|
|
|
int i;
|
2006-11-15 10:35:34 +01:00
|
|
|
block_stmt_iterator bsi, firstbsi;
|
2005-02-14 15:54:37 +01:00
|
|
|
bool insert_after;
|
2004-09-16 18:16:14 +02:00
|
|
|
edge e;
|
|
|
|
struct loop *newloop;
|
|
|
|
tree phi;
|
|
|
|
tree uboundvar;
|
|
|
|
tree stmt;
|
2004-11-01 19:08:02 +01:00
|
|
|
tree oldivvar, ivvar, ivvarinced;
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
VEC(tree,heap) *phis = NULL;
|
2006-11-15 10:35:34 +01:00
|
|
|
htab_t replacements = NULL;
|
|
|
|
|
2006-05-17 16:25:59 +02:00
|
|
|
/* Create the new loop. */
|
tree-loop-linear.c (linear_transform_loops): Use single_exit accessor functions.
* tree-loop-linear.c (linear_transform_loops): Use single_exit accessor
functions.
* tree-ssa-loop-niter.c (loop_only_exit_p): Ditto.
* cfgloopmanip.c (update_single_exits_after_duplication,
update_single_exit_for_duplicated_loop, loop_version): Ditto.
* tree-scalar-evolution.c (get_loop_exit_condition,
get_exit_conditions_rec, loop_closed_phi_def,
number_of_iterations_in_loop, scev_const_prop): Ditto.
* tree-ssa-loop-ivopts.c (single_dom_exit): Ditto.
* modulo-sched.c (generate_prolog_epilog, loop_canon_p, sms_schedule):
Ditto.
* tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables):
Ditto.
* tree-vectorizer.c (slpeel_update_phis_for_duplicate_loop,
slpeel_update_phi_nodes_for_guard1, slpeel_update_phi_nodes_for_guard2,
slpeel_make_loop_iterate_ntimes,
slpeel_tree_duplicate_loop_to_edge_cfg, slpeel_can_duplicate_loop_p,
slpeel_verify_cfg_after_peeling, slpeel_tree_peel_loop_to_edge):
Ditto.
* tree-if-conv.c (if_convertible_loop_p): Ditto.
* tree-vect-analyze.c (vect_analyze_operations, vect_stmt_relevant_p,
vect_analyze_loop_form): Ditto.
* lambda-code.c (lambda_loopnest_to_gcc_loopnest, exit_phi_for_loop_p,
can_convert_to_perfect_nest, perfect_nestify): Ditto.
* tree-vect-transform.c (vect_create_epilog_for_reduction,
vect_update_ivs_after_vectorizer, vect_do_peeling_for_loop_bound,
vect_transform_loop): Ditto.
* cfgloop.c (mark_single_exit_loops, verify_loop_structure): Ditto.
(single_exit, set_single_exit): New functions.
* cfgloop.h (struct loop): Rename single_exit field to single_exit_.
(single_exit, set_single_exit): Declare.
* doc/loop.texi: Undocument single_exit field. Document single_exit
accessor function.
From-SVN: r119075
2006-11-22 00:54:16 +01:00
|
|
|
olddest = single_exit (loop)->dest;
|
|
|
|
preheaderbb = split_edge (single_exit (loop));
|
2004-09-16 18:16:14 +02:00
|
|
|
headerbb = create_empty_bb (EXIT_BLOCK_PTR->prev_bb);
|
|
|
|
|
2005-02-17 17:29:56 +01:00
|
|
|
/* Push the exit phi nodes that we are moving. */
|
2004-09-16 18:16:14 +02:00
|
|
|
for (phi = phi_nodes (olddest); phi; phi = PHI_CHAIN (phi))
|
|
|
|
{
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
VEC_reserve (tree, heap, phis, 2);
|
vec.h: Update API to separate allocation mechanism from type.
* vec.h: Update API to separate allocation mechanism from type.
(VEC_safe_grow): New.
* vec.c (calculate_allocation): New.
(vec_gc_o_reserve, vec_heap_o_reserve): Adjust.
(vec_gc_free, vec_heap_free): Remove.
* gengtype-lex.l (DEF_VEC_): Process mult-argument macros. Adjust.
(VEC): Likewise.
(mangle_macro_name): New.
(struct macro_def): New.
(struct macro): Add multiple argument values.
(macro_expans_end): New.
(push_macro_expansion): Chain on new macro. Process multiple
args, create follow on expansion. Return follow on argument.
(macro_input): Deal with multiple arguments.
* tree.h: Define VEC(tree,heap) and VEC(tree,gc).
(struct tree_binfo): Adjust.
* basic-block.h: Define VEC(edge,gc).
(struct edge_def): Adjust.
(struct basic_block_def, struct edge_iterator): Likewise.
(ei_container, ei_start_1, ei_last_1): Likewise.
* cfg.c (connect_src, connect_dest): Likewise.
* cfgrtl.c (force_nonfallthru_and_redirect)
* dbxout.c (dbxout_type)
* dwarf2out.c (gen_member_die)
* lambda-code.c: Define VEC(int,gc), VEC(lambda_loop,gc).
(gcc_tree_to_linear_expression): Adjust.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
* lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Adjust prototypes.
* profile.c (instrument_values): Adjust.
* tree-cfg.c (modified_noreturn_calls): Adjust.
(remove_fallthru_edge): Likewise.
* tree-dump.c (dequeue_and_dump): Adjust.
* tree-flow-inline.h (mark_stmt_modified): Adjust.
* tree-flow.h (modified_noreturn_calls): Adjust.
(tree_on_heap): Remove. (yay!)
(register_new_def): Adjust.
* tree-into-ssa.c: Define VEC(int,heap).
(block_defs_stack): Adjust.
(find_idf, insert_phi_nodes, register_new_def,
rewrite_initialize_block, rewrite_finalize_block,
register_new_update_single, rewrite_update_init_block,
rewrite_update_fini_block, rewrite_blocks,
ssa_rewrite_finalize_block, ssa_register_new_def,
ssa_rewrite_initialize_block, rewrite_ssa_into_ssa): Likewise.
* tree-loop-linear.c (linear_transform_loops): Adjust.
* tree-ssa-alias.c: Define VEC(fieldoff_t,heap).
(push_fields_onto_fieldstack, create_overlap_variables_for): Adjust.
* tree-ssa-dom.c (avail_exprs_stack, block_defs_stack,
stmts_to_rescan, const_and_copies_stack, nonzero_vars_stack,
vrp_variables_stack): Adjust declarations.
(tree_ssa_dominator_optimize): Adjust.
(dom_opt_initialize_block, remove_local_expressions_from_table,
restore_nonzero_vars_to_original_value,
restore_vars_to_original_value,
restore_currdefs_to_original_value, dom_opt_finalize_block,
record_var_is_nonzero, record_cond, record_const_or_copy_1,
optimize_stmt, update_rhs_and_lookup_avail_expr,
lookup_avail_expr, record_range): Likewise.
* tree-ssa-pre.c: Define VEC(basic_block,heap).
(compute_antic_aux): Adjust.
(inserted_exprs, create_expression_by_pieces,
insert_into_preds_of_block, eliminate, mark_operand_necessary,
remove_dead_inserted_code, fini_pre): Likewise.
* tree-ssa-propagate.c (interesting_ssa_edges): Adjust.
(varying_ssa_edges, add_ssa_edge, process_ssa_edge_worklist.
ssa_prop_init): Likewise.
* tree-ssa.c: Define VEC(bitmap,heap).
(verify_name_tags): Adjust.
* value-prof.c (rtl_divmod_values_to_profile): Adjust.
(insn_prefetch_values_to_profile, rtl_find_values_to_profile,
tree_divmod_values_to_profile, tree_find_values_to_profile,
value_profile_transformations): Likewise.
* value-prof.h: Define VEC(histogram_value,heap).
* varasm.c: Remove alias_pair pointer typedef, define
VEC(alias_pair,gc).
(finish_aliases_1, finish_aliases_2, assemble_alias): Adjust.
* config/pa/pa.c (typedef extern_symbol): Typedef the structure,
not a pointer to it. Create an object vector.
(extern_symbols): Turn into an object vector.
(pa_hpux_asm_output_external, pa_hpux_file_end): Adjust.
* cp/cp-tree.h: Adjust for new VEC API.
Define VEC(tree_pair_s,gc).
(struct save_scope): Adjust.
(struct lang_type_class): Adjust.
(unemitted_tinfo_decls): Adjust.
* cp/class.c (add_method, resort_type_method_vec,
finish_struct_methods, struct find_final_overrider_data,
dfs_find_final_overrider_pre, find_final_overrider,
get_vcall_index, warn_hidden, walk_subobject_offsets,
check_methods, fixup_inline_methods, end_of_class,
warn_about_ambiguous_bases, finish_struct, build_vtbl_initializer,
add_vcall_offset): Adjust.
* cp/decl.c (xref_basetypes, finish_method): Adjust.
* cp/decl2.c (check_classfn): Adjust.
* cp/init.c (sort_mem_initializers, push_base_cleanups): Adjust.
* cp/method.c (do_build_copy_constructor): Adjust.
* cp/name-lookup.c (new_class_binding, store_binding,
store_bindings, store_class_bindings): Adjust.
* cp/name-lookup.h: Define VEC(cxx_saved_binding,gc),
VEC(cp_class_binding,gc).
(struct cp_binding_level): Adjust.
* cp/parser.c: Define VEC(cp_token_position,heap).
(struct cp_lexer): Adjust.
(cp_lexer_new_main, cp_lexer_new_from_tokens, cp_lexer_destroy,
cp_lexer_save_tokens): Adjust.
* cp/pt.c (retrieve_specialization,
check_explicit_specialization): Adjust.
* cp/rtti.c (unemitted_tinfo_decls): Adjust.
(init_rtti_processing, get_tinfo_decl, get_pseudo_ti_init,
get_pseudo_ti_desc): Adjust.
* cp/search.c (dfs_access_in_type, lookup_conversion_operator,
lookup_fnfields_1, dfs_walk_once, dfs_walk_once_accessible,
dfs_get_pure_virtuals, lookup_conversions_r, binfo_for_vbase): Adjust.
* cp/semantics.c: Define VEC(deferred_access,gc).
(push_deferring_access_checks): Adjust.
* cp/typeck2.c (abstract_virtuals_error): Adjust.
From-SVN: r98498
2005-04-21 11:18:28 +02:00
|
|
|
VEC_quick_push (tree, phis, PHI_RESULT (phi));
|
|
|
|
VEC_quick_push (tree, phis, PHI_ARG_DEF (phi, 0));
|
2004-09-16 18:16:14 +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
|
|
|
e = redirect_edge_and_branch (single_succ_edge (preheaderbb), headerbb);
|
2004-11-01 19:08:02 +01:00
|
|
|
|
2006-12-11 18:50:53 +01:00
|
|
|
/* Remove the exit phis from the old basic block. */
|
2004-11-01 19:08:02 +01:00
|
|
|
while (phi_nodes (olddest) != NULL)
|
2006-12-11 18:50:53 +01:00
|
|
|
remove_phi_node (phi_nodes (olddest), NULL, false);
|
2004-11-01 19:08:02 +01:00
|
|
|
|
2005-02-17 17:29:56 +01:00
|
|
|
/* and add them back to the new basic block. */
|
2004-09-16 18:16:14 +02:00
|
|
|
while (VEC_length (tree, phis) != 0)
|
|
|
|
{
|
|
|
|
tree def;
|
|
|
|
tree phiname;
|
|
|
|
def = VEC_pop (tree, phis);
|
2004-11-01 19:08:02 +01:00
|
|
|
phiname = VEC_pop (tree, phis);
|
2004-09-16 18:16:14 +02:00
|
|
|
phi = create_phi_node (phiname, preheaderbb);
|
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
|
|
|
add_phi_arg (phi, def, single_pred_edge (preheaderbb));
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
}
|
2004-10-28 15:31:53 +02:00
|
|
|
flush_pending_stmts (e);
|
lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
* lambda-code.c: Define VEC(int,heap), VEC(lambda_loop,heap).
(gcc_tree_to_linear_expression): Convert to heap allocated
vectors.
(gcc_loop_to_lambda_loop, gcc_loopnest_to_lambda_loopnest,
lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, can_convert_to_perfect_nest,
perfect_nestify): Likewise.
lambda.h (gcc_loopnest_to_lambda_loopnest,
lambda_loopnest_to_gcc_loopnest): Likewise.
tree-loop-linear.c (linear_transform_loops): Likewise.
From-SVN: r98561
2005-04-22 16:17:07 +02:00
|
|
|
VEC_free (tree, heap, phis);
|
2004-11-01 19:08:02 +01:00
|
|
|
|
2004-09-16 18:16:14 +02:00
|
|
|
bodybb = create_empty_bb (EXIT_BLOCK_PTR->prev_bb);
|
|
|
|
latchbb = create_empty_bb (EXIT_BLOCK_PTR->prev_bb);
|
|
|
|
make_edge (headerbb, bodybb, EDGE_FALLTHRU);
|
|
|
|
then_label = build1 (GOTO_EXPR, void_type_node, tree_block_label (latchbb));
|
|
|
|
else_label = build1 (GOTO_EXPR, void_type_node, tree_block_label (olddest));
|
tree-vrp.c (build_assert_expr_for, [...]): Use buildN instead of build.
2005-12-02 Richard Guenther <rguenther@suse.de>
* tree-vrp.c (build_assert_expr_for, process_assert_insertions_for,
simplify_cond_using_ranges): Use buildN instead of build.
* tree-tailcall.c (adjust_accumulator_values,
adjust_return_value): Likewise.
* tree-sra.c (generate_one_element_ref, generate_copy_inout,
generate_element_copy, generate_element_zero,
generate_one_element_init): Likewise.
* tree-ssa-forwprop.c (forward_propagate_into_cond_1): Likewise.
* lambda-code.c (gcc_loop_to_lambda_loop, lbv_to_gcc_expression,
lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest,
perfect_nestify): Likewise.
From-SVN: r107894
2005-12-02 15:40:40 +01:00
|
|
|
cond_stmt = build3 (COND_EXPR, void_type_node,
|
|
|
|
build2 (NE_EXPR, boolean_type_node,
|
|
|
|
integer_one_node,
|
|
|
|
integer_zero_node),
|
|
|
|
then_label, else_label);
|
2004-09-16 18:16:14 +02:00
|
|
|
bsi = bsi_start (bodybb);
|
|
|
|
bsi_insert_after (&bsi, cond_stmt, BSI_NEW_STMT);
|
|
|
|
e = make_edge (bodybb, olddest, EDGE_FALSE_VALUE);
|
|
|
|
make_edge (bodybb, latchbb, EDGE_TRUE_VALUE);
|
|
|
|
make_edge (latchbb, headerbb, EDGE_FALLTHRU);
|
|
|
|
|
|
|
|
/* Update the loop structures. */
|
tree-vrp.c (execute_vrp): Do not pass loops structure through arguments.
* tree-vrp.c (execute_vrp): Do not pass loops structure through
arguments.
* loop-unswitch.c (unswitch_loops, unswitch_single_loop,
unswitch_loop): Ditto.
* tree-loop-linear.c (linear_transform_loops): Ditto.
* tree-ssa-loop-im.c (determine_lsm, tree_ssa_lim_initialize,
tree_ssa_lim): Ditto.
* tree-ssa-loop-niter.c (estimate_numbers_of_iterations,
free_numbers_of_iterations_estimates): Ditto.
* tree-ssa-loop-unswitch.c (tree_ssa_unswitch_loops,
tree_unswitch_single_loop, tree_unswitch_loop): Ditto.
* cfgloopmanip.c (fix_bb_placement, fix_bb_placements,
remove_path, add_loop, loopify, unloop, fix_loop_placements,
place_new_loop, duplicate_loop, duplicate_subloops,
update_single_exit_for_duplicated_loops, copy_loops_to,
duplicate_loop_to_header_edge, create_preheaders,
force_single_succ_latches, loop_version, fix_loop_structure):
Ditto.
* tree-ssa-loop-manip.c (tree_duplicate_loop_to_header_edge,
tree_unroll_loop): Ditto.
* tree-ssa-loop-ch.c (copy_loop_headers): Ditto.
* tree-scalar-evolution.c (select_loops_exit_conditions,
scev_initialize, scev_analysis): Ditto.
* tree-scalar-evolution.h (scev_initialize): Ditto.
* cfghooks.c (cfg_hook_duplicate_loop_to_header_edge): Ditto.
* cfgloopanal.c (mark_irreducible_loops, mark_loop_exit_edges): Ditto.
* tree-ssa-loop-ivopts.c (tree_ssa_iv_optimize): Ditto.
* modulo-sched.c (sms_schedule): Ditto.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Ditto.
* loop-init.c (loop_optimizer_init, rtl_move_loop_invariants,
rtl_unswitch, rtl_unroll_and_peel_loops, rtl_doloop): Ditto.
* ifcvt.c (if_convert): Ditto.
* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely,
canonicalize_loop_induction_variables,
canonicalize_induction_variables,
tree_unroll_loops_completely, remove_empty_loops): Ditto.
* tree-ssa-loop.c (tree_ssa_loop_init, tree_ssa_loop_im,
tree_ssa_loop_unswitch, tree_vectorize, tree_linear_transform,
tree_ssa_loop_ivcanon, tree_ssa_empty_loop, tree_ssa_loop_bounds,
tree_complete_unroll, tree_ssa_loop_prefetch, tree_ssa_loop_ivopts,
tree_ssa_loop_done): Ditto.
* predict.c (predict_loops, tree_estimate_probability, estimate_loops,
estimate_bb_frequencies): Ditto.
* tree-vectorizer.c (slpeel_tree_duplicate_loop_to_edge_cfg,
slpeel_tree_peel_loop_to_edge, vectorize_loops): Ditto.
* loop-unroll.c (unroll_and_peel_loops, peel_loops_completely,
decide_unrolling_and_peeling, peel_loop_completely,
unroll_loop_constant_iterations, unroll_loop_runtime_iterations,
peel_loop_simple, unroll_loop_stupid): Ditto.
* loop-doloop.c (doloop_optimize_loops): Ditto.
* tree-cfgcleanup.c (cleanup_tree_cfg_loop): Ditto.
* loop-invariant.c (move_loop_invariants): Ditto.
* tree-ssa-dce.c (tree_ssa_dce_loop): Ditto.
* tree-ssa-loop-prefetch.c (loop_prefetch_arrays,
tree_ssa_prefetch_arrays): Ditto.
* lambda-code.c (gcc_loopnest_to_lambda_loopnest, perfect_nestify):
Ditto.
* tree-vect-transform.c (vect_do_peeling_for_loop_bound,
vect_do_peeling_for_alignment, vect_transform_loop): Ditto.
* cfgloop.c (flow_loops_cfg_dump, flow_loops_dump,
mark_single_exit_loops, cancel_loop, cancel_loop_tree,
verify_loop_structure): Ditto.
* tree-flow.h (vectorize_loops, tree_ssa_lim, tree_ssa_unswitch_loops,
canonicalize_induction_variables, tree_unroll_loops_completely,
tree_ssa_prefetch_arrays, remove_empty_loops, tree_ssa_iv_optimize,
estimate_numbers_of_iterations, free_numbers_of_iterations_estimates,
tree_duplicate_loop_to_header_edge, tree_ssa_loop_version,
tree_unroll_loop, linear_transform_loops): Declaration changed.
* basic-block.h: Remove declaration of struct loops.
* cfghooks.h (struct cfg_hooks): Change type of
cfg_hook_duplicate_loop_to_header_edge.
(cfg_hook_duplicate_loop_to_header_edge): Declaration changed.
* tree-vectorizer.h (slpeel_tree_peel_loop_to_edge,
vect_transform_loop): Declaration changed.
* lambda.h (gcc_loopnest_to_lambda_loopnest): Declaration changed.
* cfgloop.h (flow_loops_dump, fix_loop_structure,
mark_irreducible_loops, mark_single_exit_loops, mark_loop_exit_edges,
cancel_loop_tree, create_preheaders, force_single_succ_latches,
verify_loop_structure, duplicate_loop, duplicate_loop_to_header_edge,
loopify, loop_version, remove_path, unswitch_loops,
unroll_and_peel_loops, doloop_optimize_loops, move_loop_invariants):
Declaration changed.
From-SVN: r119189
2006-11-25 11:34:13 +01:00
|
|
|
newloop = duplicate_loop (loop, olddest->loop_father);
|
2004-09-16 18:16:14 +02:00
|
|
|
newloop->header = headerbb;
|
|
|
|
newloop->latch = latchbb;
|
|
|
|
add_bb_to_loop (latchbb, newloop);
|
|
|
|
add_bb_to_loop (bodybb, newloop);
|
|
|
|
add_bb_to_loop (headerbb, newloop);
|
|
|
|
set_immediate_dominator (CDI_DOMINATORS, bodybb, headerbb);
|
|
|
|
set_immediate_dominator (CDI_DOMINATORS, headerbb, preheaderbb);
|
|
|
|
set_immediate_dominator (CDI_DOMINATORS, preheaderbb,
|
tree-loop-linear.c (linear_transform_loops): Use single_exit accessor functions.
* tree-loop-linear.c (linear_transform_loops): Use single_exit accessor
functions.
* tree-ssa-loop-niter.c (loop_only_exit_p): Ditto.
* cfgloopmanip.c (update_single_exits_after_duplication,
update_single_exit_for_duplicated_loop, loop_version): Ditto.
* tree-scalar-evolution.c (get_loop_exit_condition,
get_exit_conditions_rec, loop_closed_phi_def,
number_of_iterations_in_loop, scev_const_prop): Ditto.
* tree-ssa-loop-ivopts.c (single_dom_exit): Ditto.
* modulo-sched.c (generate_prolog_epilog, loop_canon_p, sms_schedule):
Ditto.
* tree-ssa-loop-ivcanon.c (canonicalize_loop_induction_variables):
Ditto.
* tree-vectorizer.c (slpeel_update_phis_for_duplicate_loop,
slpeel_update_phi_nodes_for_guard1, slpeel_update_phi_nodes_for_guard2,
slpeel_make_loop_iterate_ntimes,
slpeel_tree_duplicate_loop_to_edge_cfg, slpeel_can_duplicate_loop_p,
slpeel_verify_cfg_after_peeling, slpeel_tree_peel_loop_to_edge):
Ditto.
* tree-if-conv.c (if_convertible_loop_p): Ditto.
* tree-vect-analyze.c (vect_analyze_operations, vect_stmt_relevant_p,
vect_analyze_loop_form): Ditto.
* lambda-code.c (lambda_loopnest_to_gcc_loopnest, exit_phi_for_loop_p,
can_convert_to_perfect_nest, perfect_nestify): Ditto.
* tree-vect-transform.c (vect_create_epilog_for_reduction,
vect_update_ivs_after_vectorizer, vect_do_peeling_for_loop_bound,
vect_transform_loop): Ditto.
* cfgloop.c (mark_single_exit_loops, verify_loop_structure): Ditto.
(single_exit, set_single_exit): New functions.
* cfgloop.h (struct loop): Rename single_exit field to single_exit_.
(single_exit, set_single_exit): Declare.
* doc/loop.texi: Undocument single_exit field. Document single_exit
accessor function.
From-SVN: r119075
2006-11-22 00:54:16 +01:00
|
|
|
single_exit (loop)->src);
|
2004-09-16 18:16:14 +02:00
|
|
|
set_immediate_dominator (CDI_DOMINATORS, latchbb, bodybb);
|
|
|
|
set_immediate_dominator (CDI_DOMINATORS, olddest, bodybb);
|
|
|
|
/* Create the new iv. */
|
2005-06-10 21:23:26 +02:00
|
|
|
oldivvar = VEC_index (tree, loopivs, 0);
|
|
|
|
ivvar = create_tmp_var (TREE_TYPE (oldivvar), "perfectiv");
|
re PR c++/26757 (C++ front-end producing two DECLs with the same UID)
2006-05-23 Andrew MacLeod <amacleod@redhat.com>
PR c++/26757
* tree-ssa-loop-im.c (determine_invariantness_stmt): Use
add_referenced_var instead of add_referenced_tmp_var.
* tree-complex.c (create_one_component_var): Use add_referenced_var.
* tree-ssa-loop-manip.c (create_iv, tree_unroll_loop): Use
add_referenced_var.
* tree-tailcall.c (adjust_accumulator_values, adjust_return_value,
tree_optimize_tail_calls_1): Use add_referenced_var.
* tree-ssa-loop-ivopts.c (create_new_iv): Use add_referenced_var.
* tree-ssa-alias.c (create_memory_tag, create_global_var, create_sft):
Use add_referenced_var.
* tree-if-conv.c (ifc_temp_var): Use add_referenced_var.
* gimplify.c (force_gimple_operand): Use add_referenced_var.
* tree-ssa-phiopt.c (conditional_replacement, abs_replacement):
Use add_referenced_var.
* tree-dfa.c (struct walk_state): Remove.
(find_referenced_vars): Remove walk state and vars_found hash table.
(make_rename_temp): Use add_referenced_var.
(find_vars_r): Pass less parameters to add_referenced_var.
(referenced_var_p): New. Is var in referenced_var hash table.
(referenced_var_insert): Assert var isn't already in hash table.
(add_referenced_var): Don't need walk_state parameter. Add var if it
isn't already in the hash table.
(add_referenced_tmp_var): Remove.
(find_new_referenced_vars_1): Use add_referenced_var.
* tree-ssa-pre.c (create_expression_by_pieces,
insert_into_preds_of_block, insert_extra_phis, realify_fake_stores):
Use add_referenced_var.
* tree-vect-patterns.c (vect_pattern_recog_1): Use add_referenced_var.
* lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, perfect_nestify): Use
add_referenced_var.
* tree-vect-transform.c (vect_create_addr_base_for_vector_ref,
vect_create_data_ref_ptr, vect_create_destination_var,
vect_init_vector, vect_build_loop_niters,
vect_generate_tmps_on_preheader, vect_update_ivs_after_vectorizer,
vect_gen_niters_for_prolog_loop, vect_create_cond_for_align_checks):
Use add_referenced_var.
* tree-outof-ssa.c (create_temp): Use add_referenced_var.
* tree-flow.h (add_referenced_tmp_var): Remove prototype
(add_referenced_var): Add prototype.
* tree-ssa-structalias.c (get_constraint_for,
intra_create_variable_infos): Use add_referenced_var.
From-SVN: r114018
2006-05-23 16:07:21 +02:00
|
|
|
add_referenced_var (ivvar);
|
2005-02-14 15:54:37 +01:00
|
|
|
standard_iv_increment_position (newloop, &bsi, &insert_after);
|
2004-09-16 18:16:14 +02:00
|
|
|
create_iv (VEC_index (tree, lbounds, 0),
|
2005-06-10 21:23:26 +02:00
|
|
|
build_int_cst (TREE_TYPE (oldivvar), VEC_index (int, steps, 0)),
|
2005-02-14 15:54:37 +01:00
|
|
|
ivvar, newloop, &bsi, insert_after, &ivvar, &ivvarinced);
|
2004-09-16 18:16:14 +02:00
|
|
|
|
|
|
|
/* Create the new upper bound. This may be not just a variable, so we copy
|
|
|
|
it to one just in case. */
|
|
|
|
|
|
|
|
exit_condition = get_loop_exit_condition (newloop);
|
|
|
|
uboundvar = create_tmp_var (integer_type_node, "uboundvar");
|
re PR c++/26757 (C++ front-end producing two DECLs with the same UID)
2006-05-23 Andrew MacLeod <amacleod@redhat.com>
PR c++/26757
* tree-ssa-loop-im.c (determine_invariantness_stmt): Use
add_referenced_var instead of add_referenced_tmp_var.
* tree-complex.c (create_one_component_var): Use add_referenced_var.
* tree-ssa-loop-manip.c (create_iv, tree_unroll_loop): Use
add_referenced_var.
* tree-tailcall.c (adjust_accumulator_values, adjust_return_value,
tree_optimize_tail_calls_1): Use add_referenced_var.
* tree-ssa-loop-ivopts.c (create_new_iv): Use add_referenced_var.
* tree-ssa-alias.c (create_memory_tag, create_global_var, create_sft):
Use add_referenced_var.
* tree-if-conv.c (ifc_temp_var): Use add_referenced_var.
* gimplify.c (force_gimple_operand): Use add_referenced_var.
* tree-ssa-phiopt.c (conditional_replacement, abs_replacement):
Use add_referenced_var.
* tree-dfa.c (struct walk_state): Remove.
(find_referenced_vars): Remove walk state and vars_found hash table.
(make_rename_temp): Use add_referenced_var.
(find_vars_r): Pass less parameters to add_referenced_var.
(referenced_var_p): New. Is var in referenced_var hash table.
(referenced_var_insert): Assert var isn't already in hash table.
(add_referenced_var): Don't need walk_state parameter. Add var if it
isn't already in the hash table.
(add_referenced_tmp_var): Remove.
(find_new_referenced_vars_1): Use add_referenced_var.
* tree-ssa-pre.c (create_expression_by_pieces,
insert_into_preds_of_block, insert_extra_phis, realify_fake_stores):
Use add_referenced_var.
* tree-vect-patterns.c (vect_pattern_recog_1): Use add_referenced_var.
* lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, perfect_nestify): Use
add_referenced_var.
* tree-vect-transform.c (vect_create_addr_base_for_vector_ref,
vect_create_data_ref_ptr, vect_create_destination_var,
vect_init_vector, vect_build_loop_niters,
vect_generate_tmps_on_preheader, vect_update_ivs_after_vectorizer,
vect_gen_niters_for_prolog_loop, vect_create_cond_for_align_checks):
Use add_referenced_var.
* tree-outof-ssa.c (create_temp): Use add_referenced_var.
* tree-flow.h (add_referenced_tmp_var): Remove prototype
(add_referenced_var): Add prototype.
* tree-ssa-structalias.c (get_constraint_for,
intra_create_variable_infos): Use add_referenced_var.
From-SVN: r114018
2006-05-23 16:07:21 +02:00
|
|
|
add_referenced_var (uboundvar);
|
function.c (gimplify_parameters): Call build_gimple_modify_stmt instead of calling build2 with a GIMPLE_MODIFY_STMT.
* function.c (gimplify_parameters): Call build_gimple_modify_stmt
instead of calling build2 with a GIMPLE_MODIFY_STMT.
* gimple-low.c (lower_function_body, lower_builtin_setjmp):
Likewise.
* gimplify.c (build_stack_save_restore, gimplify_return_expr,
gimplify_decl_expr, gimplify_self_mod_expr, gimplify_cond_expr,
gimplify_init_ctor_eval_range, gimple_push_cleanup,
gimplify_omp_for, gimplify_omp_atomic_pipeline,
gimplify_omp_atomic_mutex, gimplify_expr, gimplify_one_sizepos,
force_gimple_operand): Likewise.
* ipa-cp.c (constant_val_insert): Likewise.
* lambda-code.c (lbv_to_gcc_expression, lle_to_gcc_expression,
lambda_loopnest_to_gcc_loopnest, replace_uses_equiv_to_x_with_y,
perfect_nestify): Likewise.
* langhooks.c (lhd_omp_assignment): Likewise.
* omp-low.c (lower_rec_input_clauses, lower_reduction_clauses,
lower_copyprivate_clauses, lower_send_clauses,
lower_send_shared_vars, expand_parallel_call,
expand_omp_for_generic, expand_omp_for_static_nochunk,
expand_omp_for_static_chunk, expand_omp_sections,
lower_omp_single_copy, lower_omp_for_lastprivate,
lower_omp_parallel, init_tmp_var, save_tmp_var): Likewise.
* value-prof.c (tree_divmod_fixed_value, tree_mod_pow2,
tree_mod_subtract, tree_ic, tree_stringop_fixed_value):
Likewise.
From-SVN: r122120
2007-02-19 03:45:34 +01:00
|
|
|
stmt = build_gimple_modify_stmt (uboundvar, VEC_index (tree, ubounds, 0));
|
2004-09-16 18:16:14 +02:00
|
|
|
uboundvar = make_ssa_name (uboundvar, stmt);
|
2006-12-05 18:26:05 +01:00
|
|
|
GIMPLE_STMT_OPERAND (stmt, 0) = uboundvar;
|
2005-02-14 15:54:37 +01:00
|
|
|
|
|
|
|
if (insert_after)
|
|
|
|
bsi_insert_after (&bsi, stmt, BSI_SAME_STMT);
|
|
|
|
else
|
|
|
|
bsi_insert_before (&bsi, stmt, BSI_SAME_STMT);
|
2005-05-25 16:05:22 +02:00
|
|
|
update_stmt (stmt);
|
tree-vrp.c (build_assert_expr_for, [...]): Use buildN instead of build.
2005-12-02 Richard Guenther <rguenther@suse.de>
* tree-vrp.c (build_assert_expr_for, process_assert_insertions_for,
simplify_cond_using_ranges): Use buildN instead of build.
* tree-tailcall.c (adjust_accumulator_values,
adjust_return_value): Likewise.
* tree-sra.c (generate_one_element_ref, generate_copy_inout,
generate_element_copy, generate_element_zero,
generate_one_element_init): Likewise.
* tree-ssa-forwprop.c (forward_propagate_into_cond_1): Likewise.
* lambda-code.c (gcc_loop_to_lambda_loop, lbv_to_gcc_expression,
lle_to_gcc_expression, lambda_loopnest_to_gcc_loopnest,
perfect_nestify): Likewise.
From-SVN: r107894
2005-12-02 15:40:40 +01:00
|
|
|
COND_EXPR_COND (exit_condition) = build2 (GE_EXPR,
|
|
|
|
boolean_type_node,
|
|
|
|
uboundvar,
|
|
|
|
ivvarinced);
|
2005-05-25 16:05:22 +02:00
|
|
|
update_stmt (exit_condition);
|
2006-11-15 10:35:34 +01:00
|
|
|
replacements = htab_create_ggc (20, tree_map_hash,
|
|
|
|
tree_map_eq, NULL);
|
2005-06-10 21:23:26 +02:00
|
|
|
bbs = get_loop_body_in_dom_order (loop);
|
|
|
|
/* Now move the statements, and replace the induction variable in the moved
|
|
|
|
statements with the correct loop induction variable. */
|
2004-11-01 19:08:02 +01:00
|
|
|
oldivvar = VEC_index (tree, loopivs, 0);
|
2006-11-15 10:35:34 +01:00
|
|
|
firstbsi = bsi_start (bodybb);
|
2005-06-10 21:23:26 +02:00
|
|
|
for (i = loop->num_nodes - 1; i >= 0 ; i--)
|
2004-09-16 18:16:14 +02:00
|
|
|
{
|
|
|
|
block_stmt_iterator tobsi = bsi_last (bodybb);
|
|
|
|
if (bbs[i]->loop_father == loop)
|
|
|
|
{
|
2005-06-10 21:23:26 +02:00
|
|
|
/* If this is true, we are *before* the inner loop.
|
|
|
|
If this isn't true, we are *after* it.
|
[multiple changes]
2005-04-22 Diego Novillo <dnovillo@redhat.com>
* Makefile.in (tree-into-ssa.o): Add dependency on PARAMS_H.
* lambda-code.c (perfect_nestify): Mark virtual operands in
the moved statement for renaming.
* params.def (PARAM_MIN_VIRTUAL_MAPPINGS): Define.
(PARAM_VIRTUAL_MAPPINGS_TO_SYMS_RATIO): Define.
* params.h (MIN_VIRTUAL_MAPPINGS): Define.
(VIRTUAL_MAPPINGS_TO_SYMS_RATIO): Define.
* tree-flow.h (struct var_ann_d): Update comments.
(rewrite_to_new_ssa_names_bb, rewrite_to_new_ssa_names,
allocate_ssa_names, find_phi_node_for, dump_tree_ssa,
debug_tree_ssa, debug_def_blocks, dump_tree_ssa_stats,
debug_tree_ssa_stats, rewrite_ssa_into_ssa,
dump_repl_tbl, debug_repl_tbl, dump_names_replaced_by,
debug_names_replaced_by): Remove declarations.
(delete_update_ssa, get_current_def, set_current_def): Declare.
(rewrite_into_loop_closed_ssa): Add new argument. Update
all callers.
* tree-into-ssa.c: Include params.h.
(old_virtual_ssa_names): Remove. Update all users.
(need_to_replace_names_p): Remove. Update all users.
(struct update_ssa_stats_d): Declare.
(update_ssa_stats): New local.
(dump_tree_ssa, debug_tree_ssa, debug_def_blocks,
dump_tree_ssa_stats, debug_tree_ssa_stats,
dump_update_ssa, debug_update_ssa,
dump_names_replaced_by, debug_names_replaced_by): Declare.
(get_current_def, set current_def): Make extern.
(is_old_name, is_new_name): Protect against references
past the end of the sets.
(add_new_name_mapping): Assert that OLD and NEW are
different SSA names for the same symbol.
When adding a virtual mapping, update stats for virtual
mapping heuristic.
(insert_phi_nodes_for): If UPDATE_P is true, create the
LHS of the new PHI by duplicating SSA name VAR.
(insert_phi_nodes_1): Remove. Update all users.
(insert_phi_nodes): Remove second argument. Update all
users.
(maybe_replace_use, maybe_replace_def): New.
(rewrite_update_stmt): Call them.
(mark_def_interesting): Remove calls to is_gimple_reg.
(prepare_phi_args_for_update): Remove. Update all users.
(prepare_block_for_update): Only process virtual operands
and GIMPLE registers in normal form.
(prepare_use_sites_for): New.
(prepare_names_to_update): Rename from prepare_def_sites.
Call prepare_use_sites_for.
(dump_update_ssa): Rename from dump_repl_tbl.
Update all users.
Show statistics for virtual mapping heuristic.
(debug_update_ssa): Rename from debug_debug_repl_tbl.
(init_update_ssa): Initialize UPDATE_SSA_STATS.
(delete_update_ssa): Make extern.
(mark_set_for_renaming): If the set is empty, do nothing.
(release_ssa_name_after_update_ssa): Update comment.
(insert_updated_phi_nodes_for): Do not remove existing
PHI nodes for symbols.
(switch_virtuals_to_full_rewrite_p): New.
(switch_virtuals_to_full_rewrite): New.
(update_ssa): Call them.
Clear REWRITE_THIS_STMT and REGISTER_DEFS_IN_THIS_STMT
for every statement before updating.
If all the names in NEW_SSA_NAMES have been marked for
removal, do nothing.
Only start at the top of the CFG if there are symbols in
SYMS_TO_RENAME.
(ssa_rewrite_finalize_block): Remove.
(ssa_register_new_def): Remove.
(ssa_rewrite_stmt): Remove.
(ssa_rewrite_phi_arguments): Remove.
(ssa_rewrite_initialize_block): Remove.
(ssa_mark_def_sites): Remove.
(ssa_mark_def_sites_initialize_block): Remove.
(ssa_mark_phi_uses): Remove.
(rewrite_ssa_into_ssa): Remove.
* tree-phinodes.c (find_phi_node_for): Remove.
* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely):
Call update_ssa.
* tree-ssa-loop-unswitch.c (tree_ssa_unswitch_loops):
Remove calls to verify_dominators and
verify_loop_structure.
(tree_unswitch_single_loop): Call update_ssa.
* tree-ssa.c (verify_ssa): Assert that need_ssa_update_p
returns false.
Call verify_stmts.
(delete_tree_ssa): Assert that need_ssa_update_p returns
false.
* tree-vect-transform.c (vect_transform_loop): Call update_ssa.
* tree-vectorizer.c (allocate_new_names, rename_def_op,
free_new_names): Remove. Update all users.
(rename_use_op): Call get_current_def.
(rename_variables_in_bb): Do not handle any real or
virtual definition.
(slpeel_update_phis_for_duplicate_loop): Call
get_current_def and set_current_def instead of using
SSA_NAME_AUX.
(slpeel_update_phi_nodes_for_guard2): Reformat comments.
(slpeel_can_duplicate_loop_p): Call need_ssa_update_p,
ssa_names_to_replace and delete_update_ssa.
* doc/invoke.texi: Document --param min-virtual-mappings
and --param virtual-mappings-ratio.
2005-04-22 Zdenek Dvorak <dvorakz@suse.cz>
Diego Novillo <dnovillo@redhat.com>
* tree-cfg.c (tree_duplicate_bb): Call create_new_def_for
for newly created PHI nodes.
Call create_new_def_for for every new V_MAY_DEF and
V_MUST_DEF on the copied statement.
(struct ssa_name_map_entry): Remove.
(ssa_name_map_entry_hash): Remove.
(ssa_name_map_entry_eq): Remove.
(allocate_ssa_names): Remove.
(rewrite_to_new_ssa_names_def): Remove.
(rewrite_to_new_ssa_names_use): Remove.
(rewrite_to_new_ssa_names_bb): Remove.
(rewrite_to_new_ssa_names): Remove.
(tree_duplicate_sese_region): Remove variables ver,
definitions, phi, ssa_name_map and bi.
Call need_ssa_update_p instead of any_marked_for_rewrite_p.
Call update_ssa.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Call
update_ssa instead of rewrite_ssa_into_ssa.
* tree-ssa-loop-manip.c (add_exit_phis_edge): Call
create_new_def_for.
(find_uses_to_rename_use): Add argument 'need_phis'.
(find_uses_to_rename_stmt): Do not scan virtual operands.
(find_uses_to_rename): Only scan PHI nodes for
non-virtual names.
(rewrite_into_loop_closed_ssa): Call update_ssa.
(check_loop_closed_ssa_use): Ignore virtual operands.
(check_loop_closed_ssa_stmt): Likewise.
(verify_loop_closed_ssa): Do nothing if CURRENT_LOOPS is
NULL.
(rename_variables, set_phi_def_stmts): Remove.
(tree_duplicate_loop_to_header_edge): Reformat comment.
Remove variables BB, I and DEFINITIONS.
Call need_ssa_update_p.
Call update_ssa.
(lv_adjust_loop_header_phi): Reformat comment.
* tree-ssanames.c (ssa_names_to_rewrite): Remove.
(marked_for_rewrite_p, any_marked_for_rewrite_p,
mark_for_rewrite, unmark_all_for_rewrite,
marked_ssa_names): Remove. Update all users.
(release_ssa_name): If VAR has been registered for SSA
updating, do nothing.
* tree-vrp.c (new_ssa_names, old_ssa_names): Remove.
(build_assert_expr_for): Call register_new_name_mapping.
(insert_range_assertions): Update call to update_ssa.
* tree.h (mark_for_rewrite, unmark_all_for_rewrite,
marked_for_rewrite_p, any_marked_for_rewrite_p,
marked_ssa_names): Remove.
From-SVN: r98599
2005-04-23 02:59:54 +02:00
|
|
|
|
2005-06-10 21:23:26 +02:00
|
|
|
The only time can_convert_to_perfect_nest returns true when we
|
|
|
|
have statements before the inner loop is if they can be moved
|
|
|
|
into the inner loop.
|
[multiple changes]
2005-04-22 Diego Novillo <dnovillo@redhat.com>
* Makefile.in (tree-into-ssa.o): Add dependency on PARAMS_H.
* lambda-code.c (perfect_nestify): Mark virtual operands in
the moved statement for renaming.
* params.def (PARAM_MIN_VIRTUAL_MAPPINGS): Define.
(PARAM_VIRTUAL_MAPPINGS_TO_SYMS_RATIO): Define.
* params.h (MIN_VIRTUAL_MAPPINGS): Define.
(VIRTUAL_MAPPINGS_TO_SYMS_RATIO): Define.
* tree-flow.h (struct var_ann_d): Update comments.
(rewrite_to_new_ssa_names_bb, rewrite_to_new_ssa_names,
allocate_ssa_names, find_phi_node_for, dump_tree_ssa,
debug_tree_ssa, debug_def_blocks, dump_tree_ssa_stats,
debug_tree_ssa_stats, rewrite_ssa_into_ssa,
dump_repl_tbl, debug_repl_tbl, dump_names_replaced_by,
debug_names_replaced_by): Remove declarations.
(delete_update_ssa, get_current_def, set_current_def): Declare.
(rewrite_into_loop_closed_ssa): Add new argument. Update
all callers.
* tree-into-ssa.c: Include params.h.
(old_virtual_ssa_names): Remove. Update all users.
(need_to_replace_names_p): Remove. Update all users.
(struct update_ssa_stats_d): Declare.
(update_ssa_stats): New local.
(dump_tree_ssa, debug_tree_ssa, debug_def_blocks,
dump_tree_ssa_stats, debug_tree_ssa_stats,
dump_update_ssa, debug_update_ssa,
dump_names_replaced_by, debug_names_replaced_by): Declare.
(get_current_def, set current_def): Make extern.
(is_old_name, is_new_name): Protect against references
past the end of the sets.
(add_new_name_mapping): Assert that OLD and NEW are
different SSA names for the same symbol.
When adding a virtual mapping, update stats for virtual
mapping heuristic.
(insert_phi_nodes_for): If UPDATE_P is true, create the
LHS of the new PHI by duplicating SSA name VAR.
(insert_phi_nodes_1): Remove. Update all users.
(insert_phi_nodes): Remove second argument. Update all
users.
(maybe_replace_use, maybe_replace_def): New.
(rewrite_update_stmt): Call them.
(mark_def_interesting): Remove calls to is_gimple_reg.
(prepare_phi_args_for_update): Remove. Update all users.
(prepare_block_for_update): Only process virtual operands
and GIMPLE registers in normal form.
(prepare_use_sites_for): New.
(prepare_names_to_update): Rename from prepare_def_sites.
Call prepare_use_sites_for.
(dump_update_ssa): Rename from dump_repl_tbl.
Update all users.
Show statistics for virtual mapping heuristic.
(debug_update_ssa): Rename from debug_debug_repl_tbl.
(init_update_ssa): Initialize UPDATE_SSA_STATS.
(delete_update_ssa): Make extern.
(mark_set_for_renaming): If the set is empty, do nothing.
(release_ssa_name_after_update_ssa): Update comment.
(insert_updated_phi_nodes_for): Do not remove existing
PHI nodes for symbols.
(switch_virtuals_to_full_rewrite_p): New.
(switch_virtuals_to_full_rewrite): New.
(update_ssa): Call them.
Clear REWRITE_THIS_STMT and REGISTER_DEFS_IN_THIS_STMT
for every statement before updating.
If all the names in NEW_SSA_NAMES have been marked for
removal, do nothing.
Only start at the top of the CFG if there are symbols in
SYMS_TO_RENAME.
(ssa_rewrite_finalize_block): Remove.
(ssa_register_new_def): Remove.
(ssa_rewrite_stmt): Remove.
(ssa_rewrite_phi_arguments): Remove.
(ssa_rewrite_initialize_block): Remove.
(ssa_mark_def_sites): Remove.
(ssa_mark_def_sites_initialize_block): Remove.
(ssa_mark_phi_uses): Remove.
(rewrite_ssa_into_ssa): Remove.
* tree-phinodes.c (find_phi_node_for): Remove.
* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely):
Call update_ssa.
* tree-ssa-loop-unswitch.c (tree_ssa_unswitch_loops):
Remove calls to verify_dominators and
verify_loop_structure.
(tree_unswitch_single_loop): Call update_ssa.
* tree-ssa.c (verify_ssa): Assert that need_ssa_update_p
returns false.
Call verify_stmts.
(delete_tree_ssa): Assert that need_ssa_update_p returns
false.
* tree-vect-transform.c (vect_transform_loop): Call update_ssa.
* tree-vectorizer.c (allocate_new_names, rename_def_op,
free_new_names): Remove. Update all users.
(rename_use_op): Call get_current_def.
(rename_variables_in_bb): Do not handle any real or
virtual definition.
(slpeel_update_phis_for_duplicate_loop): Call
get_current_def and set_current_def instead of using
SSA_NAME_AUX.
(slpeel_update_phi_nodes_for_guard2): Reformat comments.
(slpeel_can_duplicate_loop_p): Call need_ssa_update_p,
ssa_names_to_replace and delete_update_ssa.
* doc/invoke.texi: Document --param min-virtual-mappings
and --param virtual-mappings-ratio.
2005-04-22 Zdenek Dvorak <dvorakz@suse.cz>
Diego Novillo <dnovillo@redhat.com>
* tree-cfg.c (tree_duplicate_bb): Call create_new_def_for
for newly created PHI nodes.
Call create_new_def_for for every new V_MAY_DEF and
V_MUST_DEF on the copied statement.
(struct ssa_name_map_entry): Remove.
(ssa_name_map_entry_hash): Remove.
(ssa_name_map_entry_eq): Remove.
(allocate_ssa_names): Remove.
(rewrite_to_new_ssa_names_def): Remove.
(rewrite_to_new_ssa_names_use): Remove.
(rewrite_to_new_ssa_names_bb): Remove.
(rewrite_to_new_ssa_names): Remove.
(tree_duplicate_sese_region): Remove variables ver,
definitions, phi, ssa_name_map and bi.
Call need_ssa_update_p instead of any_marked_for_rewrite_p.
Call update_ssa.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Call
update_ssa instead of rewrite_ssa_into_ssa.
* tree-ssa-loop-manip.c (add_exit_phis_edge): Call
create_new_def_for.
(find_uses_to_rename_use): Add argument 'need_phis'.
(find_uses_to_rename_stmt): Do not scan virtual operands.
(find_uses_to_rename): Only scan PHI nodes for
non-virtual names.
(rewrite_into_loop_closed_ssa): Call update_ssa.
(check_loop_closed_ssa_use): Ignore virtual operands.
(check_loop_closed_ssa_stmt): Likewise.
(verify_loop_closed_ssa): Do nothing if CURRENT_LOOPS is
NULL.
(rename_variables, set_phi_def_stmts): Remove.
(tree_duplicate_loop_to_header_edge): Reformat comment.
Remove variables BB, I and DEFINITIONS.
Call need_ssa_update_p.
Call update_ssa.
(lv_adjust_loop_header_phi): Reformat comment.
* tree-ssanames.c (ssa_names_to_rewrite): Remove.
(marked_for_rewrite_p, any_marked_for_rewrite_p,
mark_for_rewrite, unmark_all_for_rewrite,
marked_ssa_names): Remove. Update all users.
(release_ssa_name): If VAR has been registered for SSA
updating, do nothing.
* tree-vrp.c (new_ssa_names, old_ssa_names): Remove.
(build_assert_expr_for): Call register_new_name_mapping.
(insert_range_assertions): Update call to update_ssa.
* tree.h (mark_for_rewrite, unmark_all_for_rewrite,
marked_for_rewrite_p, any_marked_for_rewrite_p,
marked_ssa_names): Remove.
From-SVN: r98599
2005-04-23 02:59:54 +02:00
|
|
|
|
2005-06-10 21:23:26 +02:00
|
|
|
The only time can_convert_to_perfect_nest returns true when we
|
|
|
|
have statements after the inner loop is if they can be moved into
|
|
|
|
the new split loop. */
|
[multiple changes]
2005-04-22 Diego Novillo <dnovillo@redhat.com>
* Makefile.in (tree-into-ssa.o): Add dependency on PARAMS_H.
* lambda-code.c (perfect_nestify): Mark virtual operands in
the moved statement for renaming.
* params.def (PARAM_MIN_VIRTUAL_MAPPINGS): Define.
(PARAM_VIRTUAL_MAPPINGS_TO_SYMS_RATIO): Define.
* params.h (MIN_VIRTUAL_MAPPINGS): Define.
(VIRTUAL_MAPPINGS_TO_SYMS_RATIO): Define.
* tree-flow.h (struct var_ann_d): Update comments.
(rewrite_to_new_ssa_names_bb, rewrite_to_new_ssa_names,
allocate_ssa_names, find_phi_node_for, dump_tree_ssa,
debug_tree_ssa, debug_def_blocks, dump_tree_ssa_stats,
debug_tree_ssa_stats, rewrite_ssa_into_ssa,
dump_repl_tbl, debug_repl_tbl, dump_names_replaced_by,
debug_names_replaced_by): Remove declarations.
(delete_update_ssa, get_current_def, set_current_def): Declare.
(rewrite_into_loop_closed_ssa): Add new argument. Update
all callers.
* tree-into-ssa.c: Include params.h.
(old_virtual_ssa_names): Remove. Update all users.
(need_to_replace_names_p): Remove. Update all users.
(struct update_ssa_stats_d): Declare.
(update_ssa_stats): New local.
(dump_tree_ssa, debug_tree_ssa, debug_def_blocks,
dump_tree_ssa_stats, debug_tree_ssa_stats,
dump_update_ssa, debug_update_ssa,
dump_names_replaced_by, debug_names_replaced_by): Declare.
(get_current_def, set current_def): Make extern.
(is_old_name, is_new_name): Protect against references
past the end of the sets.
(add_new_name_mapping): Assert that OLD and NEW are
different SSA names for the same symbol.
When adding a virtual mapping, update stats for virtual
mapping heuristic.
(insert_phi_nodes_for): If UPDATE_P is true, create the
LHS of the new PHI by duplicating SSA name VAR.
(insert_phi_nodes_1): Remove. Update all users.
(insert_phi_nodes): Remove second argument. Update all
users.
(maybe_replace_use, maybe_replace_def): New.
(rewrite_update_stmt): Call them.
(mark_def_interesting): Remove calls to is_gimple_reg.
(prepare_phi_args_for_update): Remove. Update all users.
(prepare_block_for_update): Only process virtual operands
and GIMPLE registers in normal form.
(prepare_use_sites_for): New.
(prepare_names_to_update): Rename from prepare_def_sites.
Call prepare_use_sites_for.
(dump_update_ssa): Rename from dump_repl_tbl.
Update all users.
Show statistics for virtual mapping heuristic.
(debug_update_ssa): Rename from debug_debug_repl_tbl.
(init_update_ssa): Initialize UPDATE_SSA_STATS.
(delete_update_ssa): Make extern.
(mark_set_for_renaming): If the set is empty, do nothing.
(release_ssa_name_after_update_ssa): Update comment.
(insert_updated_phi_nodes_for): Do not remove existing
PHI nodes for symbols.
(switch_virtuals_to_full_rewrite_p): New.
(switch_virtuals_to_full_rewrite): New.
(update_ssa): Call them.
Clear REWRITE_THIS_STMT and REGISTER_DEFS_IN_THIS_STMT
for every statement before updating.
If all the names in NEW_SSA_NAMES have been marked for
removal, do nothing.
Only start at the top of the CFG if there are symbols in
SYMS_TO_RENAME.
(ssa_rewrite_finalize_block): Remove.
(ssa_register_new_def): Remove.
(ssa_rewrite_stmt): Remove.
(ssa_rewrite_phi_arguments): Remove.
(ssa_rewrite_initialize_block): Remove.
(ssa_mark_def_sites): Remove.
(ssa_mark_def_sites_initialize_block): Remove.
(ssa_mark_phi_uses): Remove.
(rewrite_ssa_into_ssa): Remove.
* tree-phinodes.c (find_phi_node_for): Remove.
* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely):
Call update_ssa.
* tree-ssa-loop-unswitch.c (tree_ssa_unswitch_loops):
Remove calls to verify_dominators and
verify_loop_structure.
(tree_unswitch_single_loop): Call update_ssa.
* tree-ssa.c (verify_ssa): Assert that need_ssa_update_p
returns false.
Call verify_stmts.
(delete_tree_ssa): Assert that need_ssa_update_p returns
false.
* tree-vect-transform.c (vect_transform_loop): Call update_ssa.
* tree-vectorizer.c (allocate_new_names, rename_def_op,
free_new_names): Remove. Update all users.
(rename_use_op): Call get_current_def.
(rename_variables_in_bb): Do not handle any real or
virtual definition.
(slpeel_update_phis_for_duplicate_loop): Call
get_current_def and set_current_def instead of using
SSA_NAME_AUX.
(slpeel_update_phi_nodes_for_guard2): Reformat comments.
(slpeel_can_duplicate_loop_p): Call need_ssa_update_p,
ssa_names_to_replace and delete_update_ssa.
* doc/invoke.texi: Document --param min-virtual-mappings
and --param virtual-mappings-ratio.
2005-04-22 Zdenek Dvorak <dvorakz@suse.cz>
Diego Novillo <dnovillo@redhat.com>
* tree-cfg.c (tree_duplicate_bb): Call create_new_def_for
for newly created PHI nodes.
Call create_new_def_for for every new V_MAY_DEF and
V_MUST_DEF on the copied statement.
(struct ssa_name_map_entry): Remove.
(ssa_name_map_entry_hash): Remove.
(ssa_name_map_entry_eq): Remove.
(allocate_ssa_names): Remove.
(rewrite_to_new_ssa_names_def): Remove.
(rewrite_to_new_ssa_names_use): Remove.
(rewrite_to_new_ssa_names_bb): Remove.
(rewrite_to_new_ssa_names): Remove.
(tree_duplicate_sese_region): Remove variables ver,
definitions, phi, ssa_name_map and bi.
Call need_ssa_update_p instead of any_marked_for_rewrite_p.
Call update_ssa.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Call
update_ssa instead of rewrite_ssa_into_ssa.
* tree-ssa-loop-manip.c (add_exit_phis_edge): Call
create_new_def_for.
(find_uses_to_rename_use): Add argument 'need_phis'.
(find_uses_to_rename_stmt): Do not scan virtual operands.
(find_uses_to_rename): Only scan PHI nodes for
non-virtual names.
(rewrite_into_loop_closed_ssa): Call update_ssa.
(check_loop_closed_ssa_use): Ignore virtual operands.
(check_loop_closed_ssa_stmt): Likewise.
(verify_loop_closed_ssa): Do nothing if CURRENT_LOOPS is
NULL.
(rename_variables, set_phi_def_stmts): Remove.
(tree_duplicate_loop_to_header_edge): Reformat comment.
Remove variables BB, I and DEFINITIONS.
Call need_ssa_update_p.
Call update_ssa.
(lv_adjust_loop_header_phi): Reformat comment.
* tree-ssanames.c (ssa_names_to_rewrite): Remove.
(marked_for_rewrite_p, any_marked_for_rewrite_p,
mark_for_rewrite, unmark_all_for_rewrite,
marked_ssa_names): Remove. Update all users.
(release_ssa_name): If VAR has been registered for SSA
updating, do nothing.
* tree-vrp.c (new_ssa_names, old_ssa_names): Remove.
(build_assert_expr_for): Call register_new_name_mapping.
(insert_range_assertions): Update call to update_ssa.
* tree.h (mark_for_rewrite, unmark_all_for_rewrite,
marked_for_rewrite_p, any_marked_for_rewrite_p,
marked_ssa_names): Remove.
From-SVN: r98599
2005-04-23 02:59:54 +02:00
|
|
|
|
2005-06-10 21:23:26 +02:00
|
|
|
if (dominated_by_p (CDI_DOMINATORS, loop->inner->header, bbs[i]))
|
|
|
|
{
|
2006-05-29 18:01:16 +02:00
|
|
|
block_stmt_iterator header_bsi
|
|
|
|
= bsi_after_labels (loop->inner->header);
|
|
|
|
|
|
|
|
for (bsi = bsi_start (bbs[i]); !bsi_end_p (bsi);)
|
2005-06-10 21:23:26 +02:00
|
|
|
{
|
|
|
|
tree stmt = bsi_stmt (bsi);
|
|
|
|
|
|
|
|
if (stmt == exit_condition
|
|
|
|
|| not_interesting_stmt (stmt)
|
|
|
|
|| stmt_is_bumper_for_loop (loop, stmt))
|
|
|
|
{
|
2006-05-29 18:01:16 +02:00
|
|
|
bsi_next (&bsi);
|
2005-06-10 21:23:26 +02:00
|
|
|
continue;
|
|
|
|
}
|
2006-05-29 18:01:16 +02:00
|
|
|
|
|
|
|
bsi_move_before (&bsi, &header_bsi);
|
2005-06-10 21:23:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Note that the bsi only needs to be explicitly incremented
|
|
|
|
when we don't move something, since it is automatically
|
|
|
|
incremented when we do. */
|
|
|
|
for (bsi = bsi_start (bbs[i]); !bsi_end_p (bsi);)
|
|
|
|
{
|
|
|
|
ssa_op_iter i;
|
|
|
|
tree n, stmt = bsi_stmt (bsi);
|
|
|
|
|
|
|
|
if (stmt == exit_condition
|
|
|
|
|| not_interesting_stmt (stmt)
|
|
|
|
|| stmt_is_bumper_for_loop (loop, stmt))
|
|
|
|
{
|
|
|
|
bsi_next (&bsi);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2006-05-17 16:25:59 +02:00
|
|
|
replace_uses_equiv_to_x_with_y
|
2006-11-15 10:35:34 +01:00
|
|
|
(loop, stmt, oldivvar, VEC_index (int, steps, 0), ivvar,
|
|
|
|
VEC_index (tree, lbounds, 0), replacements, &firstbsi);
|
2006-05-17 16:25:59 +02:00
|
|
|
|
2005-06-10 21:23:26 +02:00
|
|
|
bsi_move_before (&bsi, &tobsi);
|
|
|
|
|
|
|
|
/* If the statement has any virtual operands, they may
|
|
|
|
need to be rewired because the original loop may
|
|
|
|
still reference them. */
|
|
|
|
FOR_EACH_SSA_TREE_OPERAND (n, stmt, i, SSA_OP_ALL_VIRTUALS)
|
|
|
|
mark_sym_for_renaming (SSA_NAME_VAR (n));
|
|
|
|
}
|
2004-09-16 18:16:14 +02:00
|
|
|
}
|
2005-06-10 21:23:26 +02:00
|
|
|
|
2004-09-16 18:16:14 +02:00
|
|
|
}
|
|
|
|
}
|
[multiple changes]
2005-04-22 Diego Novillo <dnovillo@redhat.com>
* Makefile.in (tree-into-ssa.o): Add dependency on PARAMS_H.
* lambda-code.c (perfect_nestify): Mark virtual operands in
the moved statement for renaming.
* params.def (PARAM_MIN_VIRTUAL_MAPPINGS): Define.
(PARAM_VIRTUAL_MAPPINGS_TO_SYMS_RATIO): Define.
* params.h (MIN_VIRTUAL_MAPPINGS): Define.
(VIRTUAL_MAPPINGS_TO_SYMS_RATIO): Define.
* tree-flow.h (struct var_ann_d): Update comments.
(rewrite_to_new_ssa_names_bb, rewrite_to_new_ssa_names,
allocate_ssa_names, find_phi_node_for, dump_tree_ssa,
debug_tree_ssa, debug_def_blocks, dump_tree_ssa_stats,
debug_tree_ssa_stats, rewrite_ssa_into_ssa,
dump_repl_tbl, debug_repl_tbl, dump_names_replaced_by,
debug_names_replaced_by): Remove declarations.
(delete_update_ssa, get_current_def, set_current_def): Declare.
(rewrite_into_loop_closed_ssa): Add new argument. Update
all callers.
* tree-into-ssa.c: Include params.h.
(old_virtual_ssa_names): Remove. Update all users.
(need_to_replace_names_p): Remove. Update all users.
(struct update_ssa_stats_d): Declare.
(update_ssa_stats): New local.
(dump_tree_ssa, debug_tree_ssa, debug_def_blocks,
dump_tree_ssa_stats, debug_tree_ssa_stats,
dump_update_ssa, debug_update_ssa,
dump_names_replaced_by, debug_names_replaced_by): Declare.
(get_current_def, set current_def): Make extern.
(is_old_name, is_new_name): Protect against references
past the end of the sets.
(add_new_name_mapping): Assert that OLD and NEW are
different SSA names for the same symbol.
When adding a virtual mapping, update stats for virtual
mapping heuristic.
(insert_phi_nodes_for): If UPDATE_P is true, create the
LHS of the new PHI by duplicating SSA name VAR.
(insert_phi_nodes_1): Remove. Update all users.
(insert_phi_nodes): Remove second argument. Update all
users.
(maybe_replace_use, maybe_replace_def): New.
(rewrite_update_stmt): Call them.
(mark_def_interesting): Remove calls to is_gimple_reg.
(prepare_phi_args_for_update): Remove. Update all users.
(prepare_block_for_update): Only process virtual operands
and GIMPLE registers in normal form.
(prepare_use_sites_for): New.
(prepare_names_to_update): Rename from prepare_def_sites.
Call prepare_use_sites_for.
(dump_update_ssa): Rename from dump_repl_tbl.
Update all users.
Show statistics for virtual mapping heuristic.
(debug_update_ssa): Rename from debug_debug_repl_tbl.
(init_update_ssa): Initialize UPDATE_SSA_STATS.
(delete_update_ssa): Make extern.
(mark_set_for_renaming): If the set is empty, do nothing.
(release_ssa_name_after_update_ssa): Update comment.
(insert_updated_phi_nodes_for): Do not remove existing
PHI nodes for symbols.
(switch_virtuals_to_full_rewrite_p): New.
(switch_virtuals_to_full_rewrite): New.
(update_ssa): Call them.
Clear REWRITE_THIS_STMT and REGISTER_DEFS_IN_THIS_STMT
for every statement before updating.
If all the names in NEW_SSA_NAMES have been marked for
removal, do nothing.
Only start at the top of the CFG if there are symbols in
SYMS_TO_RENAME.
(ssa_rewrite_finalize_block): Remove.
(ssa_register_new_def): Remove.
(ssa_rewrite_stmt): Remove.
(ssa_rewrite_phi_arguments): Remove.
(ssa_rewrite_initialize_block): Remove.
(ssa_mark_def_sites): Remove.
(ssa_mark_def_sites_initialize_block): Remove.
(ssa_mark_phi_uses): Remove.
(rewrite_ssa_into_ssa): Remove.
* tree-phinodes.c (find_phi_node_for): Remove.
* tree-ssa-loop-ivcanon.c (try_unroll_loop_completely):
Call update_ssa.
* tree-ssa-loop-unswitch.c (tree_ssa_unswitch_loops):
Remove calls to verify_dominators and
verify_loop_structure.
(tree_unswitch_single_loop): Call update_ssa.
* tree-ssa.c (verify_ssa): Assert that need_ssa_update_p
returns false.
Call verify_stmts.
(delete_tree_ssa): Assert that need_ssa_update_p returns
false.
* tree-vect-transform.c (vect_transform_loop): Call update_ssa.
* tree-vectorizer.c (allocate_new_names, rename_def_op,
free_new_names): Remove. Update all users.
(rename_use_op): Call get_current_def.
(rename_variables_in_bb): Do not handle any real or
virtual definition.
(slpeel_update_phis_for_duplicate_loop): Call
get_current_def and set_current_def instead of using
SSA_NAME_AUX.
(slpeel_update_phi_nodes_for_guard2): Reformat comments.
(slpeel_can_duplicate_loop_p): Call need_ssa_update_p,
ssa_names_to_replace and delete_update_ssa.
* doc/invoke.texi: Document --param min-virtual-mappings
and --param virtual-mappings-ratio.
2005-04-22 Zdenek Dvorak <dvorakz@suse.cz>
Diego Novillo <dnovillo@redhat.com>
* tree-cfg.c (tree_duplicate_bb): Call create_new_def_for
for newly created PHI nodes.
Call create_new_def_for for every new V_MAY_DEF and
V_MUST_DEF on the copied statement.
(struct ssa_name_map_entry): Remove.
(ssa_name_map_entry_hash): Remove.
(ssa_name_map_entry_eq): Remove.
(allocate_ssa_names): Remove.
(rewrite_to_new_ssa_names_def): Remove.
(rewrite_to_new_ssa_names_use): Remove.
(rewrite_to_new_ssa_names_bb): Remove.
(rewrite_to_new_ssa_names): Remove.
(tree_duplicate_sese_region): Remove variables ver,
definitions, phi, ssa_name_map and bi.
Call need_ssa_update_p instead of any_marked_for_rewrite_p.
Call update_ssa.
* tree-ssa-dom.c (tree_ssa_dominator_optimize): Call
update_ssa instead of rewrite_ssa_into_ssa.
* tree-ssa-loop-manip.c (add_exit_phis_edge): Call
create_new_def_for.
(find_uses_to_rename_use): Add argument 'need_phis'.
(find_uses_to_rename_stmt): Do not scan virtual operands.
(find_uses_to_rename): Only scan PHI nodes for
non-virtual names.
(rewrite_into_loop_closed_ssa): Call update_ssa.
(check_loop_closed_ssa_use): Ignore virtual operands.
(check_loop_closed_ssa_stmt): Likewise.
(verify_loop_closed_ssa): Do nothing if CURRENT_LOOPS is
NULL.
(rename_variables, set_phi_def_stmts): Remove.
(tree_duplicate_loop_to_header_edge): Reformat comment.
Remove variables BB, I and DEFINITIONS.
Call need_ssa_update_p.
Call update_ssa.
(lv_adjust_loop_header_phi): Reformat comment.
* tree-ssanames.c (ssa_names_to_rewrite): Remove.
(marked_for_rewrite_p, any_marked_for_rewrite_p,
mark_for_rewrite, unmark_all_for_rewrite,
marked_ssa_names): Remove. Update all users.
(release_ssa_name): If VAR has been registered for SSA
updating, do nothing.
* tree-vrp.c (new_ssa_names, old_ssa_names): Remove.
(build_assert_expr_for): Call register_new_name_mapping.
(insert_range_assertions): Update call to update_ssa.
* tree.h (mark_for_rewrite, unmark_all_for_rewrite,
marked_for_rewrite_p, any_marked_for_rewrite_p,
marked_ssa_names): Remove.
From-SVN: r98599
2005-04-23 02:59:54 +02:00
|
|
|
|
2004-09-16 18:16:14 +02:00
|
|
|
free (bbs);
|
2006-11-15 10:35:34 +01:00
|
|
|
htab_delete (replacements);
|
2004-09-16 18:16:14 +02:00
|
|
|
return perfect_nest_p (loop);
|
|
|
|
}
|
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
/* Return true if TRANS is a legal transformation matrix that respects
|
|
|
|
the dependence vectors in DISTS and DIRS. The conservative answer
|
|
|
|
is false.
|
|
|
|
|
|
|
|
"Wolfe proves that a unimodular transformation represented by the
|
|
|
|
matrix T is legal when applied to a loop nest with a set of
|
|
|
|
lexicographically non-negative distance vectors RDG if and only if
|
|
|
|
for each vector d in RDG, (T.d >= 0) is lexicographically positive.
|
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
|
|
|
i.e.: if and only if it transforms the lexicographically positive
|
2004-08-26 19:10:50 +02:00
|
|
|
distance vectors to lexicographically positive vectors. Note that
|
|
|
|
a unimodular matrix must transform the zero vector (and only it) to
|
|
|
|
the zero vector." S.Muchnick. */
|
|
|
|
|
|
|
|
bool
|
2004-09-16 18:16:14 +02:00
|
|
|
lambda_transform_legal_p (lambda_trans_matrix trans,
|
|
|
|
int nb_loops,
|
tree-loop-linear.c: Don't include varray.h.
* tree-loop-linear.c: Don't include varray.h.
(gather_interchange_stats, try_interchange_loops,
linear_transform_loops): Use VEC instead of VARRAY.
* lambda-mat.c: Don't include varray.h.
* tree-chrec.c: Same.
* lambda-trans.c: Same.
* tree-vectorizer.c (new_loop_vec_info, destroy_loop_vec_info): Use
VEC instead of VARRAY.
* tree-vectorizer.h: Idem.
* tree-data-ref.c (dump_data_references,
dump_data_dependence_relations, dump_dist_dir_vectors, dump_ddrs,
initialize_data_dependence_relation, finalize_ddr_dependent,
compute_all_dependences, find_data_references_in_loop,
compute_data_dependences_for_loop, analyze_all_data_dependences,
free_dependence_relation, free_dependence_relations,
free_data_refs): Idem.
* tree-data-ref.h (data_reference_p, subscript_p): New.
(data_dependence_relation, DDR_SUBSCRIPT, DDR_NUM_SUBSCRIPTS): Use
VEC instead of VARRAY.
(DDR_SUBSCRIPTS_VECTOR_INIT): Removed.
(find_data_references_in_loop, compute_data_dependences_for_loop,
dump_ddrs, dump_dist_dir_vectors, dump_data_references,
dump_data_dependence_relations, free_dependence_relations,
free_data_refs): Adjust declaration.
(lambda_transform_legal_p): Move declaration here...
* tree-vect-analyze.c (vect_analyze_data_ref_dependences,
vect_compute_data_refs_alignment, vect_verify_datarefs_alignment,
vect_enhance_data_refs_alignment, vect_analyze_data_ref_accesses,
vect_analyze_data_refs): Use VEC instead of VARRAY.
* lambda.h (lambda_transform_legal_p): ...from here.
* lambda-code.c (lambda_transform_legal_p): Use VEC instead of VARRAY.
* tree-vect-transform.c (vect_update_inits_of_drs): Idem.
* Makefile.in (tree-loop-linear.o, lambda-mat.o, lambda-trans.o,
tree-chrec.o): Don't depend on VARRAY_H.
From-SVN: r112437
2006-03-28 06:19:26 +02:00
|
|
|
VEC (ddr_p, heap) *dependence_relations)
|
2004-08-26 19:10:50 +02:00
|
|
|
{
|
2005-11-05 17:50:47 +01:00
|
|
|
unsigned int i, j;
|
2004-08-26 19:10:50 +02:00
|
|
|
lambda_vector distres;
|
|
|
|
struct data_dependence_relation *ddr;
|
|
|
|
|
alias.c (true_dependence): Remove 'abort' from comments.
* alias.c (true_dependence): Remove 'abort' from comments. Use
gcc_assert and gcc_unreachable as appropriate.
(canon_true_dependence): Likewise.
* bb-reorder.c (connect_traces): Likewise.
* c-common.c (c_add_case_label): Likewise.
* c-decl.c (finish_function): Likewise.
* caller-save.c (insert_restore, insert_save): Likewise.
* cfg.c (update_bb_profile_for_threading): Likewise.
* cfganal.c (flow_active_insn_p): Likewise.
* cfgexpand.c (add_reg_br_prob_note): Likewise.
* cfgrtl.c (rtl_redirect_edge_and_branch_force, rtl_split_edge,
cfg_layout_merge_blocks): Likewise.
* ifcvt.c (cond_exec_process_insns, merge_if_block,
find_if_block): Likewise.
* integrate.c (allocate_initial_values): Likewise.
* jump.c (reverse_condition, reverse_condition_maybe_unordered,
swap_condition, unsigned_condition, signed_condition,
mark_jump_label, invert_jump_1, rtx_renumbered_equal_p,
reg_or_subregno): Likewise.
* lambda-code.c (lambda_compute_auxillary_space,
lambda_transform_legal_p): Likewise.
* lambda-mat.c (lambda_matrix_inverse_hard): Likewise.
* langhooks.c (lhd_set_decl_assembler_name, lhd_type_promotes_to,
lhd_incomplete_type_error, lhd_expand_expr,
lhd_types_compatible_p, lhd_tree_size): Likewise.
* lcm.c (create_pre_exit, optimize_mode_switching): Likewise.
* local-alloc.c (update_equiv_regs): Likewise.
* loop-unroll.c (peel_loop_completely
unroll_loop_constant_iterations, unroll_loop_runtime_iterations,
peel_loop_simple, unroll_loop_stupid,
analyze_iv_to_split_insn): Likewise.
* loop.c (gen_prefetch, find_and_verify_loops,
basic_induction_var): Likewise.
* modulo-sched.c (normalize_sched_times, check_nodes_order): Likewise.
* value-prof.c (tree_find_values_to_profile): Likewise.
* varasm.c (named_section, default_assemble_integer,
decode_addr_const): Likewise.
From-SVN: r98508
2005-04-21 17:47:33 +02:00
|
|
|
gcc_assert (LTM_COLSIZE (trans) == nb_loops
|
|
|
|
&& LTM_ROWSIZE (trans) == nb_loops);
|
2004-08-26 19:10:50 +02:00
|
|
|
|
|
|
|
/* When there is an unknown relation in the dependence_relations, we
|
|
|
|
know that it is no worth looking at this loop nest: give up. */
|
tree-loop-linear.c: Don't include varray.h.
* tree-loop-linear.c: Don't include varray.h.
(gather_interchange_stats, try_interchange_loops,
linear_transform_loops): Use VEC instead of VARRAY.
* lambda-mat.c: Don't include varray.h.
* tree-chrec.c: Same.
* lambda-trans.c: Same.
* tree-vectorizer.c (new_loop_vec_info, destroy_loop_vec_info): Use
VEC instead of VARRAY.
* tree-vectorizer.h: Idem.
* tree-data-ref.c (dump_data_references,
dump_data_dependence_relations, dump_dist_dir_vectors, dump_ddrs,
initialize_data_dependence_relation, finalize_ddr_dependent,
compute_all_dependences, find_data_references_in_loop,
compute_data_dependences_for_loop, analyze_all_data_dependences,
free_dependence_relation, free_dependence_relations,
free_data_refs): Idem.
* tree-data-ref.h (data_reference_p, subscript_p): New.
(data_dependence_relation, DDR_SUBSCRIPT, DDR_NUM_SUBSCRIPTS): Use
VEC instead of VARRAY.
(DDR_SUBSCRIPTS_VECTOR_INIT): Removed.
(find_data_references_in_loop, compute_data_dependences_for_loop,
dump_ddrs, dump_dist_dir_vectors, dump_data_references,
dump_data_dependence_relations, free_dependence_relations,
free_data_refs): Adjust declaration.
(lambda_transform_legal_p): Move declaration here...
* tree-vect-analyze.c (vect_analyze_data_ref_dependences,
vect_compute_data_refs_alignment, vect_verify_datarefs_alignment,
vect_enhance_data_refs_alignment, vect_analyze_data_ref_accesses,
vect_analyze_data_refs): Use VEC instead of VARRAY.
* lambda.h (lambda_transform_legal_p): ...from here.
* lambda-code.c (lambda_transform_legal_p): Use VEC instead of VARRAY.
* tree-vect-transform.c (vect_update_inits_of_drs): Idem.
* Makefile.in (tree-loop-linear.o, lambda-mat.o, lambda-trans.o,
tree-chrec.o): Don't depend on VARRAY_H.
From-SVN: r112437
2006-03-28 06:19:26 +02:00
|
|
|
ddr = VEC_index (ddr_p, dependence_relations, 0);
|
2004-08-26 19:10:50 +02:00
|
|
|
if (ddr == NULL)
|
|
|
|
return true;
|
|
|
|
if (DDR_ARE_DEPENDENT (ddr) == chrec_dont_know)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
distres = lambda_vector_new (nb_loops);
|
|
|
|
|
|
|
|
/* For each distance vector in the dependence graph. */
|
tree-loop-linear.c: Don't include varray.h.
* tree-loop-linear.c: Don't include varray.h.
(gather_interchange_stats, try_interchange_loops,
linear_transform_loops): Use VEC instead of VARRAY.
* lambda-mat.c: Don't include varray.h.
* tree-chrec.c: Same.
* lambda-trans.c: Same.
* tree-vectorizer.c (new_loop_vec_info, destroy_loop_vec_info): Use
VEC instead of VARRAY.
* tree-vectorizer.h: Idem.
* tree-data-ref.c (dump_data_references,
dump_data_dependence_relations, dump_dist_dir_vectors, dump_ddrs,
initialize_data_dependence_relation, finalize_ddr_dependent,
compute_all_dependences, find_data_references_in_loop,
compute_data_dependences_for_loop, analyze_all_data_dependences,
free_dependence_relation, free_dependence_relations,
free_data_refs): Idem.
* tree-data-ref.h (data_reference_p, subscript_p): New.
(data_dependence_relation, DDR_SUBSCRIPT, DDR_NUM_SUBSCRIPTS): Use
VEC instead of VARRAY.
(DDR_SUBSCRIPTS_VECTOR_INIT): Removed.
(find_data_references_in_loop, compute_data_dependences_for_loop,
dump_ddrs, dump_dist_dir_vectors, dump_data_references,
dump_data_dependence_relations, free_dependence_relations,
free_data_refs): Adjust declaration.
(lambda_transform_legal_p): Move declaration here...
* tree-vect-analyze.c (vect_analyze_data_ref_dependences,
vect_compute_data_refs_alignment, vect_verify_datarefs_alignment,
vect_enhance_data_refs_alignment, vect_analyze_data_ref_accesses,
vect_analyze_data_refs): Use VEC instead of VARRAY.
* lambda.h (lambda_transform_legal_p): ...from here.
* lambda-code.c (lambda_transform_legal_p): Use VEC instead of VARRAY.
* tree-vect-transform.c (vect_update_inits_of_drs): Idem.
* Makefile.in (tree-loop-linear.o, lambda-mat.o, lambda-trans.o,
tree-chrec.o): Don't depend on VARRAY_H.
From-SVN: r112437
2006-03-28 06:19:26 +02:00
|
|
|
for (i = 0; VEC_iterate (ddr_p, dependence_relations, i, ddr); i++)
|
2004-08-26 19:10:50 +02:00
|
|
|
{
|
|
|
|
/* Don't care about relations for which we know that there is no
|
2004-09-16 18:16:14 +02:00
|
|
|
dependence, nor about read-read (aka. output-dependences):
|
|
|
|
these data accesses can happen in any order. */
|
2004-08-26 19:10:50 +02:00
|
|
|
if (DDR_ARE_DEPENDENT (ddr) == chrec_known
|
|
|
|
|| (DR_IS_READ (DDR_A (ddr)) && DR_IS_READ (DDR_B (ddr))))
|
|
|
|
continue;
|
2004-11-01 19:08:02 +01:00
|
|
|
|
2004-08-26 19:10:50 +02:00
|
|
|
/* Conservatively answer: "this transformation is not valid". */
|
|
|
|
if (DDR_ARE_DEPENDENT (ddr) == chrec_dont_know)
|
|
|
|
return false;
|
2004-11-01 19:08:02 +01:00
|
|
|
|
|
|
|
/* If the dependence could not be captured by a distance vector,
|
|
|
|
conservatively answer that the transform is not valid. */
|
2005-11-05 17:50:47 +01:00
|
|
|
if (DDR_NUM_DIST_VECTS (ddr) == 0)
|
2004-11-01 19:08:02 +01:00
|
|
|
return false;
|
2004-08-26 19:10:50 +02:00
|
|
|
|
|
|
|
/* Compute trans.dist_vect */
|
2005-11-05 17:50:47 +01:00
|
|
|
for (j = 0; j < DDR_NUM_DIST_VECTS (ddr); j++)
|
|
|
|
{
|
|
|
|
lambda_matrix_vector_mult (LTM_MATRIX (trans), nb_loops, nb_loops,
|
|
|
|
DDR_DIST_VECT (ddr, j), distres);
|
2004-08-26 19:10:50 +02:00
|
|
|
|
2005-11-05 17:50:47 +01:00
|
|
|
if (!lambda_vector_lexico_pos (distres, nb_loops))
|
|
|
|
return false;
|
|
|
|
}
|
2004-08-26 19:10:50 +02:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|