2004-06-30 17:37:42 +02:00
|
|
|
|
/* Chains of recurrences.
|
attribs.c, [...]: Update copyright.
* attribs.c, c-pragma.c, caller-save.c, cfghooks.h,
coverage.c, cselib.h, domwalk.c, domwalk.h, errors.c,
errors.h, gcov-dump.c, gcov-io.c, gcov-io.h, gen-protos.c,
genattrtab.h, genextract.c, gthr-win32.h, insn-notes.def,
integrate.c, lambda-mat.c, lambda.h, libgcov.c, local-alloc.c,
machmode.def, mips-tfile.c, params.c, pretty-print.c,
print-rtl.c, protoize.c, regmove.c, sched-vis.c, tree-chrec.h,
tree-data-ref.h, vec.h, config/darwin-c.c, config/sol2-c.c,
config/sol2.c, config/arm/arm-cores.def, config/arm/cirrus.md,
config/arm/symbian.h, config/c4x/c4x.c, config/c4x/c4x.h,
config/i386/cygming.h, config/i386/djgpp.h,
config/i386/lynx.h, config/i386/netware.c,
config/i386/winnt.c, config/ia64/ia64-c.c,
config/iq2000/iq2000.c, config/m32r/little.h,
config/m68k/m68k-protos.h, config/m68k/m68k.h,
config/m68k/m68k.md, config/mcore/mcore.c,
config/mcore/mcore.h, config/mmix/mmix.c, config/mmix/mmix.md,
config/mn10300/mn10300-protos.h, config/mn10300/mn10300.c,
config/mn10300/mn10300.h, config/ns32k/netbsd.h,
config/ns32k/ns32k.c, config/ns32k/ns32k.h,
config/pa/pa-hpux11.h, config/pdp11/pdp11.c,
config/pdp11/pdp11.h, config/rs6000/darwin.h,
config/rs6000/default64.h, config/rs6000/rs6000-c.c,
config/s390/2064.md, config/s390/2084.md,
config/s390/s390-modes.def, config/s390/s390-protos.h,
config/s390/tpf.h, config/sh/sh.h, config/sh/symbian.c,
config/stormy16/stormy16.c, config/vax/vax-protos.h,
config/vax/vax.c, config/vax/vax.h,
config/xtensa/lib1funcs.asm, config/xtensa/xtensa.md: Update
copyright.
From-SVN: r98914
2005-04-28 07:38:50 +02:00
|
|
|
|
Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc.
|
2004-06-30 17:37:42 +02:00
|
|
|
|
Contributed by Sebastian Pop <s.pop@laposte.net>
|
|
|
|
|
|
|
|
|
|
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-06-30 17:37:42 +02:00
|
|
|
|
|
|
|
|
|
#ifndef GCC_TREE_CHREC_H
|
|
|
|
|
#define GCC_TREE_CHREC_H
|
|
|
|
|
|
|
|
|
|
/* Accessors for the chains of recurrences. */
|
|
|
|
|
#define CHREC_VAR(NODE) TREE_OPERAND (NODE, 0)
|
|
|
|
|
#define CHREC_LEFT(NODE) TREE_OPERAND (NODE, 1)
|
|
|
|
|
#define CHREC_RIGHT(NODE) TREE_OPERAND (NODE, 2)
|
|
|
|
|
#define CHREC_VARIABLE(NODE) TREE_INT_CST_LOW (CHREC_VAR (NODE))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* The following trees are unique elements. Thus the comparison of another
|
|
|
|
|
element to these elements should be done on the pointer to these trees,
|
|
|
|
|
and not on their value. */
|
|
|
|
|
|
|
|
|
|
extern tree chrec_not_analyzed_yet;
|
|
|
|
|
extern GTY(()) tree chrec_dont_know;
|
|
|
|
|
extern GTY(()) tree chrec_known;
|
|
|
|
|
|
|
|
|
|
/* After having added an automatically generated element, please
|
|
|
|
|
include it in the following function. */
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
automatically_generated_chrec_p (tree chrec)
|
|
|
|
|
{
|
|
|
|
|
return (chrec == chrec_not_analyzed_yet
|
|
|
|
|
|| chrec == chrec_dont_know
|
|
|
|
|
|| chrec == chrec_known);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* The tree nodes aka. CHRECs. */
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
tree_is_chrec (tree expr)
|
|
|
|
|
{
|
|
|
|
|
if (TREE_CODE (expr) == POLYNOMIAL_CHREC
|
|
|
|
|
|| automatically_generated_chrec_p (expr))
|
|
|
|
|
return true;
|
|
|
|
|
else
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Chrec folding functions. */
|
|
|
|
|
extern tree chrec_fold_plus (tree, tree, tree);
|
|
|
|
|
extern tree chrec_fold_minus (tree, tree, tree);
|
|
|
|
|
extern tree chrec_fold_multiply (tree, tree, tree);
|
2005-06-07 21:51:25 +02:00
|
|
|
|
extern tree chrec_convert (tree, tree, tree);
|
2005-09-20 09:09:20 +02:00
|
|
|
|
extern tree chrec_convert_aggressive (tree, tree);
|
2004-06-30 17:37:42 +02:00
|
|
|
|
extern tree chrec_type (tree);
|
|
|
|
|
|
|
|
|
|
/* Operations. */
|
|
|
|
|
extern tree chrec_apply (unsigned, tree, tree);
|
|
|
|
|
extern tree chrec_replace_initial_condition (tree, tree);
|
|
|
|
|
extern tree initial_condition (tree);
|
2004-09-19 20:01:51 +02:00
|
|
|
|
extern tree initial_condition_in_loop_num (tree, unsigned);
|
2004-06-30 17:37:42 +02:00
|
|
|
|
extern tree evolution_part_in_loop_num (tree, unsigned);
|
|
|
|
|
extern tree hide_evolution_in_other_loops_than_loop (tree, unsigned);
|
|
|
|
|
extern tree reset_evolution_in_loop (unsigned, tree, tree);
|
|
|
|
|
extern tree chrec_merge (tree, tree);
|
|
|
|
|
|
|
|
|
|
/* Observers. */
|
|
|
|
|
extern bool is_multivariate_chrec (tree);
|
|
|
|
|
extern bool chrec_is_positive (tree, bool *);
|
|
|
|
|
extern bool chrec_contains_symbols (tree);
|
|
|
|
|
extern bool chrec_contains_symbols_defined_in_loop (tree, unsigned);
|
|
|
|
|
extern bool chrec_contains_undetermined (tree);
|
2005-04-21 10:48:55 +02:00
|
|
|
|
extern bool tree_contains_chrecs (tree, int *);
|
2004-06-30 17:37:42 +02:00
|
|
|
|
extern bool evolution_function_is_affine_multivariate_p (tree);
|
|
|
|
|
extern bool evolution_function_is_univariate_p (tree);
|
Makefile.in (tree-ssa-loop-niter.o): Depends on tree-data-ref.h.
2004-10-11 Sebastian Pop <pop@cri.ensmp.fr>
* Makefile.in (tree-ssa-loop-niter.o): Depends on tree-data-ref.h.
* cfgloop.c (initialize_loops_parallel_p): New.
(flow_loops_find): Initialize the parallel_p field to true for all
the loops.
* tree-ssa-loop-niter.c: Include "tree-data-ref.h".
(estimate_numbers_of_iterations_loop): Infers the loop bounds from
the size of the data accessed in the loop.
(struct nb_iter_bound): Moved...
* cfgloop.h (struct nb_iter_bound): ... here.
(estimated_nb_iterations, parallel_p): New fields in struct loop.
(record_estimate): Declare extern here.
* tree-chrec.c: Fix comments.
(nb_vars_in_chrec): New function.
* tree-chrec.h (nb_vars_in_chrec): Declared here.
* tree-data-ref.c: Don't include lambda.h, that is already included
in tree-data-ref.h.
(tree_fold_divides_p): Don't check for integer_onep.
(tree_fold_bezout): Removed.
(gcd): New static duplicated function.
(int_divides_p, dump_subscript): New.
(dump_data_dependence_relation): Use dump_subscript.
(dump_dist_dir_vectors, dump_ddrs, compute_estimated_nb_iterations,
estimate_niter_from_size_of_data): New.
(analyze_array_indexes, analyze_array): Call
estimate_niter_from_size_of_data during the detection of array
references. Pass in a pointer to the statement that contains the
array reference.
(all_chrecs_equal_p): New.
(compute_distance_vector): Renamed compute_subscript_distance.
Deal with multivariate conflict functions.
(initialize_data_dependence_relation): Initialize DDR_AFFINE_P,
DDR_SIZE_VECT, DDR_DIST_VECT, and DDR_DIR_VECT.
(non_affine_dependence_relation): New.
(analyze_ziv_subscript, analyze_siv_subscript_cst_affine,
analyze_siv_subscript, analyze_miv_subscript,
analyze_overlapping_iterations, subscript_dependence_tester):
Initialize and return last_conflicts function.
(initialize_matrix_A, FLOOR, compute_overlap_steps_for_affine_univar,
compute_overlap_steps_for_affine_1_2): New.
(analyze_siv_subscript_affine_cst): Removed.
(analyze_subscript_affine_affine): Disprove dependences based on the
iteration domains. Solve the univariate dependence case as before,
but use lambda_matrix_right_hermite instead of tree_fold_bezout.
Implement the multivariate case of 2 versus 1 variables.
(build_classic_dist_vector, build_classic_dir_vector): Implement some
unhandled cases.
(find_data_references_in_loop): Compute and initialize
loop->estimated_nb_iterations and loop->parallel_p.
(analyze_all_data_dependences): Modify the debug dump order.
* tree-data-ref.h (SUB_LAST_CONFLICT_IN_A, SUB_LAST_CONFLICT_IN_B,
subscript->last_conflict_in_a, subscript->last_conflict_in_b): Removed.
(SUB_LAST_CONFLICT, subscript->last_conflict,
data_dependence_relation->affine_p, data_dependence_relation->size_vect,
DDR_AFFINE_P, DDR_SIZE_VECT): New.
(find_data_references_in_loop, initialize_data_dependence_relation,
dump_subscript, dump_ddrs, dump_dist_dir_vectors): Declared here.
From-SVN: r88965
2004-10-13 05:48:03 +02:00
|
|
|
|
extern unsigned nb_vars_in_chrec (tree);
|
2004-06-30 17:37:42 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Build a polynomial chain of recurrence. */
|
|
|
|
|
|
|
|
|
|
static inline tree
|
|
|
|
|
build_polynomial_chrec (unsigned loop_num,
|
|
|
|
|
tree left,
|
|
|
|
|
tree right)
|
|
|
|
|
{
|
|
|
|
|
if (left == chrec_dont_know
|
|
|
|
|
|| right == chrec_dont_know)
|
|
|
|
|
return chrec_dont_know;
|
|
|
|
|
|
tree-ssa-loop-im.c (schedule_sm): Use buildN instead of build.
2005-12-02 Richard Guenther <rguenther@suse.de>
* tree-ssa-loop-im.c (schedule_sm): Use buildN instead of build.
* tree-complex.c (update_complex_assignment, expand_complex_div_wide):
Likewise.
* tree-ssa-ccp.c (maybe_fold_offset_to_array_ref,
maybe_fold_offset_to_component_ref): Likewise.
* tree-ssa-dom.c (thread_across_edge,
simplify_rhs_and_lookup_avail_expr,
find_equivalent_equality_comparison, record_equivalences_from_stmt):
Likewise.
* gimple-low.c (lower_function_body, lower_return_expr): Likewise.
* tree-eh.c (do_return_redirection, honor_protect_cleanup_actions,
lower_try_finally_switch): Likewise.
* tree-if-conv.c (add_to_dst_predicate_list,
replace_phi_with_cond_modify_expr, ifc_temp_var): Likewise.
* gimplify.c (internal_get_tmp_var, gimple_build_eh_filter,
voidify_wrapper_expr, build_stack_save_restore, gimplify_bind_expr,
gimplify_return_expr, gimplify_decl_expr, gimplify_switch_expr,
gimplify_case_label_expr, gimplify_exit_expr, gimplify_self_mod_expr,
shortcut_cond_r, shortcut_cond_expr, gimplify_cond_expr,
gimplify_init_ctor_eval, gimplify_init_constructor,
gimplify_variable_sized_compare, gimplify_boolean_expr,
gimplify_cleanup_point_expr, gimple_push_cleanup, gimplify_target_expr,
gimplify_expr, gimplify_body, gimplify_function_tree,
force_gimple_operand): Likewise.
* tree-ssa-pre.c (create_expression_by_pieces): Likewise.
* tree-mudflap.c (mf_decl_cache_locals, mf_build_check_statement_for,
mx_register_decls): Likewise.
* tree-nested.c (init_tmp_var, save_tmp_var, get_static_chain,
get_frame_field, finalize_nesting_tree_1): Likewise.
* tree-inline.c (setup_one_parameter): Likewise.
* tree-vect-transform.c (vectorizable_condition): Likewise.
* tree-outof-ssa.c (insert_copy_on_edge, insert_backedge_copies):
Likewise.
* tree-profile.c (tree_gen_edge_profiler): Likewise.
* tree-cfg.c (factor_computed_gotos, gimplify_val): Likewise.
* c-parser.c (c_parser_if_body, c_parser_switch_statement): Likewise.
* tree-chrec.h (build_polynomial_chrec): Likewise.
From-SVN: r107907
2005-12-02 18:09:40 +01:00
|
|
|
|
return build3 (POLYNOMIAL_CHREC, TREE_TYPE (left),
|
|
|
|
|
build_int_cst (NULL_TREE, loop_num), left, right);
|
2004-06-30 17:37:42 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Observers. */
|
|
|
|
|
|
|
|
|
|
/* Determines whether CHREC is equal to zero. */
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
chrec_zerop (tree chrec)
|
|
|
|
|
{
|
|
|
|
|
if (chrec == NULL_TREE)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
if (TREE_CODE (chrec) == INTEGER_CST)
|
|
|
|
|
return integer_zerop (chrec);
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Determines whether the expression CHREC is a constant. */
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
evolution_function_is_constant_p (tree chrec)
|
|
|
|
|
{
|
|
|
|
|
if (chrec == NULL_TREE)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
switch (TREE_CODE (chrec))
|
|
|
|
|
{
|
|
|
|
|
case INTEGER_CST:
|
|
|
|
|
case REAL_CST:
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2005-06-07 21:51:25 +02:00
|
|
|
|
extern bool evolution_function_is_invariant_p (tree, int);
|
2004-06-30 17:37:42 +02:00
|
|
|
|
/* Determine whether the given tree is an affine evolution function or not. */
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
evolution_function_is_affine_p (tree chrec)
|
|
|
|
|
{
|
|
|
|
|
if (chrec == NULL_TREE)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
switch (TREE_CODE (chrec))
|
|
|
|
|
{
|
|
|
|
|
case POLYNOMIAL_CHREC:
|
2005-06-07 21:51:25 +02:00
|
|
|
|
if (evolution_function_is_invariant_p (CHREC_LEFT (chrec),
|
|
|
|
|
CHREC_VARIABLE (chrec))
|
|
|
|
|
&& evolution_function_is_invariant_p (CHREC_RIGHT (chrec),
|
|
|
|
|
CHREC_VARIABLE (chrec)))
|
2004-06-30 17:37:42 +02:00
|
|
|
|
return true;
|
|
|
|
|
else
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Determine whether the given tree is an affine or constant evolution
|
|
|
|
|
function. */
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
evolution_function_is_affine_or_constant_p (tree chrec)
|
|
|
|
|
{
|
|
|
|
|
return evolution_function_is_affine_p (chrec)
|
|
|
|
|
|| evolution_function_is_constant_p (chrec);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Determines whether EXPR does not contains chrec expressions. */
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
tree_does_not_contain_chrecs (tree expr)
|
|
|
|
|
{
|
2005-04-21 10:48:55 +02:00
|
|
|
|
return !tree_contains_chrecs (expr, NULL);
|
2004-06-30 17:37:42 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Determines whether CHREC is a loop invariant with respect to LOOP_NUM.
|
|
|
|
|
Set the result in RES and return true when the property can be computed. */
|
|
|
|
|
|
|
|
|
|
static inline bool
|
|
|
|
|
no_evolution_in_loop_p (tree chrec, unsigned loop_num, bool *res)
|
|
|
|
|
{
|
|
|
|
|
tree scev;
|
|
|
|
|
|
|
|
|
|
if (chrec == chrec_not_analyzed_yet
|
|
|
|
|
|| chrec == chrec_dont_know
|
|
|
|
|
|| chrec_contains_symbols_defined_in_loop (chrec, loop_num))
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
scev = hide_evolution_in_other_loops_than_loop (chrec, loop_num);
|
|
|
|
|
*res = !tree_is_chrec (scev);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif /* GCC_TREE_CHREC_H */
|