gcc/gcc/tree-sra.c

3679 lines
100 KiB
C
Raw Normal View History

/* Scalar Replacement of Aggregates (SRA) converts some structure
references into scalar references, exposing them to the scalar
optimizers.
Copyright (C) 2003, 2004, 2005, 2006, 2007
Free Software Foundation, Inc.
Contributed by Diego Novillo <dnovillo@redhat.com>
This file is part of GCC.
GCC is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3, 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 COPYING3. If not see
<http://www.gnu.org/licenses/>. */
#include "config.h"
#include "system.h"
#include "coretypes.h"
#include "tm.h"
#include "ggc.h"
#include "tree.h"
/* These RTL headers are needed for basic-block.h. */
#include "rtl.h"
#include "tm_p.h"
#include "hard-reg-set.h"
#include "basic-block.h"
#include "diagnostic.h"
#include "langhooks.h"
#include "tree-inline.h"
#include "tree-flow.h"
#include "tree-gimple.h"
#include "tree-dump.h"
#include "tree-pass.h"
#include "timevar.h"
#include "flags.h"
#include "bitmap.h"
#include "obstack.h"
#include "target.h"
/* expr.h is needed for MOVE_RATIO. */
#include "expr.h"
#include "params.h"
/* This object of this pass is to replace a non-addressable aggregate with a
set of independent variables. Most of the time, all of these variables
will be scalars. But a secondary objective is to break up larger
aggregates into smaller aggregates. In the process we may find that some
bits of the larger aggregate can be deleted as unreferenced.
This substitution is done globally. More localized substitutions would
be the purvey of a load-store motion pass.
The optimization proceeds in phases:
(1) Identify variables that have types that are candidates for
decomposition.
(2) Scan the function looking for the ways these variables are used.
In particular we're interested in the number of times a variable
(or member) is needed as a complete unit, and the number of times
a variable (or member) is copied.
(3) Based on the usage profile, instantiate substitution variables.
(4) Scan the function making replacements.
*/
/* True if this is the "early" pass, before inlining. */
static bool early_sra;
/* The set of todo flags to return from tree_sra. */
static unsigned int todoflags;
/* The set of aggregate variables that are candidates for scalarization. */
static bitmap sra_candidates;
/* Set of scalarizable PARM_DECLs that need copy-in operations at the
beginning of the function. */
static bitmap needs_copy_in;
/* Sets of bit pairs that cache type decomposition and instantiation. */
static bitmap sra_type_decomp_cache;
static bitmap sra_type_inst_cache;
/* One of these structures is created for each candidate aggregate and
each (accessed) member or group of members of such an aggregate. */
struct sra_elt
{
/* A tree of the elements. Used when we want to traverse everything. */
struct sra_elt *parent;
struct sra_elt *groups;
struct sra_elt *children;
struct sra_elt *sibling;
/* If this element is a root, then this is the VAR_DECL. If this is
a sub-element, this is some token used to identify the reference.
In the case of COMPONENT_REF, this is the FIELD_DECL. In the case
of an ARRAY_REF, this is the (constant) index. In the case of an
ARRAY_RANGE_REF, this is the (constant) RANGE_EXPR. In the case
of a complex number, this is a zero or one. */
tree element;
/* The type of the element. */
tree type;
/* A VAR_DECL, for any sub-element we've decided to replace. */
tree replacement;
/* The number of times the element is referenced as a whole. I.e.
given "a.b.c", this would be incremented for C, but not for A or B. */
unsigned int n_uses;
/* The number of times the element is copied to or from another
scalarizable element. */
unsigned int n_copies;
/* True if TYPE is scalar. */
bool is_scalar;
/* True if this element is a group of members of its parent. */
bool is_group;
/* True if we saw something about this element that prevents scalarization,
such as non-constant indexing. */
bool cannot_scalarize;
/* True if we've decided that structure-to-structure assignment
should happen via memcpy and not per-element. */
bool use_block_copy;
tree-ssa.texi: Remove references to VDEF and add descriptions of V_MAY_DEF and V_MUST_DEF. * doc/tree-ssa.texi: Remove references to VDEF and add descriptions of V_MAY_DEF and V_MUST_DEF. * tree-dfa.c (dfa_stats_d): Add num_v_must_defs and rename num_vdefs to num_v_may_defs. (compute_immediate_uses_for_stmt): Rename occurences of vdef to v_may_def. (redirect_immediate_uses): Ditto. (dump_dfa_stats): Ditto. Also added code to dump num_v_must_defs. (collect_dfa_stats_r): Rename occurences of vdef to v_may_def. Also add code to sum up the number of v_must_defs. (vdefs_disappeared_p): Replace with... (v_may_defs_disappeared_p): This. (v_must_defs_disappeared_p): New function. (mark_new_vars_to_rename): Rename occurences of vdef to v_may_def. Also add code to mark new variables found in V_MUST_DEFs for renameing. * tree-flow.h (stmt_ann_d): Add v_must_def_ops and replace vdef_ops to v_may_def_ops. (get_vdef_ops): Replace with... (get_v_may_def_ops): This. * tree-flow-inline.h (get_vdef_ops): Replace with... (get_v_may_def_ops): This. (get_v_must_def_ops): New function. (get_vdef_result_ptr): Replace with... (get_v_may_def_result_ptr): This. (get_vdef_op_ptr): Ditto with... (get_v_may_def_op_ptr); This. (get_v_must_def_op_ptr): New function. * tree-into-ssa.c (mark_def_sites): Rename occurences of vdef to v_may_def. Also add code to mark statements with V_MUST_DEFs as definition sites. (rewrite_stmt): Rename occurences of vdef to v_may_def. Also add code to register new V_MUST_DEFs made by the statement. * tree-outof-ssa.c (VIRTUAL_PARTITION): Update comments. (check_replaceable): Rename occurences of vdef to v_may_def. Also add check for V_MUST_DEFs. (find_replaceable_in_bb): Ditto. * tree-pretty-print.c (dump_vops): Rename occurences of vdef to v_may_def. Also add code to dump V_MUST_DEFs. * tree-sra.c (mark_all_vdefs): Replace with... (mark_all_v_may_defs): This. (mark_all_v_must_defs): New function. (create_scalar_copies): Replace call to mark_all_vdefs with calls to mark_all_v_may_defs and mark_all_v_must_defs. (scalarize_structures): Rename occurences of vdef to v_may_def. Also add a check for V_MUST_DEFs. (scalarize_modify_expr): Rename occurences of vdef to v_may_def. * tree-ssa-alias.c (global_var): Update comment. (compute_may_aliases): Ditto. (compute_points_to_and_addr_escape): Rename occurences of vdef to v_may_def. Also add code to mark variables in V_MUST_DEF operands as being written to. (group_aliases): Update comment. (maybe_create_global_var): Ditto. * tree-ssa.c (verify_ssa): Rename occurences of vdef to v_may_def. Also add a check for V_MUST_DEFs on GIMPLE registers. (replace_immediate_uses): Rename occurences of vdef to v_may_def. * tree-ssa-ccp.c (visit_stmt): Rename occurences of vdef to v_may_def. Also add code to mark all V_MUST_DEF operands VARYING. (initialize): Ditto. (set_rhs): Rename occurences of vdef to v_may_def. Also add code to update SSA_NAMEs in V_MUST_DEFs. * tree-ssa-copy.c (cprop_into_stmt): Rename occurences of vdef to v_may_def. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Rename occurences of vdef to v_may_def. Also add code to mark statements with V_MUST_DEFs as necessary. (propagate_necessity): Rename occurences of vdef to v_may_def. * tree-ssa-dom.c (redirect_edges_and_update_ssa_graph): Rename occurences of vdef to v_may_def. Also add code to mark operands in V_MUST_DEFs for renaming. (eliminate_redundant_computations): Rename occurences of vdef to v_may_def. (record_equivalences_from_stmt): Rename occurences of vdef to v_may_def. Also add code to record VUSEs for V_MUST_DEFs. (optimize_stmt): Remove unnesessary variable vdefs. Update comment. (register_definitions_for_stmt): Rename occurences of vdef to v_may_def. Also add code to register definitions made with V_MUST_DEFs. * tree-ssa-dse.c (fix_stmt_vdefs): Replace with... (fix_stmt_v_may_defs): This. (fix_phi_uses): Rename occurences of vdef to v_may_def. (dse_optimize_stmt): Ditto. * tree-ssa-live.c (create_ssa_var_map): Rename occurences of vdef to v_may_def. Also add code to mark V_MUST_DEF operands as being used in virtual operators. * tree-ssa-loop.c (mark_defs_for_rewrite): Rename occurences of vdef to v_may_def. Also add code to mark V_MUST_DEF operands for renaming. * tree-ssa-operands.c (opf_kill_def): New flag for killing definitions. (build_vdefs): Renamed to... (build_v_may_defs): This. (build_v_must_defs): New variable. (voperands_d): Add v_must_def_ops and replace vdef_ops with v_may_def_ops. (append_vdef): Replace with... (append_v_may_def): This. (append_v_must_def): New function. (NUM_FREE): Increment for V_MUST_DEF (optype_freelist): Increment its size for V_MUST_DEF (allocate_vdef_optype): Replace with... (allocate_v_may_def_optype): This. (allocate_v_must_def_optype): New function. (free_vdefs): Replace with... (free_v_may_defs): This. (free_v_must_defs): New function. (remove_vdefs): Replace with... (remove_v_may_defs): This. (remove_v_must_defs): New function. (init_ssa_operands): Rename occurences of vdef to v_may_def. Also add code to initialize build_v_must_defs. (finalize_ssa_vdefs): Replace with... (finalize_ssa_v_may_defs): This. (finalize_ssa_vuses): Rename occurences of vdef to v_may_def. (finalize_ssa_v_must_defs): New function. (finalize_ssa_stmt_operands): Replace call to finalize_ssa_vdefs with calls to finalize_ssa_v_may_defs and finalize_ssa_v_must_defs. (verify_start_operands): Rename occurences of vdef to v_may_def. Also add check for build_v_must_defs. (get_stmt_operands): Rename occurences of vdef to v_may_def. Also add code to handle V_MUST_DEFs and to use opf_kill_def for killing definitions. (get_expr_operands): Update comment and use opf_kill_def for killing definitions. (add_stmt_operand): Replace code that appends VDEFs with code that appends V_MUST_DEFs when opf_kill_def is set and V_MAY_DEFs otherwise. (add_call_clobber_ops): Update comments. * tree-ssa-operands.h (vdef_optype_d): Replace with... (v_may_def_optype_d): This. (v_must_def_optype_d): New structure. (VDEF_OPS): Replace with... (V_MAY_DEF_OPS): This. (STMT_VDEF_OPS): Same with... (STMT_V_MAY_DEF_OPS): This. (NUM_VDEFS): And... (NUM_V_MAY_DEFS): This. (VDEF_RESULT_PTR): As well as... (V_MAY_DEF_RESULT_PTR): This. (VDEF_RESULT): Same goes for... (V_MAY_DEF_RESULT): This. (VDEF_OP_PTR): And... (V_MAY_DEF_OP_PTR): This. (VDEF_OP): And... (V_MAY_DEF_OP): This. (V_MUST_DEF_OPS): New macro. (STMT_V_MUST_DEF_OPS): Ditto. (NUM_V_MUST_DEFS): Ditto. (V_MUST_DEF_OP_PTR): Ditto. (V_MUST_DEF_OP): Ditto. (remove_vdefs): Replace signature with... (remove_v_may_defs): This. (remove_v_must_defs): New function signature. * tree-ssa-pre.c (subst_phis): Replace call to remove_vdefs with calls to remove_v_may_defs and remove_v_must_defs. (process_left_occs_and_kills): Rename occurences of vdef to v_may_def. Also add code that marks left occurences of operands in V_MUST_DEFs. * tree-tailcall.c (find_tail_calls): Rename occurences of vdef to v_may_def. Also add check for V_MUST_DEFs. (eliminate_tail_call):Rename occurences of vdef to v_may_def. testsuite: * gcc.dg/tree-ssa/20031015-1.c: Scan for V_MAY_DEF instead of VDEF. * gcc.dg/tree-ssa/20040517-1.c: Ditto. From-SVN: r82947
2004-06-10 23:41:08 +02:00
/* True if everything under this element has been marked TREE_NO_WARNING. */
bool all_no_warning;
/* A flag for use with/after random access traversals. */
bool visited;
re PR middle-end/28436 (accessing an element via a "pointer" on a vector does not cause vec_extract to be used) 2006-12-12 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/28436 * tree.h (DECL_COMPLEX_GIMPLE_REG_P): Rename to ... (DECL_GIMPLE_REG_P): This. * fold-const.c (fold_indirect_ref_1): Fold *(foo *)&vectorfoo into using BIT_FIELD_REF. * omp-low.c (omp_copy_decl_2): Use the renamed DECL_GIMPLE_REG_P. * tree-gimple.c (is_gimple_reg): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. * expr.c (get_inner_reference): Set the mode for BIT_FIELD_REF with vector types. * tree-flow-inline.h (var_can_have_subvars): Use the renamed DECL_GIMPLE_REG_P. * gimplify.c (internal_get_tmp_var): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. (gimplify_bind_expr): Likewise. (gimplify_function_tree): Likewise. * expmed.c: Include target.h. (extract_bit_field): For vector mode, try find a better mode first. If that fails use gen_lowpart (for vectors only). * tree-dfa.c (make_rename_temp): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. * tree-ssa-pre.c (create_expressions_by_pieces): Likewise. (insert_into_preds_of_block): Likewise. (insert_fake_stores): Create gimple register store_tmps for vector types. * tree-sra.c (sra_elt): New field, is_vector_lhs. (sra_walk_expr <case BIT_FIELD_REF>): For vector types that are the left hand side, set the element's is_vector_lhs to true. (instantiate_element): For vector types which were on the left hand size, set DECL_GIMPLE_REG_P to false. * tree-nested.c (create_tmp_var_for): Use the renamed DECL_GIMPLE_REG_P. * tree-inline.c (declare_return_variable): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. (copy_decl_to_var): Use the renamed DECL_GIMPLE_REG_P. (copy_result_decl_to_var): Likewise. * tree-vect-transform.c (vect_get_new_vect_var): For vector types, create a gimple register variable. (vect_permute_store_chain): Set DECL_GIMPLE_REG_P to true for the vect_inter_* temp variables. * Makefile.in (expmed.o): Update dependencies. 2006-12-12 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/28436 * gcc.c-torture/compile/vector-1.c: New test. * gcc.c-torture/compile/vector-2.c: New test. * gcc.c-torture/compile/vector-3.c: New test. From-SVN: r119801
2006-12-12 23:33:06 +01:00
/* True if there is BIT_FIELD_REF on the lhs with a vector. */
bool is_vector_lhs;
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
/* 1 if the element is a field that is part of a block, 2 if the field
is the block itself, 0 if it's neither. */
char in_bitfld_block;
};
tree-ssa.texi: Remove references to VDEF and add descriptions of V_MAY_DEF and V_MUST_DEF. * doc/tree-ssa.texi: Remove references to VDEF and add descriptions of V_MAY_DEF and V_MUST_DEF. * tree-dfa.c (dfa_stats_d): Add num_v_must_defs and rename num_vdefs to num_v_may_defs. (compute_immediate_uses_for_stmt): Rename occurences of vdef to v_may_def. (redirect_immediate_uses): Ditto. (dump_dfa_stats): Ditto. Also added code to dump num_v_must_defs. (collect_dfa_stats_r): Rename occurences of vdef to v_may_def. Also add code to sum up the number of v_must_defs. (vdefs_disappeared_p): Replace with... (v_may_defs_disappeared_p): This. (v_must_defs_disappeared_p): New function. (mark_new_vars_to_rename): Rename occurences of vdef to v_may_def. Also add code to mark new variables found in V_MUST_DEFs for renameing. * tree-flow.h (stmt_ann_d): Add v_must_def_ops and replace vdef_ops to v_may_def_ops. (get_vdef_ops): Replace with... (get_v_may_def_ops): This. * tree-flow-inline.h (get_vdef_ops): Replace with... (get_v_may_def_ops): This. (get_v_must_def_ops): New function. (get_vdef_result_ptr): Replace with... (get_v_may_def_result_ptr): This. (get_vdef_op_ptr): Ditto with... (get_v_may_def_op_ptr); This. (get_v_must_def_op_ptr): New function. * tree-into-ssa.c (mark_def_sites): Rename occurences of vdef to v_may_def. Also add code to mark statements with V_MUST_DEFs as definition sites. (rewrite_stmt): Rename occurences of vdef to v_may_def. Also add code to register new V_MUST_DEFs made by the statement. * tree-outof-ssa.c (VIRTUAL_PARTITION): Update comments. (check_replaceable): Rename occurences of vdef to v_may_def. Also add check for V_MUST_DEFs. (find_replaceable_in_bb): Ditto. * tree-pretty-print.c (dump_vops): Rename occurences of vdef to v_may_def. Also add code to dump V_MUST_DEFs. * tree-sra.c (mark_all_vdefs): Replace with... (mark_all_v_may_defs): This. (mark_all_v_must_defs): New function. (create_scalar_copies): Replace call to mark_all_vdefs with calls to mark_all_v_may_defs and mark_all_v_must_defs. (scalarize_structures): Rename occurences of vdef to v_may_def. Also add a check for V_MUST_DEFs. (scalarize_modify_expr): Rename occurences of vdef to v_may_def. * tree-ssa-alias.c (global_var): Update comment. (compute_may_aliases): Ditto. (compute_points_to_and_addr_escape): Rename occurences of vdef to v_may_def. Also add code to mark variables in V_MUST_DEF operands as being written to. (group_aliases): Update comment. (maybe_create_global_var): Ditto. * tree-ssa.c (verify_ssa): Rename occurences of vdef to v_may_def. Also add a check for V_MUST_DEFs on GIMPLE registers. (replace_immediate_uses): Rename occurences of vdef to v_may_def. * tree-ssa-ccp.c (visit_stmt): Rename occurences of vdef to v_may_def. Also add code to mark all V_MUST_DEF operands VARYING. (initialize): Ditto. (set_rhs): Rename occurences of vdef to v_may_def. Also add code to update SSA_NAMEs in V_MUST_DEFs. * tree-ssa-copy.c (cprop_into_stmt): Rename occurences of vdef to v_may_def. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Rename occurences of vdef to v_may_def. Also add code to mark statements with V_MUST_DEFs as necessary. (propagate_necessity): Rename occurences of vdef to v_may_def. * tree-ssa-dom.c (redirect_edges_and_update_ssa_graph): Rename occurences of vdef to v_may_def. Also add code to mark operands in V_MUST_DEFs for renaming. (eliminate_redundant_computations): Rename occurences of vdef to v_may_def. (record_equivalences_from_stmt): Rename occurences of vdef to v_may_def. Also add code to record VUSEs for V_MUST_DEFs. (optimize_stmt): Remove unnesessary variable vdefs. Update comment. (register_definitions_for_stmt): Rename occurences of vdef to v_may_def. Also add code to register definitions made with V_MUST_DEFs. * tree-ssa-dse.c (fix_stmt_vdefs): Replace with... (fix_stmt_v_may_defs): This. (fix_phi_uses): Rename occurences of vdef to v_may_def. (dse_optimize_stmt): Ditto. * tree-ssa-live.c (create_ssa_var_map): Rename occurences of vdef to v_may_def. Also add code to mark V_MUST_DEF operands as being used in virtual operators. * tree-ssa-loop.c (mark_defs_for_rewrite): Rename occurences of vdef to v_may_def. Also add code to mark V_MUST_DEF operands for renaming. * tree-ssa-operands.c (opf_kill_def): New flag for killing definitions. (build_vdefs): Renamed to... (build_v_may_defs): This. (build_v_must_defs): New variable. (voperands_d): Add v_must_def_ops and replace vdef_ops with v_may_def_ops. (append_vdef): Replace with... (append_v_may_def): This. (append_v_must_def): New function. (NUM_FREE): Increment for V_MUST_DEF (optype_freelist): Increment its size for V_MUST_DEF (allocate_vdef_optype): Replace with... (allocate_v_may_def_optype): This. (allocate_v_must_def_optype): New function. (free_vdefs): Replace with... (free_v_may_defs): This. (free_v_must_defs): New function. (remove_vdefs): Replace with... (remove_v_may_defs): This. (remove_v_must_defs): New function. (init_ssa_operands): Rename occurences of vdef to v_may_def. Also add code to initialize build_v_must_defs. (finalize_ssa_vdefs): Replace with... (finalize_ssa_v_may_defs): This. (finalize_ssa_vuses): Rename occurences of vdef to v_may_def. (finalize_ssa_v_must_defs): New function. (finalize_ssa_stmt_operands): Replace call to finalize_ssa_vdefs with calls to finalize_ssa_v_may_defs and finalize_ssa_v_must_defs. (verify_start_operands): Rename occurences of vdef to v_may_def. Also add check for build_v_must_defs. (get_stmt_operands): Rename occurences of vdef to v_may_def. Also add code to handle V_MUST_DEFs and to use opf_kill_def for killing definitions. (get_expr_operands): Update comment and use opf_kill_def for killing definitions. (add_stmt_operand): Replace code that appends VDEFs with code that appends V_MUST_DEFs when opf_kill_def is set and V_MAY_DEFs otherwise. (add_call_clobber_ops): Update comments. * tree-ssa-operands.h (vdef_optype_d): Replace with... (v_may_def_optype_d): This. (v_must_def_optype_d): New structure. (VDEF_OPS): Replace with... (V_MAY_DEF_OPS): This. (STMT_VDEF_OPS): Same with... (STMT_V_MAY_DEF_OPS): This. (NUM_VDEFS): And... (NUM_V_MAY_DEFS): This. (VDEF_RESULT_PTR): As well as... (V_MAY_DEF_RESULT_PTR): This. (VDEF_RESULT): Same goes for... (V_MAY_DEF_RESULT): This. (VDEF_OP_PTR): And... (V_MAY_DEF_OP_PTR): This. (VDEF_OP): And... (V_MAY_DEF_OP): This. (V_MUST_DEF_OPS): New macro. (STMT_V_MUST_DEF_OPS): Ditto. (NUM_V_MUST_DEFS): Ditto. (V_MUST_DEF_OP_PTR): Ditto. (V_MUST_DEF_OP): Ditto. (remove_vdefs): Replace signature with... (remove_v_may_defs): This. (remove_v_must_defs): New function signature. * tree-ssa-pre.c (subst_phis): Replace call to remove_vdefs with calls to remove_v_may_defs and remove_v_must_defs. (process_left_occs_and_kills): Rename occurences of vdef to v_may_def. Also add code that marks left occurences of operands in V_MUST_DEFs. * tree-tailcall.c (find_tail_calls): Rename occurences of vdef to v_may_def. Also add check for V_MUST_DEFs. (eliminate_tail_call):Rename occurences of vdef to v_may_def. testsuite: * gcc.dg/tree-ssa/20031015-1.c: Scan for V_MAY_DEF instead of VDEF. * gcc.dg/tree-ssa/20040517-1.c: Ditto. From-SVN: r82947
2004-06-10 23:41:08 +02:00
#define IS_ELEMENT_FOR_GROUP(ELEMENT) (TREE_CODE (ELEMENT) == RANGE_EXPR)
#define FOR_EACH_ACTUAL_CHILD(CHILD, ELT) \
for ((CHILD) = (ELT)->is_group \
? next_child_for_group (NULL, (ELT)) \
: (ELT)->children; \
(CHILD); \
(CHILD) = (ELT)->is_group \
? next_child_for_group ((CHILD), (ELT)) \
: (CHILD)->sibling)
/* Helper function for above macro. Return next child in group. */
static struct sra_elt *
next_child_for_group (struct sra_elt *child, struct sra_elt *group)
{
gcc_assert (group->is_group);
/* Find the next child in the parent. */
if (child)
child = child->sibling;
else
child = group->parent->children;
/* Skip siblings that do not belong to the group. */
while (child)
{
tree g_elt = group->element;
if (TREE_CODE (g_elt) == RANGE_EXPR)
{
if (!tree_int_cst_lt (child->element, TREE_OPERAND (g_elt, 0))
&& !tree_int_cst_lt (TREE_OPERAND (g_elt, 1), child->element))
break;
}
else
gcc_unreachable ();
child = child->sibling;
}
return child;
}
/* Random access to the child of a parent is performed by hashing.
This prevents quadratic behavior, and allows SRA to function
reasonably on larger records. */
static htab_t sra_map;
tree-ssa.texi: Remove references to VDEF and add descriptions of V_MAY_DEF and V_MUST_DEF. * doc/tree-ssa.texi: Remove references to VDEF and add descriptions of V_MAY_DEF and V_MUST_DEF. * tree-dfa.c (dfa_stats_d): Add num_v_must_defs and rename num_vdefs to num_v_may_defs. (compute_immediate_uses_for_stmt): Rename occurences of vdef to v_may_def. (redirect_immediate_uses): Ditto. (dump_dfa_stats): Ditto. Also added code to dump num_v_must_defs. (collect_dfa_stats_r): Rename occurences of vdef to v_may_def. Also add code to sum up the number of v_must_defs. (vdefs_disappeared_p): Replace with... (v_may_defs_disappeared_p): This. (v_must_defs_disappeared_p): New function. (mark_new_vars_to_rename): Rename occurences of vdef to v_may_def. Also add code to mark new variables found in V_MUST_DEFs for renameing. * tree-flow.h (stmt_ann_d): Add v_must_def_ops and replace vdef_ops to v_may_def_ops. (get_vdef_ops): Replace with... (get_v_may_def_ops): This. * tree-flow-inline.h (get_vdef_ops): Replace with... (get_v_may_def_ops): This. (get_v_must_def_ops): New function. (get_vdef_result_ptr): Replace with... (get_v_may_def_result_ptr): This. (get_vdef_op_ptr): Ditto with... (get_v_may_def_op_ptr); This. (get_v_must_def_op_ptr): New function. * tree-into-ssa.c (mark_def_sites): Rename occurences of vdef to v_may_def. Also add code to mark statements with V_MUST_DEFs as definition sites. (rewrite_stmt): Rename occurences of vdef to v_may_def. Also add code to register new V_MUST_DEFs made by the statement. * tree-outof-ssa.c (VIRTUAL_PARTITION): Update comments. (check_replaceable): Rename occurences of vdef to v_may_def. Also add check for V_MUST_DEFs. (find_replaceable_in_bb): Ditto. * tree-pretty-print.c (dump_vops): Rename occurences of vdef to v_may_def. Also add code to dump V_MUST_DEFs. * tree-sra.c (mark_all_vdefs): Replace with... (mark_all_v_may_defs): This. (mark_all_v_must_defs): New function. (create_scalar_copies): Replace call to mark_all_vdefs with calls to mark_all_v_may_defs and mark_all_v_must_defs. (scalarize_structures): Rename occurences of vdef to v_may_def. Also add a check for V_MUST_DEFs. (scalarize_modify_expr): Rename occurences of vdef to v_may_def. * tree-ssa-alias.c (global_var): Update comment. (compute_may_aliases): Ditto. (compute_points_to_and_addr_escape): Rename occurences of vdef to v_may_def. Also add code to mark variables in V_MUST_DEF operands as being written to. (group_aliases): Update comment. (maybe_create_global_var): Ditto. * tree-ssa.c (verify_ssa): Rename occurences of vdef to v_may_def. Also add a check for V_MUST_DEFs on GIMPLE registers. (replace_immediate_uses): Rename occurences of vdef to v_may_def. * tree-ssa-ccp.c (visit_stmt): Rename occurences of vdef to v_may_def. Also add code to mark all V_MUST_DEF operands VARYING. (initialize): Ditto. (set_rhs): Rename occurences of vdef to v_may_def. Also add code to update SSA_NAMEs in V_MUST_DEFs. * tree-ssa-copy.c (cprop_into_stmt): Rename occurences of vdef to v_may_def. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Rename occurences of vdef to v_may_def. Also add code to mark statements with V_MUST_DEFs as necessary. (propagate_necessity): Rename occurences of vdef to v_may_def. * tree-ssa-dom.c (redirect_edges_and_update_ssa_graph): Rename occurences of vdef to v_may_def. Also add code to mark operands in V_MUST_DEFs for renaming. (eliminate_redundant_computations): Rename occurences of vdef to v_may_def. (record_equivalences_from_stmt): Rename occurences of vdef to v_may_def. Also add code to record VUSEs for V_MUST_DEFs. (optimize_stmt): Remove unnesessary variable vdefs. Update comment. (register_definitions_for_stmt): Rename occurences of vdef to v_may_def. Also add code to register definitions made with V_MUST_DEFs. * tree-ssa-dse.c (fix_stmt_vdefs): Replace with... (fix_stmt_v_may_defs): This. (fix_phi_uses): Rename occurences of vdef to v_may_def. (dse_optimize_stmt): Ditto. * tree-ssa-live.c (create_ssa_var_map): Rename occurences of vdef to v_may_def. Also add code to mark V_MUST_DEF operands as being used in virtual operators. * tree-ssa-loop.c (mark_defs_for_rewrite): Rename occurences of vdef to v_may_def. Also add code to mark V_MUST_DEF operands for renaming. * tree-ssa-operands.c (opf_kill_def): New flag for killing definitions. (build_vdefs): Renamed to... (build_v_may_defs): This. (build_v_must_defs): New variable. (voperands_d): Add v_must_def_ops and replace vdef_ops with v_may_def_ops. (append_vdef): Replace with... (append_v_may_def): This. (append_v_must_def): New function. (NUM_FREE): Increment for V_MUST_DEF (optype_freelist): Increment its size for V_MUST_DEF (allocate_vdef_optype): Replace with... (allocate_v_may_def_optype): This. (allocate_v_must_def_optype): New function. (free_vdefs): Replace with... (free_v_may_defs): This. (free_v_must_defs): New function. (remove_vdefs): Replace with... (remove_v_may_defs): This. (remove_v_must_defs): New function. (init_ssa_operands): Rename occurences of vdef to v_may_def. Also add code to initialize build_v_must_defs. (finalize_ssa_vdefs): Replace with... (finalize_ssa_v_may_defs): This. (finalize_ssa_vuses): Rename occurences of vdef to v_may_def. (finalize_ssa_v_must_defs): New function. (finalize_ssa_stmt_operands): Replace call to finalize_ssa_vdefs with calls to finalize_ssa_v_may_defs and finalize_ssa_v_must_defs. (verify_start_operands): Rename occurences of vdef to v_may_def. Also add check for build_v_must_defs. (get_stmt_operands): Rename occurences of vdef to v_may_def. Also add code to handle V_MUST_DEFs and to use opf_kill_def for killing definitions. (get_expr_operands): Update comment and use opf_kill_def for killing definitions. (add_stmt_operand): Replace code that appends VDEFs with code that appends V_MUST_DEFs when opf_kill_def is set and V_MAY_DEFs otherwise. (add_call_clobber_ops): Update comments. * tree-ssa-operands.h (vdef_optype_d): Replace with... (v_may_def_optype_d): This. (v_must_def_optype_d): New structure. (VDEF_OPS): Replace with... (V_MAY_DEF_OPS): This. (STMT_VDEF_OPS): Same with... (STMT_V_MAY_DEF_OPS): This. (NUM_VDEFS): And... (NUM_V_MAY_DEFS): This. (VDEF_RESULT_PTR): As well as... (V_MAY_DEF_RESULT_PTR): This. (VDEF_RESULT): Same goes for... (V_MAY_DEF_RESULT): This. (VDEF_OP_PTR): And... (V_MAY_DEF_OP_PTR): This. (VDEF_OP): And... (V_MAY_DEF_OP): This. (V_MUST_DEF_OPS): New macro. (STMT_V_MUST_DEF_OPS): Ditto. (NUM_V_MUST_DEFS): Ditto. (V_MUST_DEF_OP_PTR): Ditto. (V_MUST_DEF_OP): Ditto. (remove_vdefs): Replace signature with... (remove_v_may_defs): This. (remove_v_must_defs): New function signature. * tree-ssa-pre.c (subst_phis): Replace call to remove_vdefs with calls to remove_v_may_defs and remove_v_must_defs. (process_left_occs_and_kills): Rename occurences of vdef to v_may_def. Also add code that marks left occurences of operands in V_MUST_DEFs. * tree-tailcall.c (find_tail_calls): Rename occurences of vdef to v_may_def. Also add check for V_MUST_DEFs. (eliminate_tail_call):Rename occurences of vdef to v_may_def. testsuite: * gcc.dg/tree-ssa/20031015-1.c: Scan for V_MAY_DEF instead of VDEF. * gcc.dg/tree-ssa/20040517-1.c: Ditto. From-SVN: r82947
2004-06-10 23:41:08 +02:00
/* All structures are allocated out of the following obstack. */
static struct obstack sra_obstack;
tree-ssa.texi: Remove references to VDEF and add descriptions of V_MAY_DEF and V_MUST_DEF. * doc/tree-ssa.texi: Remove references to VDEF and add descriptions of V_MAY_DEF and V_MUST_DEF. * tree-dfa.c (dfa_stats_d): Add num_v_must_defs and rename num_vdefs to num_v_may_defs. (compute_immediate_uses_for_stmt): Rename occurences of vdef to v_may_def. (redirect_immediate_uses): Ditto. (dump_dfa_stats): Ditto. Also added code to dump num_v_must_defs. (collect_dfa_stats_r): Rename occurences of vdef to v_may_def. Also add code to sum up the number of v_must_defs. (vdefs_disappeared_p): Replace with... (v_may_defs_disappeared_p): This. (v_must_defs_disappeared_p): New function. (mark_new_vars_to_rename): Rename occurences of vdef to v_may_def. Also add code to mark new variables found in V_MUST_DEFs for renameing. * tree-flow.h (stmt_ann_d): Add v_must_def_ops and replace vdef_ops to v_may_def_ops. (get_vdef_ops): Replace with... (get_v_may_def_ops): This. * tree-flow-inline.h (get_vdef_ops): Replace with... (get_v_may_def_ops): This. (get_v_must_def_ops): New function. (get_vdef_result_ptr): Replace with... (get_v_may_def_result_ptr): This. (get_vdef_op_ptr): Ditto with... (get_v_may_def_op_ptr); This. (get_v_must_def_op_ptr): New function. * tree-into-ssa.c (mark_def_sites): Rename occurences of vdef to v_may_def. Also add code to mark statements with V_MUST_DEFs as definition sites. (rewrite_stmt): Rename occurences of vdef to v_may_def. Also add code to register new V_MUST_DEFs made by the statement. * tree-outof-ssa.c (VIRTUAL_PARTITION): Update comments. (check_replaceable): Rename occurences of vdef to v_may_def. Also add check for V_MUST_DEFs. (find_replaceable_in_bb): Ditto. * tree-pretty-print.c (dump_vops): Rename occurences of vdef to v_may_def. Also add code to dump V_MUST_DEFs. * tree-sra.c (mark_all_vdefs): Replace with... (mark_all_v_may_defs): This. (mark_all_v_must_defs): New function. (create_scalar_copies): Replace call to mark_all_vdefs with calls to mark_all_v_may_defs and mark_all_v_must_defs. (scalarize_structures): Rename occurences of vdef to v_may_def. Also add a check for V_MUST_DEFs. (scalarize_modify_expr): Rename occurences of vdef to v_may_def. * tree-ssa-alias.c (global_var): Update comment. (compute_may_aliases): Ditto. (compute_points_to_and_addr_escape): Rename occurences of vdef to v_may_def. Also add code to mark variables in V_MUST_DEF operands as being written to. (group_aliases): Update comment. (maybe_create_global_var): Ditto. * tree-ssa.c (verify_ssa): Rename occurences of vdef to v_may_def. Also add a check for V_MUST_DEFs on GIMPLE registers. (replace_immediate_uses): Rename occurences of vdef to v_may_def. * tree-ssa-ccp.c (visit_stmt): Rename occurences of vdef to v_may_def. Also add code to mark all V_MUST_DEF operands VARYING. (initialize): Ditto. (set_rhs): Rename occurences of vdef to v_may_def. Also add code to update SSA_NAMEs in V_MUST_DEFs. * tree-ssa-copy.c (cprop_into_stmt): Rename occurences of vdef to v_may_def. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Rename occurences of vdef to v_may_def. Also add code to mark statements with V_MUST_DEFs as necessary. (propagate_necessity): Rename occurences of vdef to v_may_def. * tree-ssa-dom.c (redirect_edges_and_update_ssa_graph): Rename occurences of vdef to v_may_def. Also add code to mark operands in V_MUST_DEFs for renaming. (eliminate_redundant_computations): Rename occurences of vdef to v_may_def. (record_equivalences_from_stmt): Rename occurences of vdef to v_may_def. Also add code to record VUSEs for V_MUST_DEFs. (optimize_stmt): Remove unnesessary variable vdefs. Update comment. (register_definitions_for_stmt): Rename occurences of vdef to v_may_def. Also add code to register definitions made with V_MUST_DEFs. * tree-ssa-dse.c (fix_stmt_vdefs): Replace with... (fix_stmt_v_may_defs): This. (fix_phi_uses): Rename occurences of vdef to v_may_def. (dse_optimize_stmt): Ditto. * tree-ssa-live.c (create_ssa_var_map): Rename occurences of vdef to v_may_def. Also add code to mark V_MUST_DEF operands as being used in virtual operators. * tree-ssa-loop.c (mark_defs_for_rewrite): Rename occurences of vdef to v_may_def. Also add code to mark V_MUST_DEF operands for renaming. * tree-ssa-operands.c (opf_kill_def): New flag for killing definitions. (build_vdefs): Renamed to... (build_v_may_defs): This. (build_v_must_defs): New variable. (voperands_d): Add v_must_def_ops and replace vdef_ops with v_may_def_ops. (append_vdef): Replace with... (append_v_may_def): This. (append_v_must_def): New function. (NUM_FREE): Increment for V_MUST_DEF (optype_freelist): Increment its size for V_MUST_DEF (allocate_vdef_optype): Replace with... (allocate_v_may_def_optype): This. (allocate_v_must_def_optype): New function. (free_vdefs): Replace with... (free_v_may_defs): This. (free_v_must_defs): New function. (remove_vdefs): Replace with... (remove_v_may_defs): This. (remove_v_must_defs): New function. (init_ssa_operands): Rename occurences of vdef to v_may_def. Also add code to initialize build_v_must_defs. (finalize_ssa_vdefs): Replace with... (finalize_ssa_v_may_defs): This. (finalize_ssa_vuses): Rename occurences of vdef to v_may_def. (finalize_ssa_v_must_defs): New function. (finalize_ssa_stmt_operands): Replace call to finalize_ssa_vdefs with calls to finalize_ssa_v_may_defs and finalize_ssa_v_must_defs. (verify_start_operands): Rename occurences of vdef to v_may_def. Also add check for build_v_must_defs. (get_stmt_operands): Rename occurences of vdef to v_may_def. Also add code to handle V_MUST_DEFs and to use opf_kill_def for killing definitions. (get_expr_operands): Update comment and use opf_kill_def for killing definitions. (add_stmt_operand): Replace code that appends VDEFs with code that appends V_MUST_DEFs when opf_kill_def is set and V_MAY_DEFs otherwise. (add_call_clobber_ops): Update comments. * tree-ssa-operands.h (vdef_optype_d): Replace with... (v_may_def_optype_d): This. (v_must_def_optype_d): New structure. (VDEF_OPS): Replace with... (V_MAY_DEF_OPS): This. (STMT_VDEF_OPS): Same with... (STMT_V_MAY_DEF_OPS): This. (NUM_VDEFS): And... (NUM_V_MAY_DEFS): This. (VDEF_RESULT_PTR): As well as... (V_MAY_DEF_RESULT_PTR): This. (VDEF_RESULT): Same goes for... (V_MAY_DEF_RESULT): This. (VDEF_OP_PTR): And... (V_MAY_DEF_OP_PTR): This. (VDEF_OP): And... (V_MAY_DEF_OP): This. (V_MUST_DEF_OPS): New macro. (STMT_V_MUST_DEF_OPS): Ditto. (NUM_V_MUST_DEFS): Ditto. (V_MUST_DEF_OP_PTR): Ditto. (V_MUST_DEF_OP): Ditto. (remove_vdefs): Replace signature with... (remove_v_may_defs): This. (remove_v_must_defs): New function signature. * tree-ssa-pre.c (subst_phis): Replace call to remove_vdefs with calls to remove_v_may_defs and remove_v_must_defs. (process_left_occs_and_kills): Rename occurences of vdef to v_may_def. Also add code that marks left occurences of operands in V_MUST_DEFs. * tree-tailcall.c (find_tail_calls): Rename occurences of vdef to v_may_def. Also add check for V_MUST_DEFs. (eliminate_tail_call):Rename occurences of vdef to v_may_def. testsuite: * gcc.dg/tree-ssa/20031015-1.c: Scan for V_MAY_DEF instead of VDEF. * gcc.dg/tree-ssa/20040517-1.c: Ditto. From-SVN: r82947
2004-06-10 23:41:08 +02:00
/* Debugging functions. */
static void dump_sra_elt_name (FILE *, struct sra_elt *);
extern void debug_sra_elt_name (struct sra_elt *);
/* Forward declarations. */
static tree generate_element_ref (struct sra_elt *);
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
static tree sra_build_assignment (tree dst, tree src);
static void mark_all_v_defs (tree list);
/* Return true if DECL is an SRA candidate. */
static bool
is_sra_candidate_decl (tree decl)
{
[multiple changes] 2005-06-29 Daniel Berlin <dberlin@dberlin.org> * tree-complex.c (complex_variable_components): Now a hashtable. (cvc_lookup): Ditto. (cvc_insert): Ditto. (create_components): Use referenced var iterator. Initialize hashtable. Use cvc_insert/lookup. (extract_components): Use cvc_insert/lookup. (update_complex_components): Ditto. (update_complex_components_on_edge): Ditto. * tree-dfa.c (referenced_vars): Now a hashtable. (dump_referenced_vars): Use iterator. (referenced_var_lookup): New function. (referenced_var_insert): Ditto. (add_referenced_var): Use referenced_var_insert. (mark_new_vars_to_rename): Use DECL_UID. * tree-flow-inline.h (first_htab_element): New function. (end_htab_p): Ditto. (next_htab_element): Ditto. (first_referenced_var): Ditto. (end_referenced_vars_p): Ditto. (next_referenced_var): Ditto. (is_call_clobbered): Use DECL_UID. (mark_call_clobbered): Ditto. (clear_call_clobbered): Ditto. (mark_non_addressable): Ditto. * tree-flow.h (htab_iterator): New struct. (FOR_EACH_HTAB_ELEMENT): New macro. (struct int_tree_map): New struct. (int_tree_map_hash): Prototype. (int_tree_map_eq): Ditto. (referenced_var_iterator): Ditto. (FOR_EACH_REFERENCED_VAR): New macro. (referenced_vars): Now a hashtable. * tree-into-ssa.c (symbol_marked_for_renaming): Use DECL_UID. (add_new_name_mapping): Ditto. (mark_def_sites): Ditto. (insert_phi_nodes): Use referenced_var iterator. (mark_def_site_blocks): Ditto. (mark_sym_for_renaming): Use DECL_UID. * tree-sra.c (is_sra_candidate_decl): Use DECL_UID. (lookup_element): Ditto. (find_candidates_for_sra): Use referenced_vars iterator. Use DECL_UID. * tree-ssa-alias.c (NUM_REFERENCES): New macro. (NUM_REFERENCES_CLEAR): Ditto. (NUM_REFERENCES_INC): Ditto. (NUM_REFERENCES_SET): Ditto. (alias_obstack): New bitmap obstack. (struct alias_map_d): Use bitmap, not sbitmap. (struct alias_info): Remove num_references. (init_alias_info): Use referenced_var iterator. Initialize bitmap obstack. (delete_alias_info): Use referenced_var iterator. Free bitmap obstack. (compute_points_to_and_addr_escape): Use DECL_UID. Use new NUM_REFERENCES macros. (compute_flow_sensitive_aliasing): may_aliases is now a bitmap. Use new NUM_REFERENCES macros. (group_aliases_into): Update prototype to use bitmap. (setup_pointers_and_addressables): Use referenced_vars iterator. Use DECL_UID. Use new NUM_REFERENCES macros. (add_pointed_to_var): Use DECL_UID. (dump_alias_info): Use referenced_var iterator. (add_type_alias): Ditto. (used_portions): Now a hashtable. (used_part_map_eq): New function. (used_part_map_hash): Ditto. (free_used_part_map): Ditto. (up_lookup): Ditto. (up_insert): Ditto. (get_or_create_used_part_for): Use up_lookup. (create_overlap_variables_for): Ditto. (find_used_portions): Use up_insert. Use DECL_UID. (create_structure_vars): Init used_portions hashtable, use referenced_vars iterator. * tree-ssa-live.c (create_ssa_var_map): sbitmaps became bitmaps. Use DECL_UID. * tree-ssa-loop-im.c (gather_mem_refs_stmt): Use DECL_UID. * tree-ssa-operands.c (get_asm_expr_operands): Ditto. (note_addressable): Ditto. * tree-ssa-structalias.c (set_uids_in_ptset): Ditto. * tree-ssa.c (verify_flow_insensitive_alias_info): Use referenced_var iterator. Use DECL_UID. (delete_tree_ssa): Ditto. (int_tree_map_eq): New function. (int_tree_map_hash): Ditto. * tree-stdarg.c (find_va_list_reference): Use DECL_UID. (va_list_ptr_read): Ditto. (va_list_counter_struct_op): Ditto. (va_list_ptr_write): Ditto. (check_va_list_escapes): Ditto. (check_all_va_list_escapes): Ditto. (execute_optimize_stdarg): Ditto. * tree-tailcall.c (suitable_for_tail_opt_p): Used referenced_var iterator. 2005-06-30 Daniel Berlin <dberlin@dberlin.org> * hashtab.h (HTAB_DELETED_ENTRY): New macro. (HTAB_EMPTY_ENTRY): New macro. 2005-06-30 Daniel Berlin <dberlin@dberlin.org> * hashtab.c (EMPTY_ENTRY): Moved and renamed. (DELETED_ENTRY): Ditto. From-SVN: r101480
2005-07-01 00:18:42 +02:00
return DECL_P (decl) && bitmap_bit_p (sra_candidates, DECL_UID (decl));
}
/* Return true if TYPE is a scalar type. */
static bool
is_sra_scalar_type (tree type)
{
enum tree_code code = TREE_CODE (type);
return (code == INTEGER_TYPE || code == REAL_TYPE || code == VECTOR_TYPE
tree.def (FIXED_POINT_TYPE): New type. * tree.def (FIXED_POINT_TYPE): New type. (FIXED_CST): New constant. (FIXED_CONVERT_EXPR): New expr. * doc/c-tree.texi (Types): Document FIXED_POINT_TYPE. (Expressions): Document FIXED_CST and FIXED_CONVERT_EXPR. * tree.h (struct tree_base): Add saturating_flag. Remove one bit of spare for saturating_flag. (NUMERICAL_TYPE_CHECK): Support FIXED_POINT_TYPE. (NON_SAT_FIXED_POINT_TYPE_P, SAT_FIXED_POINT_TYPE_P, FIXED_POINT_TYPE_P): Define. (TYPE_SATURATING): Define. (TREE_FIXED_CST_PTR, TREE_FIXED_CST): Define. (struct tree_fixed_cst): New. (TYPE_IBIT, TYPE_FBIT): Define. (tree_node): Add fixed_cst. (enum tree_index): Add new enumeration values of TI_SAT_SFRACT_TYPE, TI_SAT_FRACT_TYPE, TI_SAT_LFRACT_TYPE, TI_SAT_LLFRACT_TYPE, TI_SAT_USFRACT_TYPE, TI_SAT_UFRACT_TYPE, TI_SAT_ULFRACT_TYPE, TI_SAT_ULLFRACT_TYPE, TI_SFRACT_TYPE, TI_FRACT_TYPE, TI_LFRACT_TYPE, TI_LLFRACT_TYPE, TI_USFRACT_TYPE, TI_UFRACT_TYPE, TI_ULFRACT_TYPE, TI_ULLFRACT_TYPE, TI_SAT_SACCUM_TYPE, TI_SAT_ACCUM_TYPE, TI_SAT_LACCUM_TYPE, TI_SAT_LLACCUM_TYPE, TI_SAT_USACCUM_TYPE, TI_SAT_UACCUM_TYPE, TI_SAT_ULACCUM_TYPE, TI_SAT_ULLACCUM_TYPE, TI_SACCUM_TYPE, TI_ACCUM_TYPE, TI_LACCUM_TYPE, TI_LLACCUM_TYPE, TI_USACCUM_TYPE, TI_UACCUM_TYPE, TI_ULACCUM_TYPE, TI_ULLACCUM_TYPE, TI_QQ_TYPE, TI_HQ_TYPE,_TYPE, TI_SQ_TYPE, TI_DQ_TYPE, TI_TQ_TYPE, TI_UQQ_TYPE, TI_UHQ_TYPE, TI_USQ_TYPE, TI_UDQ_TYPE, TI_UTQ_TYPE, TI_SAT_QQ_TYPE, TI_SAT_HQ_TYPE, TI_SAT_SQ_TYPE, TI_SAT_DQ_TYPE, TI_SAT_TQ_TYPE, TI_SAT_UQQ_TYPE, TI_SAT_UHQ_TYPE, TI_SAT_USQ_TYPE, TI_SAT_UDQ_TYPE, TI_SAT_UTQ_TYPE, TI_HA_TYPE, TI_SA_TYPE, TI_DA_TYPE, TI_TA_TYPE, TI_UHA_TYPE, TI_USA_TYPE, TI_UDA_TYPE, TI_UTA_TYPE, TI_SAT_HA_TYPE, TI_SAT_SA_TYPE, TI_SAT_DA_TYPE, TI_SAT_TA_TYPE, TI_SAT_UHA_TYPE, TI_SAT_USA_TYPE, TI_SAT_UDA_TYPE, TI_SAT_UTA_TYPE. (sat_short_fract_type_node, sat_fract_type_node, sat_long_fract_type_node, sat_long_long_fract_type_node, sat_unsigned_short_fract_type_node, sat_unsigned_fract_type_node, sat_unsigned_long_fract_type_node, sat_unsigned_long_long_fract_type_node, short_fract_type_node, fract_type_node, long_fract_type_node, long_long_fract_type_node, unsigned_short_fract_type_node, unsigned_fract_type_node, unsigned_long_fract_type_node, unsigned_long_long_fract_type_node, sat_short_accum_type_node, sat_accum_type_node, sat_long_accum_type_node, sat_long_long_accum_type_node, sat_unsigned_short_accum_type_node, sat_unsigned_accum_type_node, sat_unsigned_long_accum_type_node, sat_unsigned_long_long_accum_type_node, short_accum_type_node, accum_type_node, long_accum_type_node, long_long_accum_type_node, unsigned_short_accum_type_node, unsigned_accum_type_node, unsigned_long_accum_type_node, unsigned_long_long_accum_type_node, qq_type_node, hq_type_node, sq_type_node, dq_type_node, tq_type_node, uqq_type_node, uhq_type_node, usq_type_node, udq_type_node, utq_type_node, sat_qq_type_node, sat_hq_type_node, sat_sq_type_node, sat_dq_type_node, sat_tq_type_node, sat_uqq_type_node, sat_uhq_type_node, sat_usq_type_node, sat_udq_type_node, sat_utq_type_node, ha_type_node, sa_type_node, da_type_node, ta_type_node, uha_type_node, usa_type_node, uda_type_node, uta_type_node, sat_ha_type_node, sat_sa_type_node, sat_da_type_node, sat_ta_type_node, sat_uha_type_node, sat_usa_type_node, sat_uda_type_node, sat_uta_type_node): New macro. (make_fract_type, make_accum_type): Declare. (make_signed_fract_type, make_unsigned_fract_type, make_sat_signed_fract_type, make_sat_unsigned_fract_type, make_signed_accum_type, make_unsigned_accum_type, make_sat_signed_accum_type, make_sat_unsigned_accum_type, make_or_reuse_signed_fract_type, make_or_reuse_unsigned_fract_type, make_or_reuse_sat_signed_fract_type, make_or_reuse_sat_unsigned_fract_type, make_or_reuse_signed_accum_type, make_or_reuse_unsigned_accum_type, make_or_reuse_sat_signed_accum_type, make_or_reuse_sat_unsigned_accum_type): New macro. (fixed_zerop): Declare. * defaults.h (SHORT_FRACT_TYPE_SIZE, FRACT_TYPE_SIZE, LONG_FRACT_TYPE_SIZE, LONG_LONG_FRACT_TYPE_SIZE, SHORT_ACCUM_TYPE_SIZE, ACCUM_TYPE_SIZE, LONG_ACCUM_TYPE_SIZE, LONG_LONG_ACCUM_TYPE_SIZE): Define. * treestruct.def: Add TS_FIXED_CST. * Makefile.in (c-pretty-print.o): Add dependence on fixed-value.h. (tree.o): Likewise. (tree-dump.o): Likewise. (print-tree.o): Likewise. (tree-pretty-print.o): Likewise. (fold-const.o): Likewise. * tree-complex.c (some_nonzerop): Handle FIXED_CST. * tree-gimple.c (is_gimple_formal_tmp_rhs): Handle FIXED_CST. (is_gimple_min_invariant): Handle FIXED_CST. * stor-layout.c (int_mode_for_mode): Handle MODE_FRACT, MODE_UFRACT, MODE_ACCUM, MODE_UACCUM, MODE_VECTOR_FRACT, MODE_VECTOR_UFRACT, MODE_VECTOR_ACCUM, MODE_VECTOR_UACCUM. (layout_type): Handle FIXED_POINT_TYPE. (make_fract_type, make_accum_type): New functions. * tree-browser.c (browse_tree): Handle FIXED_POINT_TYPE. * tree-dump.c (fixed-value.h): New include. (dump_fixed): New function. (dequeue_and_dump): Handle FIXED_POINT_TYPE and FIXED_CST. * tree-inline.c (remap_type_1): Handle FIXED_POINT_TYPE. (estimate_num_insns_1): Handle FIXED_CST and FIXED_CONVERT_EXPR. * tree-pretty-print.c (fixed-value.h): New include. (dump_generic_node): Handle FIXED_POINT_TYPE, FIXED_CST, and FIXED_CONVERT_EXPR. * tree-scalar-evolution.c (get_scalar_evolution): Handle FIXED_CST. * tree-ssa-loop-im.c (for_each_index): Handle FIXED_CST. * tree-ssa-pre.c (poolify_tree): Handle FIXED_CST. * tree-ssa-reassoc.c (break_up_subtract_bb): We can do reassociation for non-saturating fixed-point types. (reassociate_bb): Likewise. * emit-rtl.c (fixed-value.h): New include. (fconst0, fconst1): New array. (init_emit_once): Initialize fconst0 and fconst1 for fixed-point modes. * tree-vect-generic.c expand_vector_operation): Support MODE_VECTOR_FRACT, MODE_VECTOR_UFRACT, MODE_VECTOR_ACCUM, and MODE_VECTOR_UACCUM. (type_for_widest_vector_mode): Add one parameter for the saturating flag. Check scalar FRACT, UFRACT, ACCUM, and UACCUM mode to select their vector mode. Pass the satp parameter to type_for_mode for fixed-point types. (expand_vector_operations_1): Pass the saturating flag to type_for_widest_vector_mode. Support MODE_VECTOR_FRACT, MODE_VECTOR_UFRACT, MODE_VECTOR_ACCUM, and MODE_VECTOR_UACCUM. * tree-vect-transform.c (vect_is_simple_cond): Support FIXED_CST. (vectorizable_condition): Likewise. * tree.c (fixed-value.h): New include. (tree_code_size): Support FIXED_CST. (build_fixed): New function. (build_one_cst): Support FIXED_POINT_TYPE for accum types. (fixed_zerop): New function. (tree_node_structure): Support FIXED_CST. (type_contains_placeholder_1): Support FIXED_POINT_TYPE. (build_type_attribute_qual_variant): Handle FIXED_POINT_TYPE. (type_hash_eq): Handle FIXED_POINT_TYPE. (simple_cst_equal): Support FIXED_CST. (iterative_hash_expr): Handle FIXED_CST. (get_unwidened): Make sure type is not FIXED_POINT_TYPE. (get_narrower): Likewise. (variably_modified_type_p): Handle FIXED_POINT_TYPE. (make_or_reuse_fract_type, make_or_reuse_accum_type): New functions. (build_common_tree_nodes_2): Use MAKE_FIXED_TYPE_NODE_FAMILY and MAKE_FIXED_MODE_NODE macros to initialize fixed-point type nodes. (build_vector_type_for_mode): Handle MODE_VECTOR_FRACT, MODE_VECTOR_UFRACT, MODE_VECTOR_ACCUM, MODE_VECTOR_UACCUM. (initializer_zerop): Support FIXED_CST. (walk_tree): Handle FIXED_CST and FIXED_POINT_TYPE. * dwarf2out.c (base_type_die): Use DW_ATE_signed_fixed or DW_ATE_unsigned_fixed to describe FIXED_POINT_TYPE. (is_base_type): Handle FIXED_POINT_TYPE. (add_type_attribute): Handle FIXED_POINT_TYPE. (gen_type_die_with_usage): Handle FIXED_POINT_TYPE. * print-tree.c (fixed-value.h): New include. (print_node_brief): Support FIXED_CST. (print_node): Support FIXED_POINT_TYPE and FIXED_CST. * c-pretty-print.c (fixed-value.h): New include. (pp_c_type_specifier): Handle FIXED_POINT_TYPE. Need to pass TYPE_SATURATING to c_common_type_for_mode for fixed-point modes. (pp_c_direct_abstract_declarator): Handle FIXED_POINT_TYPE. Support fixed-point types for inner items in VECTOR_TYPE. (pp_c_direct_declarator): Likewise. (pp_c_declarator): Likewise. (pp_c_fixed_constant): New function. (pp_c_constant): Handle FIXED_CST. (pp_c_primary_expression): Likewise. (pp_c_expression): Likewise. * fold-const.c (fixed-value.h): New include. (negate_expr_p): Return true for FIXED_CST. (fold_negate_expr): Support FIXED_CST. (split_tree): Support FIXED_CST. (const_binop): Support FIXED_CST. (fold_convert_const_int_from_fixed): New function to convert from fixed to int. (fold_convert_const_real_from_fixed): New function to convert from fixed to real. (fold_convert_const_fixed_from_fixed): New function to convert from fixed to another fixed. (fold_convert_const_fixed_from_int): New function to convert from int to fixed. (fold_convert_const_fixed_from_real): New function to convert from real to fixed. (fold_convert_const): Support conversions from fixed to int, from fixed to real, from fixed to fixed, from int to fixed, and from real to fixed. (fold_convert): Support FIXED_CST and FIXED_POINT_TYPE. (operand_equal_p): Support FIXED_CST. (make_range): For fixed-point modes, we need to pass the saturating flag as the 2nd parameter. (tree_swap_operands_p): Handle FIXED_CST. (fold_plusminus_mult_expr): For fract modes, we cannot generate constant 1. (fold_unary): Support FIXED_CONVERT_EXPR. (fold_binary): Handle FIXED_CST. Make sure the type is not saturating, before associating operations. Ex: A + B + C, A * B * C, (A1 * C1) +/- (A2 * C2). (tree_expr_nonnegative_warnv_p): Handle FIXED_CST. (fold_negate_const): Support FIXED_CST. (fold_relational_const): Support FIXED_CST. * gimplify.c (omp_firstprivatize_type_sizes): Handle FIXED_POINT_TYPE. (gimplify_expr): Handle FIXED_CST. (gimplify_type_sizes): Handle FIXED_POINT_TYPE. * ipa-prop.c (ipa_callsite_compute_param): Support FIXED_CST. * ipa-type-escape.c (type_to_consider): Handle FIXED_POINT_TYPE. * doc/tm.texi (Type Layout): Document SHORT_FRACT_TYPE_SIZE, FRACT_TYPE_SIZE, LONG_FRACT_TYPE_SIZE, LONG_LONG_FRACT_TYPE_SIZE, SHORT_ACCUM_TYPE_SIZE, ACCUM_TYPE_SIZE, LONG_ACCUM_TYPE_SIZE, LONG_LONG_ACCUM_TYPE_SIZE. * dbxout.c (dbxout_type): Handle FIXED_POINT_TYPE. * c-aux-info.c (gen_type): Handle FIXED_POINT_TYPE. * tree-sra.c (is_sra_scalar_type): Support FIXED_POINT_TYPE. * expmed.c (extract_bit_field): Support MODE_FRACT, MODE_UFRACT, MODE_ACCUM, and MODE_UACCUM. * tree-vectorizer.c (vect_is_simple_reduction): Check for saturating fixed-point types to disable reduction. * explow.c (promote_mode): Support FIXED_POINT_TYPE. From-SVN: r127306
2007-08-09 00:29:12 +02:00
|| code == FIXED_POINT_TYPE
|| code == ENUMERAL_TYPE || code == BOOLEAN_TYPE
|| code == POINTER_TYPE || code == OFFSET_TYPE
|| code == REFERENCE_TYPE);
}
/* Return true if TYPE can be decomposed into a set of independent variables.
Note that this doesn't imply that all elements of TYPE can be
instantiated, just that if we decide to break up the type into
separate pieces that it can be done. */
Makefile.in: Added rules for ipa-pure-const.c... 2005-07-16 Danny Berlin <dberlin@dberlin.org> Kenneth Zadeck <zadeck@naturalbridge.com> * Makefile.in: Added rules for ipa-pure-const.c, ipa-reference.c, ipa-reference.h, ipa-utils.c, ipa-utils.h, ipa-type-escape.c, ipa-type-escape.h, tree-promote-statics.c * ipa-pure-const.c, ipa-reference.c, ipa-reference.h, ipa-utils.c, ipa-utils.h, ipa-type-escape.c, ipa-type-escape.h, tree-promote-statics.c: new files. * alias.c: (nonlocal_mentioned_p_1, nonlocal_mentioned_p, nonlocal_referenced_p_1, nonlocal_referenced_p, nonlocal_set_p_1, int nonlocal_set_p, mark_constant_function): Deleted. (rest_of_handle_cfg): Removed call to mark_constant_function. (nonoverlapping_component_refs_p): Added calls to support type based aliasing. * tree-ssa-alias.c (may_alias_p, compute_flow_insensitive_aliasing): Ditto. * calls.c (flags_from_decl_or_type): Removed reference to cgraph_rtl_info. (flags_from_decl_or_type): Support ECF_POINTER_NO_CAPTURE attribute. * c-common.c (handle_pointer_no_capture_attribute): New function and added pointer_no_capture attribute. * c-typeck.c (convert_arguments): Make builtins tolerant of having too many arguments. This is necessary for Spec 2000. * cgraph.h (const_function, pure_function): Removed. * common.opt: Added "fipa-pure-const", "fipa-reference", "fipa-type-escape", and "ftree-promote-static". * opts.c: Ditto. * passes.c: Added ipa and tree-promote-statics passes. * timevar.def: Added TV_IPA_PURE_CONST, TV_IPA_REFERENCE, TV_IPA_TYPE_ESCAPE, and TV_PROMOTE_STATICS. * tree.h: Support ECF_POINTER_NO_CAPTURE attribute. * tree-dfa.c (referenced_var_lookup_if_exists): New function. * tree-flow.h: Added exposed sra calls and addition of reference_vars_info field for FUNCTION_DECLS. * tree-pass.h: Added passes. * tree-sra.c: (sra_init_cache): New function. (sra_insert_before, sra_insert_after) Made public. (type_can_be_decomposed_p): Renamed from type_can_be_decomposed_p and made public. * tree-ssa-alias.c (dump_alias_stats): Added stats for type based aliasing. (may_alias_p): Added code to use type escape analysis to improve alias sets. * tree-ssa-operands.c (add_call_clobber_ops): Added parameter and code to prune clobbers of static variables based on information produced in ipa-reference pass. Changed call clobbering so that statics are not marked as clobbered if the call does not clobber them. 2005-07-16 Danny Berlin <dberlin@dberlin.org> Kenneth Zadeck <zadeck@naturalbridge.com> * gcc.dg/tree-ssa/ssa-dce-2.c: Changed dg-options to run at -O2 since pure const detection cannot run at -O1 in c compiler. * gcc.dg/tree-ssa/20030714-1.c Changed scanning patterns because we can now optimize this case properly. * gcc.dg/tree-ssa/sra-2.c: Changed to -O3 and removed xfail because we now pass. * gcc.dg/vect/vect-92.c: Removed out of bounds array access. Co-Authored-By: Kenneth Zadeck <zadeck@naturalbridge.com> From-SVN: r102098
2005-07-16 20:56:53 +02:00
bool
sra_type_can_be_decomposed_p (tree type)
{
unsigned int cache = TYPE_UID (TYPE_MAIN_VARIANT (type)) * 2;
tree t;
/* Avoid searching the same type twice. */
if (bitmap_bit_p (sra_type_decomp_cache, cache+0))
return true;
if (bitmap_bit_p (sra_type_decomp_cache, cache+1))
return false;
/* The type must have a definite nonzero size. */
if (TYPE_SIZE (type) == NULL || TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST
|| integer_zerop (TYPE_SIZE (type)))
goto fail;
/* The type must be a non-union aggregate. */
switch (TREE_CODE (type))
{
case RECORD_TYPE:
{
bool saw_one_field = false;
for (t = TYPE_FIELDS (type); t ; t = TREE_CHAIN (t))
if (TREE_CODE (t) == FIELD_DECL)
{
/* Reject incorrectly represented bit fields. */
if (DECL_BIT_FIELD (t)
&& (tree_low_cst (DECL_SIZE (t), 1)
!= TYPE_PRECISION (TREE_TYPE (t))))
goto fail;
saw_one_field = true;
}
/* Record types must have at least one field. */
if (!saw_one_field)
goto fail;
}
break;
case ARRAY_TYPE:
/* Array types must have a fixed lower and upper bound. */
t = TYPE_DOMAIN (type);
if (t == NULL)
goto fail;
if (TYPE_MIN_VALUE (t) == NULL || !TREE_CONSTANT (TYPE_MIN_VALUE (t)))
goto fail;
if (TYPE_MAX_VALUE (t) == NULL || !TREE_CONSTANT (TYPE_MAX_VALUE (t)))
goto fail;
break;
case COMPLEX_TYPE:
break;
default:
goto fail;
}
bitmap_set_bit (sra_type_decomp_cache, cache+0);
return true;
fail:
bitmap_set_bit (sra_type_decomp_cache, cache+1);
return false;
}
/* Return true if DECL can be decomposed into a set of independent
(though not necessarily scalar) variables. */
static bool
decl_can_be_decomposed_p (tree var)
{
/* Early out for scalars. */
if (is_sra_scalar_type (TREE_TYPE (var)))
return false;
/* The variable must not be aliased. */
if (!is_gimple_non_addressable (var))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Cannot scalarize variable ");
print_generic_expr (dump_file, var, dump_flags);
fprintf (dump_file, " because it must live in memory\n");
}
return false;
}
/* The variable must not be volatile. */
if (TREE_THIS_VOLATILE (var))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Cannot scalarize variable ");
print_generic_expr (dump_file, var, dump_flags);
fprintf (dump_file, " because it is declared volatile\n");
}
return false;
}
/* We must be able to decompose the variable's type. */
Makefile.in: Added rules for ipa-pure-const.c... 2005-07-16 Danny Berlin <dberlin@dberlin.org> Kenneth Zadeck <zadeck@naturalbridge.com> * Makefile.in: Added rules for ipa-pure-const.c, ipa-reference.c, ipa-reference.h, ipa-utils.c, ipa-utils.h, ipa-type-escape.c, ipa-type-escape.h, tree-promote-statics.c * ipa-pure-const.c, ipa-reference.c, ipa-reference.h, ipa-utils.c, ipa-utils.h, ipa-type-escape.c, ipa-type-escape.h, tree-promote-statics.c: new files. * alias.c: (nonlocal_mentioned_p_1, nonlocal_mentioned_p, nonlocal_referenced_p_1, nonlocal_referenced_p, nonlocal_set_p_1, int nonlocal_set_p, mark_constant_function): Deleted. (rest_of_handle_cfg): Removed call to mark_constant_function. (nonoverlapping_component_refs_p): Added calls to support type based aliasing. * tree-ssa-alias.c (may_alias_p, compute_flow_insensitive_aliasing): Ditto. * calls.c (flags_from_decl_or_type): Removed reference to cgraph_rtl_info. (flags_from_decl_or_type): Support ECF_POINTER_NO_CAPTURE attribute. * c-common.c (handle_pointer_no_capture_attribute): New function and added pointer_no_capture attribute. * c-typeck.c (convert_arguments): Make builtins tolerant of having too many arguments. This is necessary for Spec 2000. * cgraph.h (const_function, pure_function): Removed. * common.opt: Added "fipa-pure-const", "fipa-reference", "fipa-type-escape", and "ftree-promote-static". * opts.c: Ditto. * passes.c: Added ipa and tree-promote-statics passes. * timevar.def: Added TV_IPA_PURE_CONST, TV_IPA_REFERENCE, TV_IPA_TYPE_ESCAPE, and TV_PROMOTE_STATICS. * tree.h: Support ECF_POINTER_NO_CAPTURE attribute. * tree-dfa.c (referenced_var_lookup_if_exists): New function. * tree-flow.h: Added exposed sra calls and addition of reference_vars_info field for FUNCTION_DECLS. * tree-pass.h: Added passes. * tree-sra.c: (sra_init_cache): New function. (sra_insert_before, sra_insert_after) Made public. (type_can_be_decomposed_p): Renamed from type_can_be_decomposed_p and made public. * tree-ssa-alias.c (dump_alias_stats): Added stats for type based aliasing. (may_alias_p): Added code to use type escape analysis to improve alias sets. * tree-ssa-operands.c (add_call_clobber_ops): Added parameter and code to prune clobbers of static variables based on information produced in ipa-reference pass. Changed call clobbering so that statics are not marked as clobbered if the call does not clobber them. 2005-07-16 Danny Berlin <dberlin@dberlin.org> Kenneth Zadeck <zadeck@naturalbridge.com> * gcc.dg/tree-ssa/ssa-dce-2.c: Changed dg-options to run at -O2 since pure const detection cannot run at -O1 in c compiler. * gcc.dg/tree-ssa/20030714-1.c Changed scanning patterns because we can now optimize this case properly. * gcc.dg/tree-ssa/sra-2.c: Changed to -O3 and removed xfail because we now pass. * gcc.dg/vect/vect-92.c: Removed out of bounds array access. Co-Authored-By: Kenneth Zadeck <zadeck@naturalbridge.com> From-SVN: r102098
2005-07-16 20:56:53 +02:00
if (!sra_type_can_be_decomposed_p (TREE_TYPE (var)))
{
if (dump_file && (dump_flags & TDF_DETAILS))
{
fprintf (dump_file, "Cannot scalarize variable ");
print_generic_expr (dump_file, var, dump_flags);
fprintf (dump_file, " because its type cannot be decomposed\n");
}
return false;
}
/* HACK: if we decompose a va_list_type_node before inlining, then we'll
confuse tree-stdarg.c, and we won't be able to figure out which and
how many arguments are accessed. This really should be improved in
tree-stdarg.c, as the decomposition is truely a win. This could also
be fixed if the stdarg pass ran early, but this can't be done until
we've aliasing information early too. See PR 30791. */
if (early_sra
&& TYPE_MAIN_VARIANT (TREE_TYPE (var))
== TYPE_MAIN_VARIANT (va_list_type_node))
return false;
return true;
}
/* Return true if TYPE can be *completely* decomposed into scalars. */
static bool
type_can_instantiate_all_elements (tree type)
{
if (is_sra_scalar_type (type))
return true;
Makefile.in: Added rules for ipa-pure-const.c... 2005-07-16 Danny Berlin <dberlin@dberlin.org> Kenneth Zadeck <zadeck@naturalbridge.com> * Makefile.in: Added rules for ipa-pure-const.c, ipa-reference.c, ipa-reference.h, ipa-utils.c, ipa-utils.h, ipa-type-escape.c, ipa-type-escape.h, tree-promote-statics.c * ipa-pure-const.c, ipa-reference.c, ipa-reference.h, ipa-utils.c, ipa-utils.h, ipa-type-escape.c, ipa-type-escape.h, tree-promote-statics.c: new files. * alias.c: (nonlocal_mentioned_p_1, nonlocal_mentioned_p, nonlocal_referenced_p_1, nonlocal_referenced_p, nonlocal_set_p_1, int nonlocal_set_p, mark_constant_function): Deleted. (rest_of_handle_cfg): Removed call to mark_constant_function. (nonoverlapping_component_refs_p): Added calls to support type based aliasing. * tree-ssa-alias.c (may_alias_p, compute_flow_insensitive_aliasing): Ditto. * calls.c (flags_from_decl_or_type): Removed reference to cgraph_rtl_info. (flags_from_decl_or_type): Support ECF_POINTER_NO_CAPTURE attribute. * c-common.c (handle_pointer_no_capture_attribute): New function and added pointer_no_capture attribute. * c-typeck.c (convert_arguments): Make builtins tolerant of having too many arguments. This is necessary for Spec 2000. * cgraph.h (const_function, pure_function): Removed. * common.opt: Added "fipa-pure-const", "fipa-reference", "fipa-type-escape", and "ftree-promote-static". * opts.c: Ditto. * passes.c: Added ipa and tree-promote-statics passes. * timevar.def: Added TV_IPA_PURE_CONST, TV_IPA_REFERENCE, TV_IPA_TYPE_ESCAPE, and TV_PROMOTE_STATICS. * tree.h: Support ECF_POINTER_NO_CAPTURE attribute. * tree-dfa.c (referenced_var_lookup_if_exists): New function. * tree-flow.h: Added exposed sra calls and addition of reference_vars_info field for FUNCTION_DECLS. * tree-pass.h: Added passes. * tree-sra.c: (sra_init_cache): New function. (sra_insert_before, sra_insert_after) Made public. (type_can_be_decomposed_p): Renamed from type_can_be_decomposed_p and made public. * tree-ssa-alias.c (dump_alias_stats): Added stats for type based aliasing. (may_alias_p): Added code to use type escape analysis to improve alias sets. * tree-ssa-operands.c (add_call_clobber_ops): Added parameter and code to prune clobbers of static variables based on information produced in ipa-reference pass. Changed call clobbering so that statics are not marked as clobbered if the call does not clobber them. 2005-07-16 Danny Berlin <dberlin@dberlin.org> Kenneth Zadeck <zadeck@naturalbridge.com> * gcc.dg/tree-ssa/ssa-dce-2.c: Changed dg-options to run at -O2 since pure const detection cannot run at -O1 in c compiler. * gcc.dg/tree-ssa/20030714-1.c Changed scanning patterns because we can now optimize this case properly. * gcc.dg/tree-ssa/sra-2.c: Changed to -O3 and removed xfail because we now pass. * gcc.dg/vect/vect-92.c: Removed out of bounds array access. Co-Authored-By: Kenneth Zadeck <zadeck@naturalbridge.com> From-SVN: r102098
2005-07-16 20:56:53 +02:00
if (!sra_type_can_be_decomposed_p (type))
return false;
switch (TREE_CODE (type))
{
case RECORD_TYPE:
{
unsigned int cache = TYPE_UID (TYPE_MAIN_VARIANT (type)) * 2;
tree f;
if (bitmap_bit_p (sra_type_inst_cache, cache+0))
return true;
if (bitmap_bit_p (sra_type_inst_cache, cache+1))
return false;
for (f = TYPE_FIELDS (type); f ; f = TREE_CHAIN (f))
if (TREE_CODE (f) == FIELD_DECL)
{
if (!type_can_instantiate_all_elements (TREE_TYPE (f)))
{
bitmap_set_bit (sra_type_inst_cache, cache+1);
return false;
}
}
bitmap_set_bit (sra_type_inst_cache, cache+0);
return true;
}
case ARRAY_TYPE:
return type_can_instantiate_all_elements (TREE_TYPE (type));
case COMPLEX_TYPE:
return true;
default:
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * targhooks.c (default_unwind_emit, default_scalar_mode_supported_p): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * timevar.c (timevar_push, timevar_pop, timevar_start, timevar_stop): Likewise. * toplev.c (default_pch_valid_p): Likewise. * tracer.c (tail_duplicate): Likewise. * tree-alias-common.c (get_alias_var_decl, get_values_from_constructor, create_alias_var, delete_alias_vars, empty_points_to_set, same_points_to_set, ptr_may_alias_var): Likewise. * tree.c (tree_size, make_node_stat, copy_node_stat, build_int_cst_wide, integer_all_onesp, list_length, chainon, tree_node_structure, type_contains_placeholder_p, substitute_in_expr, substitute_placeholder_in_expr, tabilize_reference_1, build0_stat, build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p, lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr, build_method_type_directly, decl_type_context, get_callee_fndecl, get_set_constructor_bits, build_vector_type_for_mode, int_cst_value, tree_fold_gcd): Likewise. * tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges, make_cond_expr_edges, group_case_labels, tree_merge_blocks, cleanup_control_expr_graph, find_taken_edge, find_taken_edge_switch_expr, phi_alternatives_equal, is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt, stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate, tree_split_edge, tree_verify_flow_info, thread_jumps, tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise. * tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly, chrec_fold_multiply_poly_poly): Likewise. * tree-complex.c (extract_component, expand_complex_division, expand_complex_comparison, expand_complex_operations_1, build_replicated_const, expand_vector_operations_1): Likewise. * tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector, build_classic_dir_vector): Likewise. * tree-dfa.c (compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann, create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region, record_in_finally_tree, replace_goto_queue_1, maybe_record_in_goto_queue, verify_norecord_switch_expr, do_return_redirection): Likewise. * tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr, add_to_dst_predicate_list, find_phi_replacement_condition, replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order): Likewise. * tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r, initialize_inlined_parameters, declare_return_variable, estimate_num_insns_1, expand_call_inline, expand_calls_inline, optimize_inline_calls, copy_tree_r): Likewise. * tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt, ssa_rewrite_stmt, rewrite_into_ssa): Likewise. * tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after, tsi_split_statement_list_after, tsi_split_statement_list_before): Likewise. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-nested.c (create_tmp_var_for, lookup_field_for_decl, lookup_tramp_for_decl, convert_all_function_calls): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi, coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis, free_temp_expr_table, add_dependance, finish_expr, rewrite_trees): Likewise. * tree-phinodes.c (resize_phi_node, add_phi_arg, remove_all_phi_nodes_for): Likewise. * tree-pretty-print.c (op_prio, print_call_name): Likewise. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise. * tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree, sra_elt_eq, sra_walk_expr, instantiate_missing_elements, generate_one_element_ref, generate_element_copy, generate_element_zero, scalarize_copy, scalarize_init, scalarize_ldst): Likewise. * tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p, add_may_alias, add_pointed_to_expr, add_pointed_to_var, collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise. * tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise. * tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value, set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment, widen_bitfield, ccp_fold_builtin): Likewise. * tree-ssa-copy.c (may_propagate_copy, merge_alias_info, replace_exp_1, propagate_tree_value): Likewise. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. * tree-ssa-dce.c (set_control_dependence_map_bit, find_control_dependence, find_pdom, mark_operand_necessary, mark_stmt_if_obviously_necessary, mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise. * tree-ssa-dom.c (dom_opt_initialize_block_local_data, simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis, eliminate_redundant_computations, avail_expr_eq): Likewise. * tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, duplicate_blocks): Likewise. * tree-ssa-loop-im.c (for_each_index, set_level, is_call_clobbered_ref): Likewise. * tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos, stmt_after_increment, set_iv, contains_abnormal_ssa_name_p, find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates, peel_address, ptr_difference_cost, may_replace_final_value, determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer, rewrite_use, rewrite_uses): Likewise. * tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa, check_loop_closed_ssa_use): Likewise. * tree-ssanames.c (make_ssa_name): Likewise. * tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses, finalize_ssa_v_must_defs, finalize_ssa_stmt_operands, get_stmt_operands, get_expr_operands, get_asm_expr_operands, get_indirect_ref_operands, add_stmt_operand): Likewise. * tree-ssa-pre.c (value_exists_in_set_bitmap, value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set, phi_translate, valid_in_set, compute_antic, find_or_generate_expression, create_expression_by_pieces, insert_aux, create_value_expr_from, eliminate): Likewise. * tree-ssa-propagate.c (cfg_blocks_get): Likewise. * tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges): Likewise. * tree-tailcall.c (independent_of_stmt_p, adjust_return_value, eliminate_tail_call): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_align_data_ref, vect_create_data_ref, vect_create_destination_var, vect_get_vec_def_for_operand, vect_finish_stmt_generation, vect_transform_stmt, vect_transform_loop_bound, vect_transform_loop, vect_analyze_operations): Likewise. * tree-vn.c (vn_compute, set_value_handle, get_value_handle): Likewise. * tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr, get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start, bsi_after_labels, bsi_last): Likewise. * tree-ssa-live.c (var_union, change_partition_var, create_ssa_var_map, calculate_live_on_entry, root_var_init, type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce): Likewise. * tree-ssa-live.h (partition_is_global, live_entry_blocks, tpa_find_tree): Likewise. (register_ssa_partition_check): Declare. (register_ssa_partition): use it. * tree-ssa-live.c: Include errors.h. (register_ssa_partition_check): New. * tree-ssa-operands.c: Include errors.h. * Makefile.in (tree-ssa-operands.o): Depend on errors.h. Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> From-SVN: r87223
2004-09-09 09:54:12 +02:00
gcc_unreachable ();
}
}
/* Test whether ELT or some sub-element cannot be scalarized. */
static bool
can_completely_scalarize_p (struct sra_elt *elt)
{
struct sra_elt *c;
if (elt->cannot_scalarize)
return false;
for (c = elt->children; c; c = c->sibling)
if (!can_completely_scalarize_p (c))
return false;
for (c = elt->groups; c; c = c->sibling)
if (!can_completely_scalarize_p (c))
return false;
return true;
}
/* A simplified tree hashing algorithm that only handles the types of
trees we expect to find in sra_elt->element. */
static hashval_t
sra_hash_tree (tree t)
{
hashval_t h;
switch (TREE_CODE (t))
{
case VAR_DECL:
case PARM_DECL:
case RESULT_DECL:
h = DECL_UID (t);
break;
case INTEGER_CST:
h = TREE_INT_CST_LOW (t) ^ TREE_INT_CST_HIGH (t);
break;
case RANGE_EXPR:
h = iterative_hash_expr (TREE_OPERAND (t, 0), 0);
h = iterative_hash_expr (TREE_OPERAND (t, 1), h);
break;
case FIELD_DECL:
/* We can have types that are compatible, but have different member
lists, so we can't hash fields by ID. Use offsets instead. */
h = iterative_hash_expr (DECL_FIELD_OFFSET (t), 0);
h = iterative_hash_expr (DECL_FIELD_BIT_OFFSET (t), h);
break;
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
case BIT_FIELD_REF:
/* Don't take operand 0 into account, that's our parent. */
h = iterative_hash_expr (TREE_OPERAND (t, 1), 0);
h = iterative_hash_expr (TREE_OPERAND (t, 2), h);
break;
default:
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * targhooks.c (default_unwind_emit, default_scalar_mode_supported_p): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * timevar.c (timevar_push, timevar_pop, timevar_start, timevar_stop): Likewise. * toplev.c (default_pch_valid_p): Likewise. * tracer.c (tail_duplicate): Likewise. * tree-alias-common.c (get_alias_var_decl, get_values_from_constructor, create_alias_var, delete_alias_vars, empty_points_to_set, same_points_to_set, ptr_may_alias_var): Likewise. * tree.c (tree_size, make_node_stat, copy_node_stat, build_int_cst_wide, integer_all_onesp, list_length, chainon, tree_node_structure, type_contains_placeholder_p, substitute_in_expr, substitute_placeholder_in_expr, tabilize_reference_1, build0_stat, build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p, lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr, build_method_type_directly, decl_type_context, get_callee_fndecl, get_set_constructor_bits, build_vector_type_for_mode, int_cst_value, tree_fold_gcd): Likewise. * tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges, make_cond_expr_edges, group_case_labels, tree_merge_blocks, cleanup_control_expr_graph, find_taken_edge, find_taken_edge_switch_expr, phi_alternatives_equal, is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt, stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate, tree_split_edge, tree_verify_flow_info, thread_jumps, tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise. * tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly, chrec_fold_multiply_poly_poly): Likewise. * tree-complex.c (extract_component, expand_complex_division, expand_complex_comparison, expand_complex_operations_1, build_replicated_const, expand_vector_operations_1): Likewise. * tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector, build_classic_dir_vector): Likewise. * tree-dfa.c (compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann, create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region, record_in_finally_tree, replace_goto_queue_1, maybe_record_in_goto_queue, verify_norecord_switch_expr, do_return_redirection): Likewise. * tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr, add_to_dst_predicate_list, find_phi_replacement_condition, replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order): Likewise. * tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r, initialize_inlined_parameters, declare_return_variable, estimate_num_insns_1, expand_call_inline, expand_calls_inline, optimize_inline_calls, copy_tree_r): Likewise. * tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt, ssa_rewrite_stmt, rewrite_into_ssa): Likewise. * tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after, tsi_split_statement_list_after, tsi_split_statement_list_before): Likewise. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-nested.c (create_tmp_var_for, lookup_field_for_decl, lookup_tramp_for_decl, convert_all_function_calls): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi, coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis, free_temp_expr_table, add_dependance, finish_expr, rewrite_trees): Likewise. * tree-phinodes.c (resize_phi_node, add_phi_arg, remove_all_phi_nodes_for): Likewise. * tree-pretty-print.c (op_prio, print_call_name): Likewise. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise. * tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree, sra_elt_eq, sra_walk_expr, instantiate_missing_elements, generate_one_element_ref, generate_element_copy, generate_element_zero, scalarize_copy, scalarize_init, scalarize_ldst): Likewise. * tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p, add_may_alias, add_pointed_to_expr, add_pointed_to_var, collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise. * tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise. * tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value, set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment, widen_bitfield, ccp_fold_builtin): Likewise. * tree-ssa-copy.c (may_propagate_copy, merge_alias_info, replace_exp_1, propagate_tree_value): Likewise. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. * tree-ssa-dce.c (set_control_dependence_map_bit, find_control_dependence, find_pdom, mark_operand_necessary, mark_stmt_if_obviously_necessary, mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise. * tree-ssa-dom.c (dom_opt_initialize_block_local_data, simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis, eliminate_redundant_computations, avail_expr_eq): Likewise. * tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, duplicate_blocks): Likewise. * tree-ssa-loop-im.c (for_each_index, set_level, is_call_clobbered_ref): Likewise. * tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos, stmt_after_increment, set_iv, contains_abnormal_ssa_name_p, find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates, peel_address, ptr_difference_cost, may_replace_final_value, determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer, rewrite_use, rewrite_uses): Likewise. * tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa, check_loop_closed_ssa_use): Likewise. * tree-ssanames.c (make_ssa_name): Likewise. * tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses, finalize_ssa_v_must_defs, finalize_ssa_stmt_operands, get_stmt_operands, get_expr_operands, get_asm_expr_operands, get_indirect_ref_operands, add_stmt_operand): Likewise. * tree-ssa-pre.c (value_exists_in_set_bitmap, value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set, phi_translate, valid_in_set, compute_antic, find_or_generate_expression, create_expression_by_pieces, insert_aux, create_value_expr_from, eliminate): Likewise. * tree-ssa-propagate.c (cfg_blocks_get): Likewise. * tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges): Likewise. * tree-tailcall.c (independent_of_stmt_p, adjust_return_value, eliminate_tail_call): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_align_data_ref, vect_create_data_ref, vect_create_destination_var, vect_get_vec_def_for_operand, vect_finish_stmt_generation, vect_transform_stmt, vect_transform_loop_bound, vect_transform_loop, vect_analyze_operations): Likewise. * tree-vn.c (vn_compute, set_value_handle, get_value_handle): Likewise. * tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr, get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start, bsi_after_labels, bsi_last): Likewise. * tree-ssa-live.c (var_union, change_partition_var, create_ssa_var_map, calculate_live_on_entry, root_var_init, type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce): Likewise. * tree-ssa-live.h (partition_is_global, live_entry_blocks, tpa_find_tree): Likewise. (register_ssa_partition_check): Declare. (register_ssa_partition): use it. * tree-ssa-live.c: Include errors.h. (register_ssa_partition_check): New. * tree-ssa-operands.c: Include errors.h. * Makefile.in (tree-ssa-operands.o): Depend on errors.h. Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> From-SVN: r87223
2004-09-09 09:54:12 +02:00
gcc_unreachable ();
}
return h;
}
/* Hash function for type SRA_PAIR. */
static hashval_t
sra_elt_hash (const void *x)
{
const struct sra_elt *e = x;
const struct sra_elt *p;
hashval_t h;
h = sra_hash_tree (e->element);
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
/* Take into account everything except bitfield blocks back up the
chain. Given that chain lengths are rarely very long, this
should be acceptable. If we truly identify this as a performance
problem, it should work to hash the pointer value
"e->parent". */
for (p = e->parent; p ; p = p->parent)
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
if (!p->in_bitfld_block)
h = (h * 65521) ^ sra_hash_tree (p->element);
return h;
}
/* Equality function for type SRA_PAIR. */
static int
sra_elt_eq (const void *x, const void *y)
{
const struct sra_elt *a = x;
const struct sra_elt *b = y;
tree ae, be;
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
const struct sra_elt *ap = a->parent;
const struct sra_elt *bp = b->parent;
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
if (ap)
while (ap->in_bitfld_block)
ap = ap->parent;
if (bp)
while (bp->in_bitfld_block)
bp = bp->parent;
if (ap != bp)
return false;
ae = a->element;
be = b->element;
if (ae == be)
return true;
if (TREE_CODE (ae) != TREE_CODE (be))
return false;
switch (TREE_CODE (ae))
{
case VAR_DECL:
case PARM_DECL:
case RESULT_DECL:
/* These are all pointer unique. */
return false;
case INTEGER_CST:
/* Integers are not pointer unique, so compare their values. */
return tree_int_cst_equal (ae, be);
case RANGE_EXPR:
return
tree_int_cst_equal (TREE_OPERAND (ae, 0), TREE_OPERAND (be, 0))
&& tree_int_cst_equal (TREE_OPERAND (ae, 1), TREE_OPERAND (be, 1));
case FIELD_DECL:
/* Fields are unique within a record, but not between
compatible records. */
if (DECL_FIELD_CONTEXT (ae) == DECL_FIELD_CONTEXT (be))
return false;
return fields_compatible_p (ae, be);
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
case BIT_FIELD_REF:
return
tree_int_cst_equal (TREE_OPERAND (ae, 1), TREE_OPERAND (be, 1))
&& tree_int_cst_equal (TREE_OPERAND (ae, 2), TREE_OPERAND (be, 2));
default:
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * targhooks.c (default_unwind_emit, default_scalar_mode_supported_p): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * timevar.c (timevar_push, timevar_pop, timevar_start, timevar_stop): Likewise. * toplev.c (default_pch_valid_p): Likewise. * tracer.c (tail_duplicate): Likewise. * tree-alias-common.c (get_alias_var_decl, get_values_from_constructor, create_alias_var, delete_alias_vars, empty_points_to_set, same_points_to_set, ptr_may_alias_var): Likewise. * tree.c (tree_size, make_node_stat, copy_node_stat, build_int_cst_wide, integer_all_onesp, list_length, chainon, tree_node_structure, type_contains_placeholder_p, substitute_in_expr, substitute_placeholder_in_expr, tabilize_reference_1, build0_stat, build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p, lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr, build_method_type_directly, decl_type_context, get_callee_fndecl, get_set_constructor_bits, build_vector_type_for_mode, int_cst_value, tree_fold_gcd): Likewise. * tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges, make_cond_expr_edges, group_case_labels, tree_merge_blocks, cleanup_control_expr_graph, find_taken_edge, find_taken_edge_switch_expr, phi_alternatives_equal, is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt, stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate, tree_split_edge, tree_verify_flow_info, thread_jumps, tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise. * tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly, chrec_fold_multiply_poly_poly): Likewise. * tree-complex.c (extract_component, expand_complex_division, expand_complex_comparison, expand_complex_operations_1, build_replicated_const, expand_vector_operations_1): Likewise. * tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector, build_classic_dir_vector): Likewise. * tree-dfa.c (compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann, create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region, record_in_finally_tree, replace_goto_queue_1, maybe_record_in_goto_queue, verify_norecord_switch_expr, do_return_redirection): Likewise. * tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr, add_to_dst_predicate_list, find_phi_replacement_condition, replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order): Likewise. * tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r, initialize_inlined_parameters, declare_return_variable, estimate_num_insns_1, expand_call_inline, expand_calls_inline, optimize_inline_calls, copy_tree_r): Likewise. * tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt, ssa_rewrite_stmt, rewrite_into_ssa): Likewise. * tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after, tsi_split_statement_list_after, tsi_split_statement_list_before): Likewise. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-nested.c (create_tmp_var_for, lookup_field_for_decl, lookup_tramp_for_decl, convert_all_function_calls): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi, coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis, free_temp_expr_table, add_dependance, finish_expr, rewrite_trees): Likewise. * tree-phinodes.c (resize_phi_node, add_phi_arg, remove_all_phi_nodes_for): Likewise. * tree-pretty-print.c (op_prio, print_call_name): Likewise. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise. * tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree, sra_elt_eq, sra_walk_expr, instantiate_missing_elements, generate_one_element_ref, generate_element_copy, generate_element_zero, scalarize_copy, scalarize_init, scalarize_ldst): Likewise. * tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p, add_may_alias, add_pointed_to_expr, add_pointed_to_var, collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise. * tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise. * tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value, set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment, widen_bitfield, ccp_fold_builtin): Likewise. * tree-ssa-copy.c (may_propagate_copy, merge_alias_info, replace_exp_1, propagate_tree_value): Likewise. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. * tree-ssa-dce.c (set_control_dependence_map_bit, find_control_dependence, find_pdom, mark_operand_necessary, mark_stmt_if_obviously_necessary, mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise. * tree-ssa-dom.c (dom_opt_initialize_block_local_data, simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis, eliminate_redundant_computations, avail_expr_eq): Likewise. * tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, duplicate_blocks): Likewise. * tree-ssa-loop-im.c (for_each_index, set_level, is_call_clobbered_ref): Likewise. * tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos, stmt_after_increment, set_iv, contains_abnormal_ssa_name_p, find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates, peel_address, ptr_difference_cost, may_replace_final_value, determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer, rewrite_use, rewrite_uses): Likewise. * tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa, check_loop_closed_ssa_use): Likewise. * tree-ssanames.c (make_ssa_name): Likewise. * tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses, finalize_ssa_v_must_defs, finalize_ssa_stmt_operands, get_stmt_operands, get_expr_operands, get_asm_expr_operands, get_indirect_ref_operands, add_stmt_operand): Likewise. * tree-ssa-pre.c (value_exists_in_set_bitmap, value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set, phi_translate, valid_in_set, compute_antic, find_or_generate_expression, create_expression_by_pieces, insert_aux, create_value_expr_from, eliminate): Likewise. * tree-ssa-propagate.c (cfg_blocks_get): Likewise. * tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges): Likewise. * tree-tailcall.c (independent_of_stmt_p, adjust_return_value, eliminate_tail_call): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_align_data_ref, vect_create_data_ref, vect_create_destination_var, vect_get_vec_def_for_operand, vect_finish_stmt_generation, vect_transform_stmt, vect_transform_loop_bound, vect_transform_loop, vect_analyze_operations): Likewise. * tree-vn.c (vn_compute, set_value_handle, get_value_handle): Likewise. * tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr, get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start, bsi_after_labels, bsi_last): Likewise. * tree-ssa-live.c (var_union, change_partition_var, create_ssa_var_map, calculate_live_on_entry, root_var_init, type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce): Likewise. * tree-ssa-live.h (partition_is_global, live_entry_blocks, tpa_find_tree): Likewise. (register_ssa_partition_check): Declare. (register_ssa_partition): use it. * tree-ssa-live.c: Include errors.h. (register_ssa_partition_check): New. * tree-ssa-operands.c: Include errors.h. * Makefile.in (tree-ssa-operands.o): Depend on errors.h. Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> From-SVN: r87223
2004-09-09 09:54:12 +02:00
gcc_unreachable ();
}
}
/* Create or return the SRA_ELT structure for CHILD in PARENT. PARENT
may be null, in which case CHILD must be a DECL. */
static struct sra_elt *
lookup_element (struct sra_elt *parent, tree child, tree type,
enum insert_option insert)
{
struct sra_elt dummy;
struct sra_elt **slot;
struct sra_elt *elt;
if (parent)
dummy.parent = parent->is_group ? parent->parent : parent;
else
dummy.parent = NULL;
dummy.element = child;
slot = (struct sra_elt **) htab_find_slot (sra_map, &dummy, insert);
if (!slot && insert == NO_INSERT)
return NULL;
elt = *slot;
if (!elt && insert == INSERT)
{
*slot = elt = obstack_alloc (&sra_obstack, sizeof (*elt));
memset (elt, 0, sizeof (*elt));
elt->parent = parent;
elt->element = child;
elt->type = type;
elt->is_scalar = is_sra_scalar_type (type);
if (parent)
{
if (IS_ELEMENT_FOR_GROUP (elt->element))
{
elt->is_group = true;
elt->sibling = parent->groups;
parent->groups = elt;
}
else
{
elt->sibling = parent->children;
parent->children = elt;
}
}
/* If this is a parameter, then if we want to scalarize, we have
one copy from the true function parameter. Count it now. */
if (TREE_CODE (child) == PARM_DECL)
{
elt->n_copies = 1;
[multiple changes] 2005-06-29 Daniel Berlin <dberlin@dberlin.org> * tree-complex.c (complex_variable_components): Now a hashtable. (cvc_lookup): Ditto. (cvc_insert): Ditto. (create_components): Use referenced var iterator. Initialize hashtable. Use cvc_insert/lookup. (extract_components): Use cvc_insert/lookup. (update_complex_components): Ditto. (update_complex_components_on_edge): Ditto. * tree-dfa.c (referenced_vars): Now a hashtable. (dump_referenced_vars): Use iterator. (referenced_var_lookup): New function. (referenced_var_insert): Ditto. (add_referenced_var): Use referenced_var_insert. (mark_new_vars_to_rename): Use DECL_UID. * tree-flow-inline.h (first_htab_element): New function. (end_htab_p): Ditto. (next_htab_element): Ditto. (first_referenced_var): Ditto. (end_referenced_vars_p): Ditto. (next_referenced_var): Ditto. (is_call_clobbered): Use DECL_UID. (mark_call_clobbered): Ditto. (clear_call_clobbered): Ditto. (mark_non_addressable): Ditto. * tree-flow.h (htab_iterator): New struct. (FOR_EACH_HTAB_ELEMENT): New macro. (struct int_tree_map): New struct. (int_tree_map_hash): Prototype. (int_tree_map_eq): Ditto. (referenced_var_iterator): Ditto. (FOR_EACH_REFERENCED_VAR): New macro. (referenced_vars): Now a hashtable. * tree-into-ssa.c (symbol_marked_for_renaming): Use DECL_UID. (add_new_name_mapping): Ditto. (mark_def_sites): Ditto. (insert_phi_nodes): Use referenced_var iterator. (mark_def_site_blocks): Ditto. (mark_sym_for_renaming): Use DECL_UID. * tree-sra.c (is_sra_candidate_decl): Use DECL_UID. (lookup_element): Ditto. (find_candidates_for_sra): Use referenced_vars iterator. Use DECL_UID. * tree-ssa-alias.c (NUM_REFERENCES): New macro. (NUM_REFERENCES_CLEAR): Ditto. (NUM_REFERENCES_INC): Ditto. (NUM_REFERENCES_SET): Ditto. (alias_obstack): New bitmap obstack. (struct alias_map_d): Use bitmap, not sbitmap. (struct alias_info): Remove num_references. (init_alias_info): Use referenced_var iterator. Initialize bitmap obstack. (delete_alias_info): Use referenced_var iterator. Free bitmap obstack. (compute_points_to_and_addr_escape): Use DECL_UID. Use new NUM_REFERENCES macros. (compute_flow_sensitive_aliasing): may_aliases is now a bitmap. Use new NUM_REFERENCES macros. (group_aliases_into): Update prototype to use bitmap. (setup_pointers_and_addressables): Use referenced_vars iterator. Use DECL_UID. Use new NUM_REFERENCES macros. (add_pointed_to_var): Use DECL_UID. (dump_alias_info): Use referenced_var iterator. (add_type_alias): Ditto. (used_portions): Now a hashtable. (used_part_map_eq): New function. (used_part_map_hash): Ditto. (free_used_part_map): Ditto. (up_lookup): Ditto. (up_insert): Ditto. (get_or_create_used_part_for): Use up_lookup. (create_overlap_variables_for): Ditto. (find_used_portions): Use up_insert. Use DECL_UID. (create_structure_vars): Init used_portions hashtable, use referenced_vars iterator. * tree-ssa-live.c (create_ssa_var_map): sbitmaps became bitmaps. Use DECL_UID. * tree-ssa-loop-im.c (gather_mem_refs_stmt): Use DECL_UID. * tree-ssa-operands.c (get_asm_expr_operands): Ditto. (note_addressable): Ditto. * tree-ssa-structalias.c (set_uids_in_ptset): Ditto. * tree-ssa.c (verify_flow_insensitive_alias_info): Use referenced_var iterator. Use DECL_UID. (delete_tree_ssa): Ditto. (int_tree_map_eq): New function. (int_tree_map_hash): Ditto. * tree-stdarg.c (find_va_list_reference): Use DECL_UID. (va_list_ptr_read): Ditto. (va_list_counter_struct_op): Ditto. (va_list_ptr_write): Ditto. (check_va_list_escapes): Ditto. (check_all_va_list_escapes): Ditto. (execute_optimize_stdarg): Ditto. * tree-tailcall.c (suitable_for_tail_opt_p): Used referenced_var iterator. 2005-06-30 Daniel Berlin <dberlin@dberlin.org> * hashtab.h (HTAB_DELETED_ENTRY): New macro. (HTAB_EMPTY_ENTRY): New macro. 2005-06-30 Daniel Berlin <dberlin@dberlin.org> * hashtab.c (EMPTY_ENTRY): Moved and renamed. (DELETED_ENTRY): Ditto. From-SVN: r101480
2005-07-01 00:18:42 +02:00
bitmap_set_bit (needs_copy_in, DECL_UID (child));
}
}
return elt;
}
/* Create or return the SRA_ELT structure for EXPR if the expression
refers to a scalarizable variable. */
static struct sra_elt *
maybe_lookup_element_for_expr (tree expr)
{
struct sra_elt *elt;
tree child;
switch (TREE_CODE (expr))
{
case VAR_DECL:
case PARM_DECL:
case RESULT_DECL:
if (is_sra_candidate_decl (expr))
return lookup_element (NULL, expr, TREE_TYPE (expr), INSERT);
return NULL;
case ARRAY_REF:
/* We can't scalarize variable array indices. */
if (in_array_bounds_p (expr))
child = TREE_OPERAND (expr, 1);
else
return NULL;
break;
case ARRAY_RANGE_REF:
/* We can't scalarize variable array indices. */
if (range_in_array_bounds_p (expr))
{
tree domain = TYPE_DOMAIN (TREE_TYPE (expr));
child = build2 (RANGE_EXPR, integer_type_node,
TYPE_MIN_VALUE (domain), TYPE_MAX_VALUE (domain));
}
else
return NULL;
break;
case COMPONENT_REF:
{
tree type = TREE_TYPE (TREE_OPERAND (expr, 0));
/* Don't look through unions. */
if (TREE_CODE (type) != RECORD_TYPE)
return NULL;
/* Neither through variable-sized records. */
if (TYPE_SIZE (type) == NULL_TREE
|| TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
return NULL;
child = TREE_OPERAND (expr, 1);
}
break;
case REALPART_EXPR:
child = integer_zero_node;
break;
case IMAGPART_EXPR:
child = integer_one_node;
break;
default:
return NULL;
}
elt = maybe_lookup_element_for_expr (TREE_OPERAND (expr, 0));
if (elt)
return lookup_element (elt, child, TREE_TYPE (expr), INSERT);
return NULL;
}
/* Functions to walk just enough of the tree to see all scalarizable
references, and categorize them. */
/* A set of callbacks for phases 2 and 4. They'll be invoked for the
various kinds of references seen. In all cases, *BSI is an iterator
pointing to the statement being processed. */
struct sra_walk_fns
{
/* Invoked when ELT is required as a unit. Note that ELT might refer to
a leaf node, in which case this is a simple scalar reference. *EXPR_P
points to the location of the expression. IS_OUTPUT is true if this
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 Temporarily revert: 2007-04-06 Andreas Tobler <a.tobler@schweiz.org> 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (try_instantiate_multiple_fields): Needlessly initialize align to silence bogus warning. 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (struct sra_elt): Add in_bitfld_block. Remove all_no_warning. (struct sra_walk_fns): Remove use_all parameter from use. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (sra_walk_expr): Don't maintain or pass down use_all_p. (scan_use): Remove use_all parameter. (scalarize_use): Likewise. Re-expand assignment to BIT_FIELD_REF of gimple_reg. De-scalarize before input or output, and re-scalarize after output. Don't mark anything for no warning. (scalarize_ldst): Adjust. (scalarize_walk_gimple_modify_statement): Likewise. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Don't warn for any element whose parent is used as a whole. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. (instantiate_missing_elemnts): Use them. (mark_no_warning): Removed. (generate_one_element_ref): Handle BIT_FIELD_REFs. (REPLDUP, sra_build_elt_assignment): New. (generate_copy_inout): Use them. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_int): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (scalarize_use, scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r124302
2007-04-30 19:41:11 +02:00
is a left-hand-side reference. USE_ALL is true if we saw something we
couldn't quite identify and had to force the use of the entire object. */
void (*use) (struct sra_elt *elt, tree *expr_p,
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 Temporarily revert: 2007-04-06 Andreas Tobler <a.tobler@schweiz.org> 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (try_instantiate_multiple_fields): Needlessly initialize align to silence bogus warning. 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (struct sra_elt): Add in_bitfld_block. Remove all_no_warning. (struct sra_walk_fns): Remove use_all parameter from use. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (sra_walk_expr): Don't maintain or pass down use_all_p. (scan_use): Remove use_all parameter. (scalarize_use): Likewise. Re-expand assignment to BIT_FIELD_REF of gimple_reg. De-scalarize before input or output, and re-scalarize after output. Don't mark anything for no warning. (scalarize_ldst): Adjust. (scalarize_walk_gimple_modify_statement): Likewise. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Don't warn for any element whose parent is used as a whole. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. (instantiate_missing_elemnts): Use them. (mark_no_warning): Removed. (generate_one_element_ref): Handle BIT_FIELD_REFs. (REPLDUP, sra_build_elt_assignment): New. (generate_copy_inout): Use them. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_int): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (scalarize_use, scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r124302
2007-04-30 19:41:11 +02:00
block_stmt_iterator *bsi, bool is_output, bool use_all);
/* Invoked when we have a copy between two scalarizable references. */
void (*copy) (struct sra_elt *lhs_elt, struct sra_elt *rhs_elt,
block_stmt_iterator *bsi);
/* Invoked when ELT is initialized from a constant. VALUE may be NULL,
in which case it should be treated as an empty CONSTRUCTOR. */
void (*init) (struct sra_elt *elt, tree value, block_stmt_iterator *bsi);
/* Invoked when we have a copy between one scalarizable reference ELT
and one non-scalarizable reference OTHER without side-effects.
IS_OUTPUT is true if ELT is on the left-hand side. */
void (*ldst) (struct sra_elt *elt, tree other,
block_stmt_iterator *bsi, bool is_output);
/* True during phase 2, false during phase 4. */
/* ??? This is a hack. */
bool initial_scan;
};
#ifdef ENABLE_CHECKING
/* Invoked via walk_tree, if *TP contains a candidate decl, return it. */
static tree
sra_find_candidate_decl (tree *tp, int *walk_subtrees,
void *data ATTRIBUTE_UNUSED)
{
tree t = *tp;
enum tree_code code = TREE_CODE (t);
if (code == VAR_DECL || code == PARM_DECL || code == RESULT_DECL)
{
*walk_subtrees = 0;
if (is_sra_candidate_decl (t))
return t;
}
else if (TYPE_P (t))
*walk_subtrees = 0;
return NULL;
}
#endif
/* Walk most expressions looking for a scalarizable aggregate.
If we find one, invoke FNS->USE. */
static void
sra_walk_expr (tree *expr_p, block_stmt_iterator *bsi, bool is_output,
const struct sra_walk_fns *fns)
{
tree expr = *expr_p;
tree inner = expr;
bool disable_scalarization = false;
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 Temporarily revert: 2007-04-06 Andreas Tobler <a.tobler@schweiz.org> 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (try_instantiate_multiple_fields): Needlessly initialize align to silence bogus warning. 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (struct sra_elt): Add in_bitfld_block. Remove all_no_warning. (struct sra_walk_fns): Remove use_all parameter from use. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (sra_walk_expr): Don't maintain or pass down use_all_p. (scan_use): Remove use_all parameter. (scalarize_use): Likewise. Re-expand assignment to BIT_FIELD_REF of gimple_reg. De-scalarize before input or output, and re-scalarize after output. Don't mark anything for no warning. (scalarize_ldst): Adjust. (scalarize_walk_gimple_modify_statement): Likewise. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Don't warn for any element whose parent is used as a whole. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. (instantiate_missing_elemnts): Use them. (mark_no_warning): Removed. (generate_one_element_ref): Handle BIT_FIELD_REFs. (REPLDUP, sra_build_elt_assignment): New. (generate_copy_inout): Use them. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_int): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (scalarize_use, scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r124302
2007-04-30 19:41:11 +02:00
bool use_all_p = false;
/* We're looking to collect a reference expression between EXPR and INNER,
such that INNER is a scalarizable decl and all other nodes through EXPR
are references that we can scalarize. If we come across something that
we can't scalarize, we reset EXPR. This has the effect of making it
appear that we're referring to the larger expression as a whole. */
while (1)
switch (TREE_CODE (inner))
{
case VAR_DECL:
case PARM_DECL:
case RESULT_DECL:
/* If there is a scalarizable decl at the bottom, then process it. */
if (is_sra_candidate_decl (inner))
{
struct sra_elt *elt = maybe_lookup_element_for_expr (expr);
if (disable_scalarization)
elt->cannot_scalarize = true;
else
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 Temporarily revert: 2007-04-06 Andreas Tobler <a.tobler@schweiz.org> 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (try_instantiate_multiple_fields): Needlessly initialize align to silence bogus warning. 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (struct sra_elt): Add in_bitfld_block. Remove all_no_warning. (struct sra_walk_fns): Remove use_all parameter from use. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (sra_walk_expr): Don't maintain or pass down use_all_p. (scan_use): Remove use_all parameter. (scalarize_use): Likewise. Re-expand assignment to BIT_FIELD_REF of gimple_reg. De-scalarize before input or output, and re-scalarize after output. Don't mark anything for no warning. (scalarize_ldst): Adjust. (scalarize_walk_gimple_modify_statement): Likewise. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Don't warn for any element whose parent is used as a whole. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. (instantiate_missing_elemnts): Use them. (mark_no_warning): Removed. (generate_one_element_ref): Handle BIT_FIELD_REFs. (REPLDUP, sra_build_elt_assignment): New. (generate_copy_inout): Use them. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_int): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (scalarize_use, scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r124302
2007-04-30 19:41:11 +02:00
fns->use (elt, expr_p, bsi, is_output, use_all_p);
}
return;
case ARRAY_REF:
/* Non-constant index means any member may be accessed. Prevent the
expression from being scalarized. If we were to treat this as a
reference to the whole array, we can wind up with a single dynamic
index reference inside a loop being overridden by several constant
index references during loop setup. It's possible that this could
be avoided by using dynamic usage counts based on BB trip counts
(based on loop analysis or profiling), but that hardly seems worth
the effort. */
/* ??? Hack. Figure out how to push this into the scan routines
without duplicating too much code. */
if (!in_array_bounds_p (inner))
{
disable_scalarization = true;
goto use_all;
}
/* ??? Are we assured that non-constant bounds and stride will have
the same value everywhere? I don't think Fortran will... */
if (TREE_OPERAND (inner, 2) || TREE_OPERAND (inner, 3))
goto use_all;
inner = TREE_OPERAND (inner, 0);
break;
case ARRAY_RANGE_REF:
if (!range_in_array_bounds_p (inner))
{
disable_scalarization = true;
goto use_all;
}
/* ??? See above non-constant bounds and stride . */
if (TREE_OPERAND (inner, 2) || TREE_OPERAND (inner, 3))
goto use_all;
inner = TREE_OPERAND (inner, 0);
break;
case COMPONENT_REF:
{
tree type = TREE_TYPE (TREE_OPERAND (inner, 0));
/* Don't look through unions. */
if (TREE_CODE (type) != RECORD_TYPE)
goto use_all;
/* Neither through variable-sized records. */
if (TYPE_SIZE (type) == NULL_TREE
|| TREE_CODE (TYPE_SIZE (type)) != INTEGER_CST)
goto use_all;
inner = TREE_OPERAND (inner, 0);
}
break;
case REALPART_EXPR:
case IMAGPART_EXPR:
inner = TREE_OPERAND (inner, 0);
break;
case BIT_FIELD_REF:
re PR middle-end/28436 (accessing an element via a "pointer" on a vector does not cause vec_extract to be used) 2006-12-12 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/28436 * tree.h (DECL_COMPLEX_GIMPLE_REG_P): Rename to ... (DECL_GIMPLE_REG_P): This. * fold-const.c (fold_indirect_ref_1): Fold *(foo *)&vectorfoo into using BIT_FIELD_REF. * omp-low.c (omp_copy_decl_2): Use the renamed DECL_GIMPLE_REG_P. * tree-gimple.c (is_gimple_reg): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. * expr.c (get_inner_reference): Set the mode for BIT_FIELD_REF with vector types. * tree-flow-inline.h (var_can_have_subvars): Use the renamed DECL_GIMPLE_REG_P. * gimplify.c (internal_get_tmp_var): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. (gimplify_bind_expr): Likewise. (gimplify_function_tree): Likewise. * expmed.c: Include target.h. (extract_bit_field): For vector mode, try find a better mode first. If that fails use gen_lowpart (for vectors only). * tree-dfa.c (make_rename_temp): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. * tree-ssa-pre.c (create_expressions_by_pieces): Likewise. (insert_into_preds_of_block): Likewise. (insert_fake_stores): Create gimple register store_tmps for vector types. * tree-sra.c (sra_elt): New field, is_vector_lhs. (sra_walk_expr <case BIT_FIELD_REF>): For vector types that are the left hand side, set the element's is_vector_lhs to true. (instantiate_element): For vector types which were on the left hand size, set DECL_GIMPLE_REG_P to false. * tree-nested.c (create_tmp_var_for): Use the renamed DECL_GIMPLE_REG_P. * tree-inline.c (declare_return_variable): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. (copy_decl_to_var): Use the renamed DECL_GIMPLE_REG_P. (copy_result_decl_to_var): Likewise. * tree-vect-transform.c (vect_get_new_vect_var): For vector types, create a gimple register variable. (vect_permute_store_chain): Set DECL_GIMPLE_REG_P to true for the vect_inter_* temp variables. * Makefile.in (expmed.o): Update dependencies. 2006-12-12 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/28436 * gcc.c-torture/compile/vector-1.c: New test. * gcc.c-torture/compile/vector-2.c: New test. * gcc.c-torture/compile/vector-3.c: New test. From-SVN: r119801
2006-12-12 23:33:06 +01:00
/* A bit field reference to a specific vector is scalarized but for
ones for inputs need to be marked as used on the left hand size so
when we scalarize it, we can mark that variable as non renamable. */
if (is_output
&& TREE_CODE (TREE_TYPE (TREE_OPERAND (inner, 0))) == VECTOR_TYPE)
re PR middle-end/28436 (accessing an element via a "pointer" on a vector does not cause vec_extract to be used) 2006-12-12 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/28436 * tree.h (DECL_COMPLEX_GIMPLE_REG_P): Rename to ... (DECL_GIMPLE_REG_P): This. * fold-const.c (fold_indirect_ref_1): Fold *(foo *)&vectorfoo into using BIT_FIELD_REF. * omp-low.c (omp_copy_decl_2): Use the renamed DECL_GIMPLE_REG_P. * tree-gimple.c (is_gimple_reg): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. * expr.c (get_inner_reference): Set the mode for BIT_FIELD_REF with vector types. * tree-flow-inline.h (var_can_have_subvars): Use the renamed DECL_GIMPLE_REG_P. * gimplify.c (internal_get_tmp_var): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. (gimplify_bind_expr): Likewise. (gimplify_function_tree): Likewise. * expmed.c: Include target.h. (extract_bit_field): For vector mode, try find a better mode first. If that fails use gen_lowpart (for vectors only). * tree-dfa.c (make_rename_temp): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. * tree-ssa-pre.c (create_expressions_by_pieces): Likewise. (insert_into_preds_of_block): Likewise. (insert_fake_stores): Create gimple register store_tmps for vector types. * tree-sra.c (sra_elt): New field, is_vector_lhs. (sra_walk_expr <case BIT_FIELD_REF>): For vector types that are the left hand side, set the element's is_vector_lhs to true. (instantiate_element): For vector types which were on the left hand size, set DECL_GIMPLE_REG_P to false. * tree-nested.c (create_tmp_var_for): Use the renamed DECL_GIMPLE_REG_P. * tree-inline.c (declare_return_variable): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. (copy_decl_to_var): Use the renamed DECL_GIMPLE_REG_P. (copy_result_decl_to_var): Likewise. * tree-vect-transform.c (vect_get_new_vect_var): For vector types, create a gimple register variable. (vect_permute_store_chain): Set DECL_GIMPLE_REG_P to true for the vect_inter_* temp variables. * Makefile.in (expmed.o): Update dependencies. 2006-12-12 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/28436 * gcc.c-torture/compile/vector-1.c: New test. * gcc.c-torture/compile/vector-2.c: New test. * gcc.c-torture/compile/vector-3.c: New test. From-SVN: r119801
2006-12-12 23:33:06 +01:00
{
struct sra_elt *elt
= maybe_lookup_element_for_expr (TREE_OPERAND (inner, 0));
if (elt)
elt->is_vector_lhs = true;
re PR middle-end/28436 (accessing an element via a "pointer" on a vector does not cause vec_extract to be used) 2006-12-12 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/28436 * tree.h (DECL_COMPLEX_GIMPLE_REG_P): Rename to ... (DECL_GIMPLE_REG_P): This. * fold-const.c (fold_indirect_ref_1): Fold *(foo *)&vectorfoo into using BIT_FIELD_REF. * omp-low.c (omp_copy_decl_2): Use the renamed DECL_GIMPLE_REG_P. * tree-gimple.c (is_gimple_reg): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. * expr.c (get_inner_reference): Set the mode for BIT_FIELD_REF with vector types. * tree-flow-inline.h (var_can_have_subvars): Use the renamed DECL_GIMPLE_REG_P. * gimplify.c (internal_get_tmp_var): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. (gimplify_bind_expr): Likewise. (gimplify_function_tree): Likewise. * expmed.c: Include target.h. (extract_bit_field): For vector mode, try find a better mode first. If that fails use gen_lowpart (for vectors only). * tree-dfa.c (make_rename_temp): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. * tree-ssa-pre.c (create_expressions_by_pieces): Likewise. (insert_into_preds_of_block): Likewise. (insert_fake_stores): Create gimple register store_tmps for vector types. * tree-sra.c (sra_elt): New field, is_vector_lhs. (sra_walk_expr <case BIT_FIELD_REF>): For vector types that are the left hand side, set the element's is_vector_lhs to true. (instantiate_element): For vector types which were on the left hand size, set DECL_GIMPLE_REG_P to false. * tree-nested.c (create_tmp_var_for): Use the renamed DECL_GIMPLE_REG_P. * tree-inline.c (declare_return_variable): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. (copy_decl_to_var): Use the renamed DECL_GIMPLE_REG_P. (copy_result_decl_to_var): Likewise. * tree-vect-transform.c (vect_get_new_vect_var): For vector types, create a gimple register variable. (vect_permute_store_chain): Set DECL_GIMPLE_REG_P to true for the vect_inter_* temp variables. * Makefile.in (expmed.o): Update dependencies. 2006-12-12 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/28436 * gcc.c-torture/compile/vector-1.c: New test. * gcc.c-torture/compile/vector-2.c: New test. * gcc.c-torture/compile/vector-3.c: New test. From-SVN: r119801
2006-12-12 23:33:06 +01:00
}
/* A bit field reference (access to *multiple* fields simultaneously)
is not currently scalarized. Consider this an access to the
complete outer element, to which walk_tree will bring us next. */
re PR middle-end/28436 (accessing an element via a "pointer" on a vector does not cause vec_extract to be used) 2006-12-12 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/28436 * tree.h (DECL_COMPLEX_GIMPLE_REG_P): Rename to ... (DECL_GIMPLE_REG_P): This. * fold-const.c (fold_indirect_ref_1): Fold *(foo *)&vectorfoo into using BIT_FIELD_REF. * omp-low.c (omp_copy_decl_2): Use the renamed DECL_GIMPLE_REG_P. * tree-gimple.c (is_gimple_reg): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. * expr.c (get_inner_reference): Set the mode for BIT_FIELD_REF with vector types. * tree-flow-inline.h (var_can_have_subvars): Use the renamed DECL_GIMPLE_REG_P. * gimplify.c (internal_get_tmp_var): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. (gimplify_bind_expr): Likewise. (gimplify_function_tree): Likewise. * expmed.c: Include target.h. (extract_bit_field): For vector mode, try find a better mode first. If that fails use gen_lowpart (for vectors only). * tree-dfa.c (make_rename_temp): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. * tree-ssa-pre.c (create_expressions_by_pieces): Likewise. (insert_into_preds_of_block): Likewise. (insert_fake_stores): Create gimple register store_tmps for vector types. * tree-sra.c (sra_elt): New field, is_vector_lhs. (sra_walk_expr <case BIT_FIELD_REF>): For vector types that are the left hand side, set the element's is_vector_lhs to true. (instantiate_element): For vector types which were on the left hand size, set DECL_GIMPLE_REG_P to false. * tree-nested.c (create_tmp_var_for): Use the renamed DECL_GIMPLE_REG_P. * tree-inline.c (declare_return_variable): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. (copy_decl_to_var): Use the renamed DECL_GIMPLE_REG_P. (copy_result_decl_to_var): Likewise. * tree-vect-transform.c (vect_get_new_vect_var): For vector types, create a gimple register variable. (vect_permute_store_chain): Set DECL_GIMPLE_REG_P to true for the vect_inter_* temp variables. * Makefile.in (expmed.o): Update dependencies. 2006-12-12 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/28436 * gcc.c-torture/compile/vector-1.c: New test. * gcc.c-torture/compile/vector-2.c: New test. * gcc.c-torture/compile/vector-3.c: New test. From-SVN: r119801
2006-12-12 23:33:06 +01:00
goto use_all;
case VIEW_CONVERT_EXPR:
case NOP_EXPR:
/* Similarly, a view/nop explicitly wants to look at an object in a
type other than the one we've scalarized. */
goto use_all;
case WITH_SIZE_EXPR:
/* This is a transparent wrapper. The entire inner expression really
is being used. */
goto use_all;
use_all:
expr_p = &TREE_OPERAND (inner, 0);
inner = expr = *expr_p;
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 Temporarily revert: 2007-04-06 Andreas Tobler <a.tobler@schweiz.org> 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (try_instantiate_multiple_fields): Needlessly initialize align to silence bogus warning. 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (struct sra_elt): Add in_bitfld_block. Remove all_no_warning. (struct sra_walk_fns): Remove use_all parameter from use. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (sra_walk_expr): Don't maintain or pass down use_all_p. (scan_use): Remove use_all parameter. (scalarize_use): Likewise. Re-expand assignment to BIT_FIELD_REF of gimple_reg. De-scalarize before input or output, and re-scalarize after output. Don't mark anything for no warning. (scalarize_ldst): Adjust. (scalarize_walk_gimple_modify_statement): Likewise. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Don't warn for any element whose parent is used as a whole. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. (instantiate_missing_elemnts): Use them. (mark_no_warning): Removed. (generate_one_element_ref): Handle BIT_FIELD_REFs. (REPLDUP, sra_build_elt_assignment): New. (generate_copy_inout): Use them. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_int): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (scalarize_use, scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r124302
2007-04-30 19:41:11 +02:00
use_all_p = true;
break;
default:
#ifdef ENABLE_CHECKING
/* Validate that we're not missing any references. */
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * targhooks.c (default_unwind_emit, default_scalar_mode_supported_p): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * timevar.c (timevar_push, timevar_pop, timevar_start, timevar_stop): Likewise. * toplev.c (default_pch_valid_p): Likewise. * tracer.c (tail_duplicate): Likewise. * tree-alias-common.c (get_alias_var_decl, get_values_from_constructor, create_alias_var, delete_alias_vars, empty_points_to_set, same_points_to_set, ptr_may_alias_var): Likewise. * tree.c (tree_size, make_node_stat, copy_node_stat, build_int_cst_wide, integer_all_onesp, list_length, chainon, tree_node_structure, type_contains_placeholder_p, substitute_in_expr, substitute_placeholder_in_expr, tabilize_reference_1, build0_stat, build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p, lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr, build_method_type_directly, decl_type_context, get_callee_fndecl, get_set_constructor_bits, build_vector_type_for_mode, int_cst_value, tree_fold_gcd): Likewise. * tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges, make_cond_expr_edges, group_case_labels, tree_merge_blocks, cleanup_control_expr_graph, find_taken_edge, find_taken_edge_switch_expr, phi_alternatives_equal, is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt, stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate, tree_split_edge, tree_verify_flow_info, thread_jumps, tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise. * tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly, chrec_fold_multiply_poly_poly): Likewise. * tree-complex.c (extract_component, expand_complex_division, expand_complex_comparison, expand_complex_operations_1, build_replicated_const, expand_vector_operations_1): Likewise. * tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector, build_classic_dir_vector): Likewise. * tree-dfa.c (compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann, create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region, record_in_finally_tree, replace_goto_queue_1, maybe_record_in_goto_queue, verify_norecord_switch_expr, do_return_redirection): Likewise. * tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr, add_to_dst_predicate_list, find_phi_replacement_condition, replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order): Likewise. * tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r, initialize_inlined_parameters, declare_return_variable, estimate_num_insns_1, expand_call_inline, expand_calls_inline, optimize_inline_calls, copy_tree_r): Likewise. * tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt, ssa_rewrite_stmt, rewrite_into_ssa): Likewise. * tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after, tsi_split_statement_list_after, tsi_split_statement_list_before): Likewise. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-nested.c (create_tmp_var_for, lookup_field_for_decl, lookup_tramp_for_decl, convert_all_function_calls): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi, coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis, free_temp_expr_table, add_dependance, finish_expr, rewrite_trees): Likewise. * tree-phinodes.c (resize_phi_node, add_phi_arg, remove_all_phi_nodes_for): Likewise. * tree-pretty-print.c (op_prio, print_call_name): Likewise. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise. * tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree, sra_elt_eq, sra_walk_expr, instantiate_missing_elements, generate_one_element_ref, generate_element_copy, generate_element_zero, scalarize_copy, scalarize_init, scalarize_ldst): Likewise. * tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p, add_may_alias, add_pointed_to_expr, add_pointed_to_var, collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise. * tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise. * tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value, set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment, widen_bitfield, ccp_fold_builtin): Likewise. * tree-ssa-copy.c (may_propagate_copy, merge_alias_info, replace_exp_1, propagate_tree_value): Likewise. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. * tree-ssa-dce.c (set_control_dependence_map_bit, find_control_dependence, find_pdom, mark_operand_necessary, mark_stmt_if_obviously_necessary, mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise. * tree-ssa-dom.c (dom_opt_initialize_block_local_data, simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis, eliminate_redundant_computations, avail_expr_eq): Likewise. * tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, duplicate_blocks): Likewise. * tree-ssa-loop-im.c (for_each_index, set_level, is_call_clobbered_ref): Likewise. * tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos, stmt_after_increment, set_iv, contains_abnormal_ssa_name_p, find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates, peel_address, ptr_difference_cost, may_replace_final_value, determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer, rewrite_use, rewrite_uses): Likewise. * tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa, check_loop_closed_ssa_use): Likewise. * tree-ssanames.c (make_ssa_name): Likewise. * tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses, finalize_ssa_v_must_defs, finalize_ssa_stmt_operands, get_stmt_operands, get_expr_operands, get_asm_expr_operands, get_indirect_ref_operands, add_stmt_operand): Likewise. * tree-ssa-pre.c (value_exists_in_set_bitmap, value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set, phi_translate, valid_in_set, compute_antic, find_or_generate_expression, create_expression_by_pieces, insert_aux, create_value_expr_from, eliminate): Likewise. * tree-ssa-propagate.c (cfg_blocks_get): Likewise. * tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges): Likewise. * tree-tailcall.c (independent_of_stmt_p, adjust_return_value, eliminate_tail_call): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_align_data_ref, vect_create_data_ref, vect_create_destination_var, vect_get_vec_def_for_operand, vect_finish_stmt_generation, vect_transform_stmt, vect_transform_loop_bound, vect_transform_loop, vect_analyze_operations): Likewise. * tree-vn.c (vn_compute, set_value_handle, get_value_handle): Likewise. * tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr, get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start, bsi_after_labels, bsi_last): Likewise. * tree-ssa-live.c (var_union, change_partition_var, create_ssa_var_map, calculate_live_on_entry, root_var_init, type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce): Likewise. * tree-ssa-live.h (partition_is_global, live_entry_blocks, tpa_find_tree): Likewise. (register_ssa_partition_check): Declare. (register_ssa_partition): use it. * tree-ssa-live.c: Include errors.h. (register_ssa_partition_check): New. * tree-ssa-operands.c: Include errors.h. * Makefile.in (tree-ssa-operands.o): Depend on errors.h. Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> From-SVN: r87223
2004-09-09 09:54:12 +02:00
gcc_assert (!walk_tree (&inner, sra_find_candidate_decl, NULL, NULL));
#endif
return;
}
}
/* Walk a TREE_LIST of values looking for scalarizable aggregates.
If we find one, invoke FNS->USE. */
static void
sra_walk_tree_list (tree list, block_stmt_iterator *bsi, bool is_output,
const struct sra_walk_fns *fns)
{
tree op;
for (op = list; op ; op = TREE_CHAIN (op))
sra_walk_expr (&TREE_VALUE (op), bsi, is_output, fns);
}
/* Walk the arguments of a CALL_EXPR looking for scalarizable aggregates.
If we find one, invoke FNS->USE. */
static void
sra_walk_call_expr (tree expr, block_stmt_iterator *bsi,
const struct sra_walk_fns *fns)
{
tree.h (enum tree_code_class): Add tcc_vl_exp. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree.h (enum tree_code_class): Add tcc_vl_exp. (VL_EXP_CLASS_P): New. (TREE_OPERAND_CHECK): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (TREE_OPERAND_CHECK_CODE): Likewise. (GIMPLE_STMT_OPERAND_CHECK): Likewise. (TREE_RTL_OPERAND_CHECK): Likewise. (tree_operand_check_failed): Make second parameter the whole tree instead of its code. Fixed callers. (VL_EXP_CHECK): New. (TREE_OPERAND_LENGTH): New. (VL_EXP_OPERAND_LENGTH): New. (CALL_EXPR_FN): New. (CALL_EXPR_STATIC_CHAIN): New. (CALL_EXPR_ARGS): New. (CALL_EXPR_ARG): New. (call_expr_nargs): New. (CALL_EXPR_ARGP): New. (build_nt_call_list): Declare. (build_vl_exp_stat): Declare. (build_vl_exp): New. (build_call_list): Declare. (build_call_nary): Declare. (build_call_valist): Declare. (build_call_array): Declare. (call_expr_arg): Declare. (call_expr_argp): Declare. (call_expr_arglist): Declare. (fold_build_call_list): Declare. (fold_build_call_list_initializer): Declare. (fold_call_expr): Declare to replace fold_builtin. (fold_builtin_fputs): Update to agree with modified definition. (fold_builtin_strcpy): Likewise. (fold_builtin_strncpy): Likewise. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_next_arg): Likewise. (fold_build_call_expr): Declare. (fold_builtin_call_list): Declare. (fold_builtin_call_valist): Declare. (build_call_expr): Declare. (validate_arglist): Update to agree with modified definition. (tree_operand_length): New. (call_expr_arg_iterator): New. (init_call_expr_arg_iterator): New. (next_call_expr_arg): New. (first_call_expr_arg): New. (more_call_expr_args_p): New. (FOR_EACH_CALL_EXPR_ARG): New. * tree.c (tree_code_class_string): Add entries for tcc_vl_exp and tcc_gimple_stmt. (tree_code_size): Update documentation. Use sizeof (tree) rather than sizeof (char *). (tree_size): Likewise. Add case for tcc_vl_exp. (tree_node_structure): Add case for tcc_vl_exp. (contains_placeholder_p): Likewise. (substitute_in_expr): Likewise. (substitute_placeholder_in_expr): Likewise. (stabilize_reference_1): Likewise. (build3_stat): Remove logic for CALL_EXPRs. Replace with assertion to diagnose breakage of this interface for constructing CALL_EXPRs. (build_nt): Add similar assertion here. (build_nt_call_list): New. (simple_cst_equal) <CALL_EXPR>: Rewrite to use new accessors. (iterative_hash_expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (get_callee_fndecl): Use new CALL_EXPR accessors. (tree_operand_check_failed): Change parameters to pass entire node instead of its code, so that we can call TREE_OPERAND_LENGTH on it. (process_call_operands): New. (build_vl_exp_stat): New. (build_call_list): New. (build_call_nary): New. (build_call_valist): New. (build_call_array): New. (walk_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (call_expr_arglist): New. * tree.def (CALL_EXPR): Change representation of CALL_EXPRs to use tcc_vl_exp instead of a fixed-size tcc_expression. * doc/c-tree.texi (CALL_EXPR): Document new representation and accessors for CALL_EXPRs. (AGGR_INIT_EXPR): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * builtins.c (c_strlen): Return NULL_TREE instead of 0. (expand_builtin_nonlocal_goto): Change parameter to be entire CALL_EXPR instead of an arglist. Use new CALL_EXPR accessors. (expand_builtin_prefetch): Likewise. (expand_builtin_classify_type): Likewise. (mathfn_built_in): Return NULL_TREE instead of 0. (expand_errno_check): Use new CALL_EXPR accessors. (expand_builtin_mathfn): Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_mathfn_2): Likewise. (expand_builtin_mathfn_3): Likewise. (expand_builtin_interclass_mathfn): Likewise. (expand_builtin_sincos): Likewise. (expand_builtin_cexpi): Likewise. (expand_builtin_int_roundingfn): Likewise. (expand_builtin_int_roundingfn_2): Likewise. (expand_builtin_pow): Likewise. (expand_builtin_powi): Likewise. (expand_builtin_strlen): Pass entire CALL_EXPR as parameter instead of arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_RTX instead of 0. (expand_builtin_strstr): Likewise. (expand_builtin_strchr): Likewise. (expand_builtin_strrchr): Likewise. (expand_builtin_strpbrk): Likewise. (expand_builtin_memcpy): Likewise. (expand_builtin_mempcpy): Likewise. (expand_builtin_mempcpy_args): New. (expand_builtin_memmove): Similarly to expand_builtin_mempcpy. (expand_builtin_memmove_args): New. (expand_builtin_bcopy): Similarly to expand_builtin_mempcpy. (expand_movstr): Likewise. (expand_builtin_strcpy): Likewise. (expand_builtin_strcpy_args): New. (expand_builtin_stpcpy): Similarly to expand_builtin_strcpy. (expand_builtin_strncpy): Likewise. (expand_builtin_memset): Likewise. (expand_builtin_memset_args): New. (expand_builtin_bzero): Similarly to expand_builtin_memset. (expand_builtin_memcmp): Likewise. (expand_builtin_strcmp): Likewise. (expand_builtin_strncmp): Likewise. (expand_builtin_strcat): Likewise. (expand_builtin_strncat): Likewise. (expand_builtin_strspn): Likewise. (expand_builtin_strcspn): Likewise. (expand_builtin_args_info): Likewise. (expand_builtin_va_start): Likewise. (gimplify_va_arg_expr): Likewise. (expand_builtin_va_end): Likewise. (expand_builtin_va_copy): Likewise. (expand_builtin_frame_address): Likewise. (expand_builtin_alloca): Likewise. (expand_builtin_bswap): Likewise. (expand_builtin_unop): Likewise. (expand_builtin_fputs): Likewise. (expand_builtin_expect): Likewise. (expand_builtin_fabs): Likewise. (expand_builtin_copysign): Likewise. (expand_builtin_printf): Likewise. (expand_builtin_fprintf): Likewise. (expand_builtin_sprintf): Likewise. (expand_builtin_init_trampoline): Likewise. (expand_builtin_signbit): Likewise. (expand_builtin_fork_or_exec): Likewise. (expand_builtin_sync_operation): Likewise. (expand_builtin_compare_and_swap): Likewise. (expand_builtin_lock_test_and_set): Likewise. (expand_builtin_lock_release): Likewise. (expand_builtin): Likewise. (builtin_mathfn_code): Likewise. (fold_builtin_constant_p): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_expect): Likewise. (fold_builtin_classify_type): Likewise. (fold_builtin_strlen): Likewise. (fold_builtin_nan): Likewise. (integer_valued_real_p): Likewise. (fold_trunc_transparent_mathfn): Likewise. (fold_fixed_mathfn): Likewise. (fold_builtin_cabs): Likewise. (fold_builtin_sqrt): Likewise. (fold_builtin_cbrt): Likewise. (fold_builtin_cos): Likewise. (fold_builtin_cosh): Likewise. (fold_builtin_tan): Likewise. (fold_builtin_sincos): Likewise. (fold_builtin_cexp): Likewise. (fold_builtin_trunc): Likewise. (fold_builtin_floor): Likewise. (fold_builtin_ceil): Likewise. (fold_builtin_round): Likewise. (fold_builtin_int_roundingfn): Likewise. (fold_builtin_bitop): Likewise. (fold_builtin_bswap): Likewise. (fold_builtin_logarithm): Likewise. (fold_builtin_hypot): Likewise. (fold_builtin_pow): Likewise. (fold_builtin_powi): Likewise. (fold_builtin_exponent): Likewise. (fold_builtin_memset): Likewise. (fold_builtin_bzero): Likewise. (fold_builtin_memory_op): Likewise. (fold_builtin_bcopy): Deleted; call site changed to invoke fold_builtin_memory_op directly. (fold_builtin_strcpy): Similarly as for fold_builtin_memory_op. (fold_builtin_strncpy): Likewise. (fold_builtin_memcmp): Likewise. (fold_builtin_strcmp): Likewise. (fold_builtin_strncmp): Likewise. (fold_builtin_signbit): Likewise. (fold_builtin_copysign): Likewise. (fold_builtin_isascii): Likewise. (fold_builtin_toascii): Likewise. (fold_builtin_isdigit): Likewise. (fold_builtin_fabs): Likewise. (fold_builtin_abs): Likewise. (fold_builtin_fmin_fmax): Likewise. (fold_builtin_carg): Likewise. (fold_builtin_classify): Likewise. (fold_builtin_unordered_cmp): Likewise. (fold_builtin_0, fold_builtin_2, fold_builtin_3, fold_builtin_4): New functions split out from fold_builtin_1. (fold_builtin_n): New. (fold_builtin_varargs): New. (fold_builtin): Deleted. Most callers changed to use fold_call_expr instead. (fold_call_expr): New. (build_function_call_expr): Rewrite to use new helper function. (fold_builtin_call_list): New. (build_call_expr): New. (fold_builtin_call_valist): New. (rewrite_call_expr): New. (validate_arg): New. (validate_arglist): Change parameter to be entire CALL_EXPR instead of an arglist. Change return type to bool. Use new CALL_EXPR accessors. (fold_builtin_strstr): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_strchr): Likewise. (fold_builtin_strrchr): Likewise. (fold_builtin_strpbrk): Likewise. (fold_builtin_strcat): Likewise. (fold_builtin_strncat): Likewise. (fold_builtin_strspn): Likewise. (fold_builtin_strcspn): Likewise. (fold_builtin_fputs): Likewise. (fold_builtin_next_arg): Likewise. (fold_builtin_sprintf): Likewise. (expand_builtin_object_size): Use new CALL_EXPR accessors. Use NULL_RTX instead of 0. (expand_builtin_memory_chk): Likewise. (maybe_emit_chk_warning): Likewise. (maybe_emit_sprintf_chk_warning): Likewise. (fold_builtin_object_size): Pass call arguments individually instead of as an arglist, fixing callers appropriately. Use new CALL_EXPR accessors and constructors. Return NULL_TREE instead of 0. (fold_builtin_memory_chk): Likewise. (fold_builtin_stxcpy_chk): Likewise. (fold_builtin_strncpy_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strcat_chk): Likewise. (fold_builtin_strncat_chk): Likewise. (fold_builtin_sprintf_chk): Likewise. (fold_builtin_snprintf_chk): Likewise. (fold_builtin_printf): Likewise. (fold_builtin_vprintf): Likewise. * fold-const.c (negate_expr_p): Use new CALL_EXPR accessors and constructors. (operand_equal_p): Add separate tcc_vl_exp/CALL_EXPR case. (make_range): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (extract_muldiv_1): Add VL_EXP_CLASS_P case. (fold_mathfn_compare): Use new CALL_EXPR accessors and constructors. (fold_unary): Likewise. (fold_binary): Likewise. (fold_ternary): Remove CALL_EXPR case, since they are no longer ternary expressions. (fold): Add logic for tcc_vl_exp. (fold_checksum_tree): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (fold_build3_stat): Add assertion to flag broken interface for constructing CALL_EXPRs. (fold_build_call_list): New. (fold_build_call_list_initializer): New. (tree_expr_nonnegative_p): Use new CALL_EXPR accessors and constructors. (fold_strip_sign_ops): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * tree-dump.c (dequeue_and_dump) <CALL_EXPR>: Use new CALL_EXPR accessors and dump arguments explicitly. * tree-pretty-print.c (do_niy): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (dump_generic_node): Use new CALL_EXPR accessors and walk arguments explicitly. (print_call_name): Use new CALL_EXPR accessors. * print-tree.c (print_node): Add case tcc_vl_exp. Print CALL_EXPR arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-vrp.c (stmt_interesting_for_vrp): Use new CALL_EXPR accessors. (vrp_visit_stmt): Likewise. * tree-ssa-loop-im.c (outermost_invariant_loop_expr): Make it know about tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (force_move_till_expr): Likewise. * targhooks.c (default_external_stack_protect_fail): Use build_call_expr instead of build_function_call_expr. (default_hidden_stack_protect_fail): Likewise. * tree-complex.c (expand_complex_libcall): Use build_call_expr to build the call. * cgraphbuild.c (build_cgraph_edges): Use new CALL_EXPR accessors and walk arguments explicitly. * tree-ssa-loop-niter.c (simplify_replace_tree): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_simple_operations): Likewise. (infer_loop_bounds_from_array): Use new CALL_EXPR accessors. * gengtype.c (adjust_field_tree_exp): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (walk_type): Tweak walking of arrays not to blow up on CALL_EXPRs. * optabs.c (expand_widen_pattern-expr): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * value_prof.c (tree_ic): Use new CALL_EXPR accessors. (tree_ic_transform): Likewise. (interesting_stringop_to_profile_p): Pass entire CALL_EXPR as parameter instead of arglist. Fix callers. (tree_stringop_fixed_value): Use new CALL_EXPR accessors. (tree_stringops_transform): Likewise. (tree_indirect_call_to_profile): Likewise. (tree_stringops_values_to_profile): Likewise. * tree-tailcall.c (find_tail_calls): Use new CALL_EXPR iterator. (eliminate_tail_call): Likewise. * ipa-cp.c (ipcp_update_callgraph): Use new CALL_EXPR accessors. * tree-scalar-evolution.c (chrec_contains_symbols_defined_in_loop): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (instantiate_parameters_1): Can't handle tcc_vl_exp here. * omp-low.c (build_omp_barrier): Use build_call_expr. (lower_rec_input_clauses): Likewise. (lower_reduction_clauses): Likewise. (expand_parallel_call): Likewise. (maybe_catch_exception): Likewise. (expand_omp_for_generic): Likewise. (expand_omp_for_static_nochunk): Likewise. (expand_omp_sections): Likewise. (lower_omp_single_simple): Likewise. (lower_omp_single_copy): Likewise. (lower_omp_master): Likewise. (lower_omp_ordered): Likewise. (lower_omp_critical): Likewise. * ipa-reference.c (check-call): Use new CALL_EXPR iterator. (scan_for_static_refs): Create tcc_vl_exp case for CALL_EXPR. * tree-gimple.c (is_gimple_call_addr): Fix doc. (recalculate_side_effects): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. Add tcc_vl_exp case. * tree-chrec.c (chrec_contains_symbols): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (chrec_contains_undetermined): Likewise. (tree_contains_chrecs): Likewise. (evolution_function_is_invariant_rec_p): Use TREE_OPERAND_LENGTH. * cgraphunit.c (update_call_expr): Use new CALL_EXPR accessors. * tree-ssa-ccp.c (ccp_fold): Use new CALL_EXPR accessors. Use fold_call_expr instead of fold_builtin. (ccp_fold_builtin): Likewise. Update calls into builtins.c to match declarations there. (fold_stmt): Use new CALL_EXPR constructor and accessors. Doc updates. * tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-pure-const.c (check_call): Use new CALL_EXPR accessors. (scan_function): Add case tcc_vl_exp for CALL_EXPR. * tree-stdarg.c (execute_optimize_stdarg): Use new CALL_EXPR accessors. * tree-ssa-math-opts.c (execute_cse_sincos_1): Use build_call_expr. (execute_cse_sincos): Use new CALL_EXPR accessors. * tree-ssa-alias.c (find_used_portions): Use new CALL_EXPR iterator. * gimple-low.c (lower_function_body): Use build_call_expr. (lower_builtin_setjmp): Likewise. * expr.c (emit_block_move_via_libcall): Use build_call_expr. (set_storage_via_libcall): Likewise. (safe_from_p): Add tcc_vl_exp case. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (expand_expr_real_1): Use new CALL_EXPR accessors. * tree-browser.c (store_child_info): Use TREE_OPERAND_LENGTH and generalize to handle any number of operands. (TB_parent_eq): Likewise. * predict.c (expr_expected_value): Use new CALL_EXPR accessors. (strip_builtin_expect): Likewise. * function.c (gimplify_parameters): Use build_call_expr. * tree-vectorizer.c (vect_is_simple_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * ipa-type-escape.c (check_call): Use new CALL_EXPR iterators. (scan_for_refs): Add case tcc_vl_exp for CALL_EXPR. * tree-data-ref.c (get_references_in_stmt): Use new CALL_EXPR iterators. * gimplify.c (build_stack_save_restore): Use build_call_expr. (gimplify_decl_expr): Likewise. (gimplify_call_expr): Use fold_call_expr instead of fold_builtin. Use new CALL_EXPR iterators. (gimplify_modify_expr_to_memcpy): Use build_call_expr. (gimplify_modify_expr_to_memset): Likewise. (gimplify_variable_sized_compare): Likewise. (gimplify_omp_atomic_fetch_op): Likewise. (gimplify_omp_atomic_pipeline): Likewise. (gimplify_omp_atomic_mutex): Likewise. (gimplify_function_tree): Likewise. * calls.c (alloca_call_p): Use new CALL_EXPR accessors. (call_expr_flags): Likewise. (expand_call): Likewise. * except.c (expand_builtin_eh_return_data_regno): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. * coverage.c (create_coverage): Use build_call_expr. * tree-ssa-pre.c (expression_node_pool, list_node_pool): Delete. (temp_call_expr_obstack): New. (pool_copy_list): Delete. (temp_copy_call_expr): New. (phi_translate): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. Get rid of special goo for copying argument lists and use temp_copy_call_expr instead. (valid_in_sets): Add case tcc_vl_exp for CALL_EXPR. Use new CALL_EXPR accessors. (create_expression_by_pieces): Likewise. Use build_call_array to construct the result instead of fold_build3. (create_value_expr_from): Add tcc_vl_exp. Delete special goo for dealing with argument lists. (init_pre): Remove references to expression_node_pool and list_node_pool. Init temp_call_expr_obstack instead. (fini_pre): Remove references to expression_node_pool and list_node_pool. * tree-sra.c (sra_walk_call_expr): Use new CALL_EXPR accessors and walk arguments explicitly instead of as a list. * tree-mudflap.c (mf_build_check_statement_for): Use build_call_expr. (mx_register_decls): Likewise. (mudflap_register_call): Likewise. (mudflap_finish_file): Likewise. * ipa-prop.c (ipa_callsite_compute_count): Use new CALL_EXPR accessors. (ipa_callsite_compute_param): Likewise. * tree-vect-patterns.c (vect_recog_pow_pattern): Use new CALL_EXPR accessors and constructor. * tree-nested.c (convert_nl_goto_reference): Use new CALL_EXPR accessors and constructor. (convert_tramp_reference): Likewise. (convert_call_expr): Likewise. (finalize_nesting_tree_1): Likewise. * tree-ssa.c (tree_ssa_useless_type_conversion): Use new CALL_EXPR accessors. * tree-ssa-loop-prefetch.c (issue_prefetch_ref): Use build_call_expr. * tree-inline.c (initialize_inlined_parameters): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors. (estimate_num_insns_1): Use new CALL_EXPR accessors. (expand_call_inline): Tidy up call to initialize_inlined_parameters. * tree-vect-transform.c (vect_create_epilog_for_reduction): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (vectorizable_reduction): Likewise. (vectorizable_call): Use new CALL_EXPR iterators. (vectorizable_conversion): Use build_call_expr. (vectorizable_operation): Use TREE_OPERAND_LENGTH. (vect_gen_widened_results_half): Use build_call_expr. (vect_setup_realignment): Likewise. (vectorizable_live_operation): Use TREE_OPERAND_LENGTH. * tree-object-size.c (alloc_object_size): Use new CALL_EXPR accessors. (pass_through_call): Likewise. (compute_object_sizes): Likewise. Use fold_call_expr instead of fold_builtin. * tree-profile.c (tree_gen_interval_profiler): Use build_call_expr. (tree_gen_pow2_profiler): Likewise. (tree_gen_one_value_profiler): Likewise. (tree_gen_ic_func_profiler): Likewise. (tree_gen_average_profiler): Likewise. (tree_gen_ior_profiler): Likewise. * tree-ssa-structalias.c (get_constraint_for): Add case tcc_vl_exp. (find_func_aliases): Use new CALL_EXPR accessors. Add case tcc_vl_exp. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * tree-ssa-reassoc.c (get_rank): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * stmt.c (warn_if_unused_value): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * convert.c (convert_to_real): Use new CALL_EXPR accessors and constructor. (convert_to_integer): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * config/alpha/alpha.c (alpha_expand_builtin): Use new CALL_EXPR accessors. * config/frv/frv.c (frv_expand_builtin): Likewise. * config/s390/s390.c (s390_expand_builtin): Likewise. * config/sparc/sparc.c (sparc_gimplify_va_arg): Use build_call_expr. (sparc_expand_builtin): Use new CALL_EXPR accessors. * config/i386/i386.c (ix86_function_ok_for_sibcall): Likewise. (ix86_expand_binop_builtin): Pass entire CALL_EXPR as parameter instead of arglist. Use new CALL_EXPR accessors on it. Fix callers. (ix86_expand_store_builtin): Likewise. (ix86_expand_unop_builtin): Likewise. (ix86_expand_unop1_builtin): Likewise. (ix86_expand_sse_compare): Likewise. (ix86_expand_sse_comi): Likewise. (ix86_expand_vec_init_builtin): Likewise. (ix86_expand_vec_ext_builtin): Likewise. (ix86_expand_vec_set_builtin): Likewise. (ix86_expand_builtin): Use new CALL_EXPR accessors. * config/sh/sh.c (sh_expand_builtin): Use new CALL_EXPR accessors. * config/c4x/c4x.c (c4x_expand_builtin): Likewise. * config/iq2000/iq2000.c (expand_one_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (iq2000_expand_builtin): Use new CALL_EXPR accessors. * config/rs6000/rs6000-c.c (altivec_build_resolved_builtin): Use build_call_expr. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. (rs6000_expand_unop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_abs_builtin): Likewise. (rs6000_expand_binop_builtin): Likewise. (altivec_expand_predicate_builtin): Likewise. (altivec_expand_lv_builtin): Likewise. (spe_expand_stv_builtin): Likewise. (altivec_expand_stv_builtin): Likewise. (rs6000_expand_ternop_builtin): Likewise. (altivec_expand_ld_builtin): Use new CALL_EXPR accessors. (altivec_expand_st_builtin): Likewise. (altivec_expand_dst_builtin): Likewise. (altivec_expand_vec_init_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (altivec_expand_vec_set_builtin): Likewise. (altivec_expand_vec_ext_builtin): Likewise. (altivec_expand_builtin): Use new CALL_EXPR accessors. (spe_expand_builtin): Likewise. (spe_expand_predicate_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (spe_expand_evsel_builtin): Likewise. (rs6000_expand_builtin): Use new CALL_EXPR accessors. VCFUX and FCFSX cases must construct whole new CALL_EXPR, not just arglist. * config/arm/arm.c (arm_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (arm_expand_unop_builtin): Likewise. (arm_expand_builtin): Use new CALL_EXPR accessors. * config/mips/mips.c (mips_expand_builtin): Use new CALL_EXPR accessors. * config/bfin/bfin.c (bfin_expand_binop_builtin): Pass entire CALL_EXPR instead of arglist. Use new CALL_EXPR accessors. Fix callers. (bfin_expand_unop_builtin): Likewise. (bfin_expand_builtin): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * c-semantics.c (build_stmt): Add internal diagnostic check. * c-pretty-print.c (pp_c_postfix_expression): Use new CALL_EXPR accessors. Print arguments explicitly instead of as a list. * c-typeck.c (build_function_call): Use new CALL_EXPR constructors. * c-omp.c (c_finish_omp_barrier): Use build_call_expr. (c_finish_omp_flish): Likewise. * c-common.c (verify_tree): Use new CALL_EXPR accessors. Traverse arguments explicitly instead of as a list. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. (check_function_arguments_recurse): Use new CALL_EXPR accessors. (c_warn_unused_result): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * cp-tree.def (AGGR_INIT_EXPR): Adjust documentation. Change class to tcc_vl_exp. * call.c (build_call): Use build_call_list instead of build3. (build_over_call): Likewise. (build_new_method_call): Use build_min_non_dep_call_list instead of build_min_non_dep. * error.c (dump_call_expr_args): New function. (dump_aggr_init_expr_args): New function. (dump_expr) <AGGR_INIT_EXPR, CALL_EXPR, INDIRECT_REF>: Use them. Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. * cvt.c (convert_to_void): Use build_call_array instead of build3; use new AGGR_INIT_EXPR accessor macros. * mangle.c (write_expression): Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * dump.c (cp_dump_tree) <AGGR_INIT_EXPR>: Update to use new AGGR_INIT_EXPR accessor macros. * cp-gimplify.c (cp_gimplify_init_expr): Use AGGR_INIT_EXPR_SLOT to set the slot operand. * cp-tree.h (AGGR_INIT_EXPR_FN): New macro. (AGGR_INIT_EXPR_SLOT): New macro. (AGGR_INIT_EXPR_ARG): New macro. (aggr_init_expr_nargs): New macro. (AGGR_INIT_EXPR_ARGP): New macro. (aggr_init_expr_arg_iterator): New. (init_aggr_init_expr_arg_iterator): New. (next_aggr_init_expr_arg): New. (first_aggr_init_expr_arg): New. (more_aggr_init_expr_args_p): New. (FOR_EACH_AGGR_INIT_EXPR_ARG): New. (stabilize_aggr_init): New declaration. (build_min_non_dep_call_list): Likewise. * tree.c (process_aggr_init_operands): New function. (build_aggr_init_array) New function. (build_cplus_new): Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros. Replace use of build3 with build_aggr_init_array. (build_min_non_dep_call_list) New function. (build_min_nt): Assert input code parameter is not a variable length expression class. (build_min, build_min_non_dep): Likewise. (cp_tree_equal) <CALL_EXPR>: Iterate through the arguments to check for equality instead of recursing. Handle tcc_vl_exp tree code classes. (stabilize_call): Update to only handle CALL_EXPRs, not AGGR_INIT_EXPRs; use new CALL_EXPR accessor macros. (stabilize_aggr_init): New function. (stabilize_init): Use it. * cxx-pretty-print.c (pp_cxx_postfix_expression) <AGGR_INIT_EXPR, CALL_EXPR>: Update to use new CALL_EXPR and AGGR_INIT_EXPR accessor macros and argument iterators. * pt.c (tsubst_copy) <CALL_EXPR>: Replace build_nt with build_vl_exp. Iterate through the operands, recursively processing each one. (tsubst_copy_and_build) <CALL_EXPR>: Update to use new CALL_EXPR accessor macros. (value_dependent_expression_p) <default>: Handle tcc_vl_exp tree code classes. Use TREE_OPERAND_LENGTH instead of TREE_CODE_LENGTH. * semantics.c (finish_call_expr): Use build_nt_call_list instead of build_nt. (simplify_aggr_init_expr): Update to use new AGGR_INIT_EXPR accessor macros. Use build_call_array to construct the CALL_EXPR node instead of build3 * decl2.c (build_offset_ref_call_from_tree): Use build_nt_call_list and build_min_non_dep_call_list instead of build_min_nt and build_min_non_dep. * parser.c (cp_parser_postfix_expression) <CPP_OPEN_PAREN>: Use build_nt_call_list instead of build_min_nt. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * java-tree.h (BUILD_MONITOR_ENTER): Use build_call_nary instead of build3. (BUILD_MONITOR_EXIT): Likewise. * java-gimplify.c (java_gimplify_component_ref): Use build_call_expr. (java_gimplify_modify_expr): Likewise. * class.c (cache_this_class_ref): Use build_call_expr. (build_static_field_ref): Likewise. (emit_indirect_register_classes): Likewise. (emit_register_classes): Likewise. * resource.c (write_resource_constructor): Use build_call_expr. * builtins.c (builtin_creator_function): Change interpretation of the second parameter to be the whole CALL_EXPR instead of the arglist. (max_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (min_builtin): Likewise. (abs_builtin): Likewise. (java_build_function_call_expr): Likewise. (convert_real): Likewise. (UNMARSHAL3): Likewise. (UNMARSHAL4): Likewise. (UNMARSHAL5): Likewise. (build_arglist_for_builtin): Delete. Fix callers to use build_call_expr instead. (putObject_builtin): Tweak parameter list. Use new CALL_EXPR accessors. (compareAndSwapInt_builtin): Likewise. (compareAndSwapLong_builtin): Likewise. (compareAndSwapObject_builtin): Likewise. (putVolatile_builtin): Likewise. (getVolatile_builtin): Likewise. (VMSupportsCS8_builtin): Likewise. (check_for_builtin): Pass entire CALL_EXPR to builtin expander instead of arglist. * expr.c (build_java_athrow): Use build_call_nary instead of build3. (build_java_throw_out_of_bounds_exception): Likewise. (java_check_reference): Likewise. (build_java_arraystore_check): Likewise. (build_newarray): Likewise. (build_anewarray): Likewise. (expand_java_multinewarray): Use build_call_list instead of build3. (build_java_monitor): Use build_call_nary instead of build3. (java_create_object): Likewise. (expand_java_NEW): Likewise. (build_instanceof): Likewise. (expand_java_CHECKCAST): Likewise. (build_java_soft_divmod): Likewise. (build_java_binop): Likewise. (build_field_ref): Likewise. (build_class_init): Likewise. (rewrite_arglist_getcaller): Use build_call_expr. (build_invokeinterface): Use build_call_nary instead of build3. (expand_invoke): Use build_call_list instead of build3. (build_jni_stub): Use build_call_nary, build_call_list, or build_call_expr instead of build3. (expand_java_field_op): Use build_call_expr instead of build3. (force_evaluation_order): Use new CALL_EXPR accessors. * lang.c (java_get_callee_fndecl): Use new CALL_EXPR accessors. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * objc-act.c (receiver_is_class_object): Use new CALL_EXPR accessors. (objc_get_callee_fndecl): Likewise. 2007-02-15 Sandra Loosemore <sandra@codesourcery.com> Brooks Moses <brooks.moses@codesourcery.com> Lee Millward <lee.millward@codesourcery.com> * trans-expr.c (gfc_conv_power_op): Use build_call_expr. (gfc_conv_string_tmp): Likewise. (gfc_conv_concat_op): Likewise. (gfc_build_compare_string): Likewise. (gfc_conv_function_call): Use build_call_list instead of build3. * trans-array.c (gfc_trans_allocate_array_storage): Use build_call_expr. (gfc_grow_array): Likewise. (gfc_trans_array_ctor_element): Likewise. (gfc_trans_array_constructor_value): Likewise. (gfc_array_allocate): Likewise. (gfc_array_deallocate): Likewise. (gfc_trans_auto_array_allocation): Likewise. (gfc_trans_dummy_array_bias): Likewise. (gfc_conv_array_parameter): Likewise. (gfc_trans_dealloc_allocated): Likewise. (gfc_duplicate_allocatable): Likewise. * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. (gfc_trans_omp_flush): Likewise. * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. (gfc_trans_pause): Likewise. (gfc_trans_stop): Likewise. (gfc_trans_character_select): Likewise. (gfc_do_allocate): Likewise. (gfc_trans_assign_need_temp): Likewise. (gfc_trans_pointer_assign_need_temp): Likewise. (gfc_trans_forall_1): Likewise. (gfc_trans_where_2): Likewise. (gfc_trans_allocate): Likewise. (gfc_trans_deallocate): Likewise. * trans.c (gfc_trans_runtime_check): Use build_call_expr. * trans-io.c (gfc_trans_open): Use build_call_expr. (gfc_trans_close): Likewise. (build_filepos): Likewise. (gfc_trans_inquire): Likewise. (NML_FIRST_ARG): Delete. (NML_ADD_ARG): Delete. (transfer_namelist_element): Use build_call_expr. (build_dt): Likewise. (gfc_trans_dt_end): Likewise. (transfer_expr): Likewise. (transfer_array-desc): Likewise. * trans-decl.c (gfc_generate_function_code): Use build_call_expr. (gfc_generate_constructors): Likewise. * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. (gfc_conv_intrinsic_fdate): Likewise. (gfc_conv_intrinsic_ttynam): Likewise. (gfc_conv_intrinsic_array_transfer): Likewise. (gfc_conv_associated): Likewise. (gfc_conv_intrinsic_si_kind): Likewise. (gfc_conv_intrinsic_trim): Likewise. (gfc_conv_intrinsic_repeat: Likewise. (gfc_conv_intrinsic_iargc): Likewise. Co-Authored-By: Brooks Moses <brooks.moses@codesourcery.com> Co-Authored-By: Lee Millward <lee.millward@codesourcery.com> From-SVN: r122018
2007-02-16 00:50:49 +01:00
int i;
int nargs = call_expr_nargs (expr);
for (i = 0; i < nargs; i++)
sra_walk_expr (&CALL_EXPR_ARG (expr, i), bsi, false, fns);
}
/* Walk the inputs and outputs of an ASM_EXPR looking for scalarizable
aggregates. If we find one, invoke FNS->USE. */
static void
sra_walk_asm_expr (tree expr, block_stmt_iterator *bsi,
const struct sra_walk_fns *fns)
{
sra_walk_tree_list (ASM_INPUTS (expr), bsi, false, fns);
sra_walk_tree_list (ASM_OUTPUTS (expr), bsi, true, fns);
}
/* Walk a GIMPLE_MODIFY_STMT and categorize the assignment appropriately. */
static void
sra_walk_gimple_modify_stmt (tree expr, block_stmt_iterator *bsi,
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
const struct sra_walk_fns *fns)
{
struct sra_elt *lhs_elt, *rhs_elt;
tree lhs, rhs;
lhs = GIMPLE_STMT_OPERAND (expr, 0);
rhs = GIMPLE_STMT_OPERAND (expr, 1);
lhs_elt = maybe_lookup_element_for_expr (lhs);
rhs_elt = maybe_lookup_element_for_expr (rhs);
/* If both sides are scalarizable, this is a COPY operation. */
if (lhs_elt && rhs_elt)
{
fns->copy (lhs_elt, rhs_elt, bsi);
return;
}
/* If the RHS is scalarizable, handle it. There are only two cases. */
if (rhs_elt)
{
if (!rhs_elt->is_scalar && !TREE_SIDE_EFFECTS (lhs))
fns->ldst (rhs_elt, lhs, bsi, false);
else
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 Temporarily revert: 2007-04-06 Andreas Tobler <a.tobler@schweiz.org> 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (try_instantiate_multiple_fields): Needlessly initialize align to silence bogus warning. 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (struct sra_elt): Add in_bitfld_block. Remove all_no_warning. (struct sra_walk_fns): Remove use_all parameter from use. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (sra_walk_expr): Don't maintain or pass down use_all_p. (scan_use): Remove use_all parameter. (scalarize_use): Likewise. Re-expand assignment to BIT_FIELD_REF of gimple_reg. De-scalarize before input or output, and re-scalarize after output. Don't mark anything for no warning. (scalarize_ldst): Adjust. (scalarize_walk_gimple_modify_statement): Likewise. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Don't warn for any element whose parent is used as a whole. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. (instantiate_missing_elemnts): Use them. (mark_no_warning): Removed. (generate_one_element_ref): Handle BIT_FIELD_REFs. (REPLDUP, sra_build_elt_assignment): New. (generate_copy_inout): Use them. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_int): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (scalarize_use, scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r124302
2007-04-30 19:41:11 +02:00
fns->use (rhs_elt, &GIMPLE_STMT_OPERAND (expr, 1), bsi, false, false);
}
/* If it isn't scalarizable, there may be scalarizable variables within, so
check for a call or else walk the RHS to see if we need to do any
copy-in operations. We need to do it before the LHS is scalarized so
that the statements get inserted in the proper place, before any
copy-out operations. */
else
{
tree call = get_call_expr_in (rhs);
if (call)
sra_walk_call_expr (call, bsi, fns);
else
sra_walk_expr (&GIMPLE_STMT_OPERAND (expr, 1), bsi, false, fns);
}
/* Likewise, handle the LHS being scalarizable. We have cases similar
to those above, but also want to handle RHS being constant. */
if (lhs_elt)
{
/* If this is an assignment from a constant, or constructor, then
we have access to all of the elements individually. Invoke INIT. */
if (TREE_CODE (rhs) == COMPLEX_EXPR
|| TREE_CODE (rhs) == COMPLEX_CST
|| TREE_CODE (rhs) == CONSTRUCTOR)
fns->init (lhs_elt, rhs, bsi);
/* If this is an assignment from read-only memory, treat this as if
we'd been passed the constructor directly. Invoke INIT. */
else if (TREE_CODE (rhs) == VAR_DECL
&& TREE_STATIC (rhs)
&& TREE_READONLY (rhs)
&& targetm.binds_local_p (rhs))
fns->init (lhs_elt, DECL_INITIAL (rhs), bsi);
/* If this is a copy from a non-scalarizable lvalue, invoke LDST.
The lvalue requirement prevents us from trying to directly scalarize
the result of a function call. Which would result in trying to call
the function multiple times, and other evil things. */
else if (!lhs_elt->is_scalar
&& !TREE_SIDE_EFFECTS (rhs) && is_gimple_addressable (rhs))
fns->ldst (lhs_elt, rhs, bsi, true);
/* Otherwise we're being used in some context that requires the
aggregate to be seen as a whole. Invoke USE. */
else
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 Temporarily revert: 2007-04-06 Andreas Tobler <a.tobler@schweiz.org> 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (try_instantiate_multiple_fields): Needlessly initialize align to silence bogus warning. 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (struct sra_elt): Add in_bitfld_block. Remove all_no_warning. (struct sra_walk_fns): Remove use_all parameter from use. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (sra_walk_expr): Don't maintain or pass down use_all_p. (scan_use): Remove use_all parameter. (scalarize_use): Likewise. Re-expand assignment to BIT_FIELD_REF of gimple_reg. De-scalarize before input or output, and re-scalarize after output. Don't mark anything for no warning. (scalarize_ldst): Adjust. (scalarize_walk_gimple_modify_statement): Likewise. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Don't warn for any element whose parent is used as a whole. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. (instantiate_missing_elemnts): Use them. (mark_no_warning): Removed. (generate_one_element_ref): Handle BIT_FIELD_REFs. (REPLDUP, sra_build_elt_assignment): New. (generate_copy_inout): Use them. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_int): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (scalarize_use, scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r124302
2007-04-30 19:41:11 +02:00
fns->use (lhs_elt, &GIMPLE_STMT_OPERAND (expr, 0), bsi, true, false);
}
/* Similarly to above, LHS_ELT being null only means that the LHS as a
whole is not a scalarizable reference. There may be occurrences of
scalarizable variables within, which implies a USE. */
else
sra_walk_expr (&GIMPLE_STMT_OPERAND (expr, 0), bsi, true, fns);
}
/* Entry point to the walk functions. Search the entire function,
invoking the callbacks in FNS on each of the references to
scalarizable variables. */
static void
sra_walk_function (const struct sra_walk_fns *fns)
{
basic_block bb;
block_stmt_iterator si, ni;
/* ??? Phase 4 could derive some benefit to walking the function in
dominator tree order. */
FOR_EACH_BB (bb)
for (si = bsi_start (bb); !bsi_end_p (si); si = ni)
{
tree stmt, t;
stmt_ann_t ann;
stmt = bsi_stmt (si);
ann = stmt_ann (stmt);
ni = si;
bsi_next (&ni);
/* If the statement has no virtual operands, then it doesn't
make any structure references that we care about. */
if (gimple_aliases_computed_p (cfun)
&& ZERO_SSA_OPERANDS (stmt, (SSA_OP_VIRTUAL_DEFS | SSA_OP_VUSE)))
continue;
switch (TREE_CODE (stmt))
{
case RETURN_EXPR:
/* If we have "return <retval>" then the return value is
already exposed for our pleasure. Walk it as a USE to
force all the components back in place for the return.
If we have an embedded assignment, then <retval> is of
a type that gets returned in registers in this ABI, and
we do not wish to extend their lifetimes. Treat this
as a USE of the variable on the RHS of this assignment. */
t = TREE_OPERAND (stmt, 0);
if (t == NULL_TREE)
;
else if (TREE_CODE (t) == GIMPLE_MODIFY_STMT)
sra_walk_expr (&GIMPLE_STMT_OPERAND (t, 1), &si, false, fns);
else
sra_walk_expr (&TREE_OPERAND (stmt, 0), &si, false, fns);
break;
case GIMPLE_MODIFY_STMT:
sra_walk_gimple_modify_stmt (stmt, &si, fns);
break;
case CALL_EXPR:
sra_walk_call_expr (stmt, &si, fns);
break;
case ASM_EXPR:
sra_walk_asm_expr (stmt, &si, fns);
break;
default:
break;
}
}
}
/* Phase One: Scan all referenced variables in the program looking for
structures that could be decomposed. */
static bool
find_candidates_for_sra (void)
{
bool any_set = false;
[multiple changes] 2005-06-29 Daniel Berlin <dberlin@dberlin.org> * tree-complex.c (complex_variable_components): Now a hashtable. (cvc_lookup): Ditto. (cvc_insert): Ditto. (create_components): Use referenced var iterator. Initialize hashtable. Use cvc_insert/lookup. (extract_components): Use cvc_insert/lookup. (update_complex_components): Ditto. (update_complex_components_on_edge): Ditto. * tree-dfa.c (referenced_vars): Now a hashtable. (dump_referenced_vars): Use iterator. (referenced_var_lookup): New function. (referenced_var_insert): Ditto. (add_referenced_var): Use referenced_var_insert. (mark_new_vars_to_rename): Use DECL_UID. * tree-flow-inline.h (first_htab_element): New function. (end_htab_p): Ditto. (next_htab_element): Ditto. (first_referenced_var): Ditto. (end_referenced_vars_p): Ditto. (next_referenced_var): Ditto. (is_call_clobbered): Use DECL_UID. (mark_call_clobbered): Ditto. (clear_call_clobbered): Ditto. (mark_non_addressable): Ditto. * tree-flow.h (htab_iterator): New struct. (FOR_EACH_HTAB_ELEMENT): New macro. (struct int_tree_map): New struct. (int_tree_map_hash): Prototype. (int_tree_map_eq): Ditto. (referenced_var_iterator): Ditto. (FOR_EACH_REFERENCED_VAR): New macro. (referenced_vars): Now a hashtable. * tree-into-ssa.c (symbol_marked_for_renaming): Use DECL_UID. (add_new_name_mapping): Ditto. (mark_def_sites): Ditto. (insert_phi_nodes): Use referenced_var iterator. (mark_def_site_blocks): Ditto. (mark_sym_for_renaming): Use DECL_UID. * tree-sra.c (is_sra_candidate_decl): Use DECL_UID. (lookup_element): Ditto. (find_candidates_for_sra): Use referenced_vars iterator. Use DECL_UID. * tree-ssa-alias.c (NUM_REFERENCES): New macro. (NUM_REFERENCES_CLEAR): Ditto. (NUM_REFERENCES_INC): Ditto. (NUM_REFERENCES_SET): Ditto. (alias_obstack): New bitmap obstack. (struct alias_map_d): Use bitmap, not sbitmap. (struct alias_info): Remove num_references. (init_alias_info): Use referenced_var iterator. Initialize bitmap obstack. (delete_alias_info): Use referenced_var iterator. Free bitmap obstack. (compute_points_to_and_addr_escape): Use DECL_UID. Use new NUM_REFERENCES macros. (compute_flow_sensitive_aliasing): may_aliases is now a bitmap. Use new NUM_REFERENCES macros. (group_aliases_into): Update prototype to use bitmap. (setup_pointers_and_addressables): Use referenced_vars iterator. Use DECL_UID. Use new NUM_REFERENCES macros. (add_pointed_to_var): Use DECL_UID. (dump_alias_info): Use referenced_var iterator. (add_type_alias): Ditto. (used_portions): Now a hashtable. (used_part_map_eq): New function. (used_part_map_hash): Ditto. (free_used_part_map): Ditto. (up_lookup): Ditto. (up_insert): Ditto. (get_or_create_used_part_for): Use up_lookup. (create_overlap_variables_for): Ditto. (find_used_portions): Use up_insert. Use DECL_UID. (create_structure_vars): Init used_portions hashtable, use referenced_vars iterator. * tree-ssa-live.c (create_ssa_var_map): sbitmaps became bitmaps. Use DECL_UID. * tree-ssa-loop-im.c (gather_mem_refs_stmt): Use DECL_UID. * tree-ssa-operands.c (get_asm_expr_operands): Ditto. (note_addressable): Ditto. * tree-ssa-structalias.c (set_uids_in_ptset): Ditto. * tree-ssa.c (verify_flow_insensitive_alias_info): Use referenced_var iterator. Use DECL_UID. (delete_tree_ssa): Ditto. (int_tree_map_eq): New function. (int_tree_map_hash): Ditto. * tree-stdarg.c (find_va_list_reference): Use DECL_UID. (va_list_ptr_read): Ditto. (va_list_counter_struct_op): Ditto. (va_list_ptr_write): Ditto. (check_va_list_escapes): Ditto. (check_all_va_list_escapes): Ditto. (execute_optimize_stdarg): Ditto. * tree-tailcall.c (suitable_for_tail_opt_p): Used referenced_var iterator. 2005-06-30 Daniel Berlin <dberlin@dberlin.org> * hashtab.h (HTAB_DELETED_ENTRY): New macro. (HTAB_EMPTY_ENTRY): New macro. 2005-06-30 Daniel Berlin <dberlin@dberlin.org> * hashtab.c (EMPTY_ENTRY): Moved and renamed. (DELETED_ENTRY): Ditto. From-SVN: r101480
2005-07-01 00:18:42 +02:00
tree var;
referenced_var_iterator rvi;
[multiple changes] 2005-06-29 Daniel Berlin <dberlin@dberlin.org> * tree-complex.c (complex_variable_components): Now a hashtable. (cvc_lookup): Ditto. (cvc_insert): Ditto. (create_components): Use referenced var iterator. Initialize hashtable. Use cvc_insert/lookup. (extract_components): Use cvc_insert/lookup. (update_complex_components): Ditto. (update_complex_components_on_edge): Ditto. * tree-dfa.c (referenced_vars): Now a hashtable. (dump_referenced_vars): Use iterator. (referenced_var_lookup): New function. (referenced_var_insert): Ditto. (add_referenced_var): Use referenced_var_insert. (mark_new_vars_to_rename): Use DECL_UID. * tree-flow-inline.h (first_htab_element): New function. (end_htab_p): Ditto. (next_htab_element): Ditto. (first_referenced_var): Ditto. (end_referenced_vars_p): Ditto. (next_referenced_var): Ditto. (is_call_clobbered): Use DECL_UID. (mark_call_clobbered): Ditto. (clear_call_clobbered): Ditto. (mark_non_addressable): Ditto. * tree-flow.h (htab_iterator): New struct. (FOR_EACH_HTAB_ELEMENT): New macro. (struct int_tree_map): New struct. (int_tree_map_hash): Prototype. (int_tree_map_eq): Ditto. (referenced_var_iterator): Ditto. (FOR_EACH_REFERENCED_VAR): New macro. (referenced_vars): Now a hashtable. * tree-into-ssa.c (symbol_marked_for_renaming): Use DECL_UID. (add_new_name_mapping): Ditto. (mark_def_sites): Ditto. (insert_phi_nodes): Use referenced_var iterator. (mark_def_site_blocks): Ditto. (mark_sym_for_renaming): Use DECL_UID. * tree-sra.c (is_sra_candidate_decl): Use DECL_UID. (lookup_element): Ditto. (find_candidates_for_sra): Use referenced_vars iterator. Use DECL_UID. * tree-ssa-alias.c (NUM_REFERENCES): New macro. (NUM_REFERENCES_CLEAR): Ditto. (NUM_REFERENCES_INC): Ditto. (NUM_REFERENCES_SET): Ditto. (alias_obstack): New bitmap obstack. (struct alias_map_d): Use bitmap, not sbitmap. (struct alias_info): Remove num_references. (init_alias_info): Use referenced_var iterator. Initialize bitmap obstack. (delete_alias_info): Use referenced_var iterator. Free bitmap obstack. (compute_points_to_and_addr_escape): Use DECL_UID. Use new NUM_REFERENCES macros. (compute_flow_sensitive_aliasing): may_aliases is now a bitmap. Use new NUM_REFERENCES macros. (group_aliases_into): Update prototype to use bitmap. (setup_pointers_and_addressables): Use referenced_vars iterator. Use DECL_UID. Use new NUM_REFERENCES macros. (add_pointed_to_var): Use DECL_UID. (dump_alias_info): Use referenced_var iterator. (add_type_alias): Ditto. (used_portions): Now a hashtable. (used_part_map_eq): New function. (used_part_map_hash): Ditto. (free_used_part_map): Ditto. (up_lookup): Ditto. (up_insert): Ditto. (get_or_create_used_part_for): Use up_lookup. (create_overlap_variables_for): Ditto. (find_used_portions): Use up_insert. Use DECL_UID. (create_structure_vars): Init used_portions hashtable, use referenced_vars iterator. * tree-ssa-live.c (create_ssa_var_map): sbitmaps became bitmaps. Use DECL_UID. * tree-ssa-loop-im.c (gather_mem_refs_stmt): Use DECL_UID. * tree-ssa-operands.c (get_asm_expr_operands): Ditto. (note_addressable): Ditto. * tree-ssa-structalias.c (set_uids_in_ptset): Ditto. * tree-ssa.c (verify_flow_insensitive_alias_info): Use referenced_var iterator. Use DECL_UID. (delete_tree_ssa): Ditto. (int_tree_map_eq): New function. (int_tree_map_hash): Ditto. * tree-stdarg.c (find_va_list_reference): Use DECL_UID. (va_list_ptr_read): Ditto. (va_list_counter_struct_op): Ditto. (va_list_ptr_write): Ditto. (check_va_list_escapes): Ditto. (check_all_va_list_escapes): Ditto. (execute_optimize_stdarg): Ditto. * tree-tailcall.c (suitable_for_tail_opt_p): Used referenced_var iterator. 2005-06-30 Daniel Berlin <dberlin@dberlin.org> * hashtab.h (HTAB_DELETED_ENTRY): New macro. (HTAB_EMPTY_ENTRY): New macro. 2005-06-30 Daniel Berlin <dberlin@dberlin.org> * hashtab.c (EMPTY_ENTRY): Moved and renamed. (DELETED_ENTRY): Ditto. From-SVN: r101480
2005-07-01 00:18:42 +02:00
FOR_EACH_REFERENCED_VAR (var, rvi)
{
if (decl_can_be_decomposed_p (var))
{
[multiple changes] 2005-06-29 Daniel Berlin <dberlin@dberlin.org> * tree-complex.c (complex_variable_components): Now a hashtable. (cvc_lookup): Ditto. (cvc_insert): Ditto. (create_components): Use referenced var iterator. Initialize hashtable. Use cvc_insert/lookup. (extract_components): Use cvc_insert/lookup. (update_complex_components): Ditto. (update_complex_components_on_edge): Ditto. * tree-dfa.c (referenced_vars): Now a hashtable. (dump_referenced_vars): Use iterator. (referenced_var_lookup): New function. (referenced_var_insert): Ditto. (add_referenced_var): Use referenced_var_insert. (mark_new_vars_to_rename): Use DECL_UID. * tree-flow-inline.h (first_htab_element): New function. (end_htab_p): Ditto. (next_htab_element): Ditto. (first_referenced_var): Ditto. (end_referenced_vars_p): Ditto. (next_referenced_var): Ditto. (is_call_clobbered): Use DECL_UID. (mark_call_clobbered): Ditto. (clear_call_clobbered): Ditto. (mark_non_addressable): Ditto. * tree-flow.h (htab_iterator): New struct. (FOR_EACH_HTAB_ELEMENT): New macro. (struct int_tree_map): New struct. (int_tree_map_hash): Prototype. (int_tree_map_eq): Ditto. (referenced_var_iterator): Ditto. (FOR_EACH_REFERENCED_VAR): New macro. (referenced_vars): Now a hashtable. * tree-into-ssa.c (symbol_marked_for_renaming): Use DECL_UID. (add_new_name_mapping): Ditto. (mark_def_sites): Ditto. (insert_phi_nodes): Use referenced_var iterator. (mark_def_site_blocks): Ditto. (mark_sym_for_renaming): Use DECL_UID. * tree-sra.c (is_sra_candidate_decl): Use DECL_UID. (lookup_element): Ditto. (find_candidates_for_sra): Use referenced_vars iterator. Use DECL_UID. * tree-ssa-alias.c (NUM_REFERENCES): New macro. (NUM_REFERENCES_CLEAR): Ditto. (NUM_REFERENCES_INC): Ditto. (NUM_REFERENCES_SET): Ditto. (alias_obstack): New bitmap obstack. (struct alias_map_d): Use bitmap, not sbitmap. (struct alias_info): Remove num_references. (init_alias_info): Use referenced_var iterator. Initialize bitmap obstack. (delete_alias_info): Use referenced_var iterator. Free bitmap obstack. (compute_points_to_and_addr_escape): Use DECL_UID. Use new NUM_REFERENCES macros. (compute_flow_sensitive_aliasing): may_aliases is now a bitmap. Use new NUM_REFERENCES macros. (group_aliases_into): Update prototype to use bitmap. (setup_pointers_and_addressables): Use referenced_vars iterator. Use DECL_UID. Use new NUM_REFERENCES macros. (add_pointed_to_var): Use DECL_UID. (dump_alias_info): Use referenced_var iterator. (add_type_alias): Ditto. (used_portions): Now a hashtable. (used_part_map_eq): New function. (used_part_map_hash): Ditto. (free_used_part_map): Ditto. (up_lookup): Ditto. (up_insert): Ditto. (get_or_create_used_part_for): Use up_lookup. (create_overlap_variables_for): Ditto. (find_used_portions): Use up_insert. Use DECL_UID. (create_structure_vars): Init used_portions hashtable, use referenced_vars iterator. * tree-ssa-live.c (create_ssa_var_map): sbitmaps became bitmaps. Use DECL_UID. * tree-ssa-loop-im.c (gather_mem_refs_stmt): Use DECL_UID. * tree-ssa-operands.c (get_asm_expr_operands): Ditto. (note_addressable): Ditto. * tree-ssa-structalias.c (set_uids_in_ptset): Ditto. * tree-ssa.c (verify_flow_insensitive_alias_info): Use referenced_var iterator. Use DECL_UID. (delete_tree_ssa): Ditto. (int_tree_map_eq): New function. (int_tree_map_hash): Ditto. * tree-stdarg.c (find_va_list_reference): Use DECL_UID. (va_list_ptr_read): Ditto. (va_list_counter_struct_op): Ditto. (va_list_ptr_write): Ditto. (check_va_list_escapes): Ditto. (check_all_va_list_escapes): Ditto. (execute_optimize_stdarg): Ditto. * tree-tailcall.c (suitable_for_tail_opt_p): Used referenced_var iterator. 2005-06-30 Daniel Berlin <dberlin@dberlin.org> * hashtab.h (HTAB_DELETED_ENTRY): New macro. (HTAB_EMPTY_ENTRY): New macro. 2005-06-30 Daniel Berlin <dberlin@dberlin.org> * hashtab.c (EMPTY_ENTRY): Moved and renamed. (DELETED_ENTRY): Ditto. From-SVN: r101480
2005-07-01 00:18:42 +02:00
bitmap_set_bit (sra_candidates, DECL_UID (var));
any_set = true;
}
}
return any_set;
}
/* Phase Two: Scan all references to scalarizable variables. Count the
number of times they are used or copied respectively. */
/* Callbacks to fill in SRA_WALK_FNS. Everything but USE is
considered a copy, because we can decompose the reference such that
the sub-elements needn't be contiguous. */
static void
scan_use (struct sra_elt *elt, tree *expr_p ATTRIBUTE_UNUSED,
block_stmt_iterator *bsi ATTRIBUTE_UNUSED,
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 Temporarily revert: 2007-04-06 Andreas Tobler <a.tobler@schweiz.org> 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (try_instantiate_multiple_fields): Needlessly initialize align to silence bogus warning. 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (struct sra_elt): Add in_bitfld_block. Remove all_no_warning. (struct sra_walk_fns): Remove use_all parameter from use. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (sra_walk_expr): Don't maintain or pass down use_all_p. (scan_use): Remove use_all parameter. (scalarize_use): Likewise. Re-expand assignment to BIT_FIELD_REF of gimple_reg. De-scalarize before input or output, and re-scalarize after output. Don't mark anything for no warning. (scalarize_ldst): Adjust. (scalarize_walk_gimple_modify_statement): Likewise. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Don't warn for any element whose parent is used as a whole. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. (instantiate_missing_elemnts): Use them. (mark_no_warning): Removed. (generate_one_element_ref): Handle BIT_FIELD_REFs. (REPLDUP, sra_build_elt_assignment): New. (generate_copy_inout): Use them. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_int): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (scalarize_use, scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r124302
2007-04-30 19:41:11 +02:00
bool is_output ATTRIBUTE_UNUSED, bool use_all ATTRIBUTE_UNUSED)
{
elt->n_uses += 1;
}
static void
scan_copy (struct sra_elt *lhs_elt, struct sra_elt *rhs_elt,
block_stmt_iterator *bsi ATTRIBUTE_UNUSED)
{
lhs_elt->n_copies += 1;
rhs_elt->n_copies += 1;
}
static void
scan_init (struct sra_elt *lhs_elt, tree rhs ATTRIBUTE_UNUSED,
block_stmt_iterator *bsi ATTRIBUTE_UNUSED)
{
lhs_elt->n_copies += 1;
}
static void
scan_ldst (struct sra_elt *elt, tree other ATTRIBUTE_UNUSED,
block_stmt_iterator *bsi ATTRIBUTE_UNUSED,
bool is_output ATTRIBUTE_UNUSED)
{
elt->n_copies += 1;
}
/* Dump the values we collected during the scanning phase. */
static void
scan_dump (struct sra_elt *elt)
{
struct sra_elt *c;
dump_sra_elt_name (dump_file, elt);
fprintf (dump_file, ": n_uses=%u n_copies=%u\n", elt->n_uses, elt->n_copies);
for (c = elt->children; c ; c = c->sibling)
scan_dump (c);
for (c = elt->groups; c ; c = c->sibling)
scan_dump (c);
}
/* Entry point to phase 2. Scan the entire function, building up
scalarization data structures, recording copies and uses. */
static void
scan_function (void)
{
static const struct sra_walk_fns fns = {
scan_use, scan_copy, scan_init, scan_ldst, true
};
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style. * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style. (bitmap_iterator): New type. (bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1, bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init, bmp_iter_and_next): New functions. * basic-block.h (EXECUTE_IF_SET_IN_REG_SET, EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to use iterator-style EXECUTE_IF_IN_BITMAP macros. * bitmap.c (bitmap_print): Ditto. * bt-load.c (clear_btr_from_live_range, add_btr_to_live_range, btr_def_live_range): Ditto. * cfganal.c (compute_dominance_frontiers_1) Ditto. * cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics): Ditto. * ddg.c (build_inter_loop_deps): Ditto. * df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update): Ditto. * except.c (remove_eh_handler): Ditto. * flow.c (reg_set_to_hard_reg_set): Ditto. * gcse.c (clear_modify_mem_tables): Ditto. * global.c (build_insn_chain): Ditto. * ifcvt.c (dead_or_predicable): Ditto. * loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg): Ditto. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto. * tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region, tree_purge_all_dead_eh_edges): Ditto. * tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags, rewrite_ssa_into_ssa): Ditto. * tree-outof-ssa.c (find_replaceable_exprs): Ditto. * tree-sra.c (scan_function, decide_instantiations, scalarize_parms): Ditto. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var, dump_points_to_info_for): Ditto. * tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto. * tree-ssa-dse.c (dse_finalize_block): Ditto. * tree-ssa-live.c (live_worklist, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph, dump_live_info): Ditto. * tree-ssa-loop-ivopts.c (find_induction_variables, find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map, determine_use_iv_costs, determine_set_costs, find_best_candidate, set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data): Ditto. * tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto. * tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Ditto. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto. From-SVN: r88145
2004-09-26 21:53:13 +02:00
bitmap_iterator bi;
sra_walk_function (&fns);
if (dump_file && (dump_flags & TDF_DETAILS))
{
bitmap.c (bitmap_print): Make bitno unsigned. * bitmap.c (bitmap_print): Make bitno unsigned. * bt-load.c (clear_btr_from_live_range, btr_def_live_range): Likewise. * caller-save.c (save_call_clobbered_regs): Likewise. * cfganal.c (compute_dominance_frontiers_1): Likewise. * cfgcleanup.c (thread_jump): Likewise. * cfgrtl.c (safe_insert_insn_on_edge): Likewise. * conflict.c (conflict_graph_compute): Likewise. * ddg.c (add_deps_for_use): Likewise. * df.c (df_refs_update): Likewise. * except.c (remove_eh_handler): Likewise. * flow.c (verify_local_live_at_start, update_life_info, initialize_uninitialized_subregs, propagate_one_insn, free_propagate_block_info, propagate_block, find_use_as_address, reg_set_to_hard_reg_set): Likewise. * gcse.c (clear_modify_mem_tables): Likewise. * global.c (global_conflicts, build_insn_chain): Likewise. * ifcvt.c (dead_or_predicable): Likewise. * local-alloc.c (update_equiv_regs): Likewise. * loop.c (load_mems): Likewise. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Likewise. * ra-rewrite.c (reloads_to_loads, rewrite_program2, actual_spill): Likewise. * reload1.c (order_regs_for_reload, finish_spills): Likewise. * sched-deps.c (sched_analyze_insn, free_deps): Likewise. * sched-rgn.c (propagate_deps * tree-cfg.c (tree_purge_all_dead_eh_edges): Likewise. * tree-dfa.c (dump_dfa_stats tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags): Likewise. * tree-outof-ssa.c (coalesce_ssa_name, coalesce_vars, free_temp_expr_table, find_replaceable_exprs): Likewise. * tree-sra.c (scan_function, scalarize_parms): Likewise. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var): Likewise. * tree-ssa-dce.c (mark_control_dependent_edges_necessary): Likewise. * tree-ssa-live.c (new_tree_live_info, live_worklist, calculate_live_on_entry, calculate_live_on_exit, compare_pairs, sort_coalesce_list, build_tree_conflict_graph, dump_live_info tree-ssa-loop-manip.c (add_exit_phis_var): Likewise. tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Likewise. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Likewise. * tree-ssa-live.h (num_var_partitions): Return unsigned. From-SVN: r90053
2004-11-04 09:41:16 +01:00
unsigned i;
fputs ("\nScan results:\n", dump_file);
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style. * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style. (bitmap_iterator): New type. (bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1, bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init, bmp_iter_and_next): New functions. * basic-block.h (EXECUTE_IF_SET_IN_REG_SET, EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to use iterator-style EXECUTE_IF_IN_BITMAP macros. * bitmap.c (bitmap_print): Ditto. * bt-load.c (clear_btr_from_live_range, add_btr_to_live_range, btr_def_live_range): Ditto. * cfganal.c (compute_dominance_frontiers_1) Ditto. * cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics): Ditto. * ddg.c (build_inter_loop_deps): Ditto. * df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update): Ditto. * except.c (remove_eh_handler): Ditto. * flow.c (reg_set_to_hard_reg_set): Ditto. * gcse.c (clear_modify_mem_tables): Ditto. * global.c (build_insn_chain): Ditto. * ifcvt.c (dead_or_predicable): Ditto. * loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg): Ditto. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto. * tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region, tree_purge_all_dead_eh_edges): Ditto. * tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags, rewrite_ssa_into_ssa): Ditto. * tree-outof-ssa.c (find_replaceable_exprs): Ditto. * tree-sra.c (scan_function, decide_instantiations, scalarize_parms): Ditto. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var, dump_points_to_info_for): Ditto. * tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto. * tree-ssa-dse.c (dse_finalize_block): Ditto. * tree-ssa-live.c (live_worklist, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph, dump_live_info): Ditto. * tree-ssa-loop-ivopts.c (find_induction_variables, find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map, determine_use_iv_costs, determine_set_costs, find_best_candidate, set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data): Ditto. * tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto. * tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Ditto. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto. From-SVN: r88145
2004-09-26 21:53:13 +02:00
EXECUTE_IF_SET_IN_BITMAP (sra_candidates, 0, i, bi)
{
tree var = referenced_var (i);
struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT);
if (elt)
scan_dump (elt);
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style. * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style. (bitmap_iterator): New type. (bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1, bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init, bmp_iter_and_next): New functions. * basic-block.h (EXECUTE_IF_SET_IN_REG_SET, EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to use iterator-style EXECUTE_IF_IN_BITMAP macros. * bitmap.c (bitmap_print): Ditto. * bt-load.c (clear_btr_from_live_range, add_btr_to_live_range, btr_def_live_range): Ditto. * cfganal.c (compute_dominance_frontiers_1) Ditto. * cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics): Ditto. * ddg.c (build_inter_loop_deps): Ditto. * df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update): Ditto. * except.c (remove_eh_handler): Ditto. * flow.c (reg_set_to_hard_reg_set): Ditto. * gcse.c (clear_modify_mem_tables): Ditto. * global.c (build_insn_chain): Ditto. * ifcvt.c (dead_or_predicable): Ditto. * loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg): Ditto. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto. * tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region, tree_purge_all_dead_eh_edges): Ditto. * tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags, rewrite_ssa_into_ssa): Ditto. * tree-outof-ssa.c (find_replaceable_exprs): Ditto. * tree-sra.c (scan_function, decide_instantiations, scalarize_parms): Ditto. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var, dump_points_to_info_for): Ditto. * tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto. * tree-ssa-dse.c (dse_finalize_block): Ditto. * tree-ssa-live.c (live_worklist, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph, dump_live_info): Ditto. * tree-ssa-loop-ivopts.c (find_induction_variables, find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map, determine_use_iv_costs, determine_set_costs, find_best_candidate, set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data): Ditto. * tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto. * tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Ditto. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto. From-SVN: r88145
2004-09-26 21:53:13 +02:00
}
fputc ('\n', dump_file);
}
}
/* Phase Three: Make decisions about which variables to scalarize, if any.
All elements to be scalarized have replacement variables made for them. */
/* A subroutine of build_element_name. Recursively build the element
name on the obstack. */
static void
build_element_name_1 (struct sra_elt *elt)
{
tree t;
char buffer[32];
if (elt->parent)
{
build_element_name_1 (elt->parent);
obstack_1grow (&sra_obstack, '$');
if (TREE_CODE (elt->parent->type) == COMPLEX_TYPE)
{
if (elt->element == integer_zero_node)
obstack_grow (&sra_obstack, "real", 4);
else
obstack_grow (&sra_obstack, "imag", 4);
return;
}
}
t = elt->element;
if (TREE_CODE (t) == INTEGER_CST)
{
/* ??? Eh. Don't bother doing double-wide printing. */
sprintf (buffer, HOST_WIDE_INT_PRINT_DEC, TREE_INT_CST_LOW (t));
obstack_grow (&sra_obstack, buffer, strlen (buffer));
}
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
else if (TREE_CODE (t) == BIT_FIELD_REF)
{
sprintf (buffer, "B" HOST_WIDE_INT_PRINT_DEC,
tree_low_cst (TREE_OPERAND (t, 2), 1));
obstack_grow (&sra_obstack, buffer, strlen (buffer));
sprintf (buffer, "F" HOST_WIDE_INT_PRINT_DEC,
tree_low_cst (TREE_OPERAND (t, 1), 1));
obstack_grow (&sra_obstack, buffer, strlen (buffer));
}
else
{
tree name = DECL_NAME (t);
if (name)
obstack_grow (&sra_obstack, IDENTIFIER_POINTER (name),
IDENTIFIER_LENGTH (name));
else
{
sprintf (buffer, "D%u", DECL_UID (t));
obstack_grow (&sra_obstack, buffer, strlen (buffer));
}
}
}
/* Construct a pretty variable name for an element's replacement variable.
The name is built on the obstack. */
static char *
build_element_name (struct sra_elt *elt)
{
build_element_name_1 (elt);
obstack_1grow (&sra_obstack, '\0');
return XOBFINISH (&sra_obstack, char *);
}
/* Instantiate an element as an independent variable. */
static void
instantiate_element (struct sra_elt *elt)
{
struct sra_elt *base_elt;
tree var, base;
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
bool nowarn = TREE_NO_WARNING (elt->element);
for (base_elt = elt; base_elt->parent; base_elt = base_elt->parent)
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
if (!nowarn)
nowarn = TREE_NO_WARNING (base_elt->parent->element);
base = base_elt->element;
elt->replacement = var = make_rename_temp (elt->type, "SR");
re PR middle-end/28436 (accessing an element via a "pointer" on a vector does not cause vec_extract to be used) 2006-12-12 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/28436 * tree.h (DECL_COMPLEX_GIMPLE_REG_P): Rename to ... (DECL_GIMPLE_REG_P): This. * fold-const.c (fold_indirect_ref_1): Fold *(foo *)&vectorfoo into using BIT_FIELD_REF. * omp-low.c (omp_copy_decl_2): Use the renamed DECL_GIMPLE_REG_P. * tree-gimple.c (is_gimple_reg): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. * expr.c (get_inner_reference): Set the mode for BIT_FIELD_REF with vector types. * tree-flow-inline.h (var_can_have_subvars): Use the renamed DECL_GIMPLE_REG_P. * gimplify.c (internal_get_tmp_var): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. (gimplify_bind_expr): Likewise. (gimplify_function_tree): Likewise. * expmed.c: Include target.h. (extract_bit_field): For vector mode, try find a better mode first. If that fails use gen_lowpart (for vectors only). * tree-dfa.c (make_rename_temp): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. * tree-ssa-pre.c (create_expressions_by_pieces): Likewise. (insert_into_preds_of_block): Likewise. (insert_fake_stores): Create gimple register store_tmps for vector types. * tree-sra.c (sra_elt): New field, is_vector_lhs. (sra_walk_expr <case BIT_FIELD_REF>): For vector types that are the left hand side, set the element's is_vector_lhs to true. (instantiate_element): For vector types which were on the left hand size, set DECL_GIMPLE_REG_P to false. * tree-nested.c (create_tmp_var_for): Use the renamed DECL_GIMPLE_REG_P. * tree-inline.c (declare_return_variable): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. (copy_decl_to_var): Use the renamed DECL_GIMPLE_REG_P. (copy_result_decl_to_var): Likewise. * tree-vect-transform.c (vect_get_new_vect_var): For vector types, create a gimple register variable. (vect_permute_store_chain): Set DECL_GIMPLE_REG_P to true for the vect_inter_* temp variables. * Makefile.in (expmed.o): Update dependencies. 2006-12-12 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/28436 * gcc.c-torture/compile/vector-1.c: New test. * gcc.c-torture/compile/vector-2.c: New test. * gcc.c-torture/compile/vector-3.c: New test. From-SVN: r119801
2006-12-12 23:33:06 +01:00
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
if (DECL_P (elt->element)
&& !tree_int_cst_equal (DECL_SIZE (var), DECL_SIZE (elt->element)))
{
DECL_SIZE (var) = DECL_SIZE (elt->element);
DECL_SIZE_UNIT (var) = DECL_SIZE_UNIT (elt->element);
elt->in_bitfld_block = 1;
elt->replacement = build3 (BIT_FIELD_REF, elt->type, var,
DECL_SIZE (var),
BYTES_BIG_ENDIAN
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
? size_binop (MINUS_EXPR,
TYPE_SIZE (elt->type),
DECL_SIZE (var))
: bitsize_int (0));
if (!INTEGRAL_TYPE_P (elt->type)
|| TYPE_UNSIGNED (elt->type))
BIT_FIELD_REF_UNSIGNED (elt->replacement) = 1;
}
re PR middle-end/28436 (accessing an element via a "pointer" on a vector does not cause vec_extract to be used) 2006-12-12 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/28436 * tree.h (DECL_COMPLEX_GIMPLE_REG_P): Rename to ... (DECL_GIMPLE_REG_P): This. * fold-const.c (fold_indirect_ref_1): Fold *(foo *)&vectorfoo into using BIT_FIELD_REF. * omp-low.c (omp_copy_decl_2): Use the renamed DECL_GIMPLE_REG_P. * tree-gimple.c (is_gimple_reg): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. * expr.c (get_inner_reference): Set the mode for BIT_FIELD_REF with vector types. * tree-flow-inline.h (var_can_have_subvars): Use the renamed DECL_GIMPLE_REG_P. * gimplify.c (internal_get_tmp_var): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. (gimplify_bind_expr): Likewise. (gimplify_function_tree): Likewise. * expmed.c: Include target.h. (extract_bit_field): For vector mode, try find a better mode first. If that fails use gen_lowpart (for vectors only). * tree-dfa.c (make_rename_temp): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. * tree-ssa-pre.c (create_expressions_by_pieces): Likewise. (insert_into_preds_of_block): Likewise. (insert_fake_stores): Create gimple register store_tmps for vector types. * tree-sra.c (sra_elt): New field, is_vector_lhs. (sra_walk_expr <case BIT_FIELD_REF>): For vector types that are the left hand side, set the element's is_vector_lhs to true. (instantiate_element): For vector types which were on the left hand size, set DECL_GIMPLE_REG_P to false. * tree-nested.c (create_tmp_var_for): Use the renamed DECL_GIMPLE_REG_P. * tree-inline.c (declare_return_variable): Use the renamed DECL_GIMPLE_REG_P and check for VECTOR_TYPE. (copy_decl_to_var): Use the renamed DECL_GIMPLE_REG_P. (copy_result_decl_to_var): Likewise. * tree-vect-transform.c (vect_get_new_vect_var): For vector types, create a gimple register variable. (vect_permute_store_chain): Set DECL_GIMPLE_REG_P to true for the vect_inter_* temp variables. * Makefile.in (expmed.o): Update dependencies. 2006-12-12 Andrew Pinski <andrew_pinski@playstation.sony.com> PR tree-opt/28436 * gcc.c-torture/compile/vector-1.c: New test. * gcc.c-torture/compile/vector-2.c: New test. * gcc.c-torture/compile/vector-3.c: New test. From-SVN: r119801
2006-12-12 23:33:06 +01:00
/* For vectors, if used on the left hand side with BIT_FIELD_REF,
they are not a gimple register. */
if (TREE_CODE (TREE_TYPE (var)) == VECTOR_TYPE && elt->is_vector_lhs)
DECL_GIMPLE_REG_P (var) = 0;
DECL_SOURCE_LOCATION (var) = DECL_SOURCE_LOCATION (base);
DECL_ARTIFICIAL (var) = 1;
if (TREE_THIS_VOLATILE (elt->type))
{
TREE_THIS_VOLATILE (var) = 1;
TREE_SIDE_EFFECTS (var) = 1;
}
if (DECL_NAME (base) && !DECL_IGNORED_P (base))
{
char *pretty_name = build_element_name (elt);
DECL_NAME (var) = get_identifier (pretty_name);
obstack_free (&sra_obstack, pretty_name);
SET_DECL_DEBUG_EXPR (var, generate_element_ref (elt));
DECL_DEBUG_EXPR_IS_FROM (var) = 1;
DECL_IGNORED_P (var) = 0;
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
TREE_NO_WARNING (var) = nowarn;
}
else
{
DECL_IGNORED_P (var) = 1;
/* ??? We can't generate any warning that would be meaningful. */
TREE_NO_WARNING (var) = 1;
}
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
/* Zero-initialize bit-field scalarization variables, to avoid
triggering undefined behavior. */
if (TREE_CODE (elt->element) == BIT_FIELD_REF
|| (var != elt->replacement
&& TREE_CODE (elt->replacement) == BIT_FIELD_REF))
{
tree init = sra_build_assignment (var, fold_convert (TREE_TYPE (var),
integer_zero_node));
insert_edge_copies (init, ENTRY_BLOCK_PTR);
mark_all_v_defs (init);
}
if (dump_file)
{
fputs (" ", dump_file);
dump_sra_elt_name (dump_file, elt);
fputs (" -> ", dump_file);
print_generic_expr (dump_file, var, dump_flags);
fputc ('\n', dump_file);
}
}
/* Make one pass across an element tree deciding whether or not it's
profitable to instantiate individual leaf scalars.
PARENT_USES and PARENT_COPIES are the sum of the N_USES and N_COPIES
fields all the way up the tree. */
static void
decide_instantiation_1 (struct sra_elt *elt, unsigned int parent_uses,
unsigned int parent_copies)
{
if (dump_file && !elt->parent)
{
fputs ("Initial instantiation for ", dump_file);
dump_sra_elt_name (dump_file, elt);
fputc ('\n', dump_file);
}
if (elt->cannot_scalarize)
return;
if (elt->is_scalar)
{
/* The decision is simple: instantiate if we're used more frequently
than the parent needs to be seen as a complete unit. */
if (elt->n_uses + elt->n_copies + parent_copies > parent_uses)
instantiate_element (elt);
}
else
{
struct sra_elt *c, *group;
unsigned int this_uses = elt->n_uses + parent_uses;
unsigned int this_copies = elt->n_copies + parent_copies;
/* Consider groups of sub-elements as weighing in favour of
instantiation whatever their size. */
for (group = elt->groups; group ; group = group->sibling)
FOR_EACH_ACTUAL_CHILD (c, group)
{
c->n_uses += group->n_uses;
c->n_copies += group->n_copies;
}
for (c = elt->children; c ; c = c->sibling)
decide_instantiation_1 (c, this_uses, this_copies);
}
}
/* Compute the size and number of all instantiated elements below ELT.
We will only care about this if the size of the complete structure
fits in a HOST_WIDE_INT, so we don't have to worry about overflow. */
static unsigned int
sum_instantiated_sizes (struct sra_elt *elt, unsigned HOST_WIDE_INT *sizep)
{
if (elt->replacement)
{
*sizep += TREE_INT_CST_LOW (TYPE_SIZE_UNIT (elt->type));
return 1;
}
else
{
struct sra_elt *c;
unsigned int count = 0;
for (c = elt->children; c ; c = c->sibling)
count += sum_instantiated_sizes (c, sizep);
return count;
}
}
/* Instantiate fields in ELT->TYPE that are not currently present as
children of ELT. */
static void instantiate_missing_elements (struct sra_elt *elt);
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
static struct sra_elt *
instantiate_missing_elements_1 (struct sra_elt *elt, tree child, tree type)
{
struct sra_elt *sub = lookup_element (elt, child, type, INSERT);
if (sub->is_scalar)
{
if (sub->replacement == NULL)
instantiate_element (sub);
}
else
instantiate_missing_elements (sub);
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
return sub;
}
/* Obtain the canonical type for field F of ELEMENT. */
static tree
canon_type_for_field (tree f, tree element)
{
tree field_type = TREE_TYPE (f);
/* canonicalize_component_ref() unwidens some bit-field types (not
marked as DECL_BIT_FIELD in C++), so we must do the same, lest we
may introduce type mismatches. */
if (INTEGRAL_TYPE_P (field_type)
&& DECL_MODE (f) != TYPE_MODE (field_type))
field_type = TREE_TYPE (get_unwidened (build3 (COMPONENT_REF,
field_type,
element,
f, NULL_TREE),
NULL_TREE));
return field_type;
}
/* Look for adjacent fields of ELT starting at F that we'd like to
scalarize as a single variable. Return the last field of the
group. */
static tree
try_instantiate_multiple_fields (struct sra_elt *elt, tree f)
{
int count;
unsigned HOST_WIDE_INT align, bit, size, alchk;
enum machine_mode mode;
tree first = f, prev;
tree type, var;
struct sra_elt *block;
if (!is_sra_scalar_type (TREE_TYPE (f))
|| !host_integerp (DECL_FIELD_OFFSET (f), 1)
|| !host_integerp (DECL_FIELD_BIT_OFFSET (f), 1)
|| !host_integerp (DECL_SIZE (f), 1)
|| lookup_element (elt, f, NULL, NO_INSERT))
return f;
block = elt;
/* For complex and array objects, there are going to be integer
literals as child elements. In this case, we can't just take the
alignment and mode of the decl, so we instead rely on the element
type.
??? We could try to infer additional alignment from the full
object declaration and the location of the sub-elements we're
accessing. */
for (count = 0; !DECL_P (block->element); count++)
block = block->parent;
align = DECL_ALIGN (block->element);
alchk = GET_MODE_BITSIZE (DECL_MODE (block->element));
if (count)
{
type = TREE_TYPE (block->element);
while (count--)
type = TREE_TYPE (type);
align = TYPE_ALIGN (type);
alchk = GET_MODE_BITSIZE (TYPE_MODE (type));
}
if (align < alchk)
align = alchk;
/* Coalescing wider fields is probably pointless and
inefficient. */
if (align > BITS_PER_WORD)
align = BITS_PER_WORD;
bit = tree_low_cst (DECL_FIELD_OFFSET (f), 1) * BITS_PER_UNIT
+ tree_low_cst (DECL_FIELD_BIT_OFFSET (f), 1);
size = tree_low_cst (DECL_SIZE (f), 1);
alchk = align - 1;
alchk = ~alchk;
if ((bit & alchk) != ((bit + size - 1) & alchk))
return f;
/* Find adjacent fields in the same alignment word. */
for (prev = f, f = TREE_CHAIN (f);
f && TREE_CODE (f) == FIELD_DECL
&& is_sra_scalar_type (TREE_TYPE (f))
&& host_integerp (DECL_FIELD_OFFSET (f), 1)
&& host_integerp (DECL_FIELD_BIT_OFFSET (f), 1)
&& host_integerp (DECL_SIZE (f), 1)
&& !lookup_element (elt, f, NULL, NO_INSERT);
prev = f, f = TREE_CHAIN (f))
{
unsigned HOST_WIDE_INT nbit, nsize;
nbit = tree_low_cst (DECL_FIELD_OFFSET (f), 1) * BITS_PER_UNIT
+ tree_low_cst (DECL_FIELD_BIT_OFFSET (f), 1);
nsize = tree_low_cst (DECL_SIZE (f), 1);
if (bit + size == nbit)
{
if ((bit & alchk) != ((nbit + nsize - 1) & alchk))
{
/* If we're at an alignment boundary, don't bother
growing alignment such that we can include this next
field. */
if ((nbit & alchk)
|| GET_MODE_BITSIZE (DECL_MODE (f)) <= align)
break;
align = GET_MODE_BITSIZE (DECL_MODE (f));
alchk = align - 1;
alchk = ~alchk;
if ((bit & alchk) != ((nbit + nsize - 1) & alchk))
break;
}
size += nsize;
}
else if (nbit + nsize == bit)
{
if ((nbit & alchk) != ((bit + size - 1) & alchk))
{
if ((bit & alchk)
|| GET_MODE_BITSIZE (DECL_MODE (f)) <= align)
break;
align = GET_MODE_BITSIZE (DECL_MODE (f));
alchk = align - 1;
alchk = ~alchk;
if ((nbit & alchk) != ((bit + size - 1) & alchk))
break;
}
bit = nbit;
size += nsize;
}
else
break;
}
f = prev;
if (f == first)
return f;
gcc_assert ((bit & alchk) == ((bit + size - 1) & alchk));
/* Try to widen the bit range so as to cover padding bits as well. */
if ((bit & ~alchk) || size != align)
{
unsigned HOST_WIDE_INT mbit = bit & alchk;
unsigned HOST_WIDE_INT msize = align;
for (f = TYPE_FIELDS (elt->type);
f; f = TREE_CHAIN (f))
{
unsigned HOST_WIDE_INT fbit, fsize;
/* Skip the fields from first to prev. */
if (f == first)
{
f = prev;
continue;
}
if (!(TREE_CODE (f) == FIELD_DECL
&& host_integerp (DECL_FIELD_OFFSET (f), 1)
&& host_integerp (DECL_FIELD_BIT_OFFSET (f), 1)))
continue;
fbit = tree_low_cst (DECL_FIELD_OFFSET (f), 1) * BITS_PER_UNIT
+ tree_low_cst (DECL_FIELD_BIT_OFFSET (f), 1);
/* If we're past the selected word, we're fine. */
if ((bit & alchk) < (fbit & alchk))
continue;
if (host_integerp (DECL_SIZE (f), 1))
fsize = tree_low_cst (DECL_SIZE (f), 1);
else
/* Assume a variable-sized field takes up all space till
the end of the word. ??? Endianness issues? */
fsize = align - (fbit & alchk);
if ((fbit & alchk) < (bit & alchk))
{
/* A large field might start at a previous word and
extend into the selected word. Exclude those
bits. ??? Endianness issues? */
HOST_WIDE_INT diff = fbit + fsize - mbit;
if (diff <= 0)
continue;
mbit += diff;
msize -= diff;
}
else
{
/* Non-overlapping, great. */
if (fbit + fsize <= mbit
|| mbit + msize <= fbit)
continue;
if (fbit <= mbit)
{
unsigned HOST_WIDE_INT diff = fbit + fsize - mbit;
mbit += diff;
msize -= diff;
}
else if (fbit > mbit)
msize -= (mbit + msize - fbit);
else
gcc_unreachable ();
}
}
bit = mbit;
size = msize;
}
/* Now we know the bit range we're interested in. Find the smallest
machine mode we can use to access it. */
for (mode = smallest_mode_for_size (size, MODE_INT);
;
mode = GET_MODE_WIDER_MODE (mode))
{
gcc_assert (mode != VOIDmode);
alchk = GET_MODE_PRECISION (mode) - 1;
alchk = ~alchk;
if ((bit & alchk) == ((bit + size - 1) & alchk))
break;
}
gcc_assert (~alchk < align);
/* Create the field group as a single variable. */
type = lang_hooks.types.type_for_mode (mode, 1);
gcc_assert (type);
var = build3 (BIT_FIELD_REF, type, NULL_TREE,
bitsize_int (size),
bitsize_int (bit));
BIT_FIELD_REF_UNSIGNED (var) = 1;
block = instantiate_missing_elements_1 (elt, var, type);
gcc_assert (block && block->is_scalar);
var = block->replacement;
if ((bit & ~alchk)
|| (HOST_WIDE_INT)size != tree_low_cst (DECL_SIZE (var), 1))
{
block->replacement = build3 (BIT_FIELD_REF,
TREE_TYPE (block->element), var,
bitsize_int (size),
bitsize_int (bit & ~alchk));
BIT_FIELD_REF_UNSIGNED (block->replacement) = 1;
}
block->in_bitfld_block = 2;
/* Add the member fields to the group, such that they access
portions of the group variable. */
for (f = first; f != TREE_CHAIN (prev); f = TREE_CHAIN (f))
{
tree field_type = canon_type_for_field (f, elt->element);
struct sra_elt *fld = lookup_element (block, f, field_type, INSERT);
gcc_assert (fld && fld->is_scalar && !fld->replacement);
fld->replacement = build3 (BIT_FIELD_REF, field_type, var,
DECL_SIZE (f),
bitsize_int
((TREE_INT_CST_LOW (DECL_FIELD_OFFSET (f))
* BITS_PER_UNIT
+ (TREE_INT_CST_LOW
(DECL_FIELD_BIT_OFFSET (f))))
& ~alchk));
BIT_FIELD_REF_UNSIGNED (fld->replacement) = TYPE_UNSIGNED (field_type);
fld->in_bitfld_block = 1;
}
return prev;
}
static void
instantiate_missing_elements (struct sra_elt *elt)
{
tree type = elt->type;
switch (TREE_CODE (type))
{
case RECORD_TYPE:
{
tree f;
for (f = TYPE_FIELDS (type); f ; f = TREE_CHAIN (f))
if (TREE_CODE (f) == FIELD_DECL)
{
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
tree last = try_instantiate_multiple_fields (elt, f);
if (last != f)
{
f = last;
continue;
}
instantiate_missing_elements_1 (elt, f,
canon_type_for_field
(f, elt->element));
}
break;
}
case ARRAY_TYPE:
{
tree i, max, subtype;
i = TYPE_MIN_VALUE (TYPE_DOMAIN (type));
max = TYPE_MAX_VALUE (TYPE_DOMAIN (type));
subtype = TREE_TYPE (type);
while (1)
{
instantiate_missing_elements_1 (elt, i, subtype);
if (tree_int_cst_equal (i, max))
break;
i = int_const_binop (PLUS_EXPR, i, integer_one_node, true);
}
break;
}
case COMPLEX_TYPE:
type = TREE_TYPE (type);
instantiate_missing_elements_1 (elt, integer_zero_node, type);
instantiate_missing_elements_1 (elt, integer_one_node, type);
break;
default:
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * targhooks.c (default_unwind_emit, default_scalar_mode_supported_p): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * timevar.c (timevar_push, timevar_pop, timevar_start, timevar_stop): Likewise. * toplev.c (default_pch_valid_p): Likewise. * tracer.c (tail_duplicate): Likewise. * tree-alias-common.c (get_alias_var_decl, get_values_from_constructor, create_alias_var, delete_alias_vars, empty_points_to_set, same_points_to_set, ptr_may_alias_var): Likewise. * tree.c (tree_size, make_node_stat, copy_node_stat, build_int_cst_wide, integer_all_onesp, list_length, chainon, tree_node_structure, type_contains_placeholder_p, substitute_in_expr, substitute_placeholder_in_expr, tabilize_reference_1, build0_stat, build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p, lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr, build_method_type_directly, decl_type_context, get_callee_fndecl, get_set_constructor_bits, build_vector_type_for_mode, int_cst_value, tree_fold_gcd): Likewise. * tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges, make_cond_expr_edges, group_case_labels, tree_merge_blocks, cleanup_control_expr_graph, find_taken_edge, find_taken_edge_switch_expr, phi_alternatives_equal, is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt, stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate, tree_split_edge, tree_verify_flow_info, thread_jumps, tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise. * tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly, chrec_fold_multiply_poly_poly): Likewise. * tree-complex.c (extract_component, expand_complex_division, expand_complex_comparison, expand_complex_operations_1, build_replicated_const, expand_vector_operations_1): Likewise. * tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector, build_classic_dir_vector): Likewise. * tree-dfa.c (compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann, create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region, record_in_finally_tree, replace_goto_queue_1, maybe_record_in_goto_queue, verify_norecord_switch_expr, do_return_redirection): Likewise. * tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr, add_to_dst_predicate_list, find_phi_replacement_condition, replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order): Likewise. * tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r, initialize_inlined_parameters, declare_return_variable, estimate_num_insns_1, expand_call_inline, expand_calls_inline, optimize_inline_calls, copy_tree_r): Likewise. * tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt, ssa_rewrite_stmt, rewrite_into_ssa): Likewise. * tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after, tsi_split_statement_list_after, tsi_split_statement_list_before): Likewise. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-nested.c (create_tmp_var_for, lookup_field_for_decl, lookup_tramp_for_decl, convert_all_function_calls): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi, coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis, free_temp_expr_table, add_dependance, finish_expr, rewrite_trees): Likewise. * tree-phinodes.c (resize_phi_node, add_phi_arg, remove_all_phi_nodes_for): Likewise. * tree-pretty-print.c (op_prio, print_call_name): Likewise. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise. * tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree, sra_elt_eq, sra_walk_expr, instantiate_missing_elements, generate_one_element_ref, generate_element_copy, generate_element_zero, scalarize_copy, scalarize_init, scalarize_ldst): Likewise. * tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p, add_may_alias, add_pointed_to_expr, add_pointed_to_var, collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise. * tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise. * tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value, set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment, widen_bitfield, ccp_fold_builtin): Likewise. * tree-ssa-copy.c (may_propagate_copy, merge_alias_info, replace_exp_1, propagate_tree_value): Likewise. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. * tree-ssa-dce.c (set_control_dependence_map_bit, find_control_dependence, find_pdom, mark_operand_necessary, mark_stmt_if_obviously_necessary, mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise. * tree-ssa-dom.c (dom_opt_initialize_block_local_data, simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis, eliminate_redundant_computations, avail_expr_eq): Likewise. * tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, duplicate_blocks): Likewise. * tree-ssa-loop-im.c (for_each_index, set_level, is_call_clobbered_ref): Likewise. * tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos, stmt_after_increment, set_iv, contains_abnormal_ssa_name_p, find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates, peel_address, ptr_difference_cost, may_replace_final_value, determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer, rewrite_use, rewrite_uses): Likewise. * tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa, check_loop_closed_ssa_use): Likewise. * tree-ssanames.c (make_ssa_name): Likewise. * tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses, finalize_ssa_v_must_defs, finalize_ssa_stmt_operands, get_stmt_operands, get_expr_operands, get_asm_expr_operands, get_indirect_ref_operands, add_stmt_operand): Likewise. * tree-ssa-pre.c (value_exists_in_set_bitmap, value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set, phi_translate, valid_in_set, compute_antic, find_or_generate_expression, create_expression_by_pieces, insert_aux, create_value_expr_from, eliminate): Likewise. * tree-ssa-propagate.c (cfg_blocks_get): Likewise. * tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges): Likewise. * tree-tailcall.c (independent_of_stmt_p, adjust_return_value, eliminate_tail_call): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_align_data_ref, vect_create_data_ref, vect_create_destination_var, vect_get_vec_def_for_operand, vect_finish_stmt_generation, vect_transform_stmt, vect_transform_loop_bound, vect_transform_loop, vect_analyze_operations): Likewise. * tree-vn.c (vn_compute, set_value_handle, get_value_handle): Likewise. * tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr, get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start, bsi_after_labels, bsi_last): Likewise. * tree-ssa-live.c (var_union, change_partition_var, create_ssa_var_map, calculate_live_on_entry, root_var_init, type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce): Likewise. * tree-ssa-live.h (partition_is_global, live_entry_blocks, tpa_find_tree): Likewise. (register_ssa_partition_check): Declare. (register_ssa_partition): use it. * tree-ssa-live.c: Include errors.h. (register_ssa_partition_check): New. * tree-ssa-operands.c: Include errors.h. * Makefile.in (tree-ssa-operands.o): Depend on errors.h. Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> From-SVN: r87223
2004-09-09 09:54:12 +02:00
gcc_unreachable ();
}
}
/* Return true if there is only one non aggregate field in the record, TYPE.
Return false otherwise. */
static bool
single_scalar_field_in_record_p (tree type)
{
int num_fields = 0;
tree field;
if (TREE_CODE (type) != RECORD_TYPE)
return false;
for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
if (TREE_CODE (field) == FIELD_DECL)
{
num_fields++;
if (num_fields == 2)
return false;
if (AGGREGATE_TYPE_P (TREE_TYPE (field)))
return false;
}
return true;
}
/* Make one pass across an element tree deciding whether to perform block
or element copies. If we decide on element copies, instantiate all
elements. Return true if there are any instantiated sub-elements. */
static bool
decide_block_copy (struct sra_elt *elt)
{
struct sra_elt *c;
bool any_inst;
/* We shouldn't be invoked on groups of sub-elements as they must
behave like their parent as far as block copy is concerned. */
gcc_assert (!elt->is_group);
/* If scalarization is disabled, respect it. */
if (elt->cannot_scalarize)
{
elt->use_block_copy = 1;
if (dump_file)
{
fputs ("Scalarization disabled for ", dump_file);
dump_sra_elt_name (dump_file, elt);
fputc ('\n', dump_file);
}
/* Disable scalarization of sub-elements */
for (c = elt->children; c; c = c->sibling)
{
c->cannot_scalarize = 1;
decide_block_copy (c);
}
/* Groups behave like their parent. */
for (c = elt->groups; c; c = c->sibling)
{
c->cannot_scalarize = 1;
c->use_block_copy = 1;
}
return false;
}
/* Don't decide if we've no uses and no groups. */
if (elt->n_uses == 0 && elt->n_copies == 0 && elt->groups == NULL)
;
else if (!elt->is_scalar)
{
tree size_tree = TYPE_SIZE_UNIT (elt->type);
bool use_block_copy = true;
/* Tradeoffs for COMPLEX types pretty much always make it better
to go ahead and split the components. */
if (TREE_CODE (elt->type) == COMPLEX_TYPE)
use_block_copy = false;
/* Don't bother trying to figure out the rest if the structure is
so large we can't do easy arithmetic. This also forces block
copies for variable sized structures. */
else if (host_integerp (size_tree, 1))
{
unsigned HOST_WIDE_INT full_size, inst_size = 0;
unsigned int max_size, max_count, inst_count, full_count;
/* If the sra-max-structure-size parameter is 0, then the
user has not overridden the parameter and we can choose a
sensible default. */
max_size = SRA_MAX_STRUCTURE_SIZE
? SRA_MAX_STRUCTURE_SIZE
: MOVE_RATIO * UNITS_PER_WORD;
max_count = SRA_MAX_STRUCTURE_COUNT
? SRA_MAX_STRUCTURE_COUNT
: MOVE_RATIO;
full_size = tree_low_cst (size_tree, 1);
full_count = count_type_elements (elt->type, false);
inst_count = sum_instantiated_sizes (elt, &inst_size);
/* If there is only one scalar field in the record, don't block copy. */
if (single_scalar_field_in_record_p (elt->type))
use_block_copy = false;
/* ??? What to do here. If there are two fields, and we've only
instantiated one, then instantiating the other is clearly a win.
If there are a large number of fields then the size of the copy
is much more of a factor. */
/* If the structure is small, and we've made copies, go ahead
and instantiate, hoping that the copies will go away. */
if (full_size <= max_size
&& (full_count - inst_count) <= max_count
&& elt->n_copies > elt->n_uses)
use_block_copy = false;
else if (inst_count * 100 >= full_count * SRA_FIELD_STRUCTURE_RATIO
&& inst_size * 100 >= full_size * SRA_FIELD_STRUCTURE_RATIO)
use_block_copy = false;
/* In order to avoid block copy, we have to be able to instantiate
all elements of the type. See if this is possible. */
if (!use_block_copy
&& (!can_completely_scalarize_p (elt)
|| !type_can_instantiate_all_elements (elt->type)))
use_block_copy = true;
}
elt->use_block_copy = use_block_copy;
/* Groups behave like their parent. */
for (c = elt->groups; c; c = c->sibling)
c->use_block_copy = use_block_copy;
if (dump_file)
{
fprintf (dump_file, "Using %s for ",
use_block_copy ? "block-copy" : "element-copy");
dump_sra_elt_name (dump_file, elt);
fputc ('\n', dump_file);
}
if (!use_block_copy)
{
instantiate_missing_elements (elt);
return true;
}
}
any_inst = elt->replacement != NULL;
for (c = elt->children; c ; c = c->sibling)
any_inst |= decide_block_copy (c);
return any_inst;
}
/* Entry point to phase 3. Instantiate scalar replacement variables. */
static void
decide_instantiations (void)
{
unsigned int i;
bool cleared_any;
bitmap.h (struct bitmap_obstack): New obstack type. * bitmap.h (struct bitmap_obstack): New obstack type. (struct bitmap_head_def): Replace using_obstack with obstack pointer. (bitmap_default_obstack): New. (bitmap_initialize): Make inline, does not do allocation. (bitmap_release_memory): Remove. (bitmap_obstack_initialize, bitmap_obstack_release): Declare. (bitmap_obstack_alloc, bitmap_malloc_alloc, bitmap_gc_alloc, bitmap_obstack_free, bitmap_malloc_free): Declare. (BITMAP_OBSTACK_ALLOC, BITMAP_GGC_ALLOC, BITMAP_XMALLOC): Adjust. (BITMAP_FREE): Replace with ... (BITMAP_OBSTACK_FREE): ... this. (BITMAP_XFREE): Adjust. (BITMAP_INIT_ONCE): Remove. * bitmap.c (bitmap_obstack, bitmap_obstack_init, bitmap_free: Remove. (bitmap_default_obstack): New. (bitmap_elem_to_freelist): Adjust. (bitmap_element_allocate): Adjust. Break initialization into ... (bitmap_obstack_initialize): ... here. (bitmap_release_memory): Replace with ... (bitmap_obstack_release): ... this. (bitmap_obstack_alloc, bitmap_malloc_alloc, bitmap_gc_alloc, bitmap_obstack_free, bitmap_malloc_free): New. (bitmap_ior_and_compl, bitmap_ior_and_compl_into): Use bitmap_initialize. (bitmap_initialize): Move to bitmap.h. * gengtype.c (open_base_files): Add obstack.h to ifiles. * Makefile.in (BASIC_BLOCK_H, REGS_H): Add obstack.h. * basic-block.h (INIT_REG_SET): Allocate from reg_obstack. (INITIALIZE_REG_SET): Remove. (FREE_REG_SET): Use BITMAP_OBSTACK_FREE. (INIT_ONCE_REG_SET, MAX_REGNO_REG_SET): Remove. (flow_obstack): Do not declare. (reg_obstack): Declare. * regs.h: Include obstack.h. * tree-optimize.c (tree_rest_of_compilation): Initialize and release bitmap obstack here. * bb-reorder.c: #include regs, not basic-block. (fix_crossing_conditional_branches): Allocate regsets from reg_obstack. * bt-load.c: Do not inlude bitmap.h, sbitmap.h, basic-block.h or obstack.h. * caller-save.c: Include regs.h earlier. * cfg.c: Do not include basic-block.h or obstack.h. (reg_obstack): Define. * cfganal.c: Include obstack.h * cfgcleanyp.c: Do not include basic-block.h. Include regs.h earlier. * cfglayout.c: Do not include obstack.h. (flow_obstack): Remove declaration. (cfg_layout_duplicate_bb): Use reg_obstack. * cfgloop.c, cfgloopanal.c, cfgloopmanip.c: Include obstack.h. * cfgrtl.c (rtl_split_block): Use reg_obstack. (force_nonfallthru_and_redirect, rtl_split_edge): Likewise. (safe_insert_insn_on_edge): Use OBSTACK_ALLOC_REG_SET, adjust. (cfg_layout_split_edge): Use reg_obstack. * cse.c: Include regs.h earlier. * ddg.c: Do not include basic-block.h. * dominance.c: Inlude obstack.h. * flow.c (update_life_info): Use OBSTACK_ALLOC_REG_SET, adjust. (calculate_global_regs_live): Likewise. (allocate_bb_life_data): Use reg_obstack. (init_propagate_block_info): Use OBSTACK_ALLOC_REGSET. * global.c: Do not include basic-block.h. (build_insn_chain): Use OBSTACK_ALLOC_REG_SET, adjust. * graph.c: Include obstack.h. * haifa-sched.c: Do not include basic-block.h. * ifcvt.c: Use OBSTACK_ALLOC_REG_SET, adjust. * local-alloc.c: Do not include basic-block.h. * loop-init.c, loop-invariant.c: Include obstack.h. * loop-iv.c: Likewise. (simplify_using_initial_values): Use OBSTACK_ALLOC_REG_SET, adjust. * loop-unroll.c, loop-unswitch.c: Inlude obstack.h. * modulo-sched.c: Do not include basic-block.h. * passes.c (rest_of_handle_final): Do not call regset_release_memory. * ra-debug.c: Include regs.h earlier. Do not include basic-block.h. * recog.c (peephole2_optimize): Use OBSTACK_ALLOC_REG_SET, adjust. * regclass.c (init_reg_sets): Do not call INIT_ONCE_REG_SET. (allocate_reg_info): Do not call MAX_REGNO_REG_SET. (regset_release_memory): Remove. * resource.c: Do not include basic-block.h. * rtlanal.c: Do not include basic-block.h. * sbitmap.c: Include obstack.h. * sched-deps.c: Do not include basic-block.h. (reg_pending_sets_head, reg_pending_clobbers_head, reg_pending_uses_head): Remove. (init_deps_global): Use OBSTACK_ALLOC_REG_SET. * sched-ebb.c: Do not include basic-block.h. * sched-rgn.c: Likewise. * tree-if-conv.c (get_loop_body_in_if_conv_order): Use BITMAP_XFREE. * tree-outof-ssa.c (perform_edge_inserts): Use BITMAP_XFREE. * tree-sra.c (decide_instantiations): Adjust bitmap initialization. * tree-ssa-dce.c: Include obstack.h. * tree-ssa-pre.c (grand_bitmap_obstack): Make a bitmap_obstack. (value_insert_into_set_bitmap): Remove useless bitmap_clear. (bitmap_set_new): Likewise. (init_pre): Initialize bitmap obstack. (fini_pre): Release bitmap obstack. * tree-ssanames.c (ssa_names_to_rewrite): Make static. (marked_for_rewrite_p): ssa_names_to_rewrite is never NULL. (mark_for_rewrite, unmark_for_rewrite): Likewise. (marked_ssa_names): Likewise. (init_ssanames): Use BITMAP_XMALLOC. (fini_ssanames): Use BITMAP_XFREE. * web.c: Include obstack.h From-SVN: r91009
2004-11-22 13:23:59 +01:00
bitmap_head done_head;
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style. * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style. (bitmap_iterator): New type. (bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1, bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init, bmp_iter_and_next): New functions. * basic-block.h (EXECUTE_IF_SET_IN_REG_SET, EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to use iterator-style EXECUTE_IF_IN_BITMAP macros. * bitmap.c (bitmap_print): Ditto. * bt-load.c (clear_btr_from_live_range, add_btr_to_live_range, btr_def_live_range): Ditto. * cfganal.c (compute_dominance_frontiers_1) Ditto. * cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics): Ditto. * ddg.c (build_inter_loop_deps): Ditto. * df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update): Ditto. * except.c (remove_eh_handler): Ditto. * flow.c (reg_set_to_hard_reg_set): Ditto. * gcse.c (clear_modify_mem_tables): Ditto. * global.c (build_insn_chain): Ditto. * ifcvt.c (dead_or_predicable): Ditto. * loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg): Ditto. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto. * tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region, tree_purge_all_dead_eh_edges): Ditto. * tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags, rewrite_ssa_into_ssa): Ditto. * tree-outof-ssa.c (find_replaceable_exprs): Ditto. * tree-sra.c (scan_function, decide_instantiations, scalarize_parms): Ditto. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var, dump_points_to_info_for): Ditto. * tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto. * tree-ssa-dse.c (dse_finalize_block): Ditto. * tree-ssa-live.c (live_worklist, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph, dump_live_info): Ditto. * tree-ssa-loop-ivopts.c (find_induction_variables, find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map, determine_use_iv_costs, determine_set_costs, find_best_candidate, set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data): Ditto. * tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto. * tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Ditto. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto. From-SVN: r88145
2004-09-26 21:53:13 +02:00
bitmap_iterator bi;
/* We cannot clear bits from a bitmap we're iterating over,
so save up all the bits to clear until the end. */
bitmap.h (struct bitmap_obstack): New obstack type. * bitmap.h (struct bitmap_obstack): New obstack type. (struct bitmap_head_def): Replace using_obstack with obstack pointer. (bitmap_default_obstack): New. (bitmap_initialize): Make inline, does not do allocation. (bitmap_release_memory): Remove. (bitmap_obstack_initialize, bitmap_obstack_release): Declare. (bitmap_obstack_alloc, bitmap_malloc_alloc, bitmap_gc_alloc, bitmap_obstack_free, bitmap_malloc_free): Declare. (BITMAP_OBSTACK_ALLOC, BITMAP_GGC_ALLOC, BITMAP_XMALLOC): Adjust. (BITMAP_FREE): Replace with ... (BITMAP_OBSTACK_FREE): ... this. (BITMAP_XFREE): Adjust. (BITMAP_INIT_ONCE): Remove. * bitmap.c (bitmap_obstack, bitmap_obstack_init, bitmap_free: Remove. (bitmap_default_obstack): New. (bitmap_elem_to_freelist): Adjust. (bitmap_element_allocate): Adjust. Break initialization into ... (bitmap_obstack_initialize): ... here. (bitmap_release_memory): Replace with ... (bitmap_obstack_release): ... this. (bitmap_obstack_alloc, bitmap_malloc_alloc, bitmap_gc_alloc, bitmap_obstack_free, bitmap_malloc_free): New. (bitmap_ior_and_compl, bitmap_ior_and_compl_into): Use bitmap_initialize. (bitmap_initialize): Move to bitmap.h. * gengtype.c (open_base_files): Add obstack.h to ifiles. * Makefile.in (BASIC_BLOCK_H, REGS_H): Add obstack.h. * basic-block.h (INIT_REG_SET): Allocate from reg_obstack. (INITIALIZE_REG_SET): Remove. (FREE_REG_SET): Use BITMAP_OBSTACK_FREE. (INIT_ONCE_REG_SET, MAX_REGNO_REG_SET): Remove. (flow_obstack): Do not declare. (reg_obstack): Declare. * regs.h: Include obstack.h. * tree-optimize.c (tree_rest_of_compilation): Initialize and release bitmap obstack here. * bb-reorder.c: #include regs, not basic-block. (fix_crossing_conditional_branches): Allocate regsets from reg_obstack. * bt-load.c: Do not inlude bitmap.h, sbitmap.h, basic-block.h or obstack.h. * caller-save.c: Include regs.h earlier. * cfg.c: Do not include basic-block.h or obstack.h. (reg_obstack): Define. * cfganal.c: Include obstack.h * cfgcleanyp.c: Do not include basic-block.h. Include regs.h earlier. * cfglayout.c: Do not include obstack.h. (flow_obstack): Remove declaration. (cfg_layout_duplicate_bb): Use reg_obstack. * cfgloop.c, cfgloopanal.c, cfgloopmanip.c: Include obstack.h. * cfgrtl.c (rtl_split_block): Use reg_obstack. (force_nonfallthru_and_redirect, rtl_split_edge): Likewise. (safe_insert_insn_on_edge): Use OBSTACK_ALLOC_REG_SET, adjust. (cfg_layout_split_edge): Use reg_obstack. * cse.c: Include regs.h earlier. * ddg.c: Do not include basic-block.h. * dominance.c: Inlude obstack.h. * flow.c (update_life_info): Use OBSTACK_ALLOC_REG_SET, adjust. (calculate_global_regs_live): Likewise. (allocate_bb_life_data): Use reg_obstack. (init_propagate_block_info): Use OBSTACK_ALLOC_REGSET. * global.c: Do not include basic-block.h. (build_insn_chain): Use OBSTACK_ALLOC_REG_SET, adjust. * graph.c: Include obstack.h. * haifa-sched.c: Do not include basic-block.h. * ifcvt.c: Use OBSTACK_ALLOC_REG_SET, adjust. * local-alloc.c: Do not include basic-block.h. * loop-init.c, loop-invariant.c: Include obstack.h. * loop-iv.c: Likewise. (simplify_using_initial_values): Use OBSTACK_ALLOC_REG_SET, adjust. * loop-unroll.c, loop-unswitch.c: Inlude obstack.h. * modulo-sched.c: Do not include basic-block.h. * passes.c (rest_of_handle_final): Do not call regset_release_memory. * ra-debug.c: Include regs.h earlier. Do not include basic-block.h. * recog.c (peephole2_optimize): Use OBSTACK_ALLOC_REG_SET, adjust. * regclass.c (init_reg_sets): Do not call INIT_ONCE_REG_SET. (allocate_reg_info): Do not call MAX_REGNO_REG_SET. (regset_release_memory): Remove. * resource.c: Do not include basic-block.h. * rtlanal.c: Do not include basic-block.h. * sbitmap.c: Include obstack.h. * sched-deps.c: Do not include basic-block.h. (reg_pending_sets_head, reg_pending_clobbers_head, reg_pending_uses_head): Remove. (init_deps_global): Use OBSTACK_ALLOC_REG_SET. * sched-ebb.c: Do not include basic-block.h. * sched-rgn.c: Likewise. * tree-if-conv.c (get_loop_body_in_if_conv_order): Use BITMAP_XFREE. * tree-outof-ssa.c (perform_edge_inserts): Use BITMAP_XFREE. * tree-sra.c (decide_instantiations): Adjust bitmap initialization. * tree-ssa-dce.c: Include obstack.h. * tree-ssa-pre.c (grand_bitmap_obstack): Make a bitmap_obstack. (value_insert_into_set_bitmap): Remove useless bitmap_clear. (bitmap_set_new): Likewise. (init_pre): Initialize bitmap obstack. (fini_pre): Release bitmap obstack. * tree-ssanames.c (ssa_names_to_rewrite): Make static. (marked_for_rewrite_p): ssa_names_to_rewrite is never NULL. (mark_for_rewrite, unmark_for_rewrite): Likewise. (marked_ssa_names): Likewise. (init_ssanames): Use BITMAP_XMALLOC. (fini_ssanames): Use BITMAP_XFREE. * web.c: Include obstack.h From-SVN: r91009
2004-11-22 13:23:59 +01:00
bitmap_initialize (&done_head, &bitmap_default_obstack);
cleared_any = false;
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style. * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style. (bitmap_iterator): New type. (bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1, bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init, bmp_iter_and_next): New functions. * basic-block.h (EXECUTE_IF_SET_IN_REG_SET, EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to use iterator-style EXECUTE_IF_IN_BITMAP macros. * bitmap.c (bitmap_print): Ditto. * bt-load.c (clear_btr_from_live_range, add_btr_to_live_range, btr_def_live_range): Ditto. * cfganal.c (compute_dominance_frontiers_1) Ditto. * cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics): Ditto. * ddg.c (build_inter_loop_deps): Ditto. * df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update): Ditto. * except.c (remove_eh_handler): Ditto. * flow.c (reg_set_to_hard_reg_set): Ditto. * gcse.c (clear_modify_mem_tables): Ditto. * global.c (build_insn_chain): Ditto. * ifcvt.c (dead_or_predicable): Ditto. * loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg): Ditto. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto. * tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region, tree_purge_all_dead_eh_edges): Ditto. * tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags, rewrite_ssa_into_ssa): Ditto. * tree-outof-ssa.c (find_replaceable_exprs): Ditto. * tree-sra.c (scan_function, decide_instantiations, scalarize_parms): Ditto. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var, dump_points_to_info_for): Ditto. * tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto. * tree-ssa-dse.c (dse_finalize_block): Ditto. * tree-ssa-live.c (live_worklist, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph, dump_live_info): Ditto. * tree-ssa-loop-ivopts.c (find_induction_variables, find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map, determine_use_iv_costs, determine_set_costs, find_best_candidate, set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data): Ditto. * tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto. * tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Ditto. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto. From-SVN: r88145
2004-09-26 21:53:13 +02:00
EXECUTE_IF_SET_IN_BITMAP (sra_candidates, 0, i, bi)
{
tree var = referenced_var (i);
struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT);
if (elt)
{
decide_instantiation_1 (elt, 0, 0);
if (!decide_block_copy (elt))
elt = NULL;
}
if (!elt)
{
bitmap_set_bit (&done_head, i);
cleared_any = true;
}
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style. * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style. (bitmap_iterator): New type. (bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1, bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init, bmp_iter_and_next): New functions. * basic-block.h (EXECUTE_IF_SET_IN_REG_SET, EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to use iterator-style EXECUTE_IF_IN_BITMAP macros. * bitmap.c (bitmap_print): Ditto. * bt-load.c (clear_btr_from_live_range, add_btr_to_live_range, btr_def_live_range): Ditto. * cfganal.c (compute_dominance_frontiers_1) Ditto. * cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics): Ditto. * ddg.c (build_inter_loop_deps): Ditto. * df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update): Ditto. * except.c (remove_eh_handler): Ditto. * flow.c (reg_set_to_hard_reg_set): Ditto. * gcse.c (clear_modify_mem_tables): Ditto. * global.c (build_insn_chain): Ditto. * ifcvt.c (dead_or_predicable): Ditto. * loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg): Ditto. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto. * tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region, tree_purge_all_dead_eh_edges): Ditto. * tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags, rewrite_ssa_into_ssa): Ditto. * tree-outof-ssa.c (find_replaceable_exprs): Ditto. * tree-sra.c (scan_function, decide_instantiations, scalarize_parms): Ditto. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var, dump_points_to_info_for): Ditto. * tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto. * tree-ssa-dse.c (dse_finalize_block): Ditto. * tree-ssa-live.c (live_worklist, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph, dump_live_info): Ditto. * tree-ssa-loop-ivopts.c (find_induction_variables, find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map, determine_use_iv_costs, determine_set_costs, find_best_candidate, set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data): Ditto. * tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto. * tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Ditto. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto. From-SVN: r88145
2004-09-26 21:53:13 +02:00
}
if (cleared_any)
{
bitmap.h (bitmap_empty_p): New. * bitmap.h (bitmap_empty_p): New. (bitmap_and, bitmap_and_into, bitmap_and_compl, bitmap_and_compl_into, bitmap_ior, bitmap_ior_into, bitmap_ior_compl, bitmap_xor, bitmap_xor_into): New bitmap operation macros. (bitmap_ior_and_compl): Rename to ... (bitmap_ior_and_compl_into): ... here. * bitmap.c (bitmap_equal_p): Use bitmap_xor. (bitmap_ior_and_compl): Rename to ... (bitmap_ior_and_compl_into): ... here. Adjust. Return changed flag. (bitmap_union_of_diff): Use renamed bitmap functions. * basic-block.h (AND_REG_SET, AND_COMPL_REG_SET, IOR_REG_SET, XOR_REG_SET, IOR_AND_COMPL_REG_SET): Likewise. * cfgrtl.c (safe_insert_insn_on_edge): Likewise. * df.c (df_bb_rd_local_compute) * flow.c (calculate_global_regs_live, init_propagate_block_info): Likewise. * ifcvt.c (find_if_case_1, find_if_case_2, dead_or_predicable): Likewise. * ra-build.c (union_web_part_roots, livethrough_conflicts_bb, reset_conflicts, conflicts_between_webs): Likewise. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild): Likewise. * sched-ebb.c (compute_jump_reg_dependencies): Likewise. * tree-int-ssa.c (insert_phi_nodes_for, rewrite_into_ssa): Likewise. * tree-sra.c (decide_instantiations): Likewise. * tree-ssa-alias.c (create_name_tags, merge_pointed_to_info): Likewise. * tree-ssa-dom.c (tree_ssa_dominator_optimize): Likewise. * tree-ssa-loop-im.c (move_computations): Likewise. * tree-ssa-operands.c (get_call_expr_operands): Likewise. * tree-ssa-pre.c (fini_pre): Likewise. * tree-ssa.c (verify_flow_sensitive_alias_info): Likewise. * tree-ssanames.c (any_marked_for_rewrite_p): Likewise. * tree-vectorizer.c (vectorize_loops): Likewise. From-SVN: r89827
2004-10-29 10:41:10 +02:00
bitmap_and_compl_into (sra_candidates, &done_head);
bitmap_and_compl_into (needs_copy_in, &done_head);
}
bitmap_clear (&done_head);
backport: copy-prop, incremental SSA updating of FUD chains and newly exposed symbols. Merge from tree-cleanup-branch: VRP, store CCP, store copy-prop, incremental SSA updating of FUD chains and newly exposed symbols. * Makefile.in (tree-ssa-copy.o): Depend on tree-ssa-propagate.h. (OBJS-common): Add tree-vrp.o. (tree-vrp.o): New rule. * basic-block.h (nearest_common_dominator_for_set): Declare. * common.opt (ftree-store-ccp): New flag. (ftree-copy-prop): New flag. (ftree-vrp): New flag. (ftree-store-copy-prop): New flag. * dominance.c (nearest_common_dominator_for_set): New. * domwalk.c (walk_dominator_tree): Only traverse statements in blocks marked in walk_data->interesting_blocks. * domwalk.h (struct dom_walk_data): Add field interesting_blocks. * fold-const.c (fold): Handle ASSERT_EXPR. * opts.c (decode_options): Set flag_tree_copy_prop at -O1. Set flag_tree_store_ccp, flag_tree_store_copy_prop and flag_tree_vrp at -O2. * timevar.def (TV_TREE_VRP): Define. (TV_TREE_COPY_PROP): Define. (TV_TREE_STORE_COPY_PROP): Define. (TV_TREE_SSA_INCREMENTAL): Define. (TV_TREE_STORE_CCP): Define. * tree-cfg.c (tree_can_merge_blocks_p): Remove reference to kill_redundant_phi_nodes from comment. (verify_expr): Handle ASSERT_EXPR. * tree-dfa.c (mark_new_vars_to_rename): Remove second argument. Update all users. (mark_call_clobbered_vars_to_rename): Remove. Update all users. * tree-flow-inline.h (unmodifiable_var_p): New. * tree-flow.h (enum value_range_type): Declare. (struct value_range_def): Declare. (value_range): Declare. (remove_all_phi_nodes_for): Remove. Update all users. (find_phi_node_for): Declare. (add_type_alias): Declare. (count_uses_and_derefs): Declare. (kill_redundant_phi_nodes): Remove. (rewrite_into_ssa): Remove. (rewrite_def_def_chains): Remove. (update_ssa, register_new_name_mapping, create_new_def_for, need_ssa_update_p, name_registered_for_update_p, release_ssa_name_after_update_ssa, dump_repl_tbl, debug_repl_tbl, dump_names_replaced_by, debug_names_replaced_by, mark_sym_for_renaming, mark_set_for_renaming, get_current_def, set_current_def, get_value_range, dump_value_range, debug_value_range, dump_all_value_ranges, debug_all_value_ranges, expr_computes_nonzero, loop_depth_of_name, unmodifiable_var_p): Declare. * tree-gimple.c (is_gimple_formal_tmp_rhs): Handle ASSERT_EXPR. * tree-into-ssa.c (block_defs_stack): Update comment. (old_ssa_names, new_ssa_names, old_virtual_ssa_names, syms_to_rename, names_to_release, repl_tbl, need_to_initialize_update_ssa_p, need_to_update_vops_p, need_to_replace_names_p): New locals. (NAME_SETS_GROWTH_FACTOR): Define. (struct repl_map_d): Declare. (struct mark_def_sites_global_data): Add field interesting_blocks. (enum rewrite_mode): Declare. (REGISTER_DEFS_IN_THIS_STMT): Define. (compute_global_livein): Use last_basic_block instead of n_basic_blocks. (set_def_block): Remove last argument. Update all callers. (prepare_use_operand_for_rename): Remove. Update all callers. (prepare_def_operand_for_rename): Remove. Update all callers. (symbol_marked_for_renaming): New. (is_old_name): New. (is_new_name): New. (repl_map_hash): New. (repl_map_eq): New. (repl_map_free): New. (names_replaced_by): New. (add_to_repl_tbl): New. (add_new_name_mapping): New. (mark_def_sites): Assume that all the operands in the statement are in normal form. (find_idf): Assert that the block in the stack is valid. (get_default_def_for): New. (insert_phi_nodes_for): Add new argument 'update_p'. Add documentation. If update_p is true, add a new mapping between the LHS of each new PHI and the name that it replaces. (insert_phi_nodes_1): Only call find_idf if needed. (get_reaching_def): Call get_default_def_for. (rewrite_operand): Remove. (rewrite_stmt): Do nothing if REGISTER_DEFS_IN_THIS_STMT and REWRITE_THIS_STMT are false. Assume that all the operands in the statement are in normal form. (rewrite_add_phi_arguments): Don't use PHI_REWRITTEN. (rewrite_virtual_phi_arguments): Remove. (invalidate_name_tags): Remove. (register_new_update_single, register_new_update_set, rewrite_update_init_block, replace_use, rewrite_update_fini_block, rewrite_update_stmt, rewrite_update_phi_arguments): New. rewrite_blocks): Remove argument 'fix_virtual_phis'. Add arguments 'entry', 'what' and 'blocks'. Initialize the dominator walker according to 'what' and 'blocks'. Start the dominator walk at 'entry'. (mark_def_site_blocks): Add argument 'interesting_blocks'. Use it to configure the dominator walker. (rewrite_into_ssa): Remove argument 'all'. Make internal. (rewrite_all_into_ssa): Remove. (rewrite_def_def_chains): Remove. (mark_def_interesting, mark_use_interesting, prepare_phi_args_for_update, prepare_block_for_update, prepare_def_site_for, prepare_def_sites, dump_names_replaced_by, debug_names_replaced_by, dump_repl_tbl, debug_repl_tbl, init_update_ssa, delete_update_ssa, create_new_def_for, register_new_name_mapping, mark_sym_for_renaming, mark_set_for_renaming, need_ssa_update_p, name_registered_for_update_p, ssa_names_to_replace, release_ssa_name_after_update_ssa, insert_updated_phi_nodes_for, update_ssa): New. * tree-loop-linear.c (linear_transform_loops): Call update_ssa instead of rewrite_into_ssa. * tree-optimize.c (vars_to_rename): Remove. Update all users. (init_tree_optimization_passes): Replace pass_redundant_phi with pass_copy_prop. Add pass_vrp. Replace pass_ccp with pass_store_ccp. Add pass_store_copy_prop after pass_store_ccp. (execute_todo): If the TODO_ flags don't include updating the SSA form, assert that it does not need to be updated. Call update_ssa instead of rewrite_into_ssa and rewrite_def_def_chains. If TODO_verify_loops is set, call verify_loop_closed_ssa. (tree_rest_of_compilation): * tree-pass.h (TODO_dump_func, TODO_ggc_collect, TODO_verify_ssa, TODO_verify_flow, TODO_verify_stmts, TODO_cleanup_cfg): Renumber. (TODO_verify_loops, TODO_update_ssa, TODO_update_ssa_no_phi, TODO_update_ssa_full_phi, TODO_update_ssa_only_virtuals): Define. (pass_copy_prop, pass_store_ccp, pass_store_copy_prop, pass_vrp): Declare. * tree-phinodes.c (make_phi_node): Update documentation. (remove_all_phi_nodes_for): Remove. (find_phi_node_for): New. * tree-pretty-print.c (dump_generic_node): Handle ASSERT_EXPR. * tree-scalar-evolution.c (follow_ssa_edge_in_rhs): Likewise. (interpret_rhs_modify_expr): Likewise. * tree-sra.c (decide_instantiations): Mark all symbols in SRA_CANDIDATES for renaming. (mark_all_v_defs_1): Rename from mark_all_v_defs. (mark_all_v_defs): New function. Update all users to call it with the whole list of scalarized statements, not just the first one. * tree-ssa-alias.c (count_ptr_derefs): Make extern. (compute_flow_insensitive_aliasing): If the tag is unmodifiable and the variable isn't or vice-versa, don't make them alias of each other. (setup_pointers_and_addressables): If the type tag for VAR is about to change, mark the old one for renaming. (add_type_alias): New. * tree-ssa-ccp.c: Document SSA-CCP and STORE-CCP. (ccp_lattice_t): Rename from latticevalue. (value): Remove. Update all users. (const_val): New local variable. (do_store_ccp): New local variable. (dump_lattice_value): Handle UNINITIALIZED. (debug_lattice_value): New. (get_default_value): Re-write. (set_lattice_value): Re-write. (def_to_varying): Remove. Update all users. (likely_value): Return VARYING for statements that make stores when STORE_CCP is false. Return VARYING for any statement other than MODIFY_EXPR, COND_EXPR and SWITCH_EXPR. (ccp_initialize): Re-write. (replace_uses_in, replace_vuse_in, substitute_and_fold): Move to tree-ssa-propagate.c. (ccp_lattice_meet): Handle memory stores when DO_STORE_CCP is true. (ccp_visit_phi_node): Likewise. (ccp_fold): Likewise. (evaluate_stmt): Likewise. (visit_assignment): Likewise. (ccp_visit_stmt): Likewise. (execute_ssa_ccp): Add argument 'store_ccp'. Copy it into DO_STORE_CCP. (do_ssa_ccp): New. (pass_ccp): Use it. (do_ssa_store_ccp): New. (gate_store_ccp): New. (pass_store_ccp): Declare. * tree-ssa-copy.c: Include tree-ssa-propagate.h. (may_propagate_copy): Reformat. Don't abort if ORIG is a virtual and DEST isn't. If NEW does not have alias information but DEST does, copy it. (copy_of, cached_last_copy_of, do_store_copy_prop, enum copy_prop_kind, which_copy_prop): Declare. (stmt_may_generate_copy, get_copy_of_val, get_last_copy_of, set_copy_of_val, dump_copy_of, copy_prop_visit_assignment, copy_prop_visit_cond_stmt, copy_prop_visit_stmt, copy_prop_visit_phi_node, init_copy_prop, fini_copy_prop, execute_copy_prop, gate_copy_prop, do_copy_prop, gate_store_copy_prop, store_copy_prop): New. (pass_copy_prop, pass_store_copy_prop): Declare. * tree-ssa-dom.c (struct opt_stats_d): Add fields 'num_const_prop' and 'num_copy_prop'. (cprop_operand): Update them. (dump_dominator_optimization_stats): Dump them. (tree_ssa_dominator_optimize): Call update_ssa instead of rewrite_into_ssa. (loop_depth_of_name): Declare extern. (simplify_cond_and_lookup_avail_expr): Guard against NULL values for LOW or HIGH. (cprop_into_successor_phis): Only propagate if NEW != ORIG. (record_equivalences_from_stmt): Call expr_computes_nonzero. (cprop_operand): Only propagate if VAL != OP. * tree-ssa-dse.c (dse_optimize_stmt): Mark symbols in removed statement for renaming. * tree-ssa-loop-im.c (move_computations): Call update_ssa. * tree-ssa-loop-ivopts.c (rewrite_address_base): Call add_type_alias if necessary. Call mark_new_vars_to_rename. (tree_ssa_iv_optimize): If new symbols need to be renamed, mark every statement updated, call update_ssa and rewrite_into_loop_closed_ssa. * tree-ssa-loop-manip.c (add_exit_phis): Do not remove DEF_BB from LIVEIN if VAR is a virtual. * tree-ssa-loop.c (tree_loop_optimizer_init): Call update_ssa. * tree-ssa-operands.c (get_expr_operands): Handle ASSERT_EXPR. (get_call_expr_operands): Reformat statement. (add_stmt_operand): Don't create V_MAY_DEFs for read-only symbols. * tree-ssa-propagate.c (ssa_prop_init): Initialize SSA_NAME_VALUE for every name. (first_vdef, stmt_makes_single_load, stmt_makes_single_store, get_value_loaded_by): New. (replace_uses_in, replace_vuses_in, replace_phi_args_in, substitute_and_fold): Move from tree-ssa-ccp.c. * tree-ssa-propagate.h (struct prop_value_d, prop_value_t, first_vdef, stmt_makes_single_load, stmt_makes_single_store, get_value_loaded_by, replace_uses_in, substitute_and_fold): Declare. * tree-ssa.c (verify_use): Fix error message. (propagate_into_addr, replace_immediate_uses, get_eq_name, check_phi_redundancy, kill_redundant_phi_nodes, pass_redundant_phi): Remove. Update all users. * tree-vect-transform.c (vect_create_data_ref_ptr): Call add_type_alias, if necessary. * tree-vectorizer.h (struct _stmt_vect_info): Update documentation for field 'memtag'. * tree-vrp.c: New file. * tree.def (ASSERT_EXPR): Define. * tree.h (ASSERT_EXPR_VAR): Define. (ASSERT_EXPR_COND): Define. (SSA_NAME_VALUE_RANGE): Define. (struct tree_ssa_name): Add field 'value_range'. (PHI_REWRITTEN): Remove. (struct tree_phi_node): Remove field 'rewritten'. * doc/invoke.texi (-fdump-tree-storeccp, -ftree-copy-prop, -ftree-store-copy-prop): Document. * doc/tree-ssa.texi: Remove broken link to McCAT's compiler. Document usage of update_ssa. testsuite/ChangeLog * g++.dg/tree-ssa/pr18178.C: New test. * gcc.c-torture/execute/20030216-1.x: Ignore at -O1. * gcc.c-torture/execute/20041019-1.c: New test. * gcc.dg/tree-ssa/20041008-1.c: New test. * gcc.dg/tree-ssa/ssa-ccp-12.c: New test. * gcc.dg/tree-ssa/20030731-2.c: Update to use -fdump-tree-store_ccp. * gcc.dg/tree-ssa/20030917-1.c: Likewise. * gcc.dg/tree-ssa/20030917-3.c: Likewise. * gcc.dg/tree-ssa/20040721-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-3.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-7.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-9.c: Likewise. From-SVN: r97884
2005-04-09 03:37:54 +02:00
mark_set_for_renaming (sra_candidates);
if (dump_file)
fputc ('\n', dump_file);
}
/* Phase Four: Update the function to match the replacements created. */
[multiple changes] 2006-12-11 Diego Novillo <dnovillo@redhat.com> * doc/tree-ssa.texi: Update documentation for virtual operands and the use of push_stmt_changes/pop_stmt_changes. * doc/invoke.texi: Remove documentation for params global-var-threshold. Update documentation on max-aliased-vops. * tree-into-ssa.c: Cleanup comments, variables and spacing in various functions. (regs_to_rename): Declare. (mem_syms_to_rename): Declare. (dump_update_ssa): Declare. (debug_update_ssa): Declare. (dump_names_replaced_by): Declare. (debug_names_replaced_by): Declare. (dump_def_blocks): Declare. (debug_def_blocks): Declare. (dump_defs_stack): Declare. (debug_defs_stack): Declare. (dump_currdefs): Declare. (debug_currdefs): Declare. (mark_def_sites): Do not handle virtual operands. (compute_idf): Rename from find_idf. Update users. (register_new_def): Make local. Convert second argument to 'tree'. Use BLOCK_DEFS_STACK directly. If pushing a non-register, also push the underlying symbol. (rewrite_stmt): Do not handle virtual operands. (dump_tree_ssa): Call dump_def_blocks, dump_defs_stack, dump_currdefs and dump_tree_ssa_stats. (dump_tree_ssa_stats): Also dump REPL_TBL. (replace_use): Remove. Update all users to call SET_USE instead. (rewrite_blocks): Move code to free memory to fini_ssa_renamer. (mark_def_site_blocks): Move initialization code to init_ssa_renamer. (init_ssa_renamer): New. (fini_ssa_renamer): New. (rewrite_into_ssa): Call them. (prepare_block_for_update): Process SSA_OP_ALL_USES first and SSA_OP_ALL_DEFS later. Do not process virtual operands separately. (dump_update_ssa): Call dump_decl_set. (init_update_ssa): Initialize regs_to_rename and mem_syms_to_rename. Call init_ssa_renamer. (delete_update_ssa): Call fini_ssa_renamer. Free blocks_with_phis_to_rewrite. (mark_sym_for_renaming): If the variable has sub-variables, also mark them. If the variable belongs to a partition, also mark it. (mark_set_for_renaming): Call mark_sym_for_renaming on every symbol in the set. (switch_virtuals_to_full_rewrite): Call mark_set_for_renaming. (update_ssa): Separate syms_to_rename into regs_to_rename and mem_syms_to_rename. * tree-dump.c (dump_options): Add TDF_MEMSYMS. * tree-pretty-print.c (debug_generic_expr): Add TDF_MEMSYMS. (debug_generic_stmt): Likewise. (debug_tree_chain): Likewise. (dump_symbols): New. (dump_generic_node): Check for TDF_MEMSYMS. Handle MEMORY_PARTITION_TAG. If the statement references memory and TDF_MEMSYMS is given, call dump_symbols. Indicate default names with (D). (dump_vops): Update for new virtual operator format. * tree.c (init_ttree): Add MEMORY_PARTITION_TAG to tree_contains_struct. (tree_code_size): Handle MEMORY_PARTITION_TAG. (tree_node_structure): Likewise. (needs_to_live_in_memory): Handle SSA names. * tree.h (MTAG_P): Likewise. (struct tree_memory_partition_tag): Declare. (MPT_SYMBOLS): Define. (union tree_node): Add field 'mpt'. * treestruct.def (TS_MEMORY_PARTITION_TAG): Define. * tree.def (MEMORY_PARTITION_TAG): Define. * tree-pass.h (TDF_MEMSYMS): Define. * params.h (GLOBAL_VAR_THRESHOLD): Remove. * tree-ssa-alias.c: Include pointer-set.h (struct alias_map_d): Remove fields total_alias_vops, grouped_p and may_aliases. Update all users. (struct mp_info_def): Declare. (mp_info_t): New type. (get_smt_for): Rename from get_tmt_for. Update all users. (add_may_alias): Add argument ALREADY_ADDED. If given, use it to avoid adding duplicate entries to alias sets. (replace_may_alias): Remove. Update all users. (total_alias_vops_cmp): Remove. Update all users. (group_aliases_into): Remove. Update all users. (tree_pointer_compare): Remove. Update all users. (compact_name_tags): Remove. Update all users. (group_aliases): Remove. Update all users. (mark_non_addressable): Move from tree-flow-inline.h. Remove the symbol from the partition holding it, if needed. (dump_mp_info): New. (debug_mp_info): New. (sort_mp_info): New. (create_partition_for): New. (rewrite_alias_set_for): New. (compute_memory_partitions): New. (compute_may_aliases): Call it. (init_alias_info): If computing aliases for the first time, mark every memory symbol for renaming. (have_common_aliases_p): New. (compute_flow_insensitive_aliasing): Call it. (setup_pointers_and_addressables): Do not cache num_referenced_vars. For register promoted symbols, mark their former partition for renaming. (maybe_create_global_var): Only create .GLOBAL_VAR if there are no call-clobbered variables and a mix of pure and non-pure functions were found. (may_alias_p): Tidy comments. (create_tag_raw): Remove unused variable new_type. (dump_alias_info): call dump_memory_partitions. (dump_points_to_info_for): Call dump_decl_set. (may_be_aliased): Tidy comments and formatting. * timevar.def (TV_MEMORY_PARTITIONING): Define. * tree-vectorizer.c (vect_memsyms_to_rename): Rename from vect_vnames_to_rename. Set DECL_UIDs instead of SSA name versions in it. (slpeel_update_phi_nodes_for_guard1): Ignore memory PHIs. * tree-vect-transform.c (vect_transform_loop): Call mark_set_for_renaming with vect_memsyms_to_rename. * tree-flow-inline.h (zero_imm_uses_p): New. (memory_partition): New. (set_memory_partition): New. (factoring_name_p): New. (symbol_mem_tag): New. Update every function that used to access the annotation directly. (set_symbol_mem_tag): Likewise. * tree-ssa-copy.c (may_propagate_copy): Allow copies between a partition and a symbol as long as the symbol belongs to the partition. (merge_alias_info): Ignore merge requests when memory partitions are involved. * tree-ssa.c (verify_ssa_name): Check that default definitions have empty defining statements. (verify_use): Remove argument IS_VIRTUAL. Don't call verify_ssa_name. (verify_phi_args): Call verify_ssa_name. (verify_flow_insensitive_alias_info): Handle MPTs. (verify_flow_sensitive_alias_info): Likewise. (verify_name_tags): Likewise. (verify_call_clobbering): Likewise. (verify_ssa): Check for VOPs only after aliasing information is available. Check virtuals and real operands separately. Call verify_ssa_name on every operand. (stmt_references_memory_p): Move to tree-ssa-operands.c. (walk_use_def_chains_1): Guard against NULL PHI arguments. * tree-ssa-operands.c (stmt_references_memory_p): Move from tree-ssa.c. (get_mpt_for): New. (dump_memory_partitions): New. (debug_memory_partitions): New. * tree-flow.h (struct var_ann_d): Add field mpt. (struct stmt_ann_d): Add bitfield references_memory. * Makefile.in (tree-ssa-structalias.o): Include pointer-set.h (tree-ssa-alias.o): Likewise. * tree-ssa-structalias.c: (update_alias_info): Use STORED_SYMS to determine which variables are being written to by the store operation. * tree-ssa-structalias.h (struct alias_info) <total_alias_vops>: Remove. Update all users. <written_vars>: Change to a pointer set. Update all users. <dereferenced_ptrs_store>: Likewise. <dereferenced_ptrs_load>: Likewise. (NUM_REFERENCES): Remove. Update all users. (NUM_REFERENCES_CLEAR): Remove. Update all users. (NUM_REFERENCES_INC): Remove. Update all users. (NUM_REFERENCES_SET): Remove. Update all users. * params.def (PARAM_GLOBAL_VAR_THRESHOLD): Remove. Update all users. (PARAM_MAX_ALIASED_VOPS): Set to 10. * tree-ssanames.c (make_ssa_name): Initialize SSA_NAME_IS_DEFAULT_DEF to 0. 2006-12-11 Aldy Hernandez <aldyh@redhat.com> * tree-ssa-dse.c (aggregate_vardecl_d): New. (dse_global_data): Add aggregate_vardecl field. (dse_possible_dead_store_p): New. Add prev_defvar variable. Allow immediate uses and previous immediate uses to differ if they are setting different parts of the whole. (get_aggregate_vardecl): New. (dse_record_partial_aggregate_store): New. (dse_whole_aggregate_clobbered_p): New. (dse_partial_kill_p): New. (dse_optimize_stmt): Abstract code checking a possible dead store into new function dse_possible_dead_store_p(). Call dse_maybe_record_aggregate_store(). When checking whether a STMT and its USE_STMT refer to the same memory address, check also for partial kills that clobber the whole. Move some variable definitions to the block where they are used. (aggregate_vardecl_hash): New. (aggregate_vardecl_eq): New. (aggregate_vardecl_free): New. (aggregate_whole_store_p): New. (tree_ssa_dse): Initialize and free aggregate_vardecl. Mark which aggregate stores we care about. 2006-12-11 Andrew Macleod <amacleod@redhat.com> * tree-ssa-operands.h (struct vuse_element_d): Declare. (vuse_element_t): Declare. (struct vuse_vec_d): Declare. (vuse_vec_p): Declare. (VUSE_VECT_NUM_ELEM): Define. (VUSE_VECT_ELEMENT_NC): Define. (VUSE_ELEMENT_PTR_NC): Define. (VUSE_ELEMENT_VAR_NC): Define. (VUSE_VECT_ELEMENT): Define. (VUSE_ELEMENT_PTR): Define. (VUSE_ELEMENT_VAR): Define. (struct maydef_optype_d) <use_var>: Remove. <use_ptr>: Remove. <usev>: Add. (struct vuse_optype_d) <kill_var>: Remove. <use_ptr>: Remove. <usev>: Add. (struct mustdef_optype_d) <kill_var>: Remove. <use_ptr>: Remove. <usev>: Add. (VUSE_OP_PTR): Add argument. Use VUSE_ELEMENT_PTR. (VUSE_OP): Add argument. Use VUSE_ELEMENT_PTR. (VUSE_NUM): Define. (VUSE_VECT): Define. (MAYDEF_OP_PTR): Add argument. Use VUSE_OP_PTR. (MAYDEF_OP): Add argument. Use VUSE_OP. (MAYDEF_NUM): Define. (MAYDEF_VECT): Define. (MUSTDEF_KILL_PTR): Use VUSE_OP_PTR. (MUSTDEF_KILL): Use VUSE_OP. (MUSTDEF_NUM): Define. (MUSTDEF_VECT): Define. (realloc_maydef): Declare. (realloc_vuse): Declare. (struct ssa_operand_iterator_d) <vuse_index>: Add. <mayuse_index>: Add. (LOADED_SYMS): Define. (STORED_SYMS): Define. (FOR_EACH_SSA_MUSTDEF_OPERAND): Call op_iter_next_mustdef. * tree-into-ssa.c: Adapt for multi-operand V_MAY_DEF and VUSE operators. * tree-pretty-print.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-flow-inline.h: Likewise. (op_iter_next_mustdef): New. * tree-ssa-operands.c: Likewise. (ALLOC_OPTYPE): Remove. Update all users. (alloc_def): New. (alloc_use): New. (alloc_maydef): New. (alloc_vuse): New. (alloc_mustdef): New. (realloc_maydef): New. (realloc_vuse): New. 2006-12-11 Aldy Hernandez <aldyh@redhat.com> * tree-ssa-operands.c: Remove build_v_must_defs. (init_ssa_operands): Delete build_v_must_defs. (finalize_ssa_v_must_def_ops): Remove. (finalize_ssa_v_must_defs): Remove. (finalize_ssa_stmt_operands): Do not call finalize_ssa_v_must_defs. (start_ssa_stmt_operands): Do not check build_v_must_defs. (append_v_must_def): Delete. (copy_virtual_operands): Do not copy V_MUST_DEFs. (get_modify_expr_operands): Remove reference to V_MUST_DEF from comment. Remove opf_kill_def. (build_ssa_operands): Remove references to v_must_defs. (copy_virtual_operands): Same. (copy_virtual_operands): Same. (fini_ssa_operands): Same. (free_ssa_operands): Same. (add_mustdef_op): Remove. Remove mustdef_optype_p. (alloc_mustdef): Remove. Remove references to V_MUST_DEFs in comment at top of file. (get_expr_operands): Remove opf_kill_def. (opf_kill_def): Remove. (add_virtual_operand): Remove opf_kill_def. (get_indirect_ref_operands): Same. (get_tmr_operands): Same. * tree-vectorizer.c (rename_variables_in_bb): Remove SSA_OP_ALL_KILLS. * tree-ssa-loop-manip.c (find_uses_to_rename_stmt): Remove SSA_OP_ALL_KILLS. (check_loop_closed_ssa_stmt): Same. * tree-ssa.c (verify_def): Remove V_MUST_DEF from comment. (verify_use): Same. (verify_ssa): Remove V_MUST_DEFs traces. (verify_ssa): Remove SSA_OP_ALL_KILLS. * tree-into-ssa.c (mark_def_sites): Change SSA_OP_VMUSTDEF to SSA_OP_VMAYDEF. (rewrite_update_stmt): Remove SSA_OP_VIRTUAL_KILLS. (rewrite_stmt): Remove SSA_OP_ALL_KILLS. * tree-ssa-operands.h (struct stmt_operands_d): Remove V_MUST_DEF references. (MUSTDEF_OPS): Remove. (SSA_OP_VMUSTDEF): Remove. (FOR_EACH_SSA_MUSTDEF_OPERAND): Remove. (struct mustdef_optype_d): Remove. Remove mustdef_optype_p. (struct stmt_operands_d): Remove mustdef_ops. (ssa_operand_iterator_d): Remove mustdefs and mustkills. (SSA_OP_VIRTUAL_DEFS): Remove SSA_OP_VMUSTDEF. (MUSTDEF_RESULT_PTR): Remove. (MUSTDEF_RESULT): Remove. (MUSTDEF_KILL_PTR): Remove. (MUSTDEF_KILL): Remove. (MUSTDEF_NUM): Remove. (MUSTDEF_VECT): Remove. (SSA_OP_VIRTUAL_KILLS): Remove. (SSA_OP_ALL_VIRTUALS): Remove SSA_OP_VIRTUAL_KILLS. (SSA_OP_VMUSTKILL): Remove. (SSA_OP_ALL_KILLS): Remove. (SSA_OP_ALL_OPERANDS): Remove SSA_OP_ALL_KILLS. * tree-flow-inline.h (op_iter_init_def): Remove SSA_OP_VIRTUAL_KILLS. (delink_stmt_imm_use): Remove SSA_OP_ALL_KILLS. * tree-ssa-pre.c (compute_rvuse_and_antic_safe): Remove SSA_OP_VIRTUAL_KILLS. * tree-ssa-loop-im.c (determine_max_movement): Remove SSA_OP_VIRTUAL_KILLS. (gather_mem_refs_stmt): Same. (gather_mem_refs_stmt): Same. * tree-ssa-dce.c (mark_really_necessary_kill_operand_phis): Delete. (perform_tree_ssa_dce): Remove call to mark_really_necessary_kill_operand_phis. * tree-flow-inline.h (op_iter_init): Remove setting of mustdefs and mustkills. (op_iter_next_use): Do not check mustkills. (op_iter_next_def): Do not check mustdefs. (op_iter_next_tree): Do not check mustkills or mustdefs. (clear_and_done_ssa_iter): Do not set mustdefs or mustkills. (op_iter_next_maymustdef): Do not check mustkills. (op_iter_init_must_and_may_def): Remove SSA_OP_VMUSTKILL. (op_iter_init_mustdef): Remove. * tree-ssa-live.c (create_ssa_var_map): Change SSA_OP_VMUSTDEF to SSA_OP_VMAYDEF. * tree-ssa-dse.c (dse_optimize_stmt): Remove SSA_OP_VMUSTDEF. * tree-ssa-ccp.c: Remove V_MUST_DEF traces from comments. (visit_assignment): Same. * tree-ssa-copy.c (copy_prop_visit_assignment): Same. * tree-sra.c (mark_all_v_defs_1): Remove V_MUST_DEF from comment. * tree-outof-ssa.c (check_replaceable): Remove SSA_OP_VMUSTDEF. * tree-pretty-print.c (dump_vops): Remove printing of V_MUST_DEF. Remove kill_p variable. * tree-dfa.c (struct dfa_stats_d): Remove num_v_must_defs. (dump_dfa_stats): Remove code related to V_MUST_DEFs. (collect_dfa_stats_r): Do not set num_v_must_defs. (mark_new_vars_to_rename): Remove v_must_defs_{before,after} code. * tree-into-ssa.c (mark_def_sites): Change SSA_OP_VMUSTKILL to SSA_OP_VMAYUSE. * tree-ssa-pre.c (compute_rvuse_and_antic_safe): Remove SSA_OP_VMUSTDEF and SSA_OP_VMUSTKILL. * tree-ssa-propagate.c (stmt_makes_single_store): Remove SSA_OP_VMUSTDEF. From-SVN: r119760
2006-12-12 02:48:51 +01:00
/* Mark all the variables in VDEF/VUSE operators for STMT for
renaming. This becomes necessary when we modify all of a
non-scalar. */
static void
backport: copy-prop, incremental SSA updating of FUD chains and newly exposed symbols. Merge from tree-cleanup-branch: VRP, store CCP, store copy-prop, incremental SSA updating of FUD chains and newly exposed symbols. * Makefile.in (tree-ssa-copy.o): Depend on tree-ssa-propagate.h. (OBJS-common): Add tree-vrp.o. (tree-vrp.o): New rule. * basic-block.h (nearest_common_dominator_for_set): Declare. * common.opt (ftree-store-ccp): New flag. (ftree-copy-prop): New flag. (ftree-vrp): New flag. (ftree-store-copy-prop): New flag. * dominance.c (nearest_common_dominator_for_set): New. * domwalk.c (walk_dominator_tree): Only traverse statements in blocks marked in walk_data->interesting_blocks. * domwalk.h (struct dom_walk_data): Add field interesting_blocks. * fold-const.c (fold): Handle ASSERT_EXPR. * opts.c (decode_options): Set flag_tree_copy_prop at -O1. Set flag_tree_store_ccp, flag_tree_store_copy_prop and flag_tree_vrp at -O2. * timevar.def (TV_TREE_VRP): Define. (TV_TREE_COPY_PROP): Define. (TV_TREE_STORE_COPY_PROP): Define. (TV_TREE_SSA_INCREMENTAL): Define. (TV_TREE_STORE_CCP): Define. * tree-cfg.c (tree_can_merge_blocks_p): Remove reference to kill_redundant_phi_nodes from comment. (verify_expr): Handle ASSERT_EXPR. * tree-dfa.c (mark_new_vars_to_rename): Remove second argument. Update all users. (mark_call_clobbered_vars_to_rename): Remove. Update all users. * tree-flow-inline.h (unmodifiable_var_p): New. * tree-flow.h (enum value_range_type): Declare. (struct value_range_def): Declare. (value_range): Declare. (remove_all_phi_nodes_for): Remove. Update all users. (find_phi_node_for): Declare. (add_type_alias): Declare. (count_uses_and_derefs): Declare. (kill_redundant_phi_nodes): Remove. (rewrite_into_ssa): Remove. (rewrite_def_def_chains): Remove. (update_ssa, register_new_name_mapping, create_new_def_for, need_ssa_update_p, name_registered_for_update_p, release_ssa_name_after_update_ssa, dump_repl_tbl, debug_repl_tbl, dump_names_replaced_by, debug_names_replaced_by, mark_sym_for_renaming, mark_set_for_renaming, get_current_def, set_current_def, get_value_range, dump_value_range, debug_value_range, dump_all_value_ranges, debug_all_value_ranges, expr_computes_nonzero, loop_depth_of_name, unmodifiable_var_p): Declare. * tree-gimple.c (is_gimple_formal_tmp_rhs): Handle ASSERT_EXPR. * tree-into-ssa.c (block_defs_stack): Update comment. (old_ssa_names, new_ssa_names, old_virtual_ssa_names, syms_to_rename, names_to_release, repl_tbl, need_to_initialize_update_ssa_p, need_to_update_vops_p, need_to_replace_names_p): New locals. (NAME_SETS_GROWTH_FACTOR): Define. (struct repl_map_d): Declare. (struct mark_def_sites_global_data): Add field interesting_blocks. (enum rewrite_mode): Declare. (REGISTER_DEFS_IN_THIS_STMT): Define. (compute_global_livein): Use last_basic_block instead of n_basic_blocks. (set_def_block): Remove last argument. Update all callers. (prepare_use_operand_for_rename): Remove. Update all callers. (prepare_def_operand_for_rename): Remove. Update all callers. (symbol_marked_for_renaming): New. (is_old_name): New. (is_new_name): New. (repl_map_hash): New. (repl_map_eq): New. (repl_map_free): New. (names_replaced_by): New. (add_to_repl_tbl): New. (add_new_name_mapping): New. (mark_def_sites): Assume that all the operands in the statement are in normal form. (find_idf): Assert that the block in the stack is valid. (get_default_def_for): New. (insert_phi_nodes_for): Add new argument 'update_p'. Add documentation. If update_p is true, add a new mapping between the LHS of each new PHI and the name that it replaces. (insert_phi_nodes_1): Only call find_idf if needed. (get_reaching_def): Call get_default_def_for. (rewrite_operand): Remove. (rewrite_stmt): Do nothing if REGISTER_DEFS_IN_THIS_STMT and REWRITE_THIS_STMT are false. Assume that all the operands in the statement are in normal form. (rewrite_add_phi_arguments): Don't use PHI_REWRITTEN. (rewrite_virtual_phi_arguments): Remove. (invalidate_name_tags): Remove. (register_new_update_single, register_new_update_set, rewrite_update_init_block, replace_use, rewrite_update_fini_block, rewrite_update_stmt, rewrite_update_phi_arguments): New. rewrite_blocks): Remove argument 'fix_virtual_phis'. Add arguments 'entry', 'what' and 'blocks'. Initialize the dominator walker according to 'what' and 'blocks'. Start the dominator walk at 'entry'. (mark_def_site_blocks): Add argument 'interesting_blocks'. Use it to configure the dominator walker. (rewrite_into_ssa): Remove argument 'all'. Make internal. (rewrite_all_into_ssa): Remove. (rewrite_def_def_chains): Remove. (mark_def_interesting, mark_use_interesting, prepare_phi_args_for_update, prepare_block_for_update, prepare_def_site_for, prepare_def_sites, dump_names_replaced_by, debug_names_replaced_by, dump_repl_tbl, debug_repl_tbl, init_update_ssa, delete_update_ssa, create_new_def_for, register_new_name_mapping, mark_sym_for_renaming, mark_set_for_renaming, need_ssa_update_p, name_registered_for_update_p, ssa_names_to_replace, release_ssa_name_after_update_ssa, insert_updated_phi_nodes_for, update_ssa): New. * tree-loop-linear.c (linear_transform_loops): Call update_ssa instead of rewrite_into_ssa. * tree-optimize.c (vars_to_rename): Remove. Update all users. (init_tree_optimization_passes): Replace pass_redundant_phi with pass_copy_prop. Add pass_vrp. Replace pass_ccp with pass_store_ccp. Add pass_store_copy_prop after pass_store_ccp. (execute_todo): If the TODO_ flags don't include updating the SSA form, assert that it does not need to be updated. Call update_ssa instead of rewrite_into_ssa and rewrite_def_def_chains. If TODO_verify_loops is set, call verify_loop_closed_ssa. (tree_rest_of_compilation): * tree-pass.h (TODO_dump_func, TODO_ggc_collect, TODO_verify_ssa, TODO_verify_flow, TODO_verify_stmts, TODO_cleanup_cfg): Renumber. (TODO_verify_loops, TODO_update_ssa, TODO_update_ssa_no_phi, TODO_update_ssa_full_phi, TODO_update_ssa_only_virtuals): Define. (pass_copy_prop, pass_store_ccp, pass_store_copy_prop, pass_vrp): Declare. * tree-phinodes.c (make_phi_node): Update documentation. (remove_all_phi_nodes_for): Remove. (find_phi_node_for): New. * tree-pretty-print.c (dump_generic_node): Handle ASSERT_EXPR. * tree-scalar-evolution.c (follow_ssa_edge_in_rhs): Likewise. (interpret_rhs_modify_expr): Likewise. * tree-sra.c (decide_instantiations): Mark all symbols in SRA_CANDIDATES for renaming. (mark_all_v_defs_1): Rename from mark_all_v_defs. (mark_all_v_defs): New function. Update all users to call it with the whole list of scalarized statements, not just the first one. * tree-ssa-alias.c (count_ptr_derefs): Make extern. (compute_flow_insensitive_aliasing): If the tag is unmodifiable and the variable isn't or vice-versa, don't make them alias of each other. (setup_pointers_and_addressables): If the type tag for VAR is about to change, mark the old one for renaming. (add_type_alias): New. * tree-ssa-ccp.c: Document SSA-CCP and STORE-CCP. (ccp_lattice_t): Rename from latticevalue. (value): Remove. Update all users. (const_val): New local variable. (do_store_ccp): New local variable. (dump_lattice_value): Handle UNINITIALIZED. (debug_lattice_value): New. (get_default_value): Re-write. (set_lattice_value): Re-write. (def_to_varying): Remove. Update all users. (likely_value): Return VARYING for statements that make stores when STORE_CCP is false. Return VARYING for any statement other than MODIFY_EXPR, COND_EXPR and SWITCH_EXPR. (ccp_initialize): Re-write. (replace_uses_in, replace_vuse_in, substitute_and_fold): Move to tree-ssa-propagate.c. (ccp_lattice_meet): Handle memory stores when DO_STORE_CCP is true. (ccp_visit_phi_node): Likewise. (ccp_fold): Likewise. (evaluate_stmt): Likewise. (visit_assignment): Likewise. (ccp_visit_stmt): Likewise. (execute_ssa_ccp): Add argument 'store_ccp'. Copy it into DO_STORE_CCP. (do_ssa_ccp): New. (pass_ccp): Use it. (do_ssa_store_ccp): New. (gate_store_ccp): New. (pass_store_ccp): Declare. * tree-ssa-copy.c: Include tree-ssa-propagate.h. (may_propagate_copy): Reformat. Don't abort if ORIG is a virtual and DEST isn't. If NEW does not have alias information but DEST does, copy it. (copy_of, cached_last_copy_of, do_store_copy_prop, enum copy_prop_kind, which_copy_prop): Declare. (stmt_may_generate_copy, get_copy_of_val, get_last_copy_of, set_copy_of_val, dump_copy_of, copy_prop_visit_assignment, copy_prop_visit_cond_stmt, copy_prop_visit_stmt, copy_prop_visit_phi_node, init_copy_prop, fini_copy_prop, execute_copy_prop, gate_copy_prop, do_copy_prop, gate_store_copy_prop, store_copy_prop): New. (pass_copy_prop, pass_store_copy_prop): Declare. * tree-ssa-dom.c (struct opt_stats_d): Add fields 'num_const_prop' and 'num_copy_prop'. (cprop_operand): Update them. (dump_dominator_optimization_stats): Dump them. (tree_ssa_dominator_optimize): Call update_ssa instead of rewrite_into_ssa. (loop_depth_of_name): Declare extern. (simplify_cond_and_lookup_avail_expr): Guard against NULL values for LOW or HIGH. (cprop_into_successor_phis): Only propagate if NEW != ORIG. (record_equivalences_from_stmt): Call expr_computes_nonzero. (cprop_operand): Only propagate if VAL != OP. * tree-ssa-dse.c (dse_optimize_stmt): Mark symbols in removed statement for renaming. * tree-ssa-loop-im.c (move_computations): Call update_ssa. * tree-ssa-loop-ivopts.c (rewrite_address_base): Call add_type_alias if necessary. Call mark_new_vars_to_rename. (tree_ssa_iv_optimize): If new symbols need to be renamed, mark every statement updated, call update_ssa and rewrite_into_loop_closed_ssa. * tree-ssa-loop-manip.c (add_exit_phis): Do not remove DEF_BB from LIVEIN if VAR is a virtual. * tree-ssa-loop.c (tree_loop_optimizer_init): Call update_ssa. * tree-ssa-operands.c (get_expr_operands): Handle ASSERT_EXPR. (get_call_expr_operands): Reformat statement. (add_stmt_operand): Don't create V_MAY_DEFs for read-only symbols. * tree-ssa-propagate.c (ssa_prop_init): Initialize SSA_NAME_VALUE for every name. (first_vdef, stmt_makes_single_load, stmt_makes_single_store, get_value_loaded_by): New. (replace_uses_in, replace_vuses_in, replace_phi_args_in, substitute_and_fold): Move from tree-ssa-ccp.c. * tree-ssa-propagate.h (struct prop_value_d, prop_value_t, first_vdef, stmt_makes_single_load, stmt_makes_single_store, get_value_loaded_by, replace_uses_in, substitute_and_fold): Declare. * tree-ssa.c (verify_use): Fix error message. (propagate_into_addr, replace_immediate_uses, get_eq_name, check_phi_redundancy, kill_redundant_phi_nodes, pass_redundant_phi): Remove. Update all users. * tree-vect-transform.c (vect_create_data_ref_ptr): Call add_type_alias, if necessary. * tree-vectorizer.h (struct _stmt_vect_info): Update documentation for field 'memtag'. * tree-vrp.c: New file. * tree.def (ASSERT_EXPR): Define. * tree.h (ASSERT_EXPR_VAR): Define. (ASSERT_EXPR_COND): Define. (SSA_NAME_VALUE_RANGE): Define. (struct tree_ssa_name): Add field 'value_range'. (PHI_REWRITTEN): Remove. (struct tree_phi_node): Remove field 'rewritten'. * doc/invoke.texi (-fdump-tree-storeccp, -ftree-copy-prop, -ftree-store-copy-prop): Document. * doc/tree-ssa.texi: Remove broken link to McCAT's compiler. Document usage of update_ssa. testsuite/ChangeLog * g++.dg/tree-ssa/pr18178.C: New test. * gcc.c-torture/execute/20030216-1.x: Ignore at -O1. * gcc.c-torture/execute/20041019-1.c: New test. * gcc.dg/tree-ssa/20041008-1.c: New test. * gcc.dg/tree-ssa/ssa-ccp-12.c: New test. * gcc.dg/tree-ssa/20030731-2.c: Update to use -fdump-tree-store_ccp. * gcc.dg/tree-ssa/20030917-1.c: Likewise. * gcc.dg/tree-ssa/20030917-3.c: Likewise. * gcc.dg/tree-ssa/20040721-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-3.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-7.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-9.c: Likewise. From-SVN: r97884
2005-04-09 03:37:54 +02:00
mark_all_v_defs_1 (tree stmt)
{
tree-ssa-operands.h (struct ssa_operand_iterator_d): New. 2004-08-25 Andrew MacLeod <amacleod@redhat.com> * tree-ssa-operands.h (struct ssa_operand_iterator_d): New. SSA operand iterator controlling structure. (SSA_OP_USE, SSA_OP_DEF, SSA_OP_VUSE, SSA_OP_VMAYUSE, SSA_OP_VMAYDEF, SSA_OP_VMUSTDEF, SSA_OP_VIRTUAL_USES, SSA_OP_VIRTUAL_DEFS, SSA_OP_ALL_USES, SSA_OP_ALL_DEFS, SSA_OP_ALL_OPERANDS): New. Operand iterator flags. (FOR_EACH_SSA_TREE_OPERAND): New. Iterate over operands as trees. (FOR_EACH_SSA_USE_OPERAND): New. Iterate over operands as uses. (FOR_EACH_SSA_DEF_OPERAND): New. Iterate over operands as defs. (FOR_EACH_SSA_MAYDEF_OPERAND): New. Iterate over V_MAY_DEFs. * tree-ssa-operands.c (NULL_DEF_OPERAND_P, NULL_USE_OPERAND_P): New. Empty operand pointers. * tree-flow-inline.h (op_iter_done): New. Return true if finished. (op_iter_next_use): New. Return next use_operand_p. (op_iter_next_def): New. Return next def_operand_p. (op_iter_next_tree): New. Return next operands as a tree. (op_iter_init): New. Initialize an iterator structure. (op_iter_init_use): New. Initialize structure and get the first use. (op_iter_init_def): New. Initialize structure and get the first def. (op_iter_init_tree): New. Initialize structure and get the first tree. (op_iter_next_maydef): New. Return next V_MAY_DEF operands. (op_iter_init_maydef): New. Initialize structure and get the first V_MAY_DEF operands. * tree-cfg.c (tree_duplicate_bb): Use new operand iterator. * tree-dfa.c (compute_immediate_uses_for_stmt, redirect_immediate_uses): Use new operand iterator. (v_may_defs_disappeared_p, v_must_defs_disappeared_p): Delete. (mark_new_vars_to_rename): Use new operand iterator. Count virtual operands instead of using *_disappeared_p routines. * tree-into-ssa.c (mark_def_sites, ssa_mark_def_sites, rewrite_stmt, ssa_rewrite_stmt): Use new operand iterator. * tree-outof-ssa.c (check_replaceable, find_replaceable_in_bb, rewrite_trees): Use new operand iterator. * tree-pretty-print.c (dump_vops): Use new operand iterator. * tree-sra.c (mark_all_v_defs): Use new operand iterator. * tree-ssa-alias.c (compute_points_to_and_addr_escape, dump_points_to_info): Use new operand iterator. * tree-ssa-ccp.c (cp_lattice_meet, visit_stmt, initialize, replace_uses_in, replace_vuse_in, likely_value, set_rhs): Use new operand iterator. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary, propagate_necessity): Use new operand iterator. * tree-ssa-dom.c (cprop_into_stmt, optimize_stmt): Use operand iterator. (register_definitions_for_stmt): Use new operand iterator. Take stmt as a parameter instead of a stmt_ann_t. * tree-ssa-live.c (create_ssa_var_map, calculate_live_on_entry, build_tree_conflict_graph): Use new operand iterator. * tree-ssa-loop-im.c (determine_max_movement, single_reachable_address, rewrite_mem_refs): Use new operand iterator. * tree-ssa-loop-manip.c (find_uses_to_rename_stmt, check_loop_closed_ssa_use): Use new operand iterator. * tree-ssa.c (verify_ssa, replace_immediate_uses): Use operand iterator. * tree-ssanames.c (release_defs): Use new operand iterator. * tree-vectorizer.c (vect_create_data_ref): Use new operand iterator. From-SVN: r86583
2004-08-25 23:21:19 +02:00
tree sym;
ssa_op_iter iter;
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_if_modified (stmt);
FOR_EACH_SSA_TREE_OPERAND (sym, stmt, iter, SSA_OP_ALL_VIRTUALS)
{
if (TREE_CODE (sym) == SSA_NAME)
sym = SSA_NAME_VAR (sym);
backport: copy-prop, incremental SSA updating of FUD chains and newly exposed symbols. Merge from tree-cleanup-branch: VRP, store CCP, store copy-prop, incremental SSA updating of FUD chains and newly exposed symbols. * Makefile.in (tree-ssa-copy.o): Depend on tree-ssa-propagate.h. (OBJS-common): Add tree-vrp.o. (tree-vrp.o): New rule. * basic-block.h (nearest_common_dominator_for_set): Declare. * common.opt (ftree-store-ccp): New flag. (ftree-copy-prop): New flag. (ftree-vrp): New flag. (ftree-store-copy-prop): New flag. * dominance.c (nearest_common_dominator_for_set): New. * domwalk.c (walk_dominator_tree): Only traverse statements in blocks marked in walk_data->interesting_blocks. * domwalk.h (struct dom_walk_data): Add field interesting_blocks. * fold-const.c (fold): Handle ASSERT_EXPR. * opts.c (decode_options): Set flag_tree_copy_prop at -O1. Set flag_tree_store_ccp, flag_tree_store_copy_prop and flag_tree_vrp at -O2. * timevar.def (TV_TREE_VRP): Define. (TV_TREE_COPY_PROP): Define. (TV_TREE_STORE_COPY_PROP): Define. (TV_TREE_SSA_INCREMENTAL): Define. (TV_TREE_STORE_CCP): Define. * tree-cfg.c (tree_can_merge_blocks_p): Remove reference to kill_redundant_phi_nodes from comment. (verify_expr): Handle ASSERT_EXPR. * tree-dfa.c (mark_new_vars_to_rename): Remove second argument. Update all users. (mark_call_clobbered_vars_to_rename): Remove. Update all users. * tree-flow-inline.h (unmodifiable_var_p): New. * tree-flow.h (enum value_range_type): Declare. (struct value_range_def): Declare. (value_range): Declare. (remove_all_phi_nodes_for): Remove. Update all users. (find_phi_node_for): Declare. (add_type_alias): Declare. (count_uses_and_derefs): Declare. (kill_redundant_phi_nodes): Remove. (rewrite_into_ssa): Remove. (rewrite_def_def_chains): Remove. (update_ssa, register_new_name_mapping, create_new_def_for, need_ssa_update_p, name_registered_for_update_p, release_ssa_name_after_update_ssa, dump_repl_tbl, debug_repl_tbl, dump_names_replaced_by, debug_names_replaced_by, mark_sym_for_renaming, mark_set_for_renaming, get_current_def, set_current_def, get_value_range, dump_value_range, debug_value_range, dump_all_value_ranges, debug_all_value_ranges, expr_computes_nonzero, loop_depth_of_name, unmodifiable_var_p): Declare. * tree-gimple.c (is_gimple_formal_tmp_rhs): Handle ASSERT_EXPR. * tree-into-ssa.c (block_defs_stack): Update comment. (old_ssa_names, new_ssa_names, old_virtual_ssa_names, syms_to_rename, names_to_release, repl_tbl, need_to_initialize_update_ssa_p, need_to_update_vops_p, need_to_replace_names_p): New locals. (NAME_SETS_GROWTH_FACTOR): Define. (struct repl_map_d): Declare. (struct mark_def_sites_global_data): Add field interesting_blocks. (enum rewrite_mode): Declare. (REGISTER_DEFS_IN_THIS_STMT): Define. (compute_global_livein): Use last_basic_block instead of n_basic_blocks. (set_def_block): Remove last argument. Update all callers. (prepare_use_operand_for_rename): Remove. Update all callers. (prepare_def_operand_for_rename): Remove. Update all callers. (symbol_marked_for_renaming): New. (is_old_name): New. (is_new_name): New. (repl_map_hash): New. (repl_map_eq): New. (repl_map_free): New. (names_replaced_by): New. (add_to_repl_tbl): New. (add_new_name_mapping): New. (mark_def_sites): Assume that all the operands in the statement are in normal form. (find_idf): Assert that the block in the stack is valid. (get_default_def_for): New. (insert_phi_nodes_for): Add new argument 'update_p'. Add documentation. If update_p is true, add a new mapping between the LHS of each new PHI and the name that it replaces. (insert_phi_nodes_1): Only call find_idf if needed. (get_reaching_def): Call get_default_def_for. (rewrite_operand): Remove. (rewrite_stmt): Do nothing if REGISTER_DEFS_IN_THIS_STMT and REWRITE_THIS_STMT are false. Assume that all the operands in the statement are in normal form. (rewrite_add_phi_arguments): Don't use PHI_REWRITTEN. (rewrite_virtual_phi_arguments): Remove. (invalidate_name_tags): Remove. (register_new_update_single, register_new_update_set, rewrite_update_init_block, replace_use, rewrite_update_fini_block, rewrite_update_stmt, rewrite_update_phi_arguments): New. rewrite_blocks): Remove argument 'fix_virtual_phis'. Add arguments 'entry', 'what' and 'blocks'. Initialize the dominator walker according to 'what' and 'blocks'. Start the dominator walk at 'entry'. (mark_def_site_blocks): Add argument 'interesting_blocks'. Use it to configure the dominator walker. (rewrite_into_ssa): Remove argument 'all'. Make internal. (rewrite_all_into_ssa): Remove. (rewrite_def_def_chains): Remove. (mark_def_interesting, mark_use_interesting, prepare_phi_args_for_update, prepare_block_for_update, prepare_def_site_for, prepare_def_sites, dump_names_replaced_by, debug_names_replaced_by, dump_repl_tbl, debug_repl_tbl, init_update_ssa, delete_update_ssa, create_new_def_for, register_new_name_mapping, mark_sym_for_renaming, mark_set_for_renaming, need_ssa_update_p, name_registered_for_update_p, ssa_names_to_replace, release_ssa_name_after_update_ssa, insert_updated_phi_nodes_for, update_ssa): New. * tree-loop-linear.c (linear_transform_loops): Call update_ssa instead of rewrite_into_ssa. * tree-optimize.c (vars_to_rename): Remove. Update all users. (init_tree_optimization_passes): Replace pass_redundant_phi with pass_copy_prop. Add pass_vrp. Replace pass_ccp with pass_store_ccp. Add pass_store_copy_prop after pass_store_ccp. (execute_todo): If the TODO_ flags don't include updating the SSA form, assert that it does not need to be updated. Call update_ssa instead of rewrite_into_ssa and rewrite_def_def_chains. If TODO_verify_loops is set, call verify_loop_closed_ssa. (tree_rest_of_compilation): * tree-pass.h (TODO_dump_func, TODO_ggc_collect, TODO_verify_ssa, TODO_verify_flow, TODO_verify_stmts, TODO_cleanup_cfg): Renumber. (TODO_verify_loops, TODO_update_ssa, TODO_update_ssa_no_phi, TODO_update_ssa_full_phi, TODO_update_ssa_only_virtuals): Define. (pass_copy_prop, pass_store_ccp, pass_store_copy_prop, pass_vrp): Declare. * tree-phinodes.c (make_phi_node): Update documentation. (remove_all_phi_nodes_for): Remove. (find_phi_node_for): New. * tree-pretty-print.c (dump_generic_node): Handle ASSERT_EXPR. * tree-scalar-evolution.c (follow_ssa_edge_in_rhs): Likewise. (interpret_rhs_modify_expr): Likewise. * tree-sra.c (decide_instantiations): Mark all symbols in SRA_CANDIDATES for renaming. (mark_all_v_defs_1): Rename from mark_all_v_defs. (mark_all_v_defs): New function. Update all users to call it with the whole list of scalarized statements, not just the first one. * tree-ssa-alias.c (count_ptr_derefs): Make extern. (compute_flow_insensitive_aliasing): If the tag is unmodifiable and the variable isn't or vice-versa, don't make them alias of each other. (setup_pointers_and_addressables): If the type tag for VAR is about to change, mark the old one for renaming. (add_type_alias): New. * tree-ssa-ccp.c: Document SSA-CCP and STORE-CCP. (ccp_lattice_t): Rename from latticevalue. (value): Remove. Update all users. (const_val): New local variable. (do_store_ccp): New local variable. (dump_lattice_value): Handle UNINITIALIZED. (debug_lattice_value): New. (get_default_value): Re-write. (set_lattice_value): Re-write. (def_to_varying): Remove. Update all users. (likely_value): Return VARYING for statements that make stores when STORE_CCP is false. Return VARYING for any statement other than MODIFY_EXPR, COND_EXPR and SWITCH_EXPR. (ccp_initialize): Re-write. (replace_uses_in, replace_vuse_in, substitute_and_fold): Move to tree-ssa-propagate.c. (ccp_lattice_meet): Handle memory stores when DO_STORE_CCP is true. (ccp_visit_phi_node): Likewise. (ccp_fold): Likewise. (evaluate_stmt): Likewise. (visit_assignment): Likewise. (ccp_visit_stmt): Likewise. (execute_ssa_ccp): Add argument 'store_ccp'. Copy it into DO_STORE_CCP. (do_ssa_ccp): New. (pass_ccp): Use it. (do_ssa_store_ccp): New. (gate_store_ccp): New. (pass_store_ccp): Declare. * tree-ssa-copy.c: Include tree-ssa-propagate.h. (may_propagate_copy): Reformat. Don't abort if ORIG is a virtual and DEST isn't. If NEW does not have alias information but DEST does, copy it. (copy_of, cached_last_copy_of, do_store_copy_prop, enum copy_prop_kind, which_copy_prop): Declare. (stmt_may_generate_copy, get_copy_of_val, get_last_copy_of, set_copy_of_val, dump_copy_of, copy_prop_visit_assignment, copy_prop_visit_cond_stmt, copy_prop_visit_stmt, copy_prop_visit_phi_node, init_copy_prop, fini_copy_prop, execute_copy_prop, gate_copy_prop, do_copy_prop, gate_store_copy_prop, store_copy_prop): New. (pass_copy_prop, pass_store_copy_prop): Declare. * tree-ssa-dom.c (struct opt_stats_d): Add fields 'num_const_prop' and 'num_copy_prop'. (cprop_operand): Update them. (dump_dominator_optimization_stats): Dump them. (tree_ssa_dominator_optimize): Call update_ssa instead of rewrite_into_ssa. (loop_depth_of_name): Declare extern. (simplify_cond_and_lookup_avail_expr): Guard against NULL values for LOW or HIGH. (cprop_into_successor_phis): Only propagate if NEW != ORIG. (record_equivalences_from_stmt): Call expr_computes_nonzero. (cprop_operand): Only propagate if VAL != OP. * tree-ssa-dse.c (dse_optimize_stmt): Mark symbols in removed statement for renaming. * tree-ssa-loop-im.c (move_computations): Call update_ssa. * tree-ssa-loop-ivopts.c (rewrite_address_base): Call add_type_alias if necessary. Call mark_new_vars_to_rename. (tree_ssa_iv_optimize): If new symbols need to be renamed, mark every statement updated, call update_ssa and rewrite_into_loop_closed_ssa. * tree-ssa-loop-manip.c (add_exit_phis): Do not remove DEF_BB from LIVEIN if VAR is a virtual. * tree-ssa-loop.c (tree_loop_optimizer_init): Call update_ssa. * tree-ssa-operands.c (get_expr_operands): Handle ASSERT_EXPR. (get_call_expr_operands): Reformat statement. (add_stmt_operand): Don't create V_MAY_DEFs for read-only symbols. * tree-ssa-propagate.c (ssa_prop_init): Initialize SSA_NAME_VALUE for every name. (first_vdef, stmt_makes_single_load, stmt_makes_single_store, get_value_loaded_by): New. (replace_uses_in, replace_vuses_in, replace_phi_args_in, substitute_and_fold): Move from tree-ssa-ccp.c. * tree-ssa-propagate.h (struct prop_value_d, prop_value_t, first_vdef, stmt_makes_single_load, stmt_makes_single_store, get_value_loaded_by, replace_uses_in, substitute_and_fold): Declare. * tree-ssa.c (verify_use): Fix error message. (propagate_into_addr, replace_immediate_uses, get_eq_name, check_phi_redundancy, kill_redundant_phi_nodes, pass_redundant_phi): Remove. Update all users. * tree-vect-transform.c (vect_create_data_ref_ptr): Call add_type_alias, if necessary. * tree-vectorizer.h (struct _stmt_vect_info): Update documentation for field 'memtag'. * tree-vrp.c: New file. * tree.def (ASSERT_EXPR): Define. * tree.h (ASSERT_EXPR_VAR): Define. (ASSERT_EXPR_COND): Define. (SSA_NAME_VALUE_RANGE): Define. (struct tree_ssa_name): Add field 'value_range'. (PHI_REWRITTEN): Remove. (struct tree_phi_node): Remove field 'rewritten'. * doc/invoke.texi (-fdump-tree-storeccp, -ftree-copy-prop, -ftree-store-copy-prop): Document. * doc/tree-ssa.texi: Remove broken link to McCAT's compiler. Document usage of update_ssa. testsuite/ChangeLog * g++.dg/tree-ssa/pr18178.C: New test. * gcc.c-torture/execute/20030216-1.x: Ignore at -O1. * gcc.c-torture/execute/20041019-1.c: New test. * gcc.dg/tree-ssa/20041008-1.c: New test. * gcc.dg/tree-ssa/ssa-ccp-12.c: New test. * gcc.dg/tree-ssa/20030731-2.c: Update to use -fdump-tree-store_ccp. * gcc.dg/tree-ssa/20030917-1.c: Likewise. * gcc.dg/tree-ssa/20030917-3.c: Likewise. * gcc.dg/tree-ssa/20040721-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-3.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-7.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-9.c: Likewise. From-SVN: r97884
2005-04-09 03:37:54 +02:00
mark_sym_for_renaming (sym);
}
}
/* Mark all the variables in virtual operands in all the statements in
LIST for renaming. */
static void
mark_all_v_defs (tree list)
{
if (TREE_CODE (list) != STATEMENT_LIST)
mark_all_v_defs_1 (list);
else
{
tree_stmt_iterator i;
for (i = tsi_start (list); !tsi_end_p (i); tsi_next (&i))
mark_all_v_defs_1 (tsi_stmt (i));
}
}
[multiple changes] 2006-12-11 Diego Novillo <dnovillo@redhat.com> * doc/tree-ssa.texi: Update documentation for virtual operands and the use of push_stmt_changes/pop_stmt_changes. * doc/invoke.texi: Remove documentation for params global-var-threshold. Update documentation on max-aliased-vops. * tree-into-ssa.c: Cleanup comments, variables and spacing in various functions. (regs_to_rename): Declare. (mem_syms_to_rename): Declare. (dump_update_ssa): Declare. (debug_update_ssa): Declare. (dump_names_replaced_by): Declare. (debug_names_replaced_by): Declare. (dump_def_blocks): Declare. (debug_def_blocks): Declare. (dump_defs_stack): Declare. (debug_defs_stack): Declare. (dump_currdefs): Declare. (debug_currdefs): Declare. (mark_def_sites): Do not handle virtual operands. (compute_idf): Rename from find_idf. Update users. (register_new_def): Make local. Convert second argument to 'tree'. Use BLOCK_DEFS_STACK directly. If pushing a non-register, also push the underlying symbol. (rewrite_stmt): Do not handle virtual operands. (dump_tree_ssa): Call dump_def_blocks, dump_defs_stack, dump_currdefs and dump_tree_ssa_stats. (dump_tree_ssa_stats): Also dump REPL_TBL. (replace_use): Remove. Update all users to call SET_USE instead. (rewrite_blocks): Move code to free memory to fini_ssa_renamer. (mark_def_site_blocks): Move initialization code to init_ssa_renamer. (init_ssa_renamer): New. (fini_ssa_renamer): New. (rewrite_into_ssa): Call them. (prepare_block_for_update): Process SSA_OP_ALL_USES first and SSA_OP_ALL_DEFS later. Do not process virtual operands separately. (dump_update_ssa): Call dump_decl_set. (init_update_ssa): Initialize regs_to_rename and mem_syms_to_rename. Call init_ssa_renamer. (delete_update_ssa): Call fini_ssa_renamer. Free blocks_with_phis_to_rewrite. (mark_sym_for_renaming): If the variable has sub-variables, also mark them. If the variable belongs to a partition, also mark it. (mark_set_for_renaming): Call mark_sym_for_renaming on every symbol in the set. (switch_virtuals_to_full_rewrite): Call mark_set_for_renaming. (update_ssa): Separate syms_to_rename into regs_to_rename and mem_syms_to_rename. * tree-dump.c (dump_options): Add TDF_MEMSYMS. * tree-pretty-print.c (debug_generic_expr): Add TDF_MEMSYMS. (debug_generic_stmt): Likewise. (debug_tree_chain): Likewise. (dump_symbols): New. (dump_generic_node): Check for TDF_MEMSYMS. Handle MEMORY_PARTITION_TAG. If the statement references memory and TDF_MEMSYMS is given, call dump_symbols. Indicate default names with (D). (dump_vops): Update for new virtual operator format. * tree.c (init_ttree): Add MEMORY_PARTITION_TAG to tree_contains_struct. (tree_code_size): Handle MEMORY_PARTITION_TAG. (tree_node_structure): Likewise. (needs_to_live_in_memory): Handle SSA names. * tree.h (MTAG_P): Likewise. (struct tree_memory_partition_tag): Declare. (MPT_SYMBOLS): Define. (union tree_node): Add field 'mpt'. * treestruct.def (TS_MEMORY_PARTITION_TAG): Define. * tree.def (MEMORY_PARTITION_TAG): Define. * tree-pass.h (TDF_MEMSYMS): Define. * params.h (GLOBAL_VAR_THRESHOLD): Remove. * tree-ssa-alias.c: Include pointer-set.h (struct alias_map_d): Remove fields total_alias_vops, grouped_p and may_aliases. Update all users. (struct mp_info_def): Declare. (mp_info_t): New type. (get_smt_for): Rename from get_tmt_for. Update all users. (add_may_alias): Add argument ALREADY_ADDED. If given, use it to avoid adding duplicate entries to alias sets. (replace_may_alias): Remove. Update all users. (total_alias_vops_cmp): Remove. Update all users. (group_aliases_into): Remove. Update all users. (tree_pointer_compare): Remove. Update all users. (compact_name_tags): Remove. Update all users. (group_aliases): Remove. Update all users. (mark_non_addressable): Move from tree-flow-inline.h. Remove the symbol from the partition holding it, if needed. (dump_mp_info): New. (debug_mp_info): New. (sort_mp_info): New. (create_partition_for): New. (rewrite_alias_set_for): New. (compute_memory_partitions): New. (compute_may_aliases): Call it. (init_alias_info): If computing aliases for the first time, mark every memory symbol for renaming. (have_common_aliases_p): New. (compute_flow_insensitive_aliasing): Call it. (setup_pointers_and_addressables): Do not cache num_referenced_vars. For register promoted symbols, mark their former partition for renaming. (maybe_create_global_var): Only create .GLOBAL_VAR if there are no call-clobbered variables and a mix of pure and non-pure functions were found. (may_alias_p): Tidy comments. (create_tag_raw): Remove unused variable new_type. (dump_alias_info): call dump_memory_partitions. (dump_points_to_info_for): Call dump_decl_set. (may_be_aliased): Tidy comments and formatting. * timevar.def (TV_MEMORY_PARTITIONING): Define. * tree-vectorizer.c (vect_memsyms_to_rename): Rename from vect_vnames_to_rename. Set DECL_UIDs instead of SSA name versions in it. (slpeel_update_phi_nodes_for_guard1): Ignore memory PHIs. * tree-vect-transform.c (vect_transform_loop): Call mark_set_for_renaming with vect_memsyms_to_rename. * tree-flow-inline.h (zero_imm_uses_p): New. (memory_partition): New. (set_memory_partition): New. (factoring_name_p): New. (symbol_mem_tag): New. Update every function that used to access the annotation directly. (set_symbol_mem_tag): Likewise. * tree-ssa-copy.c (may_propagate_copy): Allow copies between a partition and a symbol as long as the symbol belongs to the partition. (merge_alias_info): Ignore merge requests when memory partitions are involved. * tree-ssa.c (verify_ssa_name): Check that default definitions have empty defining statements. (verify_use): Remove argument IS_VIRTUAL. Don't call verify_ssa_name. (verify_phi_args): Call verify_ssa_name. (verify_flow_insensitive_alias_info): Handle MPTs. (verify_flow_sensitive_alias_info): Likewise. (verify_name_tags): Likewise. (verify_call_clobbering): Likewise. (verify_ssa): Check for VOPs only after aliasing information is available. Check virtuals and real operands separately. Call verify_ssa_name on every operand. (stmt_references_memory_p): Move to tree-ssa-operands.c. (walk_use_def_chains_1): Guard against NULL PHI arguments. * tree-ssa-operands.c (stmt_references_memory_p): Move from tree-ssa.c. (get_mpt_for): New. (dump_memory_partitions): New. (debug_memory_partitions): New. * tree-flow.h (struct var_ann_d): Add field mpt. (struct stmt_ann_d): Add bitfield references_memory. * Makefile.in (tree-ssa-structalias.o): Include pointer-set.h (tree-ssa-alias.o): Likewise. * tree-ssa-structalias.c: (update_alias_info): Use STORED_SYMS to determine which variables are being written to by the store operation. * tree-ssa-structalias.h (struct alias_info) <total_alias_vops>: Remove. Update all users. <written_vars>: Change to a pointer set. Update all users. <dereferenced_ptrs_store>: Likewise. <dereferenced_ptrs_load>: Likewise. (NUM_REFERENCES): Remove. Update all users. (NUM_REFERENCES_CLEAR): Remove. Update all users. (NUM_REFERENCES_INC): Remove. Update all users. (NUM_REFERENCES_SET): Remove. Update all users. * params.def (PARAM_GLOBAL_VAR_THRESHOLD): Remove. Update all users. (PARAM_MAX_ALIASED_VOPS): Set to 10. * tree-ssanames.c (make_ssa_name): Initialize SSA_NAME_IS_DEFAULT_DEF to 0. 2006-12-11 Aldy Hernandez <aldyh@redhat.com> * tree-ssa-dse.c (aggregate_vardecl_d): New. (dse_global_data): Add aggregate_vardecl field. (dse_possible_dead_store_p): New. Add prev_defvar variable. Allow immediate uses and previous immediate uses to differ if they are setting different parts of the whole. (get_aggregate_vardecl): New. (dse_record_partial_aggregate_store): New. (dse_whole_aggregate_clobbered_p): New. (dse_partial_kill_p): New. (dse_optimize_stmt): Abstract code checking a possible dead store into new function dse_possible_dead_store_p(). Call dse_maybe_record_aggregate_store(). When checking whether a STMT and its USE_STMT refer to the same memory address, check also for partial kills that clobber the whole. Move some variable definitions to the block where they are used. (aggregate_vardecl_hash): New. (aggregate_vardecl_eq): New. (aggregate_vardecl_free): New. (aggregate_whole_store_p): New. (tree_ssa_dse): Initialize and free aggregate_vardecl. Mark which aggregate stores we care about. 2006-12-11 Andrew Macleod <amacleod@redhat.com> * tree-ssa-operands.h (struct vuse_element_d): Declare. (vuse_element_t): Declare. (struct vuse_vec_d): Declare. (vuse_vec_p): Declare. (VUSE_VECT_NUM_ELEM): Define. (VUSE_VECT_ELEMENT_NC): Define. (VUSE_ELEMENT_PTR_NC): Define. (VUSE_ELEMENT_VAR_NC): Define. (VUSE_VECT_ELEMENT): Define. (VUSE_ELEMENT_PTR): Define. (VUSE_ELEMENT_VAR): Define. (struct maydef_optype_d) <use_var>: Remove. <use_ptr>: Remove. <usev>: Add. (struct vuse_optype_d) <kill_var>: Remove. <use_ptr>: Remove. <usev>: Add. (struct mustdef_optype_d) <kill_var>: Remove. <use_ptr>: Remove. <usev>: Add. (VUSE_OP_PTR): Add argument. Use VUSE_ELEMENT_PTR. (VUSE_OP): Add argument. Use VUSE_ELEMENT_PTR. (VUSE_NUM): Define. (VUSE_VECT): Define. (MAYDEF_OP_PTR): Add argument. Use VUSE_OP_PTR. (MAYDEF_OP): Add argument. Use VUSE_OP. (MAYDEF_NUM): Define. (MAYDEF_VECT): Define. (MUSTDEF_KILL_PTR): Use VUSE_OP_PTR. (MUSTDEF_KILL): Use VUSE_OP. (MUSTDEF_NUM): Define. (MUSTDEF_VECT): Define. (realloc_maydef): Declare. (realloc_vuse): Declare. (struct ssa_operand_iterator_d) <vuse_index>: Add. <mayuse_index>: Add. (LOADED_SYMS): Define. (STORED_SYMS): Define. (FOR_EACH_SSA_MUSTDEF_OPERAND): Call op_iter_next_mustdef. * tree-into-ssa.c: Adapt for multi-operand V_MAY_DEF and VUSE operators. * tree-pretty-print.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-flow-inline.h: Likewise. (op_iter_next_mustdef): New. * tree-ssa-operands.c: Likewise. (ALLOC_OPTYPE): Remove. Update all users. (alloc_def): New. (alloc_use): New. (alloc_maydef): New. (alloc_vuse): New. (alloc_mustdef): New. (realloc_maydef): New. (realloc_vuse): New. 2006-12-11 Aldy Hernandez <aldyh@redhat.com> * tree-ssa-operands.c: Remove build_v_must_defs. (init_ssa_operands): Delete build_v_must_defs. (finalize_ssa_v_must_def_ops): Remove. (finalize_ssa_v_must_defs): Remove. (finalize_ssa_stmt_operands): Do not call finalize_ssa_v_must_defs. (start_ssa_stmt_operands): Do not check build_v_must_defs. (append_v_must_def): Delete. (copy_virtual_operands): Do not copy V_MUST_DEFs. (get_modify_expr_operands): Remove reference to V_MUST_DEF from comment. Remove opf_kill_def. (build_ssa_operands): Remove references to v_must_defs. (copy_virtual_operands): Same. (copy_virtual_operands): Same. (fini_ssa_operands): Same. (free_ssa_operands): Same. (add_mustdef_op): Remove. Remove mustdef_optype_p. (alloc_mustdef): Remove. Remove references to V_MUST_DEFs in comment at top of file. (get_expr_operands): Remove opf_kill_def. (opf_kill_def): Remove. (add_virtual_operand): Remove opf_kill_def. (get_indirect_ref_operands): Same. (get_tmr_operands): Same. * tree-vectorizer.c (rename_variables_in_bb): Remove SSA_OP_ALL_KILLS. * tree-ssa-loop-manip.c (find_uses_to_rename_stmt): Remove SSA_OP_ALL_KILLS. (check_loop_closed_ssa_stmt): Same. * tree-ssa.c (verify_def): Remove V_MUST_DEF from comment. (verify_use): Same. (verify_ssa): Remove V_MUST_DEFs traces. (verify_ssa): Remove SSA_OP_ALL_KILLS. * tree-into-ssa.c (mark_def_sites): Change SSA_OP_VMUSTDEF to SSA_OP_VMAYDEF. (rewrite_update_stmt): Remove SSA_OP_VIRTUAL_KILLS. (rewrite_stmt): Remove SSA_OP_ALL_KILLS. * tree-ssa-operands.h (struct stmt_operands_d): Remove V_MUST_DEF references. (MUSTDEF_OPS): Remove. (SSA_OP_VMUSTDEF): Remove. (FOR_EACH_SSA_MUSTDEF_OPERAND): Remove. (struct mustdef_optype_d): Remove. Remove mustdef_optype_p. (struct stmt_operands_d): Remove mustdef_ops. (ssa_operand_iterator_d): Remove mustdefs and mustkills. (SSA_OP_VIRTUAL_DEFS): Remove SSA_OP_VMUSTDEF. (MUSTDEF_RESULT_PTR): Remove. (MUSTDEF_RESULT): Remove. (MUSTDEF_KILL_PTR): Remove. (MUSTDEF_KILL): Remove. (MUSTDEF_NUM): Remove. (MUSTDEF_VECT): Remove. (SSA_OP_VIRTUAL_KILLS): Remove. (SSA_OP_ALL_VIRTUALS): Remove SSA_OP_VIRTUAL_KILLS. (SSA_OP_VMUSTKILL): Remove. (SSA_OP_ALL_KILLS): Remove. (SSA_OP_ALL_OPERANDS): Remove SSA_OP_ALL_KILLS. * tree-flow-inline.h (op_iter_init_def): Remove SSA_OP_VIRTUAL_KILLS. (delink_stmt_imm_use): Remove SSA_OP_ALL_KILLS. * tree-ssa-pre.c (compute_rvuse_and_antic_safe): Remove SSA_OP_VIRTUAL_KILLS. * tree-ssa-loop-im.c (determine_max_movement): Remove SSA_OP_VIRTUAL_KILLS. (gather_mem_refs_stmt): Same. (gather_mem_refs_stmt): Same. * tree-ssa-dce.c (mark_really_necessary_kill_operand_phis): Delete. (perform_tree_ssa_dce): Remove call to mark_really_necessary_kill_operand_phis. * tree-flow-inline.h (op_iter_init): Remove setting of mustdefs and mustkills. (op_iter_next_use): Do not check mustkills. (op_iter_next_def): Do not check mustdefs. (op_iter_next_tree): Do not check mustkills or mustdefs. (clear_and_done_ssa_iter): Do not set mustdefs or mustkills. (op_iter_next_maymustdef): Do not check mustkills. (op_iter_init_must_and_may_def): Remove SSA_OP_VMUSTKILL. (op_iter_init_mustdef): Remove. * tree-ssa-live.c (create_ssa_var_map): Change SSA_OP_VMUSTDEF to SSA_OP_VMAYDEF. * tree-ssa-dse.c (dse_optimize_stmt): Remove SSA_OP_VMUSTDEF. * tree-ssa-ccp.c: Remove V_MUST_DEF traces from comments. (visit_assignment): Same. * tree-ssa-copy.c (copy_prop_visit_assignment): Same. * tree-sra.c (mark_all_v_defs_1): Remove V_MUST_DEF from comment. * tree-outof-ssa.c (check_replaceable): Remove SSA_OP_VMUSTDEF. * tree-pretty-print.c (dump_vops): Remove printing of V_MUST_DEF. Remove kill_p variable. * tree-dfa.c (struct dfa_stats_d): Remove num_v_must_defs. (dump_dfa_stats): Remove code related to V_MUST_DEFs. (collect_dfa_stats_r): Do not set num_v_must_defs. (mark_new_vars_to_rename): Remove v_must_defs_{before,after} code. * tree-into-ssa.c (mark_def_sites): Change SSA_OP_VMUSTKILL to SSA_OP_VMAYUSE. * tree-ssa-pre.c (compute_rvuse_and_antic_safe): Remove SSA_OP_VMUSTDEF and SSA_OP_VMUSTKILL. * tree-ssa-propagate.c (stmt_makes_single_store): Remove SSA_OP_VMUSTDEF. From-SVN: r119760
2006-12-12 02:48:51 +01:00
/* Mark every replacement under ELT with TREE_NO_WARNING. */
static void
mark_no_warning (struct sra_elt *elt)
{
if (!elt->all_no_warning)
{
if (elt->replacement)
TREE_NO_WARNING (elt->replacement) = 1;
else
{
struct sra_elt *c;
FOR_EACH_ACTUAL_CHILD (c, elt)
mark_no_warning (c);
}
elt->all_no_warning = true;
}
}
backport: copy-prop, incremental SSA updating of FUD chains and newly exposed symbols. Merge from tree-cleanup-branch: VRP, store CCP, store copy-prop, incremental SSA updating of FUD chains and newly exposed symbols. * Makefile.in (tree-ssa-copy.o): Depend on tree-ssa-propagate.h. (OBJS-common): Add tree-vrp.o. (tree-vrp.o): New rule. * basic-block.h (nearest_common_dominator_for_set): Declare. * common.opt (ftree-store-ccp): New flag. (ftree-copy-prop): New flag. (ftree-vrp): New flag. (ftree-store-copy-prop): New flag. * dominance.c (nearest_common_dominator_for_set): New. * domwalk.c (walk_dominator_tree): Only traverse statements in blocks marked in walk_data->interesting_blocks. * domwalk.h (struct dom_walk_data): Add field interesting_blocks. * fold-const.c (fold): Handle ASSERT_EXPR. * opts.c (decode_options): Set flag_tree_copy_prop at -O1. Set flag_tree_store_ccp, flag_tree_store_copy_prop and flag_tree_vrp at -O2. * timevar.def (TV_TREE_VRP): Define. (TV_TREE_COPY_PROP): Define. (TV_TREE_STORE_COPY_PROP): Define. (TV_TREE_SSA_INCREMENTAL): Define. (TV_TREE_STORE_CCP): Define. * tree-cfg.c (tree_can_merge_blocks_p): Remove reference to kill_redundant_phi_nodes from comment. (verify_expr): Handle ASSERT_EXPR. * tree-dfa.c (mark_new_vars_to_rename): Remove second argument. Update all users. (mark_call_clobbered_vars_to_rename): Remove. Update all users. * tree-flow-inline.h (unmodifiable_var_p): New. * tree-flow.h (enum value_range_type): Declare. (struct value_range_def): Declare. (value_range): Declare. (remove_all_phi_nodes_for): Remove. Update all users. (find_phi_node_for): Declare. (add_type_alias): Declare. (count_uses_and_derefs): Declare. (kill_redundant_phi_nodes): Remove. (rewrite_into_ssa): Remove. (rewrite_def_def_chains): Remove. (update_ssa, register_new_name_mapping, create_new_def_for, need_ssa_update_p, name_registered_for_update_p, release_ssa_name_after_update_ssa, dump_repl_tbl, debug_repl_tbl, dump_names_replaced_by, debug_names_replaced_by, mark_sym_for_renaming, mark_set_for_renaming, get_current_def, set_current_def, get_value_range, dump_value_range, debug_value_range, dump_all_value_ranges, debug_all_value_ranges, expr_computes_nonzero, loop_depth_of_name, unmodifiable_var_p): Declare. * tree-gimple.c (is_gimple_formal_tmp_rhs): Handle ASSERT_EXPR. * tree-into-ssa.c (block_defs_stack): Update comment. (old_ssa_names, new_ssa_names, old_virtual_ssa_names, syms_to_rename, names_to_release, repl_tbl, need_to_initialize_update_ssa_p, need_to_update_vops_p, need_to_replace_names_p): New locals. (NAME_SETS_GROWTH_FACTOR): Define. (struct repl_map_d): Declare. (struct mark_def_sites_global_data): Add field interesting_blocks. (enum rewrite_mode): Declare. (REGISTER_DEFS_IN_THIS_STMT): Define. (compute_global_livein): Use last_basic_block instead of n_basic_blocks. (set_def_block): Remove last argument. Update all callers. (prepare_use_operand_for_rename): Remove. Update all callers. (prepare_def_operand_for_rename): Remove. Update all callers. (symbol_marked_for_renaming): New. (is_old_name): New. (is_new_name): New. (repl_map_hash): New. (repl_map_eq): New. (repl_map_free): New. (names_replaced_by): New. (add_to_repl_tbl): New. (add_new_name_mapping): New. (mark_def_sites): Assume that all the operands in the statement are in normal form. (find_idf): Assert that the block in the stack is valid. (get_default_def_for): New. (insert_phi_nodes_for): Add new argument 'update_p'. Add documentation. If update_p is true, add a new mapping between the LHS of each new PHI and the name that it replaces. (insert_phi_nodes_1): Only call find_idf if needed. (get_reaching_def): Call get_default_def_for. (rewrite_operand): Remove. (rewrite_stmt): Do nothing if REGISTER_DEFS_IN_THIS_STMT and REWRITE_THIS_STMT are false. Assume that all the operands in the statement are in normal form. (rewrite_add_phi_arguments): Don't use PHI_REWRITTEN. (rewrite_virtual_phi_arguments): Remove. (invalidate_name_tags): Remove. (register_new_update_single, register_new_update_set, rewrite_update_init_block, replace_use, rewrite_update_fini_block, rewrite_update_stmt, rewrite_update_phi_arguments): New. rewrite_blocks): Remove argument 'fix_virtual_phis'. Add arguments 'entry', 'what' and 'blocks'. Initialize the dominator walker according to 'what' and 'blocks'. Start the dominator walk at 'entry'. (mark_def_site_blocks): Add argument 'interesting_blocks'. Use it to configure the dominator walker. (rewrite_into_ssa): Remove argument 'all'. Make internal. (rewrite_all_into_ssa): Remove. (rewrite_def_def_chains): Remove. (mark_def_interesting, mark_use_interesting, prepare_phi_args_for_update, prepare_block_for_update, prepare_def_site_for, prepare_def_sites, dump_names_replaced_by, debug_names_replaced_by, dump_repl_tbl, debug_repl_tbl, init_update_ssa, delete_update_ssa, create_new_def_for, register_new_name_mapping, mark_sym_for_renaming, mark_set_for_renaming, need_ssa_update_p, name_registered_for_update_p, ssa_names_to_replace, release_ssa_name_after_update_ssa, insert_updated_phi_nodes_for, update_ssa): New. * tree-loop-linear.c (linear_transform_loops): Call update_ssa instead of rewrite_into_ssa. * tree-optimize.c (vars_to_rename): Remove. Update all users. (init_tree_optimization_passes): Replace pass_redundant_phi with pass_copy_prop. Add pass_vrp. Replace pass_ccp with pass_store_ccp. Add pass_store_copy_prop after pass_store_ccp. (execute_todo): If the TODO_ flags don't include updating the SSA form, assert that it does not need to be updated. Call update_ssa instead of rewrite_into_ssa and rewrite_def_def_chains. If TODO_verify_loops is set, call verify_loop_closed_ssa. (tree_rest_of_compilation): * tree-pass.h (TODO_dump_func, TODO_ggc_collect, TODO_verify_ssa, TODO_verify_flow, TODO_verify_stmts, TODO_cleanup_cfg): Renumber. (TODO_verify_loops, TODO_update_ssa, TODO_update_ssa_no_phi, TODO_update_ssa_full_phi, TODO_update_ssa_only_virtuals): Define. (pass_copy_prop, pass_store_ccp, pass_store_copy_prop, pass_vrp): Declare. * tree-phinodes.c (make_phi_node): Update documentation. (remove_all_phi_nodes_for): Remove. (find_phi_node_for): New. * tree-pretty-print.c (dump_generic_node): Handle ASSERT_EXPR. * tree-scalar-evolution.c (follow_ssa_edge_in_rhs): Likewise. (interpret_rhs_modify_expr): Likewise. * tree-sra.c (decide_instantiations): Mark all symbols in SRA_CANDIDATES for renaming. (mark_all_v_defs_1): Rename from mark_all_v_defs. (mark_all_v_defs): New function. Update all users to call it with the whole list of scalarized statements, not just the first one. * tree-ssa-alias.c (count_ptr_derefs): Make extern. (compute_flow_insensitive_aliasing): If the tag is unmodifiable and the variable isn't or vice-versa, don't make them alias of each other. (setup_pointers_and_addressables): If the type tag for VAR is about to change, mark the old one for renaming. (add_type_alias): New. * tree-ssa-ccp.c: Document SSA-CCP and STORE-CCP. (ccp_lattice_t): Rename from latticevalue. (value): Remove. Update all users. (const_val): New local variable. (do_store_ccp): New local variable. (dump_lattice_value): Handle UNINITIALIZED. (debug_lattice_value): New. (get_default_value): Re-write. (set_lattice_value): Re-write. (def_to_varying): Remove. Update all users. (likely_value): Return VARYING for statements that make stores when STORE_CCP is false. Return VARYING for any statement other than MODIFY_EXPR, COND_EXPR and SWITCH_EXPR. (ccp_initialize): Re-write. (replace_uses_in, replace_vuse_in, substitute_and_fold): Move to tree-ssa-propagate.c. (ccp_lattice_meet): Handle memory stores when DO_STORE_CCP is true. (ccp_visit_phi_node): Likewise. (ccp_fold): Likewise. (evaluate_stmt): Likewise. (visit_assignment): Likewise. (ccp_visit_stmt): Likewise. (execute_ssa_ccp): Add argument 'store_ccp'. Copy it into DO_STORE_CCP. (do_ssa_ccp): New. (pass_ccp): Use it. (do_ssa_store_ccp): New. (gate_store_ccp): New. (pass_store_ccp): Declare. * tree-ssa-copy.c: Include tree-ssa-propagate.h. (may_propagate_copy): Reformat. Don't abort if ORIG is a virtual and DEST isn't. If NEW does not have alias information but DEST does, copy it. (copy_of, cached_last_copy_of, do_store_copy_prop, enum copy_prop_kind, which_copy_prop): Declare. (stmt_may_generate_copy, get_copy_of_val, get_last_copy_of, set_copy_of_val, dump_copy_of, copy_prop_visit_assignment, copy_prop_visit_cond_stmt, copy_prop_visit_stmt, copy_prop_visit_phi_node, init_copy_prop, fini_copy_prop, execute_copy_prop, gate_copy_prop, do_copy_prop, gate_store_copy_prop, store_copy_prop): New. (pass_copy_prop, pass_store_copy_prop): Declare. * tree-ssa-dom.c (struct opt_stats_d): Add fields 'num_const_prop' and 'num_copy_prop'. (cprop_operand): Update them. (dump_dominator_optimization_stats): Dump them. (tree_ssa_dominator_optimize): Call update_ssa instead of rewrite_into_ssa. (loop_depth_of_name): Declare extern. (simplify_cond_and_lookup_avail_expr): Guard against NULL values for LOW or HIGH. (cprop_into_successor_phis): Only propagate if NEW != ORIG. (record_equivalences_from_stmt): Call expr_computes_nonzero. (cprop_operand): Only propagate if VAL != OP. * tree-ssa-dse.c (dse_optimize_stmt): Mark symbols in removed statement for renaming. * tree-ssa-loop-im.c (move_computations): Call update_ssa. * tree-ssa-loop-ivopts.c (rewrite_address_base): Call add_type_alias if necessary. Call mark_new_vars_to_rename. (tree_ssa_iv_optimize): If new symbols need to be renamed, mark every statement updated, call update_ssa and rewrite_into_loop_closed_ssa. * tree-ssa-loop-manip.c (add_exit_phis): Do not remove DEF_BB from LIVEIN if VAR is a virtual. * tree-ssa-loop.c (tree_loop_optimizer_init): Call update_ssa. * tree-ssa-operands.c (get_expr_operands): Handle ASSERT_EXPR. (get_call_expr_operands): Reformat statement. (add_stmt_operand): Don't create V_MAY_DEFs for read-only symbols. * tree-ssa-propagate.c (ssa_prop_init): Initialize SSA_NAME_VALUE for every name. (first_vdef, stmt_makes_single_load, stmt_makes_single_store, get_value_loaded_by): New. (replace_uses_in, replace_vuses_in, replace_phi_args_in, substitute_and_fold): Move from tree-ssa-ccp.c. * tree-ssa-propagate.h (struct prop_value_d, prop_value_t, first_vdef, stmt_makes_single_load, stmt_makes_single_store, get_value_loaded_by, replace_uses_in, substitute_and_fold): Declare. * tree-ssa.c (verify_use): Fix error message. (propagate_into_addr, replace_immediate_uses, get_eq_name, check_phi_redundancy, kill_redundant_phi_nodes, pass_redundant_phi): Remove. Update all users. * tree-vect-transform.c (vect_create_data_ref_ptr): Call add_type_alias, if necessary. * tree-vectorizer.h (struct _stmt_vect_info): Update documentation for field 'memtag'. * tree-vrp.c: New file. * tree.def (ASSERT_EXPR): Define. * tree.h (ASSERT_EXPR_VAR): Define. (ASSERT_EXPR_COND): Define. (SSA_NAME_VALUE_RANGE): Define. (struct tree_ssa_name): Add field 'value_range'. (PHI_REWRITTEN): Remove. (struct tree_phi_node): Remove field 'rewritten'. * doc/invoke.texi (-fdump-tree-storeccp, -ftree-copy-prop, -ftree-store-copy-prop): Document. * doc/tree-ssa.texi: Remove broken link to McCAT's compiler. Document usage of update_ssa. testsuite/ChangeLog * g++.dg/tree-ssa/pr18178.C: New test. * gcc.c-torture/execute/20030216-1.x: Ignore at -O1. * gcc.c-torture/execute/20041019-1.c: New test. * gcc.dg/tree-ssa/20041008-1.c: New test. * gcc.dg/tree-ssa/ssa-ccp-12.c: New test. * gcc.dg/tree-ssa/20030731-2.c: Update to use -fdump-tree-store_ccp. * gcc.dg/tree-ssa/20030917-1.c: Likewise. * gcc.dg/tree-ssa/20030917-3.c: Likewise. * gcc.dg/tree-ssa/20040721-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-3.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-7.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-9.c: Likewise. From-SVN: r97884
2005-04-09 03:37:54 +02:00
/* Build a single level component reference to ELT rooted at BASE. */
static tree
generate_one_element_ref (struct sra_elt *elt, tree base)
{
switch (TREE_CODE (TREE_TYPE (base)))
{
case RECORD_TYPE:
{
tree field = elt->element;
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
/* We can't test elt->in_bitfld_blk here because, when this is
called from instantiate_element, we haven't set this field
yet. */
if (TREE_CODE (field) == BIT_FIELD_REF)
{
tree ret = unshare_expr (field);
TREE_OPERAND (ret, 0) = base;
return ret;
}
/* Watch out for compatible records with differing field lists. */
if (DECL_FIELD_CONTEXT (field) != TYPE_MAIN_VARIANT (TREE_TYPE (base)))
field = find_compatible_field (TREE_TYPE (base), field);
return build3 (COMPONENT_REF, elt->type, base, field, NULL);
}
case ARRAY_TYPE:
if (TREE_CODE (elt->element) == RANGE_EXPR)
return build4 (ARRAY_RANGE_REF, elt->type, base,
TREE_OPERAND (elt->element, 0), NULL, NULL);
else
return build4 (ARRAY_REF, elt->type, base, elt->element, NULL, NULL);
case COMPLEX_TYPE:
if (elt->element == integer_zero_node)
return build1 (REALPART_EXPR, elt->type, base);
else
return build1 (IMAGPART_EXPR, elt->type, base);
default:
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * targhooks.c (default_unwind_emit, default_scalar_mode_supported_p): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * timevar.c (timevar_push, timevar_pop, timevar_start, timevar_stop): Likewise. * toplev.c (default_pch_valid_p): Likewise. * tracer.c (tail_duplicate): Likewise. * tree-alias-common.c (get_alias_var_decl, get_values_from_constructor, create_alias_var, delete_alias_vars, empty_points_to_set, same_points_to_set, ptr_may_alias_var): Likewise. * tree.c (tree_size, make_node_stat, copy_node_stat, build_int_cst_wide, integer_all_onesp, list_length, chainon, tree_node_structure, type_contains_placeholder_p, substitute_in_expr, substitute_placeholder_in_expr, tabilize_reference_1, build0_stat, build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p, lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr, build_method_type_directly, decl_type_context, get_callee_fndecl, get_set_constructor_bits, build_vector_type_for_mode, int_cst_value, tree_fold_gcd): Likewise. * tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges, make_cond_expr_edges, group_case_labels, tree_merge_blocks, cleanup_control_expr_graph, find_taken_edge, find_taken_edge_switch_expr, phi_alternatives_equal, is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt, stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate, tree_split_edge, tree_verify_flow_info, thread_jumps, tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise. * tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly, chrec_fold_multiply_poly_poly): Likewise. * tree-complex.c (extract_component, expand_complex_division, expand_complex_comparison, expand_complex_operations_1, build_replicated_const, expand_vector_operations_1): Likewise. * tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector, build_classic_dir_vector): Likewise. * tree-dfa.c (compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann, create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region, record_in_finally_tree, replace_goto_queue_1, maybe_record_in_goto_queue, verify_norecord_switch_expr, do_return_redirection): Likewise. * tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr, add_to_dst_predicate_list, find_phi_replacement_condition, replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order): Likewise. * tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r, initialize_inlined_parameters, declare_return_variable, estimate_num_insns_1, expand_call_inline, expand_calls_inline, optimize_inline_calls, copy_tree_r): Likewise. * tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt, ssa_rewrite_stmt, rewrite_into_ssa): Likewise. * tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after, tsi_split_statement_list_after, tsi_split_statement_list_before): Likewise. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-nested.c (create_tmp_var_for, lookup_field_for_decl, lookup_tramp_for_decl, convert_all_function_calls): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi, coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis, free_temp_expr_table, add_dependance, finish_expr, rewrite_trees): Likewise. * tree-phinodes.c (resize_phi_node, add_phi_arg, remove_all_phi_nodes_for): Likewise. * tree-pretty-print.c (op_prio, print_call_name): Likewise. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise. * tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree, sra_elt_eq, sra_walk_expr, instantiate_missing_elements, generate_one_element_ref, generate_element_copy, generate_element_zero, scalarize_copy, scalarize_init, scalarize_ldst): Likewise. * tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p, add_may_alias, add_pointed_to_expr, add_pointed_to_var, collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise. * tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise. * tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value, set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment, widen_bitfield, ccp_fold_builtin): Likewise. * tree-ssa-copy.c (may_propagate_copy, merge_alias_info, replace_exp_1, propagate_tree_value): Likewise. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. * tree-ssa-dce.c (set_control_dependence_map_bit, find_control_dependence, find_pdom, mark_operand_necessary, mark_stmt_if_obviously_necessary, mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise. * tree-ssa-dom.c (dom_opt_initialize_block_local_data, simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis, eliminate_redundant_computations, avail_expr_eq): Likewise. * tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, duplicate_blocks): Likewise. * tree-ssa-loop-im.c (for_each_index, set_level, is_call_clobbered_ref): Likewise. * tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos, stmt_after_increment, set_iv, contains_abnormal_ssa_name_p, find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates, peel_address, ptr_difference_cost, may_replace_final_value, determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer, rewrite_use, rewrite_uses): Likewise. * tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa, check_loop_closed_ssa_use): Likewise. * tree-ssanames.c (make_ssa_name): Likewise. * tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses, finalize_ssa_v_must_defs, finalize_ssa_stmt_operands, get_stmt_operands, get_expr_operands, get_asm_expr_operands, get_indirect_ref_operands, add_stmt_operand): Likewise. * tree-ssa-pre.c (value_exists_in_set_bitmap, value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set, phi_translate, valid_in_set, compute_antic, find_or_generate_expression, create_expression_by_pieces, insert_aux, create_value_expr_from, eliminate): Likewise. * tree-ssa-propagate.c (cfg_blocks_get): Likewise. * tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges): Likewise. * tree-tailcall.c (independent_of_stmt_p, adjust_return_value, eliminate_tail_call): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_align_data_ref, vect_create_data_ref, vect_create_destination_var, vect_get_vec_def_for_operand, vect_finish_stmt_generation, vect_transform_stmt, vect_transform_loop_bound, vect_transform_loop, vect_analyze_operations): Likewise. * tree-vn.c (vn_compute, set_value_handle, get_value_handle): Likewise. * tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr, get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start, bsi_after_labels, bsi_last): Likewise. * tree-ssa-live.c (var_union, change_partition_var, create_ssa_var_map, calculate_live_on_entry, root_var_init, type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce): Likewise. * tree-ssa-live.h (partition_is_global, live_entry_blocks, tpa_find_tree): Likewise. (register_ssa_partition_check): Declare. (register_ssa_partition): use it. * tree-ssa-live.c: Include errors.h. (register_ssa_partition_check): New. * tree-ssa-operands.c: Include errors.h. * Makefile.in (tree-ssa-operands.o): Depend on errors.h. Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> From-SVN: r87223
2004-09-09 09:54:12 +02:00
gcc_unreachable ();
}
}
/* Build a full component reference to ELT rooted at its native variable. */
static tree
generate_element_ref (struct sra_elt *elt)
{
if (elt->parent)
return generate_one_element_ref (elt, generate_element_ref (elt->parent));
else
return elt->element;
}
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
/* Return true if BF is a bit-field that we can handle like a scalar. */
static bool
scalar_bitfield_p (tree bf)
{
return (TREE_CODE (bf) == BIT_FIELD_REF
&& (is_gimple_reg (TREE_OPERAND (bf, 0))
|| (TYPE_MODE (TREE_TYPE (TREE_OPERAND (bf, 0))) != BLKmode
&& (!TREE_SIDE_EFFECTS (TREE_OPERAND (bf, 0))
|| (GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE
(TREE_OPERAND (bf, 0))))
<= BITS_PER_WORD)))));
}
/* Create an assignment statement from SRC to DST. */
static tree
sra_build_assignment (tree dst, tree src)
{
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
/* Turning BIT_FIELD_REFs into bit operations enables other passes
to do a much better job at optimizing the code. */
if (scalar_bitfield_p (src))
{
tree cst, cst2, mask, minshift, maxshift;
tree tmp, var, utype, stype;
tree list, stmt;
bool unsignedp = BIT_FIELD_REF_UNSIGNED (src);
var = TREE_OPERAND (src, 0);
cst = TREE_OPERAND (src, 2);
cst2 = size_binop (PLUS_EXPR, TREE_OPERAND (src, 1),
TREE_OPERAND (src, 2));
if (BYTES_BIG_ENDIAN)
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
{
maxshift = size_binop (MINUS_EXPR, TYPE_SIZE (TREE_TYPE (var)), cst);
minshift = size_binop (MINUS_EXPR, TYPE_SIZE (TREE_TYPE (var)), cst2);
}
else
{
maxshift = cst2;
minshift = cst;
}
stype = TREE_TYPE (var);
if (!INTEGRAL_TYPE_P (stype))
stype = lang_hooks.types.type_for_size (TREE_INT_CST_LOW
(TYPE_SIZE (stype)), 1);
else if (!TYPE_UNSIGNED (stype))
stype = unsigned_type_for (stype);
utype = TREE_TYPE (dst);
if (!INTEGRAL_TYPE_P (utype))
utype = lang_hooks.types.type_for_size (TREE_INT_CST_LOW
(TYPE_SIZE (utype)), 1);
else if (!TYPE_UNSIGNED (utype))
utype = unsigned_type_for (utype);
list = NULL;
cst2 = size_binop (MINUS_EXPR, maxshift, minshift);
if (TREE_INT_CST_LOW (cst2) == TYPE_PRECISION (utype))
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
{
unsignedp = true;
mask = NULL_TREE;
}
else
{
mask = build_int_cst_wide (utype, 1, 0);
cst = int_const_binop (LSHIFT_EXPR, mask, cst2, true);
mask = int_const_binop (MINUS_EXPR, cst, mask, true);
}
tmp = make_rename_temp (stype, "SR");
if (TYPE_MAIN_VARIANT (TREE_TYPE (var)) != TYPE_MAIN_VARIANT (stype))
{
if (INTEGRAL_TYPE_P (TREE_TYPE (var)))
stmt = build_gimple_modify_stmt (tmp,
fold_convert (stype, var));
else
stmt = build_gimple_modify_stmt (tmp,
fold_build1 (VIEW_CONVERT_EXPR,
stype, var));
append_to_statement_list (stmt, &list);
var = tmp;
}
if (!integer_zerop (minshift))
{
tmp = make_rename_temp (stype, "SR");
stmt = build_gimple_modify_stmt (tmp,
fold_build2 (RSHIFT_EXPR, stype,
var, minshift));
append_to_statement_list (stmt, &list);
var = tmp;
}
if (TYPE_MAIN_VARIANT (utype) != TYPE_MAIN_VARIANT (stype))
{
if (!mask && unsignedp
&& (TYPE_MAIN_VARIANT (utype)
== TYPE_MAIN_VARIANT (TREE_TYPE (dst))))
tmp = dst;
else
tmp = make_rename_temp (utype, "SR");
stmt = build_gimple_modify_stmt (tmp, fold_convert (utype, var));
append_to_statement_list (stmt, &list);
var = tmp;
}
if (mask)
{
if (!unsignedp
|| (TYPE_MAIN_VARIANT (TREE_TYPE (dst))
!= TYPE_MAIN_VARIANT (utype)))
tmp = make_rename_temp (utype, "SR");
else
tmp = dst;
stmt = build_gimple_modify_stmt (tmp,
fold_build2 (BIT_AND_EXPR, utype,
var, mask));
append_to_statement_list (stmt, &list);
var = tmp;
}
if (!unsignedp)
{
tree signbit = int_const_binop (LSHIFT_EXPR,
build_int_cst_wide (utype, 1, 0),
size_binop (MINUS_EXPR, cst2,
bitsize_int (1)),
true);
tmp = make_rename_temp (utype, "SR");
stmt = build_gimple_modify_stmt (tmp,
fold_build2 (BIT_XOR_EXPR, utype,
var, signbit));
append_to_statement_list (stmt, &list);
var = tmp;
if (TYPE_MAIN_VARIANT (TREE_TYPE (dst)) != TYPE_MAIN_VARIANT (utype))
tmp = make_rename_temp (utype, "SR");
else
tmp = dst;
stmt = build_gimple_modify_stmt (tmp,
fold_build2 (MINUS_EXPR, utype,
var, signbit));
append_to_statement_list (stmt, &list);
var = tmp;
}
if (var != dst)
{
if (INTEGRAL_TYPE_P (TREE_TYPE (dst)))
var = fold_convert (TREE_TYPE (dst), var);
else
var = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (dst), var);
stmt = build_gimple_modify_stmt (dst, var);
append_to_statement_list (stmt, &list);
}
return list;
}
/* It was hoped that we could perform some type sanity checking
here, but since front-ends can emit accesses of fields in types
different from their nominal types and copy structures containing
them as a whole, we'd have to handle such differences here.
Since such accesses under different types require compatibility
anyway, there's little point in making tests and/or adding
conversions to ensure the types of src and dst are the same.
So we just assume type differences at this point are ok. */
tree-eh.c (do_return_redirection): Call build_gimple_modify_stmt instead of calling build2 with a GIMPLE_MODIFY_STMT. * tree-eh.c (do_return_redirection): Call build_gimple_modify_stmt instead of calling build2 with a GIMPLE_MODIFY_STMT. (honor_protect_cleanup_actions, lower_try_finally_switch): Likewise. * tree-if-conv.c (replace_phi_with_cond_gimple_modify_stmt, ifc_temp_var): Likewise. * tree-inline.c (setup_one_parameter): Likewise. * tree-mudflap.c (mf_decl_cache_locals, mf_build_check_statement_for): Likewise. * tree-nested.c (init_tmp_var, save_tmp_var, finalize_nesting_tree_1): Likewise. * tree-outof-ssa.c (insert_copy_on_edge, insert_backedge_copies): Likewise. * tree-profile.c (tree_gen_edge_profiler, tree_gen_ic_profiler): Likewise. * tree-scalar-evolution.c (scev_const_prop): Likewise. * tree-sra.c (sra_build_assignment): Likewise. * tree-ssa-loop-im.c (determine_invariantness_stmt): Likewise. * tree-ssa-math-opts.c (insert_reciprocals, execute_cse_sincos_1): Likewise. * tree-tailcall.c (adjust_accumulator_values, adjust_return_value): Likewise. * tree-vect-patterns.c (vect_pattern_recog_1): Likewise. * tree-vect-transform.c (vect_create_data_ref_ptr, bump_vector_ptr, vect_init_vector, get_initial_def_for_induction, vect_create_epilog_for_reduction, vectorizable_reduction, vectorizable_call, vectorizable_conversion, vectorizable_assignment, vectorizable_operation, vectorizable_type_demotion, vect_gen_widened_results_half, vect_permute_store_chain, vectorizable_store, vect_setup_realignment, vect_permute_load_chain, vectorizable_load, vectorizable_condition, vect_create_cond_for_align_checks): Likewise. * tree-vrp.c (build_assert_expr_for): Likewise. From-SVN: r122707
2007-03-08 20:02:51 +01:00
return build_gimple_modify_stmt (dst, src);
}
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
/* BIT_FIELD_REFs must not be shared. sra_build_elt_assignment()
takes care of assignments, but we must create copies for uses. */
#define REPLDUP(t) (TREE_CODE (t) != BIT_FIELD_REF ? (t) : unshare_expr (t))
/* Emit an assignment from SRC to DST, but if DST is a scalarizable
BIT_FIELD_REF, turn it into bit operations. */
static tree
sra_build_bf_assignment (tree dst, tree src)
{
tree var, type, utype, tmp, tmp2, tmp3;
tree list, stmt;
tree cst, cst2, mask;
tree minshift, maxshift;
if (TREE_CODE (dst) != BIT_FIELD_REF)
return sra_build_assignment (dst, src);
var = TREE_OPERAND (dst, 0);
if (!scalar_bitfield_p (dst))
return sra_build_assignment (REPLDUP (dst), src);
list = NULL;
cst = fold_convert (bitsizetype, TREE_OPERAND (dst, 2));
cst2 = size_binop (PLUS_EXPR,
fold_convert (bitsizetype, TREE_OPERAND (dst, 1)),
cst);
if (BYTES_BIG_ENDIAN)
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
{
maxshift = size_binop (MINUS_EXPR, TYPE_SIZE (TREE_TYPE (var)), cst);
minshift = size_binop (MINUS_EXPR, TYPE_SIZE (TREE_TYPE (var)), cst2);
}
else
{
maxshift = cst2;
minshift = cst;
}
type = TREE_TYPE (var);
if (!INTEGRAL_TYPE_P (type))
type = lang_hooks.types.type_for_size
(TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (var))), 1);
if (TYPE_UNSIGNED (type))
utype = type;
else
utype = unsigned_type_for (type);
mask = build_int_cst_wide (utype, 1, 0);
if (TREE_INT_CST_LOW (maxshift) == TYPE_PRECISION (utype))
cst = build_int_cst_wide (utype, 0, 0);
else
cst = int_const_binop (LSHIFT_EXPR, mask, maxshift, true);
if (integer_zerop (minshift))
cst2 = mask;
else
cst2 = int_const_binop (LSHIFT_EXPR, mask, minshift, true);
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
mask = int_const_binop (MINUS_EXPR, cst, cst2, true);
mask = fold_build1 (BIT_NOT_EXPR, utype, mask);
if (TYPE_MAIN_VARIANT (utype) != TYPE_MAIN_VARIANT (TREE_TYPE (var))
&& !integer_zerop (mask))
{
tmp = var;
if (!is_gimple_variable (tmp))
tmp = unshare_expr (var);
tmp2 = make_rename_temp (utype, "SR");
if (INTEGRAL_TYPE_P (TREE_TYPE (var)))
stmt = build_gimple_modify_stmt (tmp2, fold_convert (utype, tmp));
else
stmt = build_gimple_modify_stmt (tmp2, fold_build1 (VIEW_CONVERT_EXPR,
utype, tmp));
append_to_statement_list (stmt, &list);
}
else
tmp2 = var;
if (!integer_zerop (mask))
{
tmp = make_rename_temp (utype, "SR");
stmt = build_gimple_modify_stmt (tmp,
fold_build2 (BIT_AND_EXPR, utype,
tmp2, mask));
append_to_statement_list (stmt, &list);
}
else
tmp = mask;
if (is_gimple_reg (src) && INTEGRAL_TYPE_P (TREE_TYPE (src)))
tmp2 = src;
else if (INTEGRAL_TYPE_P (TREE_TYPE (src)))
{
tmp2 = make_rename_temp (TREE_TYPE (src), "SR");
stmt = sra_build_assignment (tmp2, src);
append_to_statement_list (stmt, &list);
}
else
{
tmp2 = make_rename_temp
(lang_hooks.types.type_for_size
(TREE_INT_CST_LOW (TYPE_SIZE (TREE_TYPE (src))),
1), "SR");
stmt = sra_build_assignment (tmp2, fold_build1 (VIEW_CONVERT_EXPR,
TREE_TYPE (tmp2), src));
append_to_statement_list (stmt, &list);
}
if (!TYPE_UNSIGNED (TREE_TYPE (tmp2)))
{
tree ut = unsigned_type_for (TREE_TYPE (tmp2));
tmp3 = make_rename_temp (ut, "SR");
tmp2 = fold_convert (ut, tmp2);
stmt = sra_build_assignment (tmp3, tmp2);
append_to_statement_list (stmt, &list);
tmp2 = fold_build1 (BIT_NOT_EXPR, utype, mask);
tmp2 = int_const_binop (RSHIFT_EXPR, tmp2, minshift, true);
tmp2 = fold_convert (ut, tmp2);
tmp2 = fold_build2 (BIT_AND_EXPR, ut, tmp3, tmp2);
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
if (tmp3 != tmp2)
{
tmp3 = make_rename_temp (ut, "SR");
stmt = sra_build_assignment (tmp3, tmp2);
append_to_statement_list (stmt, &list);
}
tmp2 = tmp3;
}
if (TYPE_MAIN_VARIANT (TREE_TYPE (tmp2)) != TYPE_MAIN_VARIANT (utype))
{
tmp3 = make_rename_temp (utype, "SR");
tmp2 = fold_convert (utype, tmp2);
stmt = sra_build_assignment (tmp3, tmp2);
append_to_statement_list (stmt, &list);
tmp2 = tmp3;
}
if (!integer_zerop (minshift))
{
tmp3 = make_rename_temp (utype, "SR");
stmt = build_gimple_modify_stmt (tmp3,
fold_build2 (LSHIFT_EXPR, utype,
tmp2, minshift));
append_to_statement_list (stmt, &list);
tmp2 = tmp3;
}
if (utype != TREE_TYPE (var))
tmp3 = make_rename_temp (utype, "SR");
else
tmp3 = var;
stmt = build_gimple_modify_stmt (tmp3,
fold_build2 (BIT_IOR_EXPR, utype,
tmp, tmp2));
append_to_statement_list (stmt, &list);
if (tmp3 != var)
{
if (TREE_TYPE (var) == type)
stmt = build_gimple_modify_stmt (var,
fold_convert (type, tmp3));
else
stmt = build_gimple_modify_stmt (var,
fold_build1 (VIEW_CONVERT_EXPR,
TREE_TYPE (var), tmp3));
append_to_statement_list (stmt, &list);
}
return list;
}
/* Expand an assignment of SRC to the scalarized representation of
ELT. If it is a field group, try to widen the assignment to cover
the full variable. */
static tree
sra_build_elt_assignment (struct sra_elt *elt, tree src)
{
tree dst = elt->replacement;
tree var, tmp, cst, cst2, list, stmt;
if (TREE_CODE (dst) != BIT_FIELD_REF
|| !elt->in_bitfld_block)
return sra_build_assignment (REPLDUP (dst), src);
var = TREE_OPERAND (dst, 0);
/* Try to widen the assignment to the entire variable.
We need the source to be a BIT_FIELD_REF as well, such that, for
BIT_FIELD_REF<d,sz,dp> = BIT_FIELD_REF<s,sz,sp>,
by design, conditions are met such that we can turn it into
d = BIT_FIELD_REF<s,dw,sp-dp>. */
if (elt->in_bitfld_block == 2
&& TREE_CODE (src) == BIT_FIELD_REF)
{
cst = TYPE_SIZE (TREE_TYPE (var));
cst2 = size_binop (MINUS_EXPR, TREE_OPERAND (src, 2),
TREE_OPERAND (dst, 2));
src = TREE_OPERAND (src, 0);
/* Avoid full-width bit-fields. */
if (integer_zerop (cst2)
&& tree_int_cst_equal (cst, TYPE_SIZE (TREE_TYPE (src))))
{
if (INTEGRAL_TYPE_P (TREE_TYPE (src))
&& !TYPE_UNSIGNED (TREE_TYPE (src)))
src = fold_convert (unsigned_type_for (TREE_TYPE (src)), src);
/* If a single conversion won't do, we'll need a statement
list. */
if (TYPE_MAIN_VARIANT (TREE_TYPE (var))
!= TYPE_MAIN_VARIANT (TREE_TYPE (src)))
{
list = NULL;
if (!INTEGRAL_TYPE_P (TREE_TYPE (src)))
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
src = fold_build1 (VIEW_CONVERT_EXPR,
lang_hooks.types.type_for_size
(TREE_INT_CST_LOW
(TYPE_SIZE (TREE_TYPE (src))),
1), src);
gcc_assert (TYPE_UNSIGNED (TREE_TYPE (src)));
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
tmp = make_rename_temp (TREE_TYPE (src), "SR");
stmt = build_gimple_modify_stmt (tmp, src);
append_to_statement_list (stmt, &list);
stmt = sra_build_assignment (var,
fold_convert (TREE_TYPE (var),
tmp));
append_to_statement_list (stmt, &list);
return list;
}
src = fold_convert (TREE_TYPE (var), src);
}
else
{
src = fold_build3 (BIT_FIELD_REF, TREE_TYPE (var), src, cst, cst2);
BIT_FIELD_REF_UNSIGNED (src) = 1;
}
return sra_build_assignment (var, src);
}
return sra_build_bf_assignment (dst, src);
}
/* Generate a set of assignment statements in *LIST_P to copy all
instantiated elements under ELT to or from the equivalent structure
rooted at EXPR. COPY_OUT controls the direction of the copy, with
true meaning to copy out of EXPR into ELT. */
static void
generate_copy_inout (struct sra_elt *elt, bool copy_out, tree expr,
tree *list_p)
{
struct sra_elt *c;
tree t;
if (!copy_out && TREE_CODE (expr) == SSA_NAME
&& TREE_CODE (TREE_TYPE (expr)) == COMPLEX_TYPE)
{
tree r, i;
c = lookup_element (elt, integer_zero_node, NULL, NO_INSERT);
r = c->replacement;
c = lookup_element (elt, integer_one_node, NULL, NO_INSERT);
i = c->replacement;
t = build2 (COMPLEX_EXPR, elt->type, r, i);
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
t = sra_build_bf_assignment (expr, t);
SSA_NAME_DEF_STMT (expr) = t;
append_to_statement_list (t, list_p);
}
else if (elt->replacement)
{
if (copy_out)
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
t = sra_build_elt_assignment (elt, expr);
else
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
t = sra_build_bf_assignment (expr, REPLDUP (elt->replacement));
append_to_statement_list (t, list_p);
}
else
{
FOR_EACH_ACTUAL_CHILD (c, elt)
{
t = generate_one_element_ref (c, unshare_expr (expr));
generate_copy_inout (c, copy_out, t, list_p);
}
}
}
/* Generate a set of assignment statements in *LIST_P to copy all instantiated
elements under SRC to their counterparts under DST. There must be a 1-1
correspondence of instantiated elements. */
static void
generate_element_copy (struct sra_elt *dst, struct sra_elt *src, tree *list_p)
{
struct sra_elt *dc, *sc;
FOR_EACH_ACTUAL_CHILD (dc, dst)
{
sc = lookup_element (src, dc->element, NULL, NO_INSERT);
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
if (!sc && dc->in_bitfld_block == 2)
{
struct sra_elt *dcs;
FOR_EACH_ACTUAL_CHILD (dcs, dc)
{
sc = lookup_element (src, dcs->element, NULL, NO_INSERT);
gcc_assert (sc);
generate_element_copy (dcs, sc, list_p);
}
continue;
}
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * targhooks.c (default_unwind_emit, default_scalar_mode_supported_p): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * timevar.c (timevar_push, timevar_pop, timevar_start, timevar_stop): Likewise. * toplev.c (default_pch_valid_p): Likewise. * tracer.c (tail_duplicate): Likewise. * tree-alias-common.c (get_alias_var_decl, get_values_from_constructor, create_alias_var, delete_alias_vars, empty_points_to_set, same_points_to_set, ptr_may_alias_var): Likewise. * tree.c (tree_size, make_node_stat, copy_node_stat, build_int_cst_wide, integer_all_onesp, list_length, chainon, tree_node_structure, type_contains_placeholder_p, substitute_in_expr, substitute_placeholder_in_expr, tabilize_reference_1, build0_stat, build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p, lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr, build_method_type_directly, decl_type_context, get_callee_fndecl, get_set_constructor_bits, build_vector_type_for_mode, int_cst_value, tree_fold_gcd): Likewise. * tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges, make_cond_expr_edges, group_case_labels, tree_merge_blocks, cleanup_control_expr_graph, find_taken_edge, find_taken_edge_switch_expr, phi_alternatives_equal, is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt, stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate, tree_split_edge, tree_verify_flow_info, thread_jumps, tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise. * tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly, chrec_fold_multiply_poly_poly): Likewise. * tree-complex.c (extract_component, expand_complex_division, expand_complex_comparison, expand_complex_operations_1, build_replicated_const, expand_vector_operations_1): Likewise. * tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector, build_classic_dir_vector): Likewise. * tree-dfa.c (compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann, create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region, record_in_finally_tree, replace_goto_queue_1, maybe_record_in_goto_queue, verify_norecord_switch_expr, do_return_redirection): Likewise. * tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr, add_to_dst_predicate_list, find_phi_replacement_condition, replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order): Likewise. * tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r, initialize_inlined_parameters, declare_return_variable, estimate_num_insns_1, expand_call_inline, expand_calls_inline, optimize_inline_calls, copy_tree_r): Likewise. * tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt, ssa_rewrite_stmt, rewrite_into_ssa): Likewise. * tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after, tsi_split_statement_list_after, tsi_split_statement_list_before): Likewise. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-nested.c (create_tmp_var_for, lookup_field_for_decl, lookup_tramp_for_decl, convert_all_function_calls): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi, coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis, free_temp_expr_table, add_dependance, finish_expr, rewrite_trees): Likewise. * tree-phinodes.c (resize_phi_node, add_phi_arg, remove_all_phi_nodes_for): Likewise. * tree-pretty-print.c (op_prio, print_call_name): Likewise. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise. * tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree, sra_elt_eq, sra_walk_expr, instantiate_missing_elements, generate_one_element_ref, generate_element_copy, generate_element_zero, scalarize_copy, scalarize_init, scalarize_ldst): Likewise. * tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p, add_may_alias, add_pointed_to_expr, add_pointed_to_var, collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise. * tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise. * tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value, set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment, widen_bitfield, ccp_fold_builtin): Likewise. * tree-ssa-copy.c (may_propagate_copy, merge_alias_info, replace_exp_1, propagate_tree_value): Likewise. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. * tree-ssa-dce.c (set_control_dependence_map_bit, find_control_dependence, find_pdom, mark_operand_necessary, mark_stmt_if_obviously_necessary, mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise. * tree-ssa-dom.c (dom_opt_initialize_block_local_data, simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis, eliminate_redundant_computations, avail_expr_eq): Likewise. * tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, duplicate_blocks): Likewise. * tree-ssa-loop-im.c (for_each_index, set_level, is_call_clobbered_ref): Likewise. * tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos, stmt_after_increment, set_iv, contains_abnormal_ssa_name_p, find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates, peel_address, ptr_difference_cost, may_replace_final_value, determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer, rewrite_use, rewrite_uses): Likewise. * tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa, check_loop_closed_ssa_use): Likewise. * tree-ssanames.c (make_ssa_name): Likewise. * tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses, finalize_ssa_v_must_defs, finalize_ssa_stmt_operands, get_stmt_operands, get_expr_operands, get_asm_expr_operands, get_indirect_ref_operands, add_stmt_operand): Likewise. * tree-ssa-pre.c (value_exists_in_set_bitmap, value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set, phi_translate, valid_in_set, compute_antic, find_or_generate_expression, create_expression_by_pieces, insert_aux, create_value_expr_from, eliminate): Likewise. * tree-ssa-propagate.c (cfg_blocks_get): Likewise. * tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges): Likewise. * tree-tailcall.c (independent_of_stmt_p, adjust_return_value, eliminate_tail_call): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_align_data_ref, vect_create_data_ref, vect_create_destination_var, vect_get_vec_def_for_operand, vect_finish_stmt_generation, vect_transform_stmt, vect_transform_loop_bound, vect_transform_loop, vect_analyze_operations): Likewise. * tree-vn.c (vn_compute, set_value_handle, get_value_handle): Likewise. * tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr, get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start, bsi_after_labels, bsi_last): Likewise. * tree-ssa-live.c (var_union, change_partition_var, create_ssa_var_map, calculate_live_on_entry, root_var_init, type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce): Likewise. * tree-ssa-live.h (partition_is_global, live_entry_blocks, tpa_find_tree): Likewise. (register_ssa_partition_check): Declare. (register_ssa_partition): use it. * tree-ssa-live.c: Include errors.h. (register_ssa_partition_check): New. * tree-ssa-operands.c: Include errors.h. * Makefile.in (tree-ssa-operands.o): Depend on errors.h. Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> From-SVN: r87223
2004-09-09 09:54:12 +02:00
gcc_assert (sc);
generate_element_copy (dc, sc, list_p);
}
if (dst->replacement)
{
tree t;
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * targhooks.c (default_unwind_emit, default_scalar_mode_supported_p): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * timevar.c (timevar_push, timevar_pop, timevar_start, timevar_stop): Likewise. * toplev.c (default_pch_valid_p): Likewise. * tracer.c (tail_duplicate): Likewise. * tree-alias-common.c (get_alias_var_decl, get_values_from_constructor, create_alias_var, delete_alias_vars, empty_points_to_set, same_points_to_set, ptr_may_alias_var): Likewise. * tree.c (tree_size, make_node_stat, copy_node_stat, build_int_cst_wide, integer_all_onesp, list_length, chainon, tree_node_structure, type_contains_placeholder_p, substitute_in_expr, substitute_placeholder_in_expr, tabilize_reference_1, build0_stat, build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p, lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr, build_method_type_directly, decl_type_context, get_callee_fndecl, get_set_constructor_bits, build_vector_type_for_mode, int_cst_value, tree_fold_gcd): Likewise. * tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges, make_cond_expr_edges, group_case_labels, tree_merge_blocks, cleanup_control_expr_graph, find_taken_edge, find_taken_edge_switch_expr, phi_alternatives_equal, is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt, stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate, tree_split_edge, tree_verify_flow_info, thread_jumps, tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise. * tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly, chrec_fold_multiply_poly_poly): Likewise. * tree-complex.c (extract_component, expand_complex_division, expand_complex_comparison, expand_complex_operations_1, build_replicated_const, expand_vector_operations_1): Likewise. * tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector, build_classic_dir_vector): Likewise. * tree-dfa.c (compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann, create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region, record_in_finally_tree, replace_goto_queue_1, maybe_record_in_goto_queue, verify_norecord_switch_expr, do_return_redirection): Likewise. * tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr, add_to_dst_predicate_list, find_phi_replacement_condition, replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order): Likewise. * tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r, initialize_inlined_parameters, declare_return_variable, estimate_num_insns_1, expand_call_inline, expand_calls_inline, optimize_inline_calls, copy_tree_r): Likewise. * tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt, ssa_rewrite_stmt, rewrite_into_ssa): Likewise. * tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after, tsi_split_statement_list_after, tsi_split_statement_list_before): Likewise. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-nested.c (create_tmp_var_for, lookup_field_for_decl, lookup_tramp_for_decl, convert_all_function_calls): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi, coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis, free_temp_expr_table, add_dependance, finish_expr, rewrite_trees): Likewise. * tree-phinodes.c (resize_phi_node, add_phi_arg, remove_all_phi_nodes_for): Likewise. * tree-pretty-print.c (op_prio, print_call_name): Likewise. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise. * tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree, sra_elt_eq, sra_walk_expr, instantiate_missing_elements, generate_one_element_ref, generate_element_copy, generate_element_zero, scalarize_copy, scalarize_init, scalarize_ldst): Likewise. * tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p, add_may_alias, add_pointed_to_expr, add_pointed_to_var, collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise. * tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise. * tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value, set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment, widen_bitfield, ccp_fold_builtin): Likewise. * tree-ssa-copy.c (may_propagate_copy, merge_alias_info, replace_exp_1, propagate_tree_value): Likewise. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. * tree-ssa-dce.c (set_control_dependence_map_bit, find_control_dependence, find_pdom, mark_operand_necessary, mark_stmt_if_obviously_necessary, mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise. * tree-ssa-dom.c (dom_opt_initialize_block_local_data, simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis, eliminate_redundant_computations, avail_expr_eq): Likewise. * tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, duplicate_blocks): Likewise. * tree-ssa-loop-im.c (for_each_index, set_level, is_call_clobbered_ref): Likewise. * tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos, stmt_after_increment, set_iv, contains_abnormal_ssa_name_p, find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates, peel_address, ptr_difference_cost, may_replace_final_value, determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer, rewrite_use, rewrite_uses): Likewise. * tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa, check_loop_closed_ssa_use): Likewise. * tree-ssanames.c (make_ssa_name): Likewise. * tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses, finalize_ssa_v_must_defs, finalize_ssa_stmt_operands, get_stmt_operands, get_expr_operands, get_asm_expr_operands, get_indirect_ref_operands, add_stmt_operand): Likewise. * tree-ssa-pre.c (value_exists_in_set_bitmap, value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set, phi_translate, valid_in_set, compute_antic, find_or_generate_expression, create_expression_by_pieces, insert_aux, create_value_expr_from, eliminate): Likewise. * tree-ssa-propagate.c (cfg_blocks_get): Likewise. * tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges): Likewise. * tree-tailcall.c (independent_of_stmt_p, adjust_return_value, eliminate_tail_call): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_align_data_ref, vect_create_data_ref, vect_create_destination_var, vect_get_vec_def_for_operand, vect_finish_stmt_generation, vect_transform_stmt, vect_transform_loop_bound, vect_transform_loop, vect_analyze_operations): Likewise. * tree-vn.c (vn_compute, set_value_handle, get_value_handle): Likewise. * tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr, get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start, bsi_after_labels, bsi_last): Likewise. * tree-ssa-live.c (var_union, change_partition_var, create_ssa_var_map, calculate_live_on_entry, root_var_init, type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce): Likewise. * tree-ssa-live.h (partition_is_global, live_entry_blocks, tpa_find_tree): Likewise. (register_ssa_partition_check): Declare. (register_ssa_partition): use it. * tree-ssa-live.c: Include errors.h. (register_ssa_partition_check): New. * tree-ssa-operands.c: Include errors.h. * Makefile.in (tree-ssa-operands.o): Depend on errors.h. Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> From-SVN: r87223
2004-09-09 09:54:12 +02:00
gcc_assert (src->replacement);
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
t = sra_build_elt_assignment (dst, REPLDUP (src->replacement));
append_to_statement_list (t, list_p);
}
}
/* Generate a set of assignment statements in *LIST_P to zero all instantiated
elements under ELT. In addition, do not assign to elements that have been
marked VISITED but do reset the visited flag; this allows easy coordination
with generate_element_init. */
static void
generate_element_zero (struct sra_elt *elt, tree *list_p)
{
struct sra_elt *c;
if (elt->visited)
{
elt->visited = false;
return;
}
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
if (!elt->in_bitfld_block)
FOR_EACH_ACTUAL_CHILD (c, elt)
generate_element_zero (c, list_p);
if (elt->replacement)
{
tree t;
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * targhooks.c (default_unwind_emit, default_scalar_mode_supported_p): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * timevar.c (timevar_push, timevar_pop, timevar_start, timevar_stop): Likewise. * toplev.c (default_pch_valid_p): Likewise. * tracer.c (tail_duplicate): Likewise. * tree-alias-common.c (get_alias_var_decl, get_values_from_constructor, create_alias_var, delete_alias_vars, empty_points_to_set, same_points_to_set, ptr_may_alias_var): Likewise. * tree.c (tree_size, make_node_stat, copy_node_stat, build_int_cst_wide, integer_all_onesp, list_length, chainon, tree_node_structure, type_contains_placeholder_p, substitute_in_expr, substitute_placeholder_in_expr, tabilize_reference_1, build0_stat, build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p, lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr, build_method_type_directly, decl_type_context, get_callee_fndecl, get_set_constructor_bits, build_vector_type_for_mode, int_cst_value, tree_fold_gcd): Likewise. * tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges, make_cond_expr_edges, group_case_labels, tree_merge_blocks, cleanup_control_expr_graph, find_taken_edge, find_taken_edge_switch_expr, phi_alternatives_equal, is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt, stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate, tree_split_edge, tree_verify_flow_info, thread_jumps, tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise. * tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly, chrec_fold_multiply_poly_poly): Likewise. * tree-complex.c (extract_component, expand_complex_division, expand_complex_comparison, expand_complex_operations_1, build_replicated_const, expand_vector_operations_1): Likewise. * tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector, build_classic_dir_vector): Likewise. * tree-dfa.c (compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann, create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region, record_in_finally_tree, replace_goto_queue_1, maybe_record_in_goto_queue, verify_norecord_switch_expr, do_return_redirection): Likewise. * tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr, add_to_dst_predicate_list, find_phi_replacement_condition, replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order): Likewise. * tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r, initialize_inlined_parameters, declare_return_variable, estimate_num_insns_1, expand_call_inline, expand_calls_inline, optimize_inline_calls, copy_tree_r): Likewise. * tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt, ssa_rewrite_stmt, rewrite_into_ssa): Likewise. * tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after, tsi_split_statement_list_after, tsi_split_statement_list_before): Likewise. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-nested.c (create_tmp_var_for, lookup_field_for_decl, lookup_tramp_for_decl, convert_all_function_calls): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi, coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis, free_temp_expr_table, add_dependance, finish_expr, rewrite_trees): Likewise. * tree-phinodes.c (resize_phi_node, add_phi_arg, remove_all_phi_nodes_for): Likewise. * tree-pretty-print.c (op_prio, print_call_name): Likewise. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise. * tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree, sra_elt_eq, sra_walk_expr, instantiate_missing_elements, generate_one_element_ref, generate_element_copy, generate_element_zero, scalarize_copy, scalarize_init, scalarize_ldst): Likewise. * tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p, add_may_alias, add_pointed_to_expr, add_pointed_to_var, collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise. * tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise. * tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value, set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment, widen_bitfield, ccp_fold_builtin): Likewise. * tree-ssa-copy.c (may_propagate_copy, merge_alias_info, replace_exp_1, propagate_tree_value): Likewise. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. * tree-ssa-dce.c (set_control_dependence_map_bit, find_control_dependence, find_pdom, mark_operand_necessary, mark_stmt_if_obviously_necessary, mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise. * tree-ssa-dom.c (dom_opt_initialize_block_local_data, simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis, eliminate_redundant_computations, avail_expr_eq): Likewise. * tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, duplicate_blocks): Likewise. * tree-ssa-loop-im.c (for_each_index, set_level, is_call_clobbered_ref): Likewise. * tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos, stmt_after_increment, set_iv, contains_abnormal_ssa_name_p, find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates, peel_address, ptr_difference_cost, may_replace_final_value, determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer, rewrite_use, rewrite_uses): Likewise. * tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa, check_loop_closed_ssa_use): Likewise. * tree-ssanames.c (make_ssa_name): Likewise. * tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses, finalize_ssa_v_must_defs, finalize_ssa_stmt_operands, get_stmt_operands, get_expr_operands, get_asm_expr_operands, get_indirect_ref_operands, add_stmt_operand): Likewise. * tree-ssa-pre.c (value_exists_in_set_bitmap, value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set, phi_translate, valid_in_set, compute_antic, find_or_generate_expression, create_expression_by_pieces, insert_aux, create_value_expr_from, eliminate): Likewise. * tree-ssa-propagate.c (cfg_blocks_get): Likewise. * tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges): Likewise. * tree-tailcall.c (independent_of_stmt_p, adjust_return_value, eliminate_tail_call): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_align_data_ref, vect_create_data_ref, vect_create_destination_var, vect_get_vec_def_for_operand, vect_finish_stmt_generation, vect_transform_stmt, vect_transform_loop_bound, vect_transform_loop, vect_analyze_operations): Likewise. * tree-vn.c (vn_compute, set_value_handle, get_value_handle): Likewise. * tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr, get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start, bsi_after_labels, bsi_last): Likewise. * tree-ssa-live.c (var_union, change_partition_var, create_ssa_var_map, calculate_live_on_entry, root_var_init, type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce): Likewise. * tree-ssa-live.h (partition_is_global, live_entry_blocks, tpa_find_tree): Likewise. (register_ssa_partition_check): Declare. (register_ssa_partition): use it. * tree-ssa-live.c: Include errors.h. (register_ssa_partition_check): New. * tree-ssa-operands.c: Include errors.h. * Makefile.in (tree-ssa-operands.o): Depend on errors.h. Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> From-SVN: r87223
2004-09-09 09:54:12 +02:00
gcc_assert (elt->is_scalar);
t = fold_convert (elt->type, integer_zero_node);
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
t = sra_build_elt_assignment (elt, t);
append_to_statement_list (t, list_p);
}
}
/* Generate an assignment VAR = INIT, where INIT may need gimplification.
Add the result to *LIST_P. */
static void
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
generate_one_element_init (struct sra_elt *elt, tree init, tree *list_p)
{
/* The replacement can be almost arbitrarily complex. Gimplify. */
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
tree stmt = sra_build_elt_assignment (elt, init);
gimplify_and_add (stmt, list_p);
}
/* Generate a set of assignment statements in *LIST_P to set all instantiated
elements under ELT with the contents of the initializer INIT. In addition,
mark all assigned elements VISITED; this allows easy coordination with
generate_element_zero. Return false if we found a case we couldn't
handle. */
static bool
generate_element_init_1 (struct sra_elt *elt, tree init, tree *list_p)
{
bool result = true;
enum tree_code init_code;
struct sra_elt *sub;
tree t;
Make CONSTRUCTOR use VEC to store initializers. * c-common.c (complete_array_type): Update to cope with VEC in CONSTRUCTOR_ELTS. * c-pretty-print.c (pp_c_initializer_list): Use pp_c_constructor_elts. (pp_c_constructor_elts): New function. * c-pretty-print.h (pp_c_constructor_elts): Declare. * c-typeck.c (build_function_call, build_c_cast, digest_init, struct constructor_stack, struct initializer_stack, constructor_elements, push_init_level, pop_init_level, add_pending_init, find_init_member, output_init_element): Update to cope with VEC in CONSTRUCTOR_ELTS. * coverage.c (build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * expr.c (categorize_ctor_elements_1, store_constructor, expand_expr_real_1): Likewise. * fold-const.c (fold_ternary): Likewise. * gimplify.c (gimplify_init_ctor_preeval, zero_sized_field_decl, gimplify_init_constructor, gimplify_expr): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-inline.c (copy_tree_r): Add code to duplicate a CONSTRUCTOR node. * tree-pretty-print.c (dump_generic_node): Update to cope with VEC in CONSTRUCTOR_ELTS. * tree-sra.c (generate_element_init_1): Likewise. * tree-ssa-ccp.c (fold_const_aggregate_ref): Likewise. * tree-ssa-operands.c (get_expr_operands): Likewise. * tree-vect-generic.c (expand_vector_piecewise): Likewise. * tree-vect-transform.c (vect_get_vec_def_for_operand): (get_initial_def_for_reduction): Likewise. * tree-vn.c (set_value_handle, get_value_handle): CONSTURCTOR uses value handle in annotations. * tree.c (tree_node_kind, tree_code_size, make_node_stat, tree_node_structure): Add support for constr_kind. (build_vector_from_ctor, build_constructor_single, build_constructor_from_list): New functions. (build_constructor): Update to take a VEC instead of a TREE_LIST. (simple_cst_equal, iterative_hash_expr, initializer_zerop, walk_tree): Update to cope with VEC in CONSTRUCTOR_ELTS. * tree.def (CONSTRUCTOR): Make it a tcc_exceptional node. * tree.h (FOR_EACH_CONSTRUCTOR_VALUE, FOR_EACH_CONSTRUCTOR_ELT, CONSTRUCTOR_APPEND_ELT): New macros. (struct constructor_elt, struct tree_constructor): New data types. (union tree_node): Add tree_constructor field. * treestruct.def: Define TS_CONSTRUCTOR. * varasm.c (const_hash_1, compare_constant, copy_constant, compute_reloc_for_constant, output_addressed_constants, initializer_constant_valid_p, output_constant, array_size_for_constructor, output_constructor): Update to cope with VEC in CONSTRUCTOR_ELTS. * vec.h (VEC_empty, VEC_copy): New macros. ada/ Make CONSTRUCTOR use VEC to store initializers. * decl.c (gnat_to_gnu_entity): Update to cope with VEC in CONSTRUCTOR_ELTS. * trans.c (extract_values): Likewise. * utils.c (convert, remove_conversions): Likewise. * utils2.c (contains_save_expr_p, build_binary_op, build_unary_op, gnat_build_constructor): Likewise. cp/ Make CONSTRUCTOR use VEC to store initializers. * call.c (convert_default_arg): Update call to digest_init. * class.c (dump_class_hierarchy, dump_array): Update to cope with VEC in CONSTRUCTOR_ELTS. * cp-tree.h (EMPTY_CONSTRUCTOR_P): Likewise. (finish_compound_literal, digest_init): Update declaration. * decl.c (struct reshape_iter): New data type. (reshape_init_array): Rename to... (reshape_init_array_1): Update to cope with VEC in CONSTRUCTOR_ELTS. (reshape_init): Rewrite from scratch. Split parts into... (reshape_init_array, reshape_init_vector, reshape_init_class, reshape_init_r): New functions. (check_initializer): Update call to reshape_init. Remove obsolete code. (initialize_artificial_var, cp_complete_array_type): Update to cope with VEC in CONSTRUCTOR_ELTS. * decl2.c (grokfield): Update calls to digest_init. (mark_vtable_entries): Update to cope with VEC in CONSTRUCTOR_ELTS. * error.c (dump_expr_init_vec): New function. (dump_expr): Use dump_expr_init_vec. * init.c (build_zero_init, build_vec_init): Update to cope with VEC in CONSTRUCTOR_ELTS. (expand_default_init): Update call to digest_init. * parser.c (cp_parser_postfix_expression): Use a VEC for the initializers. (cp_parser_initializer_list): Build a VEC of initializers. * pt.c (tsubst_copy, tsubst_copy_and_build): Update to cope with VEC in CONSTRUCTOR_ELTS. * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer, ptm_initializer, class_initializer, get_pseudo_ti_init): Use build_constructor_from_list instead of build_constructor. * semantics.c (finish_compound_literal): Update call to digest_init. * tree.c (stabilize_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * typeck.c (build_ptrmemfunc1): Likewise. * typeck2.c: (cxx_incomplete_type_error, split_nonconstant_init_1): Likewise. (store_init_value): Use build_constructor_from_list and update call to digest_init. (digest_init): Rewrite. (process_init_constructor): Rewrite from scratch. Split into... (process_init_constructor_array, picflag_from_initializer, process_init_constructor_record, process_init_constructor_union): New functions. (PICFLAG_ERRONEOUS, PICFLAG_NOT_ALL_CONSTANT, PICFLAG_NOT_ALL_SIMPLE): New macros. (build_functional_cast): Use build_constructor_from_list instead of build_constructor. fortran/ Make CONSTRUCTOR use VEC to store initializers. * trans-array.c (gfc_build_null_descriptor, gfc_trans_array_constructor_value, gfc_conv_array_initializer): Update to cope with VEC in CONSTRUCTOR_ELTS. * trans-common.c (create_common): Likewise. * trans-expr.c (gfc_conv_structure): Likewise. * trans-stmt.c (gfc_trans_character_select): Use build_constructor_from_list instead of build_constructor. java/ Make CONSTRUCTOR use VEC to store initializers. * check-init.c (check_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * class.c (make_field_value, make_method_value, get_dispatch_table, make_class_data, emit_symbol_table, emit_catch_table, emit_assertion_table): Use build_constructor_from_list instead of build_constructor. * constants.c (build_constants_constructor): Likewise. * java-gimplify.c (java_gimplify_new_array_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * java-tree.h (START_RECORD_CONSTRUCTOR, PUSH_SUPER_VALUE, PUSH_FIELD_VALUE, FINISH_RECORD_CONSTRUCTOR): Create a VEC instead of a TREE_LIST. * jcf-write.c (generate_bytecode_insns): Update to cope with VEC in CONSTRUCTOR_ELTS. * parse.y (build_new_array_init): Use build_constructor_from_list instead of build_constructor. (patch_new_array_init): Update to cope with VEC in CONSTRUCTOR_ELTS. (array_constructor_check_entry): Likewise. objc/ Make CONSTRUCTOR use VEC to store initializers. * objc-act.c (objc_build_constructor): Use build_constructor_from_list instead of build_constructor. testsuite/ Make CONSTRUCTOR use VEC to store initializers. * g++.dg/ext/complit3.C: Check for specific error messages. * g++.dg/init/brace2.C: Update error message. * g++.dg/warn/Wbraces2.C: Likewise. From-SVN: r102182
2005-07-20 03:19:59 +02:00
unsigned HOST_WIDE_INT idx;
tree value, purpose;
/* We can be passed DECL_INITIAL of a static variable. It might have a
conversion, which we strip off here. */
STRIP_USELESS_TYPE_CONVERSION (init);
init_code = TREE_CODE (init);
if (elt->is_scalar)
{
if (elt->replacement)
{
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
generate_one_element_init (elt, init, list_p);
elt->visited = true;
}
return result;
}
switch (init_code)
{
case COMPLEX_CST:
case COMPLEX_EXPR:
FOR_EACH_ACTUAL_CHILD (sub, elt)
{
if (sub->element == integer_zero_node)
t = (init_code == COMPLEX_EXPR
? TREE_OPERAND (init, 0) : TREE_REALPART (init));
else
t = (init_code == COMPLEX_EXPR
? TREE_OPERAND (init, 1) : TREE_IMAGPART (init));
result &= generate_element_init_1 (sub, t, list_p);
}
break;
case CONSTRUCTOR:
Make CONSTRUCTOR use VEC to store initializers. * c-common.c (complete_array_type): Update to cope with VEC in CONSTRUCTOR_ELTS. * c-pretty-print.c (pp_c_initializer_list): Use pp_c_constructor_elts. (pp_c_constructor_elts): New function. * c-pretty-print.h (pp_c_constructor_elts): Declare. * c-typeck.c (build_function_call, build_c_cast, digest_init, struct constructor_stack, struct initializer_stack, constructor_elements, push_init_level, pop_init_level, add_pending_init, find_init_member, output_init_element): Update to cope with VEC in CONSTRUCTOR_ELTS. * coverage.c (build_fn_info_value, build_ctr_info_value, build_gcov_info): Likewise. * expr.c (categorize_ctor_elements_1, store_constructor, expand_expr_real_1): Likewise. * fold-const.c (fold_ternary): Likewise. * gimplify.c (gimplify_init_ctor_preeval, zero_sized_field_decl, gimplify_init_constructor, gimplify_expr): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-inline.c (copy_tree_r): Add code to duplicate a CONSTRUCTOR node. * tree-pretty-print.c (dump_generic_node): Update to cope with VEC in CONSTRUCTOR_ELTS. * tree-sra.c (generate_element_init_1): Likewise. * tree-ssa-ccp.c (fold_const_aggregate_ref): Likewise. * tree-ssa-operands.c (get_expr_operands): Likewise. * tree-vect-generic.c (expand_vector_piecewise): Likewise. * tree-vect-transform.c (vect_get_vec_def_for_operand): (get_initial_def_for_reduction): Likewise. * tree-vn.c (set_value_handle, get_value_handle): CONSTURCTOR uses value handle in annotations. * tree.c (tree_node_kind, tree_code_size, make_node_stat, tree_node_structure): Add support for constr_kind. (build_vector_from_ctor, build_constructor_single, build_constructor_from_list): New functions. (build_constructor): Update to take a VEC instead of a TREE_LIST. (simple_cst_equal, iterative_hash_expr, initializer_zerop, walk_tree): Update to cope with VEC in CONSTRUCTOR_ELTS. * tree.def (CONSTRUCTOR): Make it a tcc_exceptional node. * tree.h (FOR_EACH_CONSTRUCTOR_VALUE, FOR_EACH_CONSTRUCTOR_ELT, CONSTRUCTOR_APPEND_ELT): New macros. (struct constructor_elt, struct tree_constructor): New data types. (union tree_node): Add tree_constructor field. * treestruct.def: Define TS_CONSTRUCTOR. * varasm.c (const_hash_1, compare_constant, copy_constant, compute_reloc_for_constant, output_addressed_constants, initializer_constant_valid_p, output_constant, array_size_for_constructor, output_constructor): Update to cope with VEC in CONSTRUCTOR_ELTS. * vec.h (VEC_empty, VEC_copy): New macros. ada/ Make CONSTRUCTOR use VEC to store initializers. * decl.c (gnat_to_gnu_entity): Update to cope with VEC in CONSTRUCTOR_ELTS. * trans.c (extract_values): Likewise. * utils.c (convert, remove_conversions): Likewise. * utils2.c (contains_save_expr_p, build_binary_op, build_unary_op, gnat_build_constructor): Likewise. cp/ Make CONSTRUCTOR use VEC to store initializers. * call.c (convert_default_arg): Update call to digest_init. * class.c (dump_class_hierarchy, dump_array): Update to cope with VEC in CONSTRUCTOR_ELTS. * cp-tree.h (EMPTY_CONSTRUCTOR_P): Likewise. (finish_compound_literal, digest_init): Update declaration. * decl.c (struct reshape_iter): New data type. (reshape_init_array): Rename to... (reshape_init_array_1): Update to cope with VEC in CONSTRUCTOR_ELTS. (reshape_init): Rewrite from scratch. Split parts into... (reshape_init_array, reshape_init_vector, reshape_init_class, reshape_init_r): New functions. (check_initializer): Update call to reshape_init. Remove obsolete code. (initialize_artificial_var, cp_complete_array_type): Update to cope with VEC in CONSTRUCTOR_ELTS. * decl2.c (grokfield): Update calls to digest_init. (mark_vtable_entries): Update to cope with VEC in CONSTRUCTOR_ELTS. * error.c (dump_expr_init_vec): New function. (dump_expr): Use dump_expr_init_vec. * init.c (build_zero_init, build_vec_init): Update to cope with VEC in CONSTRUCTOR_ELTS. (expand_default_init): Update call to digest_init. * parser.c (cp_parser_postfix_expression): Use a VEC for the initializers. (cp_parser_initializer_list): Build a VEC of initializers. * pt.c (tsubst_copy, tsubst_copy_and_build): Update to cope with VEC in CONSTRUCTOR_ELTS. * rtti.c (tinfo_base_init, generic_initializer, ptr_initializer, ptm_initializer, class_initializer, get_pseudo_ti_init): Use build_constructor_from_list instead of build_constructor. * semantics.c (finish_compound_literal): Update call to digest_init. * tree.c (stabilize_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * typeck.c (build_ptrmemfunc1): Likewise. * typeck2.c: (cxx_incomplete_type_error, split_nonconstant_init_1): Likewise. (store_init_value): Use build_constructor_from_list and update call to digest_init. (digest_init): Rewrite. (process_init_constructor): Rewrite from scratch. Split into... (process_init_constructor_array, picflag_from_initializer, process_init_constructor_record, process_init_constructor_union): New functions. (PICFLAG_ERRONEOUS, PICFLAG_NOT_ALL_CONSTANT, PICFLAG_NOT_ALL_SIMPLE): New macros. (build_functional_cast): Use build_constructor_from_list instead of build_constructor. fortran/ Make CONSTRUCTOR use VEC to store initializers. * trans-array.c (gfc_build_null_descriptor, gfc_trans_array_constructor_value, gfc_conv_array_initializer): Update to cope with VEC in CONSTRUCTOR_ELTS. * trans-common.c (create_common): Likewise. * trans-expr.c (gfc_conv_structure): Likewise. * trans-stmt.c (gfc_trans_character_select): Use build_constructor_from_list instead of build_constructor. java/ Make CONSTRUCTOR use VEC to store initializers. * check-init.c (check_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * class.c (make_field_value, make_method_value, get_dispatch_table, make_class_data, emit_symbol_table, emit_catch_table, emit_assertion_table): Use build_constructor_from_list instead of build_constructor. * constants.c (build_constants_constructor): Likewise. * java-gimplify.c (java_gimplify_new_array_init): Update to cope with VEC in CONSTRUCTOR_ELTS. * java-tree.h (START_RECORD_CONSTRUCTOR, PUSH_SUPER_VALUE, PUSH_FIELD_VALUE, FINISH_RECORD_CONSTRUCTOR): Create a VEC instead of a TREE_LIST. * jcf-write.c (generate_bytecode_insns): Update to cope with VEC in CONSTRUCTOR_ELTS. * parse.y (build_new_array_init): Use build_constructor_from_list instead of build_constructor. (patch_new_array_init): Update to cope with VEC in CONSTRUCTOR_ELTS. (array_constructor_check_entry): Likewise. objc/ Make CONSTRUCTOR use VEC to store initializers. * objc-act.c (objc_build_constructor): Use build_constructor_from_list instead of build_constructor. testsuite/ Make CONSTRUCTOR use VEC to store initializers. * g++.dg/ext/complit3.C: Check for specific error messages. * g++.dg/init/brace2.C: Update error message. * g++.dg/warn/Wbraces2.C: Likewise. From-SVN: r102182
2005-07-20 03:19:59 +02:00
FOR_EACH_CONSTRUCTOR_ELT (CONSTRUCTOR_ELTS (init), idx, purpose, value)
{
if (TREE_CODE (purpose) == RANGE_EXPR)
{
tree lower = TREE_OPERAND (purpose, 0);
tree upper = TREE_OPERAND (purpose, 1);
while (1)
{
sub = lookup_element (elt, lower, NULL, NO_INSERT);
if (sub != NULL)
result &= generate_element_init_1 (sub, value, list_p);
if (tree_int_cst_equal (lower, upper))
break;
lower = int_const_binop (PLUS_EXPR, lower,
integer_one_node, true);
}
}
else
{
sub = lookup_element (elt, purpose, NULL, NO_INSERT);
if (sub != NULL)
result &= generate_element_init_1 (sub, value, list_p);
}
}
break;
default:
elt->visited = true;
result = false;
}
return result;
}
/* A wrapper function for generate_element_init_1 that handles cleanup after
gimplification. */
static bool
generate_element_init (struct sra_elt *elt, tree init, tree *list_p)
{
bool ret;
push_gimplify_context ();
ret = generate_element_init_1 (elt, init, list_p);
pop_gimplify_context (NULL);
/* The replacement can expose previously unreferenced variables. */
if (ret && *list_p)
{
tree_stmt_iterator i;
for (i = tsi_start (*list_p); !tsi_end_p (i); tsi_next (&i))
find_new_referenced_vars (tsi_stmt_ptr (i));
}
return ret;
}
/* Insert STMT on all the outgoing edges out of BB. Note that if BB
has more than one edge, STMT will be replicated for each edge. Also,
abnormal edges will be ignored. */
void
insert_edge_copies (tree stmt, basic_block bb)
{
edge e;
backport: basic-block.h: Include vec.h, errors.h. 2004-09-24 Ben Elliston <bje@au.ibm.com> Steven Bosscher <stevenb@suse.de> Andrew Pinski <pinskia@physics.uc.edu> Merge from edge-vector-branch: * basic-block.h: Include vec.h, errors.h. Instantiate a VEC(edge). (struct edge_def): Remove pred_next, succ_next members. (struct basic_block_def): Remove pred, succ members. Add preds and succs members of type VEC(edge). (FALLTHRU_EDGE): Redefine using EDGE_SUCC. (BRANCH_EDGE): Likewise. (EDGE_CRITICAL_P): Redefine using EDGE_COUNT. (EDGE_COUNT, EDGE_I, EDGE_PRED, EDGE_SUCC): New. (edge_iterator): New. (ei_start, ei_last, ei_end_p, ei_one_before_end_p): New. (ei_next, ei_prev, ei_edge, ei_safe_edge): Likewise. (FOR_EACH_EDGE): New. * bb-reorder.c (find_traces): Use FOR_EACH_EDGE and EDGE_* macros where applicable. (rotate_loop): Likewise. (find_traces_1_route): Likewise. (bb_to_key): Likewise. (connect_traces): Likewise. (copy_bb_p): Likewise. (find_rarely_executed_basic_blocks_and_crossing_edges): Likewise. (add_labels_and_missing_jumps): Likewise. (fix_up_fall_thru_edges): Likewise. (find_jump_block): Likewise. (fix_crossing_conditional_branches): Likewise. (fix_crossing_unconditional_branches): Likewise. (add_reg_crossing_jump_notes): Likewise. * bt-load.c (augment_live_range): Likewise. * cfg.c (clear_edges): Likewise. (unchecked_make_edge): Likewise. (cached_make_edge): Likewise. (make_single_succ_edge): Likewise. (remove_edge): Likewise. (redirect_edge_succ_nodup): Likewise. (check_bb_profile): Likewise. (dump_flow_info): Likewise. (alloc_aux_for_edges): Likewise. (clear_aux_for_edges): Likewise. (dump_cfg_bb_info): Likewise. * cfganal.c (forwarder_block_p): Likewise. (can_fallthru): Likewise. (could_fall_through): Likewise. (mark_dfs_back_edges): Likewise. (set_edge_can_fallthru_flag): Likewise. (find_unreachable_blocks): Likewise. (create_edge_list): Likewise. (verify_edge_list): Likewise. (add_noreturn_fake_exit_edges): Likewise. (connect_infinite_loops_to_exit): Likewise. (flow_reverse_top_sort_order_compute): Likewise. (flow_depth_first_order_compute): Likewise. (flow_preorder_transversal_compute): Likewise. (flow_dfs_compute_reverse_execute): Likewise. (dfs_enumerate_from): Likewise. (compute_dominance_frontiers_1): Likewise. * cfgbuild.c (make_edges): Likewise. (compute_outgoing_frequencies): Likewise. (find_many_sub_basic_blocks): Likewise. (find_sub_basic_blocks): Likewise. * cfgcleanup.c (try_simplify_condjump): Likewise. (thread_jump): Likewise. (try_forward_edges): Likewise. (merge_blocks_move): Likewise. (outgoing_edges_match): Likewise. (try_crossjump_to_edge): Likewise. (try_crossjump_bb): Likewise. (try_optimize_cfg): Likewise. (merge_seq_blocks): Likewise. * cfgexpand.c (expand_gimple_tailcall): Likewise. (expand_gimple_basic_block): Likewise. (construct_init_block): Likewise. (construct_exit_block): Likewise. * cfghooks.c (verify_flow_info): Likewise. (dump_bb): Likewise. (delete_basic_block): Likewise. (split_edge): Likewise. (merge_blocks): Likewise. (make_forwarder_block): Likewise. (tidy_fallthru_edges): Likewise. (can_duplicate_block_p): Likewise. (duplicate_block): Likewise. * cfglayout.c (fixup_reorder_chain): Likewise. (fixup_fallthru_exit_predecessor): Likewise. (can_copy_bbs_p): Likewise. (copy_bbs): Likewise. * cfgloop.c (flow_loops_cfg_dump): Likewise. (flow_loop_entry_edges_find): Likewise. (flow_loop_exit_edges_find): Likewise. (flow_loop_nodes_find): Likewise. (mark_single_exit_loops): Likewise. (flow_loop_pre_header_scan): Likewise. (flow_loop_pre_header_find): Likewise. (update_latch_info): Likewise. (canonicalize_loop_headers): Likewise. (flow_loops_find): Likewise. (get_loop_body_in_bfs_order): Likewise. (get_loop_exit_edges): Likewise. (num_loop_branches): Likewise. (verify_loop_structure): Likewise. (loop_latch_edge): Likewise. (loop_preheader_edge): Likewise. * cfgloopanal.c (mark_irreducible_loops): Likewise. (expected_loop_iterations): Likewise. * cfgloopmanip.c (remove_bbs): Likewise. (fix_bb_placement): Likewise. (fix_irreducible_loops): Likewise. (remove_path): Likewise. (scale_bbs_frequencies): Likewise. (loopify): Likewise. (unloop): Likewise. (fix_loop_placement): Likewise. (loop_delete_branch_edge): Likewise. (duplicate_loop_to_header_edge): Likewise. (mfb_keep_just): Likewise. (create_preheader): Likewise. (force_single_succ_latches): Likewise. (loop_split_edge_with): Likewise. (create_loop_notes): Likewise. * cfgrtl.c (rtl_split_block): Likewise. (rtl_merge_blocks): Likewise. (rtl_can_merge_blocks): Likewise. (try_redirect_by_replacing_jump): Likewise. (force_nonfallthru_and_redirect): Likewise. (rtl_tidy_fallthru_edge): Likewise. (commit_one_edge_insertion): Likewise. (commit_edge_insertions): Likewise. (commit_edge_insertions_watch_calls): Likewise. (rtl_verify_flow_info_1): Likewise. (rtl_verify_flow_info): Likewise. (purge_dead_edges): Likewise. (cfg_layout_redirect_edge_and_branch): Likewise. (cfg_layout_can_merge_blocks_p): Likewise. (rtl_flow_call_edges_add): Likewise. * cse.c (cse_cc_succs): Likewise. * df.c (hybrid_search): Likewise. * dominance.c (calc_dfs_tree_nonrec): Likewise. (calc_dfs_tree): Likewise. (calc_idoms): Likewise. (recount_dominator): Likewise. * domwalk.c (walk_dominator_tree): Likewise. * except.c (emit_to_new_bb_before): Likewise. (connect_post_landing_pads): Likewise. (sjlj_emit_function_enter): Likewise. (sjlj_emit_function_exit): Likewise. (finish_eh_generation): Likewise. * final.c (compute_alignments): Likewise. * flow.c (calculate_global_regs_live): Likewise. (initialize_uninitialized_subregs): Likewise. (init_propagate_block_info): Likewise. * function.c (thread_prologue_and_epilogue_insns): Likewise. * gcse.c (find_implicit_sets): Likewise. (bypass_block): Likewise. (bypass_conditional_jumps): Likewise. (compute_pre_data): Likewise. (insert_insn_end_bb): Likewise. (insert_store): Likewise. (remove_reachable_equiv_notes): Likewise. * global.c (global_conflicts): Likewise. (calculate_reg_pav): Likewise. * graph.c (print_rtl_graph_with_bb): Likewise. * ifcvt.c (mark_loop_exit_edges): Likewise. (merge_if_block): Likewise. (find_if_header): Likewise. (block_jumps_and_fallthru_p): Likewise. (find_if_block): Likewise. (find_cond_trap): Likewise. (block_has_only_trap): Likewise. (find_if_case1): Likewise. (find_if_case_2): Likewise. * lambda-code.c (lambda_loopnest_to_gcc_loopnest): Likewise. (perfect_nestify): Likewise. * lcm.c (compute_antinout_edge): Likewise. (compute_laterin): Likewise. (compute_available): Likewise. (compute_nearerout): Likewise. * loop-doloop.c (doloop_modify): Likewise. * loop-init.c (loop_optimizer_init): Likewise. * loop-invariant.c (find_exits): Likewise. * loop-iv.c (simplify_using_initial_values): Likewise. (check_simple_exit): Likewise. (find_simple_exit): Likewise. * loop-unroll.c (peel_loop_completely): Likewise. (unroll_loop_constant_iterations): Likewise. (unroll_loop_runtime_iterations): Likewise. * loop-unswitch.c (may_unswitch_on): Likewise. (unswitch_loop): Likewise. * modulo-sched.c (generate_prolog_epilog): Likewise. (sms_schedule): Likewise. * postreload-gcse.c (eliminate_partially_redundant_load): Likewise. * predict.c (can_predict_insn_p): Likewise. (set_even_probabilities): Likewise. (combine_predictions_for_bb): Likewise. (predict_loops): Likewise. (estimate_probability): Likewise. (tree_predict_by_opcode): Likewise. (tree_estimate_probability): Likewise. (last_basic_block_p): Likewise. (propagate_freq): Likewise. (estimate_loops_at_level): Likewise. (estimate_bb_frequencies): Likewise. * profile.c (instrument_edges): Likewise. (get_exec_counts): Likewise. (compute_branch_probabilities): Likewise. (branch_prob): Likewise. * ra-build.c (live_in): Likewise. * ra-rewrite.c (rewrite_program2): Likewise. * ra.c (reg_alloc): Likewise. * reg-stack.c (reg_to_stack): Likewise. (convert_regs_entry): Likewise. (compensate_edge): Likewise. (convert_regs_1): Likewise, (convert_regs_2): Likewise. (convert_regs): Likewise. * regrename.c (copyprop_hardreg_forward): Likewise. * reload1.c (fixup_abnormal_edges): Likewise. * sbitmap.c (sbitmap_intersection_of_succs): Likewise. (sbitmap_insersection_of_preds): Likewise. (sbitmap_union_of_succs): Likewise. (sbitmap_union_of_preds): Likewise. * sched-ebb.c (compute_jump_reg_dependencies): Likewise. (fix_basic_block_boundaries): Likewise. (sched_ebbs): Likewise. * sched-rgn.c (build_control_flow): Likewise. (find_rgns): Likewise. * tracer.c (find_best_successor): Likewise. (find_best_predecessor): Likewise. (tail_duplicate): Likewise. * tree-cfg.c (make_edges): Likewise. (make_ctrl_stmt_edges): Likewise. (make_goto_expr_edges): Likewise. (tree_can_merge_blocks_p): Likewise. (tree_merge_blocks): Likewise. (cfg_remove_useless_stmts_bb): Likewise. (remove_phi_nodes_and_edges_for_unreachable_block): Likewise. (tree_block_forwards_to): Likewise. (cleanup_control_expr_graph): Likewise. (find_taken_edge): Likewise. (dump_cfg_stats): Likewise. (tree_cfg2vcg): Likewise. (disband_implicit_edges): Likewise. (tree_find_edge_insert_loc): Likewise. (bsi_commit_edge_inserts): Likewise. (tree_split_edge): Likewise. (tree_verify_flow_info): Likewise. (tree_make_forwarder_block): Likewise. (tree_forwarder_block_p): Likewise. (thread_jumps): Likewise. (tree_try_redirect_by_replacing_jump): Likewise. (tree_split_block): Likewise. (add_phi_args_after_copy_bb): Likewise. (rewrite_to_new_ssa_names_bb): Likewise. (dump_function_to_file): Likewise. (print_pred_bbs): Likewise. (print_loop): Likewise. (tree_flow_call_edges_add): Likewise. (split_critical_edges): Likewise. (execute_warn_function_return): Likewise. (extract_true_false_edges_from_block): Likewise. * tree-if-conv.c (tree_if_conversion): Likewise. (if_convertable_bb_p): Likewise. (find_phi_replacement_condition): Likewise. (combine_blocks): Likewise. * tree-into-ssa.c (compute_global_livein): Likewise. (ssa_mark_phi_uses): Likewise. (ssa_rewrite_initialize_block): Likewise. (rewrite_add_phi_arguments): Likewise. (ssa_rewrite_phi_arguments): Likewise. (insert_phi_nodes_for): Likewise. (rewrite_into_ssa): Likewise. (rewrite_ssa_into_ssa): Likewise. * tree-mudflap.c (mf_build_check_statement_for): Likewise. * tree-outof-ssa.c (coalesce_abnormal_edges): Likewise. (rewrite_trees): Likewise. * tree-pretty-print.c (dump_bb_header): Likewise. (dump_implicit_edges): Likewise. * tree-sra.c (insert_edge_copies): Likewise. (find_obviously_necessary_stmts): Likewise. (remove_data_stmt): Likewise. * tree-ssa-dom.c (thread_across_edge): Likewise. (dom_opt_finalize_block): Likewise. (single_incoming_edge_ignoring_loop_edges): Likewise. (record_equivalences_from_incoming_edges): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-live.c (live_worklist): Likewise. (calculate_live_on_entry): Likewise. (calculate_live_on_exit): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p): Likewise. (copy_loop_headers): Likewise. * tree-ssa-loop-im.c (loop_commit_inserts): Likewise. (fill_always_executed_in): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv): Likewise. * tree-ssa-loop-ivopts.c (find_interesting_uses): Likewise. (compute_phi_arg_on_exit): Likewise. * tree-ssa-loop-manip.c (add_exit_phis_edge): Likewise. (get_loops_exit): Likewise. (split_loop_exit_edge): Likewise. (ip_normal_pos): Likewise. * tree-ssa-loop-niter.c (simplify_using_initial_conditions): Likewise. * tree-ssa-phiopt.c (candidate_bb_for_phi_optimization): Likewise. (replace_phi_with_stmt): Likewise. (value_replacement): Likewise. * tree-ssa-pre.c (compute_antic_aux): Likewise. (insert_aux): Likewise. (init_pre): Likewise. * tree-ssa-propagate.c (simulate_stmt): Likewise. (simulate_block): Likewise. (ssa_prop_init): Likewise. * tree-ssa-threadupdate.c (thread_block): Likewise. (create_block_for_threading): Likewise. (remove_last_stmt_and_useless_edges): Likewise. * tree-ssa.c (verify_phi_args): Likewise. (verify_ssa): Likewise. * tree_tailcall.c (independent_of_stmt_p): Likewise. (find_tail_calls): Likewise. (eliminate_tail_call): Likewise. (tree_optimize_tail_calls_1): Likewise. * tree-vectorizer.c (vect_transform_loop): Likewise. * var-tracking.c (prologue_stack_adjust): Likewise. (vt_stack_adjustments): Likewise. (vt_find_locations): Likewise. * config/frv/frv.c (frv_ifcvt_modify_tests): Likewise. * config/i386/i386.c (ix86_pad_returns): Likewise. * config/ia64/ia64.c (ia64_expand_prologue): Likewise. * config/rs6000/rs6000.c (rs6000_emit_prologue): Likewise. Co-Authored-By: Andrew Pinski <pinskia@physics.uc.edu> Co-Authored-By: Steven Bosscher <stevenb@suse.de> From-SVN: r88222
2004-09-28 09:59:54 +02:00
edge_iterator ei;
bool first_copy;
first_copy = true;
backport: basic-block.h: Include vec.h, errors.h. 2004-09-24 Ben Elliston <bje@au.ibm.com> Steven Bosscher <stevenb@suse.de> Andrew Pinski <pinskia@physics.uc.edu> Merge from edge-vector-branch: * basic-block.h: Include vec.h, errors.h. Instantiate a VEC(edge). (struct edge_def): Remove pred_next, succ_next members. (struct basic_block_def): Remove pred, succ members. Add preds and succs members of type VEC(edge). (FALLTHRU_EDGE): Redefine using EDGE_SUCC. (BRANCH_EDGE): Likewise. (EDGE_CRITICAL_P): Redefine using EDGE_COUNT. (EDGE_COUNT, EDGE_I, EDGE_PRED, EDGE_SUCC): New. (edge_iterator): New. (ei_start, ei_last, ei_end_p, ei_one_before_end_p): New. (ei_next, ei_prev, ei_edge, ei_safe_edge): Likewise. (FOR_EACH_EDGE): New. * bb-reorder.c (find_traces): Use FOR_EACH_EDGE and EDGE_* macros where applicable. (rotate_loop): Likewise. (find_traces_1_route): Likewise. (bb_to_key): Likewise. (connect_traces): Likewise. (copy_bb_p): Likewise. (find_rarely_executed_basic_blocks_and_crossing_edges): Likewise. (add_labels_and_missing_jumps): Likewise. (fix_up_fall_thru_edges): Likewise. (find_jump_block): Likewise. (fix_crossing_conditional_branches): Likewise. (fix_crossing_unconditional_branches): Likewise. (add_reg_crossing_jump_notes): Likewise. * bt-load.c (augment_live_range): Likewise. * cfg.c (clear_edges): Likewise. (unchecked_make_edge): Likewise. (cached_make_edge): Likewise. (make_single_succ_edge): Likewise. (remove_edge): Likewise. (redirect_edge_succ_nodup): Likewise. (check_bb_profile): Likewise. (dump_flow_info): Likewise. (alloc_aux_for_edges): Likewise. (clear_aux_for_edges): Likewise. (dump_cfg_bb_info): Likewise. * cfganal.c (forwarder_block_p): Likewise. (can_fallthru): Likewise. (could_fall_through): Likewise. (mark_dfs_back_edges): Likewise. (set_edge_can_fallthru_flag): Likewise. (find_unreachable_blocks): Likewise. (create_edge_list): Likewise. (verify_edge_list): Likewise. (add_noreturn_fake_exit_edges): Likewise. (connect_infinite_loops_to_exit): Likewise. (flow_reverse_top_sort_order_compute): Likewise. (flow_depth_first_order_compute): Likewise. (flow_preorder_transversal_compute): Likewise. (flow_dfs_compute_reverse_execute): Likewise. (dfs_enumerate_from): Likewise. (compute_dominance_frontiers_1): Likewise. * cfgbuild.c (make_edges): Likewise. (compute_outgoing_frequencies): Likewise. (find_many_sub_basic_blocks): Likewise. (find_sub_basic_blocks): Likewise. * cfgcleanup.c (try_simplify_condjump): Likewise. (thread_jump): Likewise. (try_forward_edges): Likewise. (merge_blocks_move): Likewise. (outgoing_edges_match): Likewise. (try_crossjump_to_edge): Likewise. (try_crossjump_bb): Likewise. (try_optimize_cfg): Likewise. (merge_seq_blocks): Likewise. * cfgexpand.c (expand_gimple_tailcall): Likewise. (expand_gimple_basic_block): Likewise. (construct_init_block): Likewise. (construct_exit_block): Likewise. * cfghooks.c (verify_flow_info): Likewise. (dump_bb): Likewise. (delete_basic_block): Likewise. (split_edge): Likewise. (merge_blocks): Likewise. (make_forwarder_block): Likewise. (tidy_fallthru_edges): Likewise. (can_duplicate_block_p): Likewise. (duplicate_block): Likewise. * cfglayout.c (fixup_reorder_chain): Likewise. (fixup_fallthru_exit_predecessor): Likewise. (can_copy_bbs_p): Likewise. (copy_bbs): Likewise. * cfgloop.c (flow_loops_cfg_dump): Likewise. (flow_loop_entry_edges_find): Likewise. (flow_loop_exit_edges_find): Likewise. (flow_loop_nodes_find): Likewise. (mark_single_exit_loops): Likewise. (flow_loop_pre_header_scan): Likewise. (flow_loop_pre_header_find): Likewise. (update_latch_info): Likewise. (canonicalize_loop_headers): Likewise. (flow_loops_find): Likewise. (get_loop_body_in_bfs_order): Likewise. (get_loop_exit_edges): Likewise. (num_loop_branches): Likewise. (verify_loop_structure): Likewise. (loop_latch_edge): Likewise. (loop_preheader_edge): Likewise. * cfgloopanal.c (mark_irreducible_loops): Likewise. (expected_loop_iterations): Likewise. * cfgloopmanip.c (remove_bbs): Likewise. (fix_bb_placement): Likewise. (fix_irreducible_loops): Likewise. (remove_path): Likewise. (scale_bbs_frequencies): Likewise. (loopify): Likewise. (unloop): Likewise. (fix_loop_placement): Likewise. (loop_delete_branch_edge): Likewise. (duplicate_loop_to_header_edge): Likewise. (mfb_keep_just): Likewise. (create_preheader): Likewise. (force_single_succ_latches): Likewise. (loop_split_edge_with): Likewise. (create_loop_notes): Likewise. * cfgrtl.c (rtl_split_block): Likewise. (rtl_merge_blocks): Likewise. (rtl_can_merge_blocks): Likewise. (try_redirect_by_replacing_jump): Likewise. (force_nonfallthru_and_redirect): Likewise. (rtl_tidy_fallthru_edge): Likewise. (commit_one_edge_insertion): Likewise. (commit_edge_insertions): Likewise. (commit_edge_insertions_watch_calls): Likewise. (rtl_verify_flow_info_1): Likewise. (rtl_verify_flow_info): Likewise. (purge_dead_edges): Likewise. (cfg_layout_redirect_edge_and_branch): Likewise. (cfg_layout_can_merge_blocks_p): Likewise. (rtl_flow_call_edges_add): Likewise. * cse.c (cse_cc_succs): Likewise. * df.c (hybrid_search): Likewise. * dominance.c (calc_dfs_tree_nonrec): Likewise. (calc_dfs_tree): Likewise. (calc_idoms): Likewise. (recount_dominator): Likewise. * domwalk.c (walk_dominator_tree): Likewise. * except.c (emit_to_new_bb_before): Likewise. (connect_post_landing_pads): Likewise. (sjlj_emit_function_enter): Likewise. (sjlj_emit_function_exit): Likewise. (finish_eh_generation): Likewise. * final.c (compute_alignments): Likewise. * flow.c (calculate_global_regs_live): Likewise. (initialize_uninitialized_subregs): Likewise. (init_propagate_block_info): Likewise. * function.c (thread_prologue_and_epilogue_insns): Likewise. * gcse.c (find_implicit_sets): Likewise. (bypass_block): Likewise. (bypass_conditional_jumps): Likewise. (compute_pre_data): Likewise. (insert_insn_end_bb): Likewise. (insert_store): Likewise. (remove_reachable_equiv_notes): Likewise. * global.c (global_conflicts): Likewise. (calculate_reg_pav): Likewise. * graph.c (print_rtl_graph_with_bb): Likewise. * ifcvt.c (mark_loop_exit_edges): Likewise. (merge_if_block): Likewise. (find_if_header): Likewise. (block_jumps_and_fallthru_p): Likewise. (find_if_block): Likewise. (find_cond_trap): Likewise. (block_has_only_trap): Likewise. (find_if_case1): Likewise. (find_if_case_2): Likewise. * lambda-code.c (lambda_loopnest_to_gcc_loopnest): Likewise. (perfect_nestify): Likewise. * lcm.c (compute_antinout_edge): Likewise. (compute_laterin): Likewise. (compute_available): Likewise. (compute_nearerout): Likewise. * loop-doloop.c (doloop_modify): Likewise. * loop-init.c (loop_optimizer_init): Likewise. * loop-invariant.c (find_exits): Likewise. * loop-iv.c (simplify_using_initial_values): Likewise. (check_simple_exit): Likewise. (find_simple_exit): Likewise. * loop-unroll.c (peel_loop_completely): Likewise. (unroll_loop_constant_iterations): Likewise. (unroll_loop_runtime_iterations): Likewise. * loop-unswitch.c (may_unswitch_on): Likewise. (unswitch_loop): Likewise. * modulo-sched.c (generate_prolog_epilog): Likewise. (sms_schedule): Likewise. * postreload-gcse.c (eliminate_partially_redundant_load): Likewise. * predict.c (can_predict_insn_p): Likewise. (set_even_probabilities): Likewise. (combine_predictions_for_bb): Likewise. (predict_loops): Likewise. (estimate_probability): Likewise. (tree_predict_by_opcode): Likewise. (tree_estimate_probability): Likewise. (last_basic_block_p): Likewise. (propagate_freq): Likewise. (estimate_loops_at_level): Likewise. (estimate_bb_frequencies): Likewise. * profile.c (instrument_edges): Likewise. (get_exec_counts): Likewise. (compute_branch_probabilities): Likewise. (branch_prob): Likewise. * ra-build.c (live_in): Likewise. * ra-rewrite.c (rewrite_program2): Likewise. * ra.c (reg_alloc): Likewise. * reg-stack.c (reg_to_stack): Likewise. (convert_regs_entry): Likewise. (compensate_edge): Likewise. (convert_regs_1): Likewise, (convert_regs_2): Likewise. (convert_regs): Likewise. * regrename.c (copyprop_hardreg_forward): Likewise. * reload1.c (fixup_abnormal_edges): Likewise. * sbitmap.c (sbitmap_intersection_of_succs): Likewise. (sbitmap_insersection_of_preds): Likewise. (sbitmap_union_of_succs): Likewise. (sbitmap_union_of_preds): Likewise. * sched-ebb.c (compute_jump_reg_dependencies): Likewise. (fix_basic_block_boundaries): Likewise. (sched_ebbs): Likewise. * sched-rgn.c (build_control_flow): Likewise. (find_rgns): Likewise. * tracer.c (find_best_successor): Likewise. (find_best_predecessor): Likewise. (tail_duplicate): Likewise. * tree-cfg.c (make_edges): Likewise. (make_ctrl_stmt_edges): Likewise. (make_goto_expr_edges): Likewise. (tree_can_merge_blocks_p): Likewise. (tree_merge_blocks): Likewise. (cfg_remove_useless_stmts_bb): Likewise. (remove_phi_nodes_and_edges_for_unreachable_block): Likewise. (tree_block_forwards_to): Likewise. (cleanup_control_expr_graph): Likewise. (find_taken_edge): Likewise. (dump_cfg_stats): Likewise. (tree_cfg2vcg): Likewise. (disband_implicit_edges): Likewise. (tree_find_edge_insert_loc): Likewise. (bsi_commit_edge_inserts): Likewise. (tree_split_edge): Likewise. (tree_verify_flow_info): Likewise. (tree_make_forwarder_block): Likewise. (tree_forwarder_block_p): Likewise. (thread_jumps): Likewise. (tree_try_redirect_by_replacing_jump): Likewise. (tree_split_block): Likewise. (add_phi_args_after_copy_bb): Likewise. (rewrite_to_new_ssa_names_bb): Likewise. (dump_function_to_file): Likewise. (print_pred_bbs): Likewise. (print_loop): Likewise. (tree_flow_call_edges_add): Likewise. (split_critical_edges): Likewise. (execute_warn_function_return): Likewise. (extract_true_false_edges_from_block): Likewise. * tree-if-conv.c (tree_if_conversion): Likewise. (if_convertable_bb_p): Likewise. (find_phi_replacement_condition): Likewise. (combine_blocks): Likewise. * tree-into-ssa.c (compute_global_livein): Likewise. (ssa_mark_phi_uses): Likewise. (ssa_rewrite_initialize_block): Likewise. (rewrite_add_phi_arguments): Likewise. (ssa_rewrite_phi_arguments): Likewise. (insert_phi_nodes_for): Likewise. (rewrite_into_ssa): Likewise. (rewrite_ssa_into_ssa): Likewise. * tree-mudflap.c (mf_build_check_statement_for): Likewise. * tree-outof-ssa.c (coalesce_abnormal_edges): Likewise. (rewrite_trees): Likewise. * tree-pretty-print.c (dump_bb_header): Likewise. (dump_implicit_edges): Likewise. * tree-sra.c (insert_edge_copies): Likewise. (find_obviously_necessary_stmts): Likewise. (remove_data_stmt): Likewise. * tree-ssa-dom.c (thread_across_edge): Likewise. (dom_opt_finalize_block): Likewise. (single_incoming_edge_ignoring_loop_edges): Likewise. (record_equivalences_from_incoming_edges): Likewise. (cprop_into_successor_phis): Likewise. * tree-ssa-live.c (live_worklist): Likewise. (calculate_live_on_entry): Likewise. (calculate_live_on_exit): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p): Likewise. (copy_loop_headers): Likewise. * tree-ssa-loop-im.c (loop_commit_inserts): Likewise. (fill_always_executed_in): Likewise. * tree-ssa-loop-ivcanon.c (create_canonical_iv): Likewise. * tree-ssa-loop-ivopts.c (find_interesting_uses): Likewise. (compute_phi_arg_on_exit): Likewise. * tree-ssa-loop-manip.c (add_exit_phis_edge): Likewise. (get_loops_exit): Likewise. (split_loop_exit_edge): Likewise. (ip_normal_pos): Likewise. * tree-ssa-loop-niter.c (simplify_using_initial_conditions): Likewise. * tree-ssa-phiopt.c (candidate_bb_for_phi_optimization): Likewise. (replace_phi_with_stmt): Likewise. (value_replacement): Likewise. * tree-ssa-pre.c (compute_antic_aux): Likewise. (insert_aux): Likewise. (init_pre): Likewise. * tree-ssa-propagate.c (simulate_stmt): Likewise. (simulate_block): Likewise. (ssa_prop_init): Likewise. * tree-ssa-threadupdate.c (thread_block): Likewise. (create_block_for_threading): Likewise. (remove_last_stmt_and_useless_edges): Likewise. * tree-ssa.c (verify_phi_args): Likewise. (verify_ssa): Likewise. * tree_tailcall.c (independent_of_stmt_p): Likewise. (find_tail_calls): Likewise. (eliminate_tail_call): Likewise. (tree_optimize_tail_calls_1): Likewise. * tree-vectorizer.c (vect_transform_loop): Likewise. * var-tracking.c (prologue_stack_adjust): Likewise. (vt_stack_adjustments): Likewise. (vt_find_locations): Likewise. * config/frv/frv.c (frv_ifcvt_modify_tests): Likewise. * config/i386/i386.c (ix86_pad_returns): Likewise. * config/ia64/ia64.c (ia64_expand_prologue): Likewise. * config/rs6000/rs6000.c (rs6000_emit_prologue): Likewise. Co-Authored-By: Andrew Pinski <pinskia@physics.uc.edu> Co-Authored-By: Steven Bosscher <stevenb@suse.de> From-SVN: r88222
2004-09-28 09:59:54 +02:00
FOR_EACH_EDGE (e, ei, bb->succs)
{
/* We don't need to insert copies on abnormal edges. The
value of the scalar replacement is not guaranteed to
be valid through an abnormal edge. */
if (!(e->flags & EDGE_ABNORMAL))
{
if (first_copy)
{
bsi_insert_on_edge (e, stmt);
first_copy = false;
}
else
bsi_insert_on_edge (e, unsave_expr_now (stmt));
}
}
}
/* Helper function to insert LIST before BSI, and set up line number info. */
Makefile.in: Added rules for ipa-pure-const.c... 2005-07-16 Danny Berlin <dberlin@dberlin.org> Kenneth Zadeck <zadeck@naturalbridge.com> * Makefile.in: Added rules for ipa-pure-const.c, ipa-reference.c, ipa-reference.h, ipa-utils.c, ipa-utils.h, ipa-type-escape.c, ipa-type-escape.h, tree-promote-statics.c * ipa-pure-const.c, ipa-reference.c, ipa-reference.h, ipa-utils.c, ipa-utils.h, ipa-type-escape.c, ipa-type-escape.h, tree-promote-statics.c: new files. * alias.c: (nonlocal_mentioned_p_1, nonlocal_mentioned_p, nonlocal_referenced_p_1, nonlocal_referenced_p, nonlocal_set_p_1, int nonlocal_set_p, mark_constant_function): Deleted. (rest_of_handle_cfg): Removed call to mark_constant_function. (nonoverlapping_component_refs_p): Added calls to support type based aliasing. * tree-ssa-alias.c (may_alias_p, compute_flow_insensitive_aliasing): Ditto. * calls.c (flags_from_decl_or_type): Removed reference to cgraph_rtl_info. (flags_from_decl_or_type): Support ECF_POINTER_NO_CAPTURE attribute. * c-common.c (handle_pointer_no_capture_attribute): New function and added pointer_no_capture attribute. * c-typeck.c (convert_arguments): Make builtins tolerant of having too many arguments. This is necessary for Spec 2000. * cgraph.h (const_function, pure_function): Removed. * common.opt: Added "fipa-pure-const", "fipa-reference", "fipa-type-escape", and "ftree-promote-static". * opts.c: Ditto. * passes.c: Added ipa and tree-promote-statics passes. * timevar.def: Added TV_IPA_PURE_CONST, TV_IPA_REFERENCE, TV_IPA_TYPE_ESCAPE, and TV_PROMOTE_STATICS. * tree.h: Support ECF_POINTER_NO_CAPTURE attribute. * tree-dfa.c (referenced_var_lookup_if_exists): New function. * tree-flow.h: Added exposed sra calls and addition of reference_vars_info field for FUNCTION_DECLS. * tree-pass.h: Added passes. * tree-sra.c: (sra_init_cache): New function. (sra_insert_before, sra_insert_after) Made public. (type_can_be_decomposed_p): Renamed from type_can_be_decomposed_p and made public. * tree-ssa-alias.c (dump_alias_stats): Added stats for type based aliasing. (may_alias_p): Added code to use type escape analysis to improve alias sets. * tree-ssa-operands.c (add_call_clobber_ops): Added parameter and code to prune clobbers of static variables based on information produced in ipa-reference pass. Changed call clobbering so that statics are not marked as clobbered if the call does not clobber them. 2005-07-16 Danny Berlin <dberlin@dberlin.org> Kenneth Zadeck <zadeck@naturalbridge.com> * gcc.dg/tree-ssa/ssa-dce-2.c: Changed dg-options to run at -O2 since pure const detection cannot run at -O1 in c compiler. * gcc.dg/tree-ssa/20030714-1.c Changed scanning patterns because we can now optimize this case properly. * gcc.dg/tree-ssa/sra-2.c: Changed to -O3 and removed xfail because we now pass. * gcc.dg/vect/vect-92.c: Removed out of bounds array access. Co-Authored-By: Kenneth Zadeck <zadeck@naturalbridge.com> From-SVN: r102098
2005-07-16 20:56:53 +02:00
void
sra_insert_before (block_stmt_iterator *bsi, tree list)
{
tree stmt = bsi_stmt (*bsi);
if (EXPR_HAS_LOCATION (stmt))
annotate_all_with_locus (&list, EXPR_LOCATION (stmt));
bsi_insert_before (bsi, list, BSI_SAME_STMT);
}
/* Similarly, but insert after BSI. Handles insertion onto edges as well. */
Makefile.in: Added rules for ipa-pure-const.c... 2005-07-16 Danny Berlin <dberlin@dberlin.org> Kenneth Zadeck <zadeck@naturalbridge.com> * Makefile.in: Added rules for ipa-pure-const.c, ipa-reference.c, ipa-reference.h, ipa-utils.c, ipa-utils.h, ipa-type-escape.c, ipa-type-escape.h, tree-promote-statics.c * ipa-pure-const.c, ipa-reference.c, ipa-reference.h, ipa-utils.c, ipa-utils.h, ipa-type-escape.c, ipa-type-escape.h, tree-promote-statics.c: new files. * alias.c: (nonlocal_mentioned_p_1, nonlocal_mentioned_p, nonlocal_referenced_p_1, nonlocal_referenced_p, nonlocal_set_p_1, int nonlocal_set_p, mark_constant_function): Deleted. (rest_of_handle_cfg): Removed call to mark_constant_function. (nonoverlapping_component_refs_p): Added calls to support type based aliasing. * tree-ssa-alias.c (may_alias_p, compute_flow_insensitive_aliasing): Ditto. * calls.c (flags_from_decl_or_type): Removed reference to cgraph_rtl_info. (flags_from_decl_or_type): Support ECF_POINTER_NO_CAPTURE attribute. * c-common.c (handle_pointer_no_capture_attribute): New function and added pointer_no_capture attribute. * c-typeck.c (convert_arguments): Make builtins tolerant of having too many arguments. This is necessary for Spec 2000. * cgraph.h (const_function, pure_function): Removed. * common.opt: Added "fipa-pure-const", "fipa-reference", "fipa-type-escape", and "ftree-promote-static". * opts.c: Ditto. * passes.c: Added ipa and tree-promote-statics passes. * timevar.def: Added TV_IPA_PURE_CONST, TV_IPA_REFERENCE, TV_IPA_TYPE_ESCAPE, and TV_PROMOTE_STATICS. * tree.h: Support ECF_POINTER_NO_CAPTURE attribute. * tree-dfa.c (referenced_var_lookup_if_exists): New function. * tree-flow.h: Added exposed sra calls and addition of reference_vars_info field for FUNCTION_DECLS. * tree-pass.h: Added passes. * tree-sra.c: (sra_init_cache): New function. (sra_insert_before, sra_insert_after) Made public. (type_can_be_decomposed_p): Renamed from type_can_be_decomposed_p and made public. * tree-ssa-alias.c (dump_alias_stats): Added stats for type based aliasing. (may_alias_p): Added code to use type escape analysis to improve alias sets. * tree-ssa-operands.c (add_call_clobber_ops): Added parameter and code to prune clobbers of static variables based on information produced in ipa-reference pass. Changed call clobbering so that statics are not marked as clobbered if the call does not clobber them. 2005-07-16 Danny Berlin <dberlin@dberlin.org> Kenneth Zadeck <zadeck@naturalbridge.com> * gcc.dg/tree-ssa/ssa-dce-2.c: Changed dg-options to run at -O2 since pure const detection cannot run at -O1 in c compiler. * gcc.dg/tree-ssa/20030714-1.c Changed scanning patterns because we can now optimize this case properly. * gcc.dg/tree-ssa/sra-2.c: Changed to -O3 and removed xfail because we now pass. * gcc.dg/vect/vect-92.c: Removed out of bounds array access. Co-Authored-By: Kenneth Zadeck <zadeck@naturalbridge.com> From-SVN: r102098
2005-07-16 20:56:53 +02:00
void
sra_insert_after (block_stmt_iterator *bsi, tree list)
{
tree stmt = bsi_stmt (*bsi);
if (EXPR_HAS_LOCATION (stmt))
annotate_all_with_locus (&list, EXPR_LOCATION (stmt));
if (stmt_ends_bb_p (stmt))
insert_edge_copies (list, bsi->bb);
else
bsi_insert_after (bsi, list, BSI_SAME_STMT);
}
/* Similarly, but replace the statement at BSI. */
static void
sra_replace (block_stmt_iterator *bsi, tree list)
{
sra_insert_before (bsi, list);
tree-cfg.c (bsi_replace): Rename final argument from PRESERVE_EH_INFO to UPDATE_EH_INFO. * tree-cfg.c (bsi_replace): Rename final argument from PRESERVE_EH_INFO to UPDATE_EH_INFO. Fix typo in last change (stmt -> orig_stmt). * tree-eh.c (verify_eh_throw_stmt_node): New function. (bsi_remove): Add new argument. Remove EH information if requested. (verify_eh_throw_table_statements): New function. (bsi_remove): Add new argument REMOVE_EH_INFO. All callers updated. * tree-optimize.c (execute_free_cfg_annotations): Verify the EH throw statement table after removing annotations. * except.h (verify_eh_throw_table_statements): Prototype. * tree-flow.h (bsi_remove): Update prototype. * tree-vrp.c (remove_range_assertions): Add new argument to bsi_remove call. * tree-ssa-loop-im.c (move_computations_stmt): Likewise. * tree-complex.c (expand_complex_div_wide): Likewise. * tree-ssa-threadupdate.c (remove_ctrl_stmt_and_useless_edges): Likewise * tree-tailcall.c (eliminate_tailcall): Likewise. * tree-ssa-dse.c (dse_optimize_stmt): Likewise. * tree-ssa-loop-ivopts.c (remove_statement): Likewise. * tree-nrv.c (tree_nrv): Likewise. * tree-vectorizer.c (slpeel_make_loop_iterate_ntimes): Likewise. * tree-if-conv.c (tree_if_convert_cond_expr): Likewise. (combine_blocks): Likewise. * tree-ssa-phiopt.c (replace_phi_edge_with_variable): Likewise. * tree-cfgcleanup.c (cleanup_ctrl_expr_graph): Likewise. (cleanup_control_flow): Likewise. (remove_forwarder_block): Likewise. * tree-ssa-pre.c (remove_dead_inserted_code): Likewise. * tree-sra.c (sra_replace): Likewise. * tree-ssa-forwprop.c (forward_propagate_into_cond): Likewise. (forward_propagate_single_use_vars): Likewise. * tree-ssa-dce.c (remove_dead_stmt): Likewise. * tree-inline.c (expand_call_inline): Likewise. * tree-vect-transform.c (vect_transform_loop): Likewise. * tree-outof-ssa.c (rewrite_trees): Likewise. * tree-cfg.c (make_goto_expr_edges): Likewise. (cleanup_dead_labels): Likewise. (tree_merge_blocks, remove_bb, disband_implicit_edges): Likewise. (bsi_move_before, bsi_move_after): Likewise. (bsi_move_to_bb_end, try_redirect_by_replacing_jump): Likewise (tree_redirect_edge_and_branch, tree_split_block): Likewise. From-SVN: r109421
2006-01-06 18:50:26 +01:00
bsi_remove (bsi, false);
if (bsi_end_p (*bsi))
*bsi = bsi_last (bsi->bb);
else
bsi_prev (bsi);
}
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
/* Data structure that bitfield_overlaps_p fills in with information
about the element passed in and how much of it overlaps with the
bit-range passed it to. */
struct bitfield_overlap_info
{
/* The bit-length of an element. */
tree field_len;
/* The bit-position of the element in its parent. */
tree field_pos;
/* The number of bits of the element that overlap with the incoming
bit range. */
tree overlap_len;
/* The first bit of the element that overlaps with the incoming bit
range. */
tree overlap_pos;
};
/* Return true if a BIT_FIELD_REF<(FLD->parent), BLEN, BPOS>
expression (refereced as BF below) accesses any of the bits in FLD,
false if it doesn't. If DATA is non-null, its field_len and
field_pos are filled in such that BIT_FIELD_REF<(FLD->parent),
field_len, field_pos> (referenced as BFLD below) represents the
entire field FLD->element, and BIT_FIELD_REF<BFLD, overlap_len,
overlap_pos> represents the portion of the entire field that
overlaps with BF. */
static bool
bitfield_overlaps_p (tree blen, tree bpos, struct sra_elt *fld,
struct bitfield_overlap_info *data)
{
tree flen, fpos;
bool ret;
if (TREE_CODE (fld->element) == FIELD_DECL)
{
flen = fold_convert (bitsizetype, DECL_SIZE (fld->element));
fpos = fold_convert (bitsizetype, DECL_FIELD_OFFSET (fld->element));
fpos = size_binop (MULT_EXPR, fpos, bitsize_int (BITS_PER_UNIT));
fpos = size_binop (PLUS_EXPR, fpos, DECL_FIELD_BIT_OFFSET (fld->element));
}
else if (TREE_CODE (fld->element) == BIT_FIELD_REF)
{
flen = fold_convert (bitsizetype, TREE_OPERAND (fld->element, 1));
fpos = fold_convert (bitsizetype, TREE_OPERAND (fld->element, 2));
}
else if (TREE_CODE (fld->element) == INTEGER_CST)
{
flen = fold_convert (bitsizetype, TYPE_SIZE (fld->type));
fpos = size_binop (MULT_EXPR, flen, fld->element);
}
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
else
gcc_unreachable ();
gcc_assert (host_integerp (blen, 1)
&& host_integerp (bpos, 1)
&& host_integerp (flen, 1)
&& host_integerp (fpos, 1));
ret = ((!tree_int_cst_lt (fpos, bpos)
&& tree_int_cst_lt (size_binop (MINUS_EXPR, fpos, bpos),
blen))
|| (!tree_int_cst_lt (bpos, fpos)
&& tree_int_cst_lt (size_binop (MINUS_EXPR, bpos, fpos),
flen)));
if (!ret)
return ret;
if (data)
{
tree bend, fend;
data->field_len = flen;
data->field_pos = fpos;
fend = size_binop (PLUS_EXPR, fpos, flen);
bend = size_binop (PLUS_EXPR, bpos, blen);
if (tree_int_cst_lt (bend, fend))
data->overlap_len = size_binop (MINUS_EXPR, bend, fpos);
else
data->overlap_len = NULL;
if (tree_int_cst_lt (fpos, bpos))
{
data->overlap_pos = size_binop (MINUS_EXPR, bpos, fpos);
data->overlap_len = size_binop (MINUS_EXPR,
data->overlap_len
? data->overlap_len
: data->field_len,
data->overlap_pos);
}
else
data->overlap_pos = NULL;
}
return ret;
}
/* Add to LISTP a sequence of statements that copies BLEN bits between
VAR and the scalarized elements of ELT, starting a bit VPOS of VAR
and at bit BPOS of ELT. The direction of the copy is given by
TO_VAR. */
static void
sra_explode_bitfield_assignment (tree var, tree vpos, bool to_var,
tree *listp, tree blen, tree bpos,
struct sra_elt *elt)
{
struct sra_elt *fld;
struct bitfield_overlap_info flp;
FOR_EACH_ACTUAL_CHILD (fld, elt)
{
tree flen, fpos;
if (!bitfield_overlaps_p (blen, bpos, fld, &flp))
continue;
flen = flp.overlap_len ? flp.overlap_len : flp.field_len;
fpos = flp.overlap_pos ? flp.overlap_pos : bitsize_int (0);
if (fld->replacement)
{
tree infld, invar, st, type;
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
infld = fld->replacement;
type = TREE_TYPE (infld);
if (TYPE_PRECISION (type) != TREE_INT_CST_LOW (flen))
type = lang_hooks.types.type_for_size (TREE_INT_CST_LOW (flen), 1);
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
if (TREE_CODE (infld) == BIT_FIELD_REF)
{
fpos = size_binop (PLUS_EXPR, fpos, TREE_OPERAND (infld, 2));
infld = TREE_OPERAND (infld, 0);
}
else if (BYTES_BIG_ENDIAN && DECL_P (fld->element)
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
&& !tree_int_cst_equal (TYPE_SIZE (TREE_TYPE (infld)),
DECL_SIZE (fld->element)))
{
fpos = size_binop (PLUS_EXPR, fpos,
TYPE_SIZE (TREE_TYPE (infld)));
fpos = size_binop (MINUS_EXPR, fpos,
DECL_SIZE (fld->element));
}
infld = fold_build3 (BIT_FIELD_REF, type, infld, flen, fpos);
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
BIT_FIELD_REF_UNSIGNED (infld) = 1;
invar = size_binop (MINUS_EXPR, flp.field_pos, bpos);
if (flp.overlap_pos)
invar = size_binop (PLUS_EXPR, invar, flp.overlap_pos);
invar = size_binop (PLUS_EXPR, invar, vpos);
invar = fold_build3 (BIT_FIELD_REF, type, var, flen, invar);
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
BIT_FIELD_REF_UNSIGNED (invar) = 1;
if (to_var)
st = sra_build_bf_assignment (invar, infld);
else
st = sra_build_bf_assignment (infld, invar);
append_to_statement_list (st, listp);
}
else
{
tree sub = size_binop (MINUS_EXPR, flp.field_pos, bpos);
sub = size_binop (PLUS_EXPR, vpos, sub);
if (flp.overlap_pos)
sub = size_binop (PLUS_EXPR, sub, flp.overlap_pos);
sra_explode_bitfield_assignment (var, sub, to_var, listp,
flen, fpos, fld);
}
}
}
/* Add to LISTBEFOREP statements that copy scalarized members of ELT
that overlap with BIT_FIELD_REF<(ELT->element), BLEN, BPOS> back
into the full variable, and to LISTAFTERP, if non-NULL, statements
that copy the (presumably modified) overlapping portions of the
full variable back to the scalarized variables. */
static void
sra_sync_for_bitfield_assignment (tree *listbeforep, tree *listafterp,
tree blen, tree bpos,
struct sra_elt *elt)
{
struct sra_elt *fld;
struct bitfield_overlap_info flp;
FOR_EACH_ACTUAL_CHILD (fld, elt)
if (bitfield_overlaps_p (blen, bpos, fld, &flp))
{
if (fld->replacement || (!flp.overlap_len && !flp.overlap_pos))
{
generate_copy_inout (fld, false, generate_element_ref (fld),
listbeforep);
mark_no_warning (fld);
if (listafterp)
generate_copy_inout (fld, true, generate_element_ref (fld),
listafterp);
}
else
{
tree flen = flp.overlap_len ? flp.overlap_len : flp.field_len;
tree fpos = flp.overlap_pos ? flp.overlap_pos : bitsize_int (0);
sra_sync_for_bitfield_assignment (listbeforep, listafterp,
flen, fpos, fld);
}
}
}
/* Scalarize a USE. To recap, this is either a simple reference to ELT,
if elt is scalar, or some occurrence of ELT that requires a complete
aggregate. IS_OUTPUT is true if ELT is being modified. */
static void
scalarize_use (struct sra_elt *elt, tree *expr_p, block_stmt_iterator *bsi,
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 Temporarily revert: 2007-04-06 Andreas Tobler <a.tobler@schweiz.org> 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (try_instantiate_multiple_fields): Needlessly initialize align to silence bogus warning. 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (struct sra_elt): Add in_bitfld_block. Remove all_no_warning. (struct sra_walk_fns): Remove use_all parameter from use. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (sra_walk_expr): Don't maintain or pass down use_all_p. (scan_use): Remove use_all parameter. (scalarize_use): Likewise. Re-expand assignment to BIT_FIELD_REF of gimple_reg. De-scalarize before input or output, and re-scalarize after output. Don't mark anything for no warning. (scalarize_ldst): Adjust. (scalarize_walk_gimple_modify_statement): Likewise. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Don't warn for any element whose parent is used as a whole. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. (instantiate_missing_elemnts): Use them. (mark_no_warning): Removed. (generate_one_element_ref): Handle BIT_FIELD_REFs. (REPLDUP, sra_build_elt_assignment): New. (generate_copy_inout): Use them. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_int): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (scalarize_use, scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r124302
2007-04-30 19:41:11 +02:00
bool is_output, bool use_all)
{
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
tree stmt = bsi_stmt (*bsi);
tree bfexpr;
if (elt->replacement)
{
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
tree replacement = elt->replacement;
/* If we have a replacement, then updating the reference is as
simple as modifying the existing statement in place. */
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
if (is_output
&& TREE_CODE (elt->replacement) == BIT_FIELD_REF
&& is_gimple_reg (TREE_OPERAND (elt->replacement, 0))
&& TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
&& &GIMPLE_STMT_OPERAND (stmt, 0) == expr_p)
{
tree newstmt = sra_build_elt_assignment
(elt, GIMPLE_STMT_OPERAND (stmt, 1));
if (TREE_CODE (newstmt) != STATEMENT_LIST)
{
tree list = NULL;
append_to_statement_list (newstmt, &list);
newstmt = list;
}
sra_replace (bsi, newstmt);
return;
}
else if (!is_output
&& TREE_CODE (elt->replacement) == BIT_FIELD_REF
&& TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
&& &GIMPLE_STMT_OPERAND (stmt, 1) == expr_p)
{
tree tmp = make_rename_temp
(TREE_TYPE (GIMPLE_STMT_OPERAND (stmt, 0)), "SR");
tree newstmt = sra_build_assignment (tmp, REPLDUP (elt->replacement));
if (TREE_CODE (newstmt) != STATEMENT_LIST)
{
tree list = NULL;
append_to_statement_list (newstmt, &list);
newstmt = list;
}
sra_insert_before (bsi, newstmt);
replacement = tmp;
}
if (is_output)
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
mark_all_v_defs (stmt);
*expr_p = REPLDUP (replacement);
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 (stmt);
}
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
else if (use_all && is_output
&& TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
&& TREE_CODE (bfexpr
= GIMPLE_STMT_OPERAND (stmt, 0)) == BIT_FIELD_REF
&& &TREE_OPERAND (bfexpr, 0) == expr_p
&& INTEGRAL_TYPE_P (TREE_TYPE (bfexpr))
&& TREE_CODE (TREE_TYPE (*expr_p)) == RECORD_TYPE)
{
tree listbefore = NULL, listafter = NULL;
tree blen = fold_convert (bitsizetype, TREE_OPERAND (bfexpr, 1));
tree bpos = fold_convert (bitsizetype, TREE_OPERAND (bfexpr, 2));
bool update = false;
if (!elt->use_block_copy)
{
tree type = TREE_TYPE (bfexpr);
tree var = make_rename_temp (type, "SR"), tmp, st;
GIMPLE_STMT_OPERAND (stmt, 0) = var;
update = true;
if (!TYPE_UNSIGNED (type))
{
type = unsigned_type_for (type);
tmp = make_rename_temp (type, "SR");
st = build_gimple_modify_stmt (tmp,
fold_convert (type, var));
append_to_statement_list (st, &listafter);
var = tmp;
}
sra_explode_bitfield_assignment
(var, bitsize_int (0), false, &listafter, blen, bpos, elt);
}
else
sra_sync_for_bitfield_assignment
(&listbefore, &listafter, blen, bpos, elt);
if (listbefore)
{
mark_all_v_defs (listbefore);
sra_insert_before (bsi, listbefore);
}
if (listafter)
{
mark_all_v_defs (listafter);
sra_insert_after (bsi, listafter);
}
if (update)
update_stmt (stmt);
}
else if (use_all && !is_output
&& TREE_CODE (stmt) == GIMPLE_MODIFY_STMT
&& TREE_CODE (bfexpr
= GIMPLE_STMT_OPERAND (stmt, 1)) == BIT_FIELD_REF
&& &TREE_OPERAND (GIMPLE_STMT_OPERAND (stmt, 1), 0) == expr_p
&& INTEGRAL_TYPE_P (TREE_TYPE (bfexpr))
&& TREE_CODE (TREE_TYPE (*expr_p)) == RECORD_TYPE)
{
tree list = NULL;
tree blen = fold_convert (bitsizetype, TREE_OPERAND (bfexpr, 1));
tree bpos = fold_convert (bitsizetype, TREE_OPERAND (bfexpr, 2));
bool update = false;
if (!elt->use_block_copy)
{
tree type = TREE_TYPE (bfexpr);
tree var;
if (!TYPE_UNSIGNED (type))
type = unsigned_type_for (type);
var = make_rename_temp (type, "SR");
append_to_statement_list (build_gimple_modify_stmt
(var, build_int_cst_wide (type, 0, 0)),
&list);
sra_explode_bitfield_assignment
(var, bitsize_int (0), true, &list, blen, bpos, elt);
GIMPLE_STMT_OPERAND (stmt, 1) = var;
update = true;
}
else
sra_sync_for_bitfield_assignment
(&list, NULL, blen, bpos, elt);
if (list)
{
mark_all_v_defs (list);
sra_insert_before (bsi, list);
}
if (update)
update_stmt (stmt);
}
else
{
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
tree list = NULL;
/* Otherwise we need some copies. If ELT is being read, then we
want to store all (modified) sub-elements back into the
structure before the reference takes place. If ELT is being
written, then we want to load the changed values back into
our shadow variables. */
/* ??? We don't check modified for reads, we just always write all of
the values. We should be able to record the SSA number of the VOP
for which the values were last read. If that number matches the
SSA number of the VOP in the current statement, then we needn't
emit an assignment. This would also eliminate double writes when
a structure is passed as more than one argument to a function call.
This optimization would be most effective if sra_walk_function
processed the blocks in dominator order. */
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 Temporarily revert: 2007-04-06 Andreas Tobler <a.tobler@schweiz.org> 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (try_instantiate_multiple_fields): Needlessly initialize align to silence bogus warning. 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (struct sra_elt): Add in_bitfld_block. Remove all_no_warning. (struct sra_walk_fns): Remove use_all parameter from use. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (sra_walk_expr): Don't maintain or pass down use_all_p. (scan_use): Remove use_all parameter. (scalarize_use): Likewise. Re-expand assignment to BIT_FIELD_REF of gimple_reg. De-scalarize before input or output, and re-scalarize after output. Don't mark anything for no warning. (scalarize_ldst): Adjust. (scalarize_walk_gimple_modify_statement): Likewise. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Don't warn for any element whose parent is used as a whole. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. (instantiate_missing_elemnts): Use them. (mark_no_warning): Removed. (generate_one_element_ref): Handle BIT_FIELD_REFs. (REPLDUP, sra_build_elt_assignment): New. (generate_copy_inout): Use them. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_int): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (scalarize_use, scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r124302
2007-04-30 19:41:11 +02:00
generate_copy_inout (elt, is_output, generate_element_ref (elt), &list);
if (list == NULL)
return;
mark_all_v_defs (list);
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. Remove all_no_warning. (struct sra_walk_fns): Remove use_all parameter from use. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (sra_walk_expr): Don't maintain or pass down use_all_p. (scan_use): Remove use_all parameter. (scalarize_use): Likewise. Re-expand assignment to BIT_FIELD_REF of gimple_reg. De-scalarize before input or output, and re-scalarize after output. Don't mark anything for no warning. (scalarize_ldst): Adjust. (scalarize_walk_gimple_modify_statement): Likewise. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Don't warn for any element whose parent is used as a whole. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. (instantiate_missing_elemnts): Use them. (mark_no_warning): Removed. (generate_one_element_ref): Handle BIT_FIELD_REFs. (REPLDUP, sra_build_elt_assignment): New. (generate_copy_inout): Use them. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_int): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (scalarize_use, scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r123524
2007-04-05 20:50:34 +02:00
if (is_output)
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 Temporarily revert: 2007-04-06 Andreas Tobler <a.tobler@schweiz.org> 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (try_instantiate_multiple_fields): Needlessly initialize align to silence bogus warning. 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (struct sra_elt): Add in_bitfld_block. Remove all_no_warning. (struct sra_walk_fns): Remove use_all parameter from use. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (sra_walk_expr): Don't maintain or pass down use_all_p. (scan_use): Remove use_all parameter. (scalarize_use): Likewise. Re-expand assignment to BIT_FIELD_REF of gimple_reg. De-scalarize before input or output, and re-scalarize after output. Don't mark anything for no warning. (scalarize_ldst): Adjust. (scalarize_walk_gimple_modify_statement): Likewise. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Don't warn for any element whose parent is used as a whole. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. (instantiate_missing_elemnts): Use them. (mark_no_warning): Removed. (generate_one_element_ref): Handle BIT_FIELD_REFs. (REPLDUP, sra_build_elt_assignment): New. (generate_copy_inout): Use them. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_int): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (scalarize_use, scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r124302
2007-04-30 19:41:11 +02:00
sra_insert_after (bsi, list);
else
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. Remove all_no_warning. (struct sra_walk_fns): Remove use_all parameter from use. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (sra_walk_expr): Don't maintain or pass down use_all_p. (scan_use): Remove use_all parameter. (scalarize_use): Likewise. Re-expand assignment to BIT_FIELD_REF of gimple_reg. De-scalarize before input or output, and re-scalarize after output. Don't mark anything for no warning. (scalarize_ldst): Adjust. (scalarize_walk_gimple_modify_statement): Likewise. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Don't warn for any element whose parent is used as a whole. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. (instantiate_missing_elemnts): Use them. (mark_no_warning): Removed. (generate_one_element_ref): Handle BIT_FIELD_REFs. (REPLDUP, sra_build_elt_assignment): New. (generate_copy_inout): Use them. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_int): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (scalarize_use, scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r123524
2007-04-05 20:50:34 +02:00
{
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 Temporarily revert: 2007-04-06 Andreas Tobler <a.tobler@schweiz.org> 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (try_instantiate_multiple_fields): Needlessly initialize align to silence bogus warning. 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (struct sra_elt): Add in_bitfld_block. Remove all_no_warning. (struct sra_walk_fns): Remove use_all parameter from use. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (sra_walk_expr): Don't maintain or pass down use_all_p. (scan_use): Remove use_all parameter. (scalarize_use): Likewise. Re-expand assignment to BIT_FIELD_REF of gimple_reg. De-scalarize before input or output, and re-scalarize after output. Don't mark anything for no warning. (scalarize_ldst): Adjust. (scalarize_walk_gimple_modify_statement): Likewise. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Don't warn for any element whose parent is used as a whole. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. (instantiate_missing_elemnts): Use them. (mark_no_warning): Removed. (generate_one_element_ref): Handle BIT_FIELD_REFs. (REPLDUP, sra_build_elt_assignment): New. (generate_copy_inout): Use them. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_int): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (scalarize_use, scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r124302
2007-04-30 19:41:11 +02:00
sra_insert_before (bsi, list);
if (use_all)
mark_no_warning (elt);
}
}
}
/* Scalarize a COPY. To recap, this is an assignment statement between
two scalarizable references, LHS_ELT and RHS_ELT. */
static void
scalarize_copy (struct sra_elt *lhs_elt, struct sra_elt *rhs_elt,
block_stmt_iterator *bsi)
{
tree list, stmt;
if (lhs_elt->replacement && rhs_elt->replacement)
{
/* If we have two scalar operands, modify the existing statement. */
stmt = bsi_stmt (*bsi);
/* See the commentary in sra_walk_function concerning
RETURN_EXPR, and why we should never see one here. */
gcc_assert (TREE_CODE (stmt) == GIMPLE_MODIFY_STMT);
GIMPLE_STMT_OPERAND (stmt, 0) = lhs_elt->replacement;
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
GIMPLE_STMT_OPERAND (stmt, 1) = REPLDUP (rhs_elt->replacement);
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 (stmt);
}
else if (lhs_elt->use_block_copy || rhs_elt->use_block_copy)
{
/* If either side requires a block copy, then sync the RHS back
to the original structure, leave the original assignment
statement (which will perform the block copy), then load the
LHS values out of its now-updated original structure. */
/* ??? Could perform a modified pair-wise element copy. That
would at least allow those elements that are instantiated in
both structures to be optimized well. */
list = NULL;
generate_copy_inout (rhs_elt, false,
generate_element_ref (rhs_elt), &list);
if (list)
{
backport: copy-prop, incremental SSA updating of FUD chains and newly exposed symbols. Merge from tree-cleanup-branch: VRP, store CCP, store copy-prop, incremental SSA updating of FUD chains and newly exposed symbols. * Makefile.in (tree-ssa-copy.o): Depend on tree-ssa-propagate.h. (OBJS-common): Add tree-vrp.o. (tree-vrp.o): New rule. * basic-block.h (nearest_common_dominator_for_set): Declare. * common.opt (ftree-store-ccp): New flag. (ftree-copy-prop): New flag. (ftree-vrp): New flag. (ftree-store-copy-prop): New flag. * dominance.c (nearest_common_dominator_for_set): New. * domwalk.c (walk_dominator_tree): Only traverse statements in blocks marked in walk_data->interesting_blocks. * domwalk.h (struct dom_walk_data): Add field interesting_blocks. * fold-const.c (fold): Handle ASSERT_EXPR. * opts.c (decode_options): Set flag_tree_copy_prop at -O1. Set flag_tree_store_ccp, flag_tree_store_copy_prop and flag_tree_vrp at -O2. * timevar.def (TV_TREE_VRP): Define. (TV_TREE_COPY_PROP): Define. (TV_TREE_STORE_COPY_PROP): Define. (TV_TREE_SSA_INCREMENTAL): Define. (TV_TREE_STORE_CCP): Define. * tree-cfg.c (tree_can_merge_blocks_p): Remove reference to kill_redundant_phi_nodes from comment. (verify_expr): Handle ASSERT_EXPR. * tree-dfa.c (mark_new_vars_to_rename): Remove second argument. Update all users. (mark_call_clobbered_vars_to_rename): Remove. Update all users. * tree-flow-inline.h (unmodifiable_var_p): New. * tree-flow.h (enum value_range_type): Declare. (struct value_range_def): Declare. (value_range): Declare. (remove_all_phi_nodes_for): Remove. Update all users. (find_phi_node_for): Declare. (add_type_alias): Declare. (count_uses_and_derefs): Declare. (kill_redundant_phi_nodes): Remove. (rewrite_into_ssa): Remove. (rewrite_def_def_chains): Remove. (update_ssa, register_new_name_mapping, create_new_def_for, need_ssa_update_p, name_registered_for_update_p, release_ssa_name_after_update_ssa, dump_repl_tbl, debug_repl_tbl, dump_names_replaced_by, debug_names_replaced_by, mark_sym_for_renaming, mark_set_for_renaming, get_current_def, set_current_def, get_value_range, dump_value_range, debug_value_range, dump_all_value_ranges, debug_all_value_ranges, expr_computes_nonzero, loop_depth_of_name, unmodifiable_var_p): Declare. * tree-gimple.c (is_gimple_formal_tmp_rhs): Handle ASSERT_EXPR. * tree-into-ssa.c (block_defs_stack): Update comment. (old_ssa_names, new_ssa_names, old_virtual_ssa_names, syms_to_rename, names_to_release, repl_tbl, need_to_initialize_update_ssa_p, need_to_update_vops_p, need_to_replace_names_p): New locals. (NAME_SETS_GROWTH_FACTOR): Define. (struct repl_map_d): Declare. (struct mark_def_sites_global_data): Add field interesting_blocks. (enum rewrite_mode): Declare. (REGISTER_DEFS_IN_THIS_STMT): Define. (compute_global_livein): Use last_basic_block instead of n_basic_blocks. (set_def_block): Remove last argument. Update all callers. (prepare_use_operand_for_rename): Remove. Update all callers. (prepare_def_operand_for_rename): Remove. Update all callers. (symbol_marked_for_renaming): New. (is_old_name): New. (is_new_name): New. (repl_map_hash): New. (repl_map_eq): New. (repl_map_free): New. (names_replaced_by): New. (add_to_repl_tbl): New. (add_new_name_mapping): New. (mark_def_sites): Assume that all the operands in the statement are in normal form. (find_idf): Assert that the block in the stack is valid. (get_default_def_for): New. (insert_phi_nodes_for): Add new argument 'update_p'. Add documentation. If update_p is true, add a new mapping between the LHS of each new PHI and the name that it replaces. (insert_phi_nodes_1): Only call find_idf if needed. (get_reaching_def): Call get_default_def_for. (rewrite_operand): Remove. (rewrite_stmt): Do nothing if REGISTER_DEFS_IN_THIS_STMT and REWRITE_THIS_STMT are false. Assume that all the operands in the statement are in normal form. (rewrite_add_phi_arguments): Don't use PHI_REWRITTEN. (rewrite_virtual_phi_arguments): Remove. (invalidate_name_tags): Remove. (register_new_update_single, register_new_update_set, rewrite_update_init_block, replace_use, rewrite_update_fini_block, rewrite_update_stmt, rewrite_update_phi_arguments): New. rewrite_blocks): Remove argument 'fix_virtual_phis'. Add arguments 'entry', 'what' and 'blocks'. Initialize the dominator walker according to 'what' and 'blocks'. Start the dominator walk at 'entry'. (mark_def_site_blocks): Add argument 'interesting_blocks'. Use it to configure the dominator walker. (rewrite_into_ssa): Remove argument 'all'. Make internal. (rewrite_all_into_ssa): Remove. (rewrite_def_def_chains): Remove. (mark_def_interesting, mark_use_interesting, prepare_phi_args_for_update, prepare_block_for_update, prepare_def_site_for, prepare_def_sites, dump_names_replaced_by, debug_names_replaced_by, dump_repl_tbl, debug_repl_tbl, init_update_ssa, delete_update_ssa, create_new_def_for, register_new_name_mapping, mark_sym_for_renaming, mark_set_for_renaming, need_ssa_update_p, name_registered_for_update_p, ssa_names_to_replace, release_ssa_name_after_update_ssa, insert_updated_phi_nodes_for, update_ssa): New. * tree-loop-linear.c (linear_transform_loops): Call update_ssa instead of rewrite_into_ssa. * tree-optimize.c (vars_to_rename): Remove. Update all users. (init_tree_optimization_passes): Replace pass_redundant_phi with pass_copy_prop. Add pass_vrp. Replace pass_ccp with pass_store_ccp. Add pass_store_copy_prop after pass_store_ccp. (execute_todo): If the TODO_ flags don't include updating the SSA form, assert that it does not need to be updated. Call update_ssa instead of rewrite_into_ssa and rewrite_def_def_chains. If TODO_verify_loops is set, call verify_loop_closed_ssa. (tree_rest_of_compilation): * tree-pass.h (TODO_dump_func, TODO_ggc_collect, TODO_verify_ssa, TODO_verify_flow, TODO_verify_stmts, TODO_cleanup_cfg): Renumber. (TODO_verify_loops, TODO_update_ssa, TODO_update_ssa_no_phi, TODO_update_ssa_full_phi, TODO_update_ssa_only_virtuals): Define. (pass_copy_prop, pass_store_ccp, pass_store_copy_prop, pass_vrp): Declare. * tree-phinodes.c (make_phi_node): Update documentation. (remove_all_phi_nodes_for): Remove. (find_phi_node_for): New. * tree-pretty-print.c (dump_generic_node): Handle ASSERT_EXPR. * tree-scalar-evolution.c (follow_ssa_edge_in_rhs): Likewise. (interpret_rhs_modify_expr): Likewise. * tree-sra.c (decide_instantiations): Mark all symbols in SRA_CANDIDATES for renaming. (mark_all_v_defs_1): Rename from mark_all_v_defs. (mark_all_v_defs): New function. Update all users to call it with the whole list of scalarized statements, not just the first one. * tree-ssa-alias.c (count_ptr_derefs): Make extern. (compute_flow_insensitive_aliasing): If the tag is unmodifiable and the variable isn't or vice-versa, don't make them alias of each other. (setup_pointers_and_addressables): If the type tag for VAR is about to change, mark the old one for renaming. (add_type_alias): New. * tree-ssa-ccp.c: Document SSA-CCP and STORE-CCP. (ccp_lattice_t): Rename from latticevalue. (value): Remove. Update all users. (const_val): New local variable. (do_store_ccp): New local variable. (dump_lattice_value): Handle UNINITIALIZED. (debug_lattice_value): New. (get_default_value): Re-write. (set_lattice_value): Re-write. (def_to_varying): Remove. Update all users. (likely_value): Return VARYING for statements that make stores when STORE_CCP is false. Return VARYING for any statement other than MODIFY_EXPR, COND_EXPR and SWITCH_EXPR. (ccp_initialize): Re-write. (replace_uses_in, replace_vuse_in, substitute_and_fold): Move to tree-ssa-propagate.c. (ccp_lattice_meet): Handle memory stores when DO_STORE_CCP is true. (ccp_visit_phi_node): Likewise. (ccp_fold): Likewise. (evaluate_stmt): Likewise. (visit_assignment): Likewise. (ccp_visit_stmt): Likewise. (execute_ssa_ccp): Add argument 'store_ccp'. Copy it into DO_STORE_CCP. (do_ssa_ccp): New. (pass_ccp): Use it. (do_ssa_store_ccp): New. (gate_store_ccp): New. (pass_store_ccp): Declare. * tree-ssa-copy.c: Include tree-ssa-propagate.h. (may_propagate_copy): Reformat. Don't abort if ORIG is a virtual and DEST isn't. If NEW does not have alias information but DEST does, copy it. (copy_of, cached_last_copy_of, do_store_copy_prop, enum copy_prop_kind, which_copy_prop): Declare. (stmt_may_generate_copy, get_copy_of_val, get_last_copy_of, set_copy_of_val, dump_copy_of, copy_prop_visit_assignment, copy_prop_visit_cond_stmt, copy_prop_visit_stmt, copy_prop_visit_phi_node, init_copy_prop, fini_copy_prop, execute_copy_prop, gate_copy_prop, do_copy_prop, gate_store_copy_prop, store_copy_prop): New. (pass_copy_prop, pass_store_copy_prop): Declare. * tree-ssa-dom.c (struct opt_stats_d): Add fields 'num_const_prop' and 'num_copy_prop'. (cprop_operand): Update them. (dump_dominator_optimization_stats): Dump them. (tree_ssa_dominator_optimize): Call update_ssa instead of rewrite_into_ssa. (loop_depth_of_name): Declare extern. (simplify_cond_and_lookup_avail_expr): Guard against NULL values for LOW or HIGH. (cprop_into_successor_phis): Only propagate if NEW != ORIG. (record_equivalences_from_stmt): Call expr_computes_nonzero. (cprop_operand): Only propagate if VAL != OP. * tree-ssa-dse.c (dse_optimize_stmt): Mark symbols in removed statement for renaming. * tree-ssa-loop-im.c (move_computations): Call update_ssa. * tree-ssa-loop-ivopts.c (rewrite_address_base): Call add_type_alias if necessary. Call mark_new_vars_to_rename. (tree_ssa_iv_optimize): If new symbols need to be renamed, mark every statement updated, call update_ssa and rewrite_into_loop_closed_ssa. * tree-ssa-loop-manip.c (add_exit_phis): Do not remove DEF_BB from LIVEIN if VAR is a virtual. * tree-ssa-loop.c (tree_loop_optimizer_init): Call update_ssa. * tree-ssa-operands.c (get_expr_operands): Handle ASSERT_EXPR. (get_call_expr_operands): Reformat statement. (add_stmt_operand): Don't create V_MAY_DEFs for read-only symbols. * tree-ssa-propagate.c (ssa_prop_init): Initialize SSA_NAME_VALUE for every name. (first_vdef, stmt_makes_single_load, stmt_makes_single_store, get_value_loaded_by): New. (replace_uses_in, replace_vuses_in, replace_phi_args_in, substitute_and_fold): Move from tree-ssa-ccp.c. * tree-ssa-propagate.h (struct prop_value_d, prop_value_t, first_vdef, stmt_makes_single_load, stmt_makes_single_store, get_value_loaded_by, replace_uses_in, substitute_and_fold): Declare. * tree-ssa.c (verify_use): Fix error message. (propagate_into_addr, replace_immediate_uses, get_eq_name, check_phi_redundancy, kill_redundant_phi_nodes, pass_redundant_phi): Remove. Update all users. * tree-vect-transform.c (vect_create_data_ref_ptr): Call add_type_alias, if necessary. * tree-vectorizer.h (struct _stmt_vect_info): Update documentation for field 'memtag'. * tree-vrp.c: New file. * tree.def (ASSERT_EXPR): Define. * tree.h (ASSERT_EXPR_VAR): Define. (ASSERT_EXPR_COND): Define. (SSA_NAME_VALUE_RANGE): Define. (struct tree_ssa_name): Add field 'value_range'. (PHI_REWRITTEN): Remove. (struct tree_phi_node): Remove field 'rewritten'. * doc/invoke.texi (-fdump-tree-storeccp, -ftree-copy-prop, -ftree-store-copy-prop): Document. * doc/tree-ssa.texi: Remove broken link to McCAT's compiler. Document usage of update_ssa. testsuite/ChangeLog * g++.dg/tree-ssa/pr18178.C: New test. * gcc.c-torture/execute/20030216-1.x: Ignore at -O1. * gcc.c-torture/execute/20041019-1.c: New test. * gcc.dg/tree-ssa/20041008-1.c: New test. * gcc.dg/tree-ssa/ssa-ccp-12.c: New test. * gcc.dg/tree-ssa/20030731-2.c: Update to use -fdump-tree-store_ccp. * gcc.dg/tree-ssa/20030917-1.c: Likewise. * gcc.dg/tree-ssa/20030917-3.c: Likewise. * gcc.dg/tree-ssa/20040721-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-3.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-7.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-9.c: Likewise. From-SVN: r97884
2005-04-09 03:37:54 +02:00
mark_all_v_defs (list);
sra_insert_before (bsi, list);
}
list = NULL;
generate_copy_inout (lhs_elt, true,
generate_element_ref (lhs_elt), &list);
if (list)
backport: copy-prop, incremental SSA updating of FUD chains and newly exposed symbols. Merge from tree-cleanup-branch: VRP, store CCP, store copy-prop, incremental SSA updating of FUD chains and newly exposed symbols. * Makefile.in (tree-ssa-copy.o): Depend on tree-ssa-propagate.h. (OBJS-common): Add tree-vrp.o. (tree-vrp.o): New rule. * basic-block.h (nearest_common_dominator_for_set): Declare. * common.opt (ftree-store-ccp): New flag. (ftree-copy-prop): New flag. (ftree-vrp): New flag. (ftree-store-copy-prop): New flag. * dominance.c (nearest_common_dominator_for_set): New. * domwalk.c (walk_dominator_tree): Only traverse statements in blocks marked in walk_data->interesting_blocks. * domwalk.h (struct dom_walk_data): Add field interesting_blocks. * fold-const.c (fold): Handle ASSERT_EXPR. * opts.c (decode_options): Set flag_tree_copy_prop at -O1. Set flag_tree_store_ccp, flag_tree_store_copy_prop and flag_tree_vrp at -O2. * timevar.def (TV_TREE_VRP): Define. (TV_TREE_COPY_PROP): Define. (TV_TREE_STORE_COPY_PROP): Define. (TV_TREE_SSA_INCREMENTAL): Define. (TV_TREE_STORE_CCP): Define. * tree-cfg.c (tree_can_merge_blocks_p): Remove reference to kill_redundant_phi_nodes from comment. (verify_expr): Handle ASSERT_EXPR. * tree-dfa.c (mark_new_vars_to_rename): Remove second argument. Update all users. (mark_call_clobbered_vars_to_rename): Remove. Update all users. * tree-flow-inline.h (unmodifiable_var_p): New. * tree-flow.h (enum value_range_type): Declare. (struct value_range_def): Declare. (value_range): Declare. (remove_all_phi_nodes_for): Remove. Update all users. (find_phi_node_for): Declare. (add_type_alias): Declare. (count_uses_and_derefs): Declare. (kill_redundant_phi_nodes): Remove. (rewrite_into_ssa): Remove. (rewrite_def_def_chains): Remove. (update_ssa, register_new_name_mapping, create_new_def_for, need_ssa_update_p, name_registered_for_update_p, release_ssa_name_after_update_ssa, dump_repl_tbl, debug_repl_tbl, dump_names_replaced_by, debug_names_replaced_by, mark_sym_for_renaming, mark_set_for_renaming, get_current_def, set_current_def, get_value_range, dump_value_range, debug_value_range, dump_all_value_ranges, debug_all_value_ranges, expr_computes_nonzero, loop_depth_of_name, unmodifiable_var_p): Declare. * tree-gimple.c (is_gimple_formal_tmp_rhs): Handle ASSERT_EXPR. * tree-into-ssa.c (block_defs_stack): Update comment. (old_ssa_names, new_ssa_names, old_virtual_ssa_names, syms_to_rename, names_to_release, repl_tbl, need_to_initialize_update_ssa_p, need_to_update_vops_p, need_to_replace_names_p): New locals. (NAME_SETS_GROWTH_FACTOR): Define. (struct repl_map_d): Declare. (struct mark_def_sites_global_data): Add field interesting_blocks. (enum rewrite_mode): Declare. (REGISTER_DEFS_IN_THIS_STMT): Define. (compute_global_livein): Use last_basic_block instead of n_basic_blocks. (set_def_block): Remove last argument. Update all callers. (prepare_use_operand_for_rename): Remove. Update all callers. (prepare_def_operand_for_rename): Remove. Update all callers. (symbol_marked_for_renaming): New. (is_old_name): New. (is_new_name): New. (repl_map_hash): New. (repl_map_eq): New. (repl_map_free): New. (names_replaced_by): New. (add_to_repl_tbl): New. (add_new_name_mapping): New. (mark_def_sites): Assume that all the operands in the statement are in normal form. (find_idf): Assert that the block in the stack is valid. (get_default_def_for): New. (insert_phi_nodes_for): Add new argument 'update_p'. Add documentation. If update_p is true, add a new mapping between the LHS of each new PHI and the name that it replaces. (insert_phi_nodes_1): Only call find_idf if needed. (get_reaching_def): Call get_default_def_for. (rewrite_operand): Remove. (rewrite_stmt): Do nothing if REGISTER_DEFS_IN_THIS_STMT and REWRITE_THIS_STMT are false. Assume that all the operands in the statement are in normal form. (rewrite_add_phi_arguments): Don't use PHI_REWRITTEN. (rewrite_virtual_phi_arguments): Remove. (invalidate_name_tags): Remove. (register_new_update_single, register_new_update_set, rewrite_update_init_block, replace_use, rewrite_update_fini_block, rewrite_update_stmt, rewrite_update_phi_arguments): New. rewrite_blocks): Remove argument 'fix_virtual_phis'. Add arguments 'entry', 'what' and 'blocks'. Initialize the dominator walker according to 'what' and 'blocks'. Start the dominator walk at 'entry'. (mark_def_site_blocks): Add argument 'interesting_blocks'. Use it to configure the dominator walker. (rewrite_into_ssa): Remove argument 'all'. Make internal. (rewrite_all_into_ssa): Remove. (rewrite_def_def_chains): Remove. (mark_def_interesting, mark_use_interesting, prepare_phi_args_for_update, prepare_block_for_update, prepare_def_site_for, prepare_def_sites, dump_names_replaced_by, debug_names_replaced_by, dump_repl_tbl, debug_repl_tbl, init_update_ssa, delete_update_ssa, create_new_def_for, register_new_name_mapping, mark_sym_for_renaming, mark_set_for_renaming, need_ssa_update_p, name_registered_for_update_p, ssa_names_to_replace, release_ssa_name_after_update_ssa, insert_updated_phi_nodes_for, update_ssa): New. * tree-loop-linear.c (linear_transform_loops): Call update_ssa instead of rewrite_into_ssa. * tree-optimize.c (vars_to_rename): Remove. Update all users. (init_tree_optimization_passes): Replace pass_redundant_phi with pass_copy_prop. Add pass_vrp. Replace pass_ccp with pass_store_ccp. Add pass_store_copy_prop after pass_store_ccp. (execute_todo): If the TODO_ flags don't include updating the SSA form, assert that it does not need to be updated. Call update_ssa instead of rewrite_into_ssa and rewrite_def_def_chains. If TODO_verify_loops is set, call verify_loop_closed_ssa. (tree_rest_of_compilation): * tree-pass.h (TODO_dump_func, TODO_ggc_collect, TODO_verify_ssa, TODO_verify_flow, TODO_verify_stmts, TODO_cleanup_cfg): Renumber. (TODO_verify_loops, TODO_update_ssa, TODO_update_ssa_no_phi, TODO_update_ssa_full_phi, TODO_update_ssa_only_virtuals): Define. (pass_copy_prop, pass_store_ccp, pass_store_copy_prop, pass_vrp): Declare. * tree-phinodes.c (make_phi_node): Update documentation. (remove_all_phi_nodes_for): Remove. (find_phi_node_for): New. * tree-pretty-print.c (dump_generic_node): Handle ASSERT_EXPR. * tree-scalar-evolution.c (follow_ssa_edge_in_rhs): Likewise. (interpret_rhs_modify_expr): Likewise. * tree-sra.c (decide_instantiations): Mark all symbols in SRA_CANDIDATES for renaming. (mark_all_v_defs_1): Rename from mark_all_v_defs. (mark_all_v_defs): New function. Update all users to call it with the whole list of scalarized statements, not just the first one. * tree-ssa-alias.c (count_ptr_derefs): Make extern. (compute_flow_insensitive_aliasing): If the tag is unmodifiable and the variable isn't or vice-versa, don't make them alias of each other. (setup_pointers_and_addressables): If the type tag for VAR is about to change, mark the old one for renaming. (add_type_alias): New. * tree-ssa-ccp.c: Document SSA-CCP and STORE-CCP. (ccp_lattice_t): Rename from latticevalue. (value): Remove. Update all users. (const_val): New local variable. (do_store_ccp): New local variable. (dump_lattice_value): Handle UNINITIALIZED. (debug_lattice_value): New. (get_default_value): Re-write. (set_lattice_value): Re-write. (def_to_varying): Remove. Update all users. (likely_value): Return VARYING for statements that make stores when STORE_CCP is false. Return VARYING for any statement other than MODIFY_EXPR, COND_EXPR and SWITCH_EXPR. (ccp_initialize): Re-write. (replace_uses_in, replace_vuse_in, substitute_and_fold): Move to tree-ssa-propagate.c. (ccp_lattice_meet): Handle memory stores when DO_STORE_CCP is true. (ccp_visit_phi_node): Likewise. (ccp_fold): Likewise. (evaluate_stmt): Likewise. (visit_assignment): Likewise. (ccp_visit_stmt): Likewise. (execute_ssa_ccp): Add argument 'store_ccp'. Copy it into DO_STORE_CCP. (do_ssa_ccp): New. (pass_ccp): Use it. (do_ssa_store_ccp): New. (gate_store_ccp): New. (pass_store_ccp): Declare. * tree-ssa-copy.c: Include tree-ssa-propagate.h. (may_propagate_copy): Reformat. Don't abort if ORIG is a virtual and DEST isn't. If NEW does not have alias information but DEST does, copy it. (copy_of, cached_last_copy_of, do_store_copy_prop, enum copy_prop_kind, which_copy_prop): Declare. (stmt_may_generate_copy, get_copy_of_val, get_last_copy_of, set_copy_of_val, dump_copy_of, copy_prop_visit_assignment, copy_prop_visit_cond_stmt, copy_prop_visit_stmt, copy_prop_visit_phi_node, init_copy_prop, fini_copy_prop, execute_copy_prop, gate_copy_prop, do_copy_prop, gate_store_copy_prop, store_copy_prop): New. (pass_copy_prop, pass_store_copy_prop): Declare. * tree-ssa-dom.c (struct opt_stats_d): Add fields 'num_const_prop' and 'num_copy_prop'. (cprop_operand): Update them. (dump_dominator_optimization_stats): Dump them. (tree_ssa_dominator_optimize): Call update_ssa instead of rewrite_into_ssa. (loop_depth_of_name): Declare extern. (simplify_cond_and_lookup_avail_expr): Guard against NULL values for LOW or HIGH. (cprop_into_successor_phis): Only propagate if NEW != ORIG. (record_equivalences_from_stmt): Call expr_computes_nonzero. (cprop_operand): Only propagate if VAL != OP. * tree-ssa-dse.c (dse_optimize_stmt): Mark symbols in removed statement for renaming. * tree-ssa-loop-im.c (move_computations): Call update_ssa. * tree-ssa-loop-ivopts.c (rewrite_address_base): Call add_type_alias if necessary. Call mark_new_vars_to_rename. (tree_ssa_iv_optimize): If new symbols need to be renamed, mark every statement updated, call update_ssa and rewrite_into_loop_closed_ssa. * tree-ssa-loop-manip.c (add_exit_phis): Do not remove DEF_BB from LIVEIN if VAR is a virtual. * tree-ssa-loop.c (tree_loop_optimizer_init): Call update_ssa. * tree-ssa-operands.c (get_expr_operands): Handle ASSERT_EXPR. (get_call_expr_operands): Reformat statement. (add_stmt_operand): Don't create V_MAY_DEFs for read-only symbols. * tree-ssa-propagate.c (ssa_prop_init): Initialize SSA_NAME_VALUE for every name. (first_vdef, stmt_makes_single_load, stmt_makes_single_store, get_value_loaded_by): New. (replace_uses_in, replace_vuses_in, replace_phi_args_in, substitute_and_fold): Move from tree-ssa-ccp.c. * tree-ssa-propagate.h (struct prop_value_d, prop_value_t, first_vdef, stmt_makes_single_load, stmt_makes_single_store, get_value_loaded_by, replace_uses_in, substitute_and_fold): Declare. * tree-ssa.c (verify_use): Fix error message. (propagate_into_addr, replace_immediate_uses, get_eq_name, check_phi_redundancy, kill_redundant_phi_nodes, pass_redundant_phi): Remove. Update all users. * tree-vect-transform.c (vect_create_data_ref_ptr): Call add_type_alias, if necessary. * tree-vectorizer.h (struct _stmt_vect_info): Update documentation for field 'memtag'. * tree-vrp.c: New file. * tree.def (ASSERT_EXPR): Define. * tree.h (ASSERT_EXPR_VAR): Define. (ASSERT_EXPR_COND): Define. (SSA_NAME_VALUE_RANGE): Define. (struct tree_ssa_name): Add field 'value_range'. (PHI_REWRITTEN): Remove. (struct tree_phi_node): Remove field 'rewritten'. * doc/invoke.texi (-fdump-tree-storeccp, -ftree-copy-prop, -ftree-store-copy-prop): Document. * doc/tree-ssa.texi: Remove broken link to McCAT's compiler. Document usage of update_ssa. testsuite/ChangeLog * g++.dg/tree-ssa/pr18178.C: New test. * gcc.c-torture/execute/20030216-1.x: Ignore at -O1. * gcc.c-torture/execute/20041019-1.c: New test. * gcc.dg/tree-ssa/20041008-1.c: New test. * gcc.dg/tree-ssa/ssa-ccp-12.c: New test. * gcc.dg/tree-ssa/20030731-2.c: Update to use -fdump-tree-store_ccp. * gcc.dg/tree-ssa/20030917-1.c: Likewise. * gcc.dg/tree-ssa/20030917-3.c: Likewise. * gcc.dg/tree-ssa/20040721-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-3.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-7.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-9.c: Likewise. From-SVN: r97884
2005-04-09 03:37:54 +02:00
{
mark_all_v_defs (list);
sra_insert_after (bsi, list);
}
}
else
{
/* Otherwise both sides must be fully instantiated. In which
case perform pair-wise element assignments and replace the
original block copy statement. */
stmt = bsi_stmt (*bsi);
mark_all_v_defs (stmt);
list = NULL;
generate_element_copy (lhs_elt, rhs_elt, &list);
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * targhooks.c (default_unwind_emit, default_scalar_mode_supported_p): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * timevar.c (timevar_push, timevar_pop, timevar_start, timevar_stop): Likewise. * toplev.c (default_pch_valid_p): Likewise. * tracer.c (tail_duplicate): Likewise. * tree-alias-common.c (get_alias_var_decl, get_values_from_constructor, create_alias_var, delete_alias_vars, empty_points_to_set, same_points_to_set, ptr_may_alias_var): Likewise. * tree.c (tree_size, make_node_stat, copy_node_stat, build_int_cst_wide, integer_all_onesp, list_length, chainon, tree_node_structure, type_contains_placeholder_p, substitute_in_expr, substitute_placeholder_in_expr, tabilize_reference_1, build0_stat, build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p, lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr, build_method_type_directly, decl_type_context, get_callee_fndecl, get_set_constructor_bits, build_vector_type_for_mode, int_cst_value, tree_fold_gcd): Likewise. * tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges, make_cond_expr_edges, group_case_labels, tree_merge_blocks, cleanup_control_expr_graph, find_taken_edge, find_taken_edge_switch_expr, phi_alternatives_equal, is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt, stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate, tree_split_edge, tree_verify_flow_info, thread_jumps, tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise. * tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly, chrec_fold_multiply_poly_poly): Likewise. * tree-complex.c (extract_component, expand_complex_division, expand_complex_comparison, expand_complex_operations_1, build_replicated_const, expand_vector_operations_1): Likewise. * tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector, build_classic_dir_vector): Likewise. * tree-dfa.c (compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann, create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region, record_in_finally_tree, replace_goto_queue_1, maybe_record_in_goto_queue, verify_norecord_switch_expr, do_return_redirection): Likewise. * tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr, add_to_dst_predicate_list, find_phi_replacement_condition, replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order): Likewise. * tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r, initialize_inlined_parameters, declare_return_variable, estimate_num_insns_1, expand_call_inline, expand_calls_inline, optimize_inline_calls, copy_tree_r): Likewise. * tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt, ssa_rewrite_stmt, rewrite_into_ssa): Likewise. * tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after, tsi_split_statement_list_after, tsi_split_statement_list_before): Likewise. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-nested.c (create_tmp_var_for, lookup_field_for_decl, lookup_tramp_for_decl, convert_all_function_calls): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi, coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis, free_temp_expr_table, add_dependance, finish_expr, rewrite_trees): Likewise. * tree-phinodes.c (resize_phi_node, add_phi_arg, remove_all_phi_nodes_for): Likewise. * tree-pretty-print.c (op_prio, print_call_name): Likewise. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise. * tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree, sra_elt_eq, sra_walk_expr, instantiate_missing_elements, generate_one_element_ref, generate_element_copy, generate_element_zero, scalarize_copy, scalarize_init, scalarize_ldst): Likewise. * tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p, add_may_alias, add_pointed_to_expr, add_pointed_to_var, collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise. * tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise. * tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value, set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment, widen_bitfield, ccp_fold_builtin): Likewise. * tree-ssa-copy.c (may_propagate_copy, merge_alias_info, replace_exp_1, propagate_tree_value): Likewise. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. * tree-ssa-dce.c (set_control_dependence_map_bit, find_control_dependence, find_pdom, mark_operand_necessary, mark_stmt_if_obviously_necessary, mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise. * tree-ssa-dom.c (dom_opt_initialize_block_local_data, simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis, eliminate_redundant_computations, avail_expr_eq): Likewise. * tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, duplicate_blocks): Likewise. * tree-ssa-loop-im.c (for_each_index, set_level, is_call_clobbered_ref): Likewise. * tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos, stmt_after_increment, set_iv, contains_abnormal_ssa_name_p, find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates, peel_address, ptr_difference_cost, may_replace_final_value, determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer, rewrite_use, rewrite_uses): Likewise. * tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa, check_loop_closed_ssa_use): Likewise. * tree-ssanames.c (make_ssa_name): Likewise. * tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses, finalize_ssa_v_must_defs, finalize_ssa_stmt_operands, get_stmt_operands, get_expr_operands, get_asm_expr_operands, get_indirect_ref_operands, add_stmt_operand): Likewise. * tree-ssa-pre.c (value_exists_in_set_bitmap, value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set, phi_translate, valid_in_set, compute_antic, find_or_generate_expression, create_expression_by_pieces, insert_aux, create_value_expr_from, eliminate): Likewise. * tree-ssa-propagate.c (cfg_blocks_get): Likewise. * tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges): Likewise. * tree-tailcall.c (independent_of_stmt_p, adjust_return_value, eliminate_tail_call): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_align_data_ref, vect_create_data_ref, vect_create_destination_var, vect_get_vec_def_for_operand, vect_finish_stmt_generation, vect_transform_stmt, vect_transform_loop_bound, vect_transform_loop, vect_analyze_operations): Likewise. * tree-vn.c (vn_compute, set_value_handle, get_value_handle): Likewise. * tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr, get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start, bsi_after_labels, bsi_last): Likewise. * tree-ssa-live.c (var_union, change_partition_var, create_ssa_var_map, calculate_live_on_entry, root_var_init, type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce): Likewise. * tree-ssa-live.h (partition_is_global, live_entry_blocks, tpa_find_tree): Likewise. (register_ssa_partition_check): Declare. (register_ssa_partition): use it. * tree-ssa-live.c: Include errors.h. (register_ssa_partition_check): New. * tree-ssa-operands.c: Include errors.h. * Makefile.in (tree-ssa-operands.o): Depend on errors.h. Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> From-SVN: r87223
2004-09-09 09:54:12 +02:00
gcc_assert (list);
backport: copy-prop, incremental SSA updating of FUD chains and newly exposed symbols. Merge from tree-cleanup-branch: VRP, store CCP, store copy-prop, incremental SSA updating of FUD chains and newly exposed symbols. * Makefile.in (tree-ssa-copy.o): Depend on tree-ssa-propagate.h. (OBJS-common): Add tree-vrp.o. (tree-vrp.o): New rule. * basic-block.h (nearest_common_dominator_for_set): Declare. * common.opt (ftree-store-ccp): New flag. (ftree-copy-prop): New flag. (ftree-vrp): New flag. (ftree-store-copy-prop): New flag. * dominance.c (nearest_common_dominator_for_set): New. * domwalk.c (walk_dominator_tree): Only traverse statements in blocks marked in walk_data->interesting_blocks. * domwalk.h (struct dom_walk_data): Add field interesting_blocks. * fold-const.c (fold): Handle ASSERT_EXPR. * opts.c (decode_options): Set flag_tree_copy_prop at -O1. Set flag_tree_store_ccp, flag_tree_store_copy_prop and flag_tree_vrp at -O2. * timevar.def (TV_TREE_VRP): Define. (TV_TREE_COPY_PROP): Define. (TV_TREE_STORE_COPY_PROP): Define. (TV_TREE_SSA_INCREMENTAL): Define. (TV_TREE_STORE_CCP): Define. * tree-cfg.c (tree_can_merge_blocks_p): Remove reference to kill_redundant_phi_nodes from comment. (verify_expr): Handle ASSERT_EXPR. * tree-dfa.c (mark_new_vars_to_rename): Remove second argument. Update all users. (mark_call_clobbered_vars_to_rename): Remove. Update all users. * tree-flow-inline.h (unmodifiable_var_p): New. * tree-flow.h (enum value_range_type): Declare. (struct value_range_def): Declare. (value_range): Declare. (remove_all_phi_nodes_for): Remove. Update all users. (find_phi_node_for): Declare. (add_type_alias): Declare. (count_uses_and_derefs): Declare. (kill_redundant_phi_nodes): Remove. (rewrite_into_ssa): Remove. (rewrite_def_def_chains): Remove. (update_ssa, register_new_name_mapping, create_new_def_for, need_ssa_update_p, name_registered_for_update_p, release_ssa_name_after_update_ssa, dump_repl_tbl, debug_repl_tbl, dump_names_replaced_by, debug_names_replaced_by, mark_sym_for_renaming, mark_set_for_renaming, get_current_def, set_current_def, get_value_range, dump_value_range, debug_value_range, dump_all_value_ranges, debug_all_value_ranges, expr_computes_nonzero, loop_depth_of_name, unmodifiable_var_p): Declare. * tree-gimple.c (is_gimple_formal_tmp_rhs): Handle ASSERT_EXPR. * tree-into-ssa.c (block_defs_stack): Update comment. (old_ssa_names, new_ssa_names, old_virtual_ssa_names, syms_to_rename, names_to_release, repl_tbl, need_to_initialize_update_ssa_p, need_to_update_vops_p, need_to_replace_names_p): New locals. (NAME_SETS_GROWTH_FACTOR): Define. (struct repl_map_d): Declare. (struct mark_def_sites_global_data): Add field interesting_blocks. (enum rewrite_mode): Declare. (REGISTER_DEFS_IN_THIS_STMT): Define. (compute_global_livein): Use last_basic_block instead of n_basic_blocks. (set_def_block): Remove last argument. Update all callers. (prepare_use_operand_for_rename): Remove. Update all callers. (prepare_def_operand_for_rename): Remove. Update all callers. (symbol_marked_for_renaming): New. (is_old_name): New. (is_new_name): New. (repl_map_hash): New. (repl_map_eq): New. (repl_map_free): New. (names_replaced_by): New. (add_to_repl_tbl): New. (add_new_name_mapping): New. (mark_def_sites): Assume that all the operands in the statement are in normal form. (find_idf): Assert that the block in the stack is valid. (get_default_def_for): New. (insert_phi_nodes_for): Add new argument 'update_p'. Add documentation. If update_p is true, add a new mapping between the LHS of each new PHI and the name that it replaces. (insert_phi_nodes_1): Only call find_idf if needed. (get_reaching_def): Call get_default_def_for. (rewrite_operand): Remove. (rewrite_stmt): Do nothing if REGISTER_DEFS_IN_THIS_STMT and REWRITE_THIS_STMT are false. Assume that all the operands in the statement are in normal form. (rewrite_add_phi_arguments): Don't use PHI_REWRITTEN. (rewrite_virtual_phi_arguments): Remove. (invalidate_name_tags): Remove. (register_new_update_single, register_new_update_set, rewrite_update_init_block, replace_use, rewrite_update_fini_block, rewrite_update_stmt, rewrite_update_phi_arguments): New. rewrite_blocks): Remove argument 'fix_virtual_phis'. Add arguments 'entry', 'what' and 'blocks'. Initialize the dominator walker according to 'what' and 'blocks'. Start the dominator walk at 'entry'. (mark_def_site_blocks): Add argument 'interesting_blocks'. Use it to configure the dominator walker. (rewrite_into_ssa): Remove argument 'all'. Make internal. (rewrite_all_into_ssa): Remove. (rewrite_def_def_chains): Remove. (mark_def_interesting, mark_use_interesting, prepare_phi_args_for_update, prepare_block_for_update, prepare_def_site_for, prepare_def_sites, dump_names_replaced_by, debug_names_replaced_by, dump_repl_tbl, debug_repl_tbl, init_update_ssa, delete_update_ssa, create_new_def_for, register_new_name_mapping, mark_sym_for_renaming, mark_set_for_renaming, need_ssa_update_p, name_registered_for_update_p, ssa_names_to_replace, release_ssa_name_after_update_ssa, insert_updated_phi_nodes_for, update_ssa): New. * tree-loop-linear.c (linear_transform_loops): Call update_ssa instead of rewrite_into_ssa. * tree-optimize.c (vars_to_rename): Remove. Update all users. (init_tree_optimization_passes): Replace pass_redundant_phi with pass_copy_prop. Add pass_vrp. Replace pass_ccp with pass_store_ccp. Add pass_store_copy_prop after pass_store_ccp. (execute_todo): If the TODO_ flags don't include updating the SSA form, assert that it does not need to be updated. Call update_ssa instead of rewrite_into_ssa and rewrite_def_def_chains. If TODO_verify_loops is set, call verify_loop_closed_ssa. (tree_rest_of_compilation): * tree-pass.h (TODO_dump_func, TODO_ggc_collect, TODO_verify_ssa, TODO_verify_flow, TODO_verify_stmts, TODO_cleanup_cfg): Renumber. (TODO_verify_loops, TODO_update_ssa, TODO_update_ssa_no_phi, TODO_update_ssa_full_phi, TODO_update_ssa_only_virtuals): Define. (pass_copy_prop, pass_store_ccp, pass_store_copy_prop, pass_vrp): Declare. * tree-phinodes.c (make_phi_node): Update documentation. (remove_all_phi_nodes_for): Remove. (find_phi_node_for): New. * tree-pretty-print.c (dump_generic_node): Handle ASSERT_EXPR. * tree-scalar-evolution.c (follow_ssa_edge_in_rhs): Likewise. (interpret_rhs_modify_expr): Likewise. * tree-sra.c (decide_instantiations): Mark all symbols in SRA_CANDIDATES for renaming. (mark_all_v_defs_1): Rename from mark_all_v_defs. (mark_all_v_defs): New function. Update all users to call it with the whole list of scalarized statements, not just the first one. * tree-ssa-alias.c (count_ptr_derefs): Make extern. (compute_flow_insensitive_aliasing): If the tag is unmodifiable and the variable isn't or vice-versa, don't make them alias of each other. (setup_pointers_and_addressables): If the type tag for VAR is about to change, mark the old one for renaming. (add_type_alias): New. * tree-ssa-ccp.c: Document SSA-CCP and STORE-CCP. (ccp_lattice_t): Rename from latticevalue. (value): Remove. Update all users. (const_val): New local variable. (do_store_ccp): New local variable. (dump_lattice_value): Handle UNINITIALIZED. (debug_lattice_value): New. (get_default_value): Re-write. (set_lattice_value): Re-write. (def_to_varying): Remove. Update all users. (likely_value): Return VARYING for statements that make stores when STORE_CCP is false. Return VARYING for any statement other than MODIFY_EXPR, COND_EXPR and SWITCH_EXPR. (ccp_initialize): Re-write. (replace_uses_in, replace_vuse_in, substitute_and_fold): Move to tree-ssa-propagate.c. (ccp_lattice_meet): Handle memory stores when DO_STORE_CCP is true. (ccp_visit_phi_node): Likewise. (ccp_fold): Likewise. (evaluate_stmt): Likewise. (visit_assignment): Likewise. (ccp_visit_stmt): Likewise. (execute_ssa_ccp): Add argument 'store_ccp'. Copy it into DO_STORE_CCP. (do_ssa_ccp): New. (pass_ccp): Use it. (do_ssa_store_ccp): New. (gate_store_ccp): New. (pass_store_ccp): Declare. * tree-ssa-copy.c: Include tree-ssa-propagate.h. (may_propagate_copy): Reformat. Don't abort if ORIG is a virtual and DEST isn't. If NEW does not have alias information but DEST does, copy it. (copy_of, cached_last_copy_of, do_store_copy_prop, enum copy_prop_kind, which_copy_prop): Declare. (stmt_may_generate_copy, get_copy_of_val, get_last_copy_of, set_copy_of_val, dump_copy_of, copy_prop_visit_assignment, copy_prop_visit_cond_stmt, copy_prop_visit_stmt, copy_prop_visit_phi_node, init_copy_prop, fini_copy_prop, execute_copy_prop, gate_copy_prop, do_copy_prop, gate_store_copy_prop, store_copy_prop): New. (pass_copy_prop, pass_store_copy_prop): Declare. * tree-ssa-dom.c (struct opt_stats_d): Add fields 'num_const_prop' and 'num_copy_prop'. (cprop_operand): Update them. (dump_dominator_optimization_stats): Dump them. (tree_ssa_dominator_optimize): Call update_ssa instead of rewrite_into_ssa. (loop_depth_of_name): Declare extern. (simplify_cond_and_lookup_avail_expr): Guard against NULL values for LOW or HIGH. (cprop_into_successor_phis): Only propagate if NEW != ORIG. (record_equivalences_from_stmt): Call expr_computes_nonzero. (cprop_operand): Only propagate if VAL != OP. * tree-ssa-dse.c (dse_optimize_stmt): Mark symbols in removed statement for renaming. * tree-ssa-loop-im.c (move_computations): Call update_ssa. * tree-ssa-loop-ivopts.c (rewrite_address_base): Call add_type_alias if necessary. Call mark_new_vars_to_rename. (tree_ssa_iv_optimize): If new symbols need to be renamed, mark every statement updated, call update_ssa and rewrite_into_loop_closed_ssa. * tree-ssa-loop-manip.c (add_exit_phis): Do not remove DEF_BB from LIVEIN if VAR is a virtual. * tree-ssa-loop.c (tree_loop_optimizer_init): Call update_ssa. * tree-ssa-operands.c (get_expr_operands): Handle ASSERT_EXPR. (get_call_expr_operands): Reformat statement. (add_stmt_operand): Don't create V_MAY_DEFs for read-only symbols. * tree-ssa-propagate.c (ssa_prop_init): Initialize SSA_NAME_VALUE for every name. (first_vdef, stmt_makes_single_load, stmt_makes_single_store, get_value_loaded_by): New. (replace_uses_in, replace_vuses_in, replace_phi_args_in, substitute_and_fold): Move from tree-ssa-ccp.c. * tree-ssa-propagate.h (struct prop_value_d, prop_value_t, first_vdef, stmt_makes_single_load, stmt_makes_single_store, get_value_loaded_by, replace_uses_in, substitute_and_fold): Declare. * tree-ssa.c (verify_use): Fix error message. (propagate_into_addr, replace_immediate_uses, get_eq_name, check_phi_redundancy, kill_redundant_phi_nodes, pass_redundant_phi): Remove. Update all users. * tree-vect-transform.c (vect_create_data_ref_ptr): Call add_type_alias, if necessary. * tree-vectorizer.h (struct _stmt_vect_info): Update documentation for field 'memtag'. * tree-vrp.c: New file. * tree.def (ASSERT_EXPR): Define. * tree.h (ASSERT_EXPR_VAR): Define. (ASSERT_EXPR_COND): Define. (SSA_NAME_VALUE_RANGE): Define. (struct tree_ssa_name): Add field 'value_range'. (PHI_REWRITTEN): Remove. (struct tree_phi_node): Remove field 'rewritten'. * doc/invoke.texi (-fdump-tree-storeccp, -ftree-copy-prop, -ftree-store-copy-prop): Document. * doc/tree-ssa.texi: Remove broken link to McCAT's compiler. Document usage of update_ssa. testsuite/ChangeLog * g++.dg/tree-ssa/pr18178.C: New test. * gcc.c-torture/execute/20030216-1.x: Ignore at -O1. * gcc.c-torture/execute/20041019-1.c: New test. * gcc.dg/tree-ssa/20041008-1.c: New test. * gcc.dg/tree-ssa/ssa-ccp-12.c: New test. * gcc.dg/tree-ssa/20030731-2.c: Update to use -fdump-tree-store_ccp. * gcc.dg/tree-ssa/20030917-1.c: Likewise. * gcc.dg/tree-ssa/20030917-3.c: Likewise. * gcc.dg/tree-ssa/20040721-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-3.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-7.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-9.c: Likewise. From-SVN: r97884
2005-04-09 03:37:54 +02:00
mark_all_v_defs (list);
sra_replace (bsi, list);
}
}
/* Scalarize an INIT. To recap, this is an assignment to a scalarizable
reference from some form of constructor: CONSTRUCTOR, COMPLEX_CST or
COMPLEX_EXPR. If RHS is NULL, it should be treated as an empty
CONSTRUCTOR. */
static void
scalarize_init (struct sra_elt *lhs_elt, tree rhs, block_stmt_iterator *bsi)
{
bool result = true;
tree list = NULL;
/* Generate initialization statements for all members extant in the RHS. */
if (rhs)
{
/* Unshare the expression just in case this is from a decl's initial. */
rhs = unshare_expr (rhs);
result = generate_element_init (lhs_elt, rhs, &list);
}
/* CONSTRUCTOR is defined such that any member not mentioned is assigned
a zero value. Initialize the rest of the instantiated elements. */
generate_element_zero (lhs_elt, &list);
if (!result)
{
/* If we failed to convert the entire initializer, then we must
leave the structure assignment in place and must load values
from the structure into the slots for which we did not find
constants. The easiest way to do this is to generate a complete
copy-out, and then follow that with the constant assignments
that we were able to build. DCE will clean things up. */
tree list0 = NULL;
generate_copy_inout (lhs_elt, true, generate_element_ref (lhs_elt),
&list0);
append_to_statement_list (list, &list0);
list = list0;
}
if (lhs_elt->use_block_copy || !result)
{
/* Since LHS is not fully instantiated, we must leave the structure
assignment in place. Treating this case differently from a USE
exposes constants to later optimizations. */
if (list)
{
backport: copy-prop, incremental SSA updating of FUD chains and newly exposed symbols. Merge from tree-cleanup-branch: VRP, store CCP, store copy-prop, incremental SSA updating of FUD chains and newly exposed symbols. * Makefile.in (tree-ssa-copy.o): Depend on tree-ssa-propagate.h. (OBJS-common): Add tree-vrp.o. (tree-vrp.o): New rule. * basic-block.h (nearest_common_dominator_for_set): Declare. * common.opt (ftree-store-ccp): New flag. (ftree-copy-prop): New flag. (ftree-vrp): New flag. (ftree-store-copy-prop): New flag. * dominance.c (nearest_common_dominator_for_set): New. * domwalk.c (walk_dominator_tree): Only traverse statements in blocks marked in walk_data->interesting_blocks. * domwalk.h (struct dom_walk_data): Add field interesting_blocks. * fold-const.c (fold): Handle ASSERT_EXPR. * opts.c (decode_options): Set flag_tree_copy_prop at -O1. Set flag_tree_store_ccp, flag_tree_store_copy_prop and flag_tree_vrp at -O2. * timevar.def (TV_TREE_VRP): Define. (TV_TREE_COPY_PROP): Define. (TV_TREE_STORE_COPY_PROP): Define. (TV_TREE_SSA_INCREMENTAL): Define. (TV_TREE_STORE_CCP): Define. * tree-cfg.c (tree_can_merge_blocks_p): Remove reference to kill_redundant_phi_nodes from comment. (verify_expr): Handle ASSERT_EXPR. * tree-dfa.c (mark_new_vars_to_rename): Remove second argument. Update all users. (mark_call_clobbered_vars_to_rename): Remove. Update all users. * tree-flow-inline.h (unmodifiable_var_p): New. * tree-flow.h (enum value_range_type): Declare. (struct value_range_def): Declare. (value_range): Declare. (remove_all_phi_nodes_for): Remove. Update all users. (find_phi_node_for): Declare. (add_type_alias): Declare. (count_uses_and_derefs): Declare. (kill_redundant_phi_nodes): Remove. (rewrite_into_ssa): Remove. (rewrite_def_def_chains): Remove. (update_ssa, register_new_name_mapping, create_new_def_for, need_ssa_update_p, name_registered_for_update_p, release_ssa_name_after_update_ssa, dump_repl_tbl, debug_repl_tbl, dump_names_replaced_by, debug_names_replaced_by, mark_sym_for_renaming, mark_set_for_renaming, get_current_def, set_current_def, get_value_range, dump_value_range, debug_value_range, dump_all_value_ranges, debug_all_value_ranges, expr_computes_nonzero, loop_depth_of_name, unmodifiable_var_p): Declare. * tree-gimple.c (is_gimple_formal_tmp_rhs): Handle ASSERT_EXPR. * tree-into-ssa.c (block_defs_stack): Update comment. (old_ssa_names, new_ssa_names, old_virtual_ssa_names, syms_to_rename, names_to_release, repl_tbl, need_to_initialize_update_ssa_p, need_to_update_vops_p, need_to_replace_names_p): New locals. (NAME_SETS_GROWTH_FACTOR): Define. (struct repl_map_d): Declare. (struct mark_def_sites_global_data): Add field interesting_blocks. (enum rewrite_mode): Declare. (REGISTER_DEFS_IN_THIS_STMT): Define. (compute_global_livein): Use last_basic_block instead of n_basic_blocks. (set_def_block): Remove last argument. Update all callers. (prepare_use_operand_for_rename): Remove. Update all callers. (prepare_def_operand_for_rename): Remove. Update all callers. (symbol_marked_for_renaming): New. (is_old_name): New. (is_new_name): New. (repl_map_hash): New. (repl_map_eq): New. (repl_map_free): New. (names_replaced_by): New. (add_to_repl_tbl): New. (add_new_name_mapping): New. (mark_def_sites): Assume that all the operands in the statement are in normal form. (find_idf): Assert that the block in the stack is valid. (get_default_def_for): New. (insert_phi_nodes_for): Add new argument 'update_p'. Add documentation. If update_p is true, add a new mapping between the LHS of each new PHI and the name that it replaces. (insert_phi_nodes_1): Only call find_idf if needed. (get_reaching_def): Call get_default_def_for. (rewrite_operand): Remove. (rewrite_stmt): Do nothing if REGISTER_DEFS_IN_THIS_STMT and REWRITE_THIS_STMT are false. Assume that all the operands in the statement are in normal form. (rewrite_add_phi_arguments): Don't use PHI_REWRITTEN. (rewrite_virtual_phi_arguments): Remove. (invalidate_name_tags): Remove. (register_new_update_single, register_new_update_set, rewrite_update_init_block, replace_use, rewrite_update_fini_block, rewrite_update_stmt, rewrite_update_phi_arguments): New. rewrite_blocks): Remove argument 'fix_virtual_phis'. Add arguments 'entry', 'what' and 'blocks'. Initialize the dominator walker according to 'what' and 'blocks'. Start the dominator walk at 'entry'. (mark_def_site_blocks): Add argument 'interesting_blocks'. Use it to configure the dominator walker. (rewrite_into_ssa): Remove argument 'all'. Make internal. (rewrite_all_into_ssa): Remove. (rewrite_def_def_chains): Remove. (mark_def_interesting, mark_use_interesting, prepare_phi_args_for_update, prepare_block_for_update, prepare_def_site_for, prepare_def_sites, dump_names_replaced_by, debug_names_replaced_by, dump_repl_tbl, debug_repl_tbl, init_update_ssa, delete_update_ssa, create_new_def_for, register_new_name_mapping, mark_sym_for_renaming, mark_set_for_renaming, need_ssa_update_p, name_registered_for_update_p, ssa_names_to_replace, release_ssa_name_after_update_ssa, insert_updated_phi_nodes_for, update_ssa): New. * tree-loop-linear.c (linear_transform_loops): Call update_ssa instead of rewrite_into_ssa. * tree-optimize.c (vars_to_rename): Remove. Update all users. (init_tree_optimization_passes): Replace pass_redundant_phi with pass_copy_prop. Add pass_vrp. Replace pass_ccp with pass_store_ccp. Add pass_store_copy_prop after pass_store_ccp. (execute_todo): If the TODO_ flags don't include updating the SSA form, assert that it does not need to be updated. Call update_ssa instead of rewrite_into_ssa and rewrite_def_def_chains. If TODO_verify_loops is set, call verify_loop_closed_ssa. (tree_rest_of_compilation): * tree-pass.h (TODO_dump_func, TODO_ggc_collect, TODO_verify_ssa, TODO_verify_flow, TODO_verify_stmts, TODO_cleanup_cfg): Renumber. (TODO_verify_loops, TODO_update_ssa, TODO_update_ssa_no_phi, TODO_update_ssa_full_phi, TODO_update_ssa_only_virtuals): Define. (pass_copy_prop, pass_store_ccp, pass_store_copy_prop, pass_vrp): Declare. * tree-phinodes.c (make_phi_node): Update documentation. (remove_all_phi_nodes_for): Remove. (find_phi_node_for): New. * tree-pretty-print.c (dump_generic_node): Handle ASSERT_EXPR. * tree-scalar-evolution.c (follow_ssa_edge_in_rhs): Likewise. (interpret_rhs_modify_expr): Likewise. * tree-sra.c (decide_instantiations): Mark all symbols in SRA_CANDIDATES for renaming. (mark_all_v_defs_1): Rename from mark_all_v_defs. (mark_all_v_defs): New function. Update all users to call it with the whole list of scalarized statements, not just the first one. * tree-ssa-alias.c (count_ptr_derefs): Make extern. (compute_flow_insensitive_aliasing): If the tag is unmodifiable and the variable isn't or vice-versa, don't make them alias of each other. (setup_pointers_and_addressables): If the type tag for VAR is about to change, mark the old one for renaming. (add_type_alias): New. * tree-ssa-ccp.c: Document SSA-CCP and STORE-CCP. (ccp_lattice_t): Rename from latticevalue. (value): Remove. Update all users. (const_val): New local variable. (do_store_ccp): New local variable. (dump_lattice_value): Handle UNINITIALIZED. (debug_lattice_value): New. (get_default_value): Re-write. (set_lattice_value): Re-write. (def_to_varying): Remove. Update all users. (likely_value): Return VARYING for statements that make stores when STORE_CCP is false. Return VARYING for any statement other than MODIFY_EXPR, COND_EXPR and SWITCH_EXPR. (ccp_initialize): Re-write. (replace_uses_in, replace_vuse_in, substitute_and_fold): Move to tree-ssa-propagate.c. (ccp_lattice_meet): Handle memory stores when DO_STORE_CCP is true. (ccp_visit_phi_node): Likewise. (ccp_fold): Likewise. (evaluate_stmt): Likewise. (visit_assignment): Likewise. (ccp_visit_stmt): Likewise. (execute_ssa_ccp): Add argument 'store_ccp'. Copy it into DO_STORE_CCP. (do_ssa_ccp): New. (pass_ccp): Use it. (do_ssa_store_ccp): New. (gate_store_ccp): New. (pass_store_ccp): Declare. * tree-ssa-copy.c: Include tree-ssa-propagate.h. (may_propagate_copy): Reformat. Don't abort if ORIG is a virtual and DEST isn't. If NEW does not have alias information but DEST does, copy it. (copy_of, cached_last_copy_of, do_store_copy_prop, enum copy_prop_kind, which_copy_prop): Declare. (stmt_may_generate_copy, get_copy_of_val, get_last_copy_of, set_copy_of_val, dump_copy_of, copy_prop_visit_assignment, copy_prop_visit_cond_stmt, copy_prop_visit_stmt, copy_prop_visit_phi_node, init_copy_prop, fini_copy_prop, execute_copy_prop, gate_copy_prop, do_copy_prop, gate_store_copy_prop, store_copy_prop): New. (pass_copy_prop, pass_store_copy_prop): Declare. * tree-ssa-dom.c (struct opt_stats_d): Add fields 'num_const_prop' and 'num_copy_prop'. (cprop_operand): Update them. (dump_dominator_optimization_stats): Dump them. (tree_ssa_dominator_optimize): Call update_ssa instead of rewrite_into_ssa. (loop_depth_of_name): Declare extern. (simplify_cond_and_lookup_avail_expr): Guard against NULL values for LOW or HIGH. (cprop_into_successor_phis): Only propagate if NEW != ORIG. (record_equivalences_from_stmt): Call expr_computes_nonzero. (cprop_operand): Only propagate if VAL != OP. * tree-ssa-dse.c (dse_optimize_stmt): Mark symbols in removed statement for renaming. * tree-ssa-loop-im.c (move_computations): Call update_ssa. * tree-ssa-loop-ivopts.c (rewrite_address_base): Call add_type_alias if necessary. Call mark_new_vars_to_rename. (tree_ssa_iv_optimize): If new symbols need to be renamed, mark every statement updated, call update_ssa and rewrite_into_loop_closed_ssa. * tree-ssa-loop-manip.c (add_exit_phis): Do not remove DEF_BB from LIVEIN if VAR is a virtual. * tree-ssa-loop.c (tree_loop_optimizer_init): Call update_ssa. * tree-ssa-operands.c (get_expr_operands): Handle ASSERT_EXPR. (get_call_expr_operands): Reformat statement. (add_stmt_operand): Don't create V_MAY_DEFs for read-only symbols. * tree-ssa-propagate.c (ssa_prop_init): Initialize SSA_NAME_VALUE for every name. (first_vdef, stmt_makes_single_load, stmt_makes_single_store, get_value_loaded_by): New. (replace_uses_in, replace_vuses_in, replace_phi_args_in, substitute_and_fold): Move from tree-ssa-ccp.c. * tree-ssa-propagate.h (struct prop_value_d, prop_value_t, first_vdef, stmt_makes_single_load, stmt_makes_single_store, get_value_loaded_by, replace_uses_in, substitute_and_fold): Declare. * tree-ssa.c (verify_use): Fix error message. (propagate_into_addr, replace_immediate_uses, get_eq_name, check_phi_redundancy, kill_redundant_phi_nodes, pass_redundant_phi): Remove. Update all users. * tree-vect-transform.c (vect_create_data_ref_ptr): Call add_type_alias, if necessary. * tree-vectorizer.h (struct _stmt_vect_info): Update documentation for field 'memtag'. * tree-vrp.c: New file. * tree.def (ASSERT_EXPR): Define. * tree.h (ASSERT_EXPR_VAR): Define. (ASSERT_EXPR_COND): Define. (SSA_NAME_VALUE_RANGE): Define. (struct tree_ssa_name): Add field 'value_range'. (PHI_REWRITTEN): Remove. (struct tree_phi_node): Remove field 'rewritten'. * doc/invoke.texi (-fdump-tree-storeccp, -ftree-copy-prop, -ftree-store-copy-prop): Document. * doc/tree-ssa.texi: Remove broken link to McCAT's compiler. Document usage of update_ssa. testsuite/ChangeLog * g++.dg/tree-ssa/pr18178.C: New test. * gcc.c-torture/execute/20030216-1.x: Ignore at -O1. * gcc.c-torture/execute/20041019-1.c: New test. * gcc.dg/tree-ssa/20041008-1.c: New test. * gcc.dg/tree-ssa/ssa-ccp-12.c: New test. * gcc.dg/tree-ssa/20030731-2.c: Update to use -fdump-tree-store_ccp. * gcc.dg/tree-ssa/20030917-1.c: Likewise. * gcc.dg/tree-ssa/20030917-3.c: Likewise. * gcc.dg/tree-ssa/20040721-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-3.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-7.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-9.c: Likewise. From-SVN: r97884
2005-04-09 03:37:54 +02:00
mark_all_v_defs (list);
sra_insert_after (bsi, list);
}
}
else
{
/* The LHS is fully instantiated. The list of initializations
replaces the original structure assignment. */
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * targhooks.c (default_unwind_emit, default_scalar_mode_supported_p): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * timevar.c (timevar_push, timevar_pop, timevar_start, timevar_stop): Likewise. * toplev.c (default_pch_valid_p): Likewise. * tracer.c (tail_duplicate): Likewise. * tree-alias-common.c (get_alias_var_decl, get_values_from_constructor, create_alias_var, delete_alias_vars, empty_points_to_set, same_points_to_set, ptr_may_alias_var): Likewise. * tree.c (tree_size, make_node_stat, copy_node_stat, build_int_cst_wide, integer_all_onesp, list_length, chainon, tree_node_structure, type_contains_placeholder_p, substitute_in_expr, substitute_placeholder_in_expr, tabilize_reference_1, build0_stat, build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p, lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr, build_method_type_directly, decl_type_context, get_callee_fndecl, get_set_constructor_bits, build_vector_type_for_mode, int_cst_value, tree_fold_gcd): Likewise. * tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges, make_cond_expr_edges, group_case_labels, tree_merge_blocks, cleanup_control_expr_graph, find_taken_edge, find_taken_edge_switch_expr, phi_alternatives_equal, is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt, stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate, tree_split_edge, tree_verify_flow_info, thread_jumps, tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise. * tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly, chrec_fold_multiply_poly_poly): Likewise. * tree-complex.c (extract_component, expand_complex_division, expand_complex_comparison, expand_complex_operations_1, build_replicated_const, expand_vector_operations_1): Likewise. * tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector, build_classic_dir_vector): Likewise. * tree-dfa.c (compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann, create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region, record_in_finally_tree, replace_goto_queue_1, maybe_record_in_goto_queue, verify_norecord_switch_expr, do_return_redirection): Likewise. * tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr, add_to_dst_predicate_list, find_phi_replacement_condition, replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order): Likewise. * tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r, initialize_inlined_parameters, declare_return_variable, estimate_num_insns_1, expand_call_inline, expand_calls_inline, optimize_inline_calls, copy_tree_r): Likewise. * tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt, ssa_rewrite_stmt, rewrite_into_ssa): Likewise. * tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after, tsi_split_statement_list_after, tsi_split_statement_list_before): Likewise. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-nested.c (create_tmp_var_for, lookup_field_for_decl, lookup_tramp_for_decl, convert_all_function_calls): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi, coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis, free_temp_expr_table, add_dependance, finish_expr, rewrite_trees): Likewise. * tree-phinodes.c (resize_phi_node, add_phi_arg, remove_all_phi_nodes_for): Likewise. * tree-pretty-print.c (op_prio, print_call_name): Likewise. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise. * tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree, sra_elt_eq, sra_walk_expr, instantiate_missing_elements, generate_one_element_ref, generate_element_copy, generate_element_zero, scalarize_copy, scalarize_init, scalarize_ldst): Likewise. * tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p, add_may_alias, add_pointed_to_expr, add_pointed_to_var, collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise. * tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise. * tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value, set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment, widen_bitfield, ccp_fold_builtin): Likewise. * tree-ssa-copy.c (may_propagate_copy, merge_alias_info, replace_exp_1, propagate_tree_value): Likewise. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. * tree-ssa-dce.c (set_control_dependence_map_bit, find_control_dependence, find_pdom, mark_operand_necessary, mark_stmt_if_obviously_necessary, mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise. * tree-ssa-dom.c (dom_opt_initialize_block_local_data, simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis, eliminate_redundant_computations, avail_expr_eq): Likewise. * tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, duplicate_blocks): Likewise. * tree-ssa-loop-im.c (for_each_index, set_level, is_call_clobbered_ref): Likewise. * tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos, stmt_after_increment, set_iv, contains_abnormal_ssa_name_p, find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates, peel_address, ptr_difference_cost, may_replace_final_value, determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer, rewrite_use, rewrite_uses): Likewise. * tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa, check_loop_closed_ssa_use): Likewise. * tree-ssanames.c (make_ssa_name): Likewise. * tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses, finalize_ssa_v_must_defs, finalize_ssa_stmt_operands, get_stmt_operands, get_expr_operands, get_asm_expr_operands, get_indirect_ref_operands, add_stmt_operand): Likewise. * tree-ssa-pre.c (value_exists_in_set_bitmap, value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set, phi_translate, valid_in_set, compute_antic, find_or_generate_expression, create_expression_by_pieces, insert_aux, create_value_expr_from, eliminate): Likewise. * tree-ssa-propagate.c (cfg_blocks_get): Likewise. * tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges): Likewise. * tree-tailcall.c (independent_of_stmt_p, adjust_return_value, eliminate_tail_call): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_align_data_ref, vect_create_data_ref, vect_create_destination_var, vect_get_vec_def_for_operand, vect_finish_stmt_generation, vect_transform_stmt, vect_transform_loop_bound, vect_transform_loop, vect_analyze_operations): Likewise. * tree-vn.c (vn_compute, set_value_handle, get_value_handle): Likewise. * tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr, get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start, bsi_after_labels, bsi_last): Likewise. * tree-ssa-live.c (var_union, change_partition_var, create_ssa_var_map, calculate_live_on_entry, root_var_init, type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce): Likewise. * tree-ssa-live.h (partition_is_global, live_entry_blocks, tpa_find_tree): Likewise. (register_ssa_partition_check): Declare. (register_ssa_partition): use it. * tree-ssa-live.c: Include errors.h. (register_ssa_partition_check): New. * tree-ssa-operands.c: Include errors.h. * Makefile.in (tree-ssa-operands.o): Depend on errors.h. Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> From-SVN: r87223
2004-09-09 09:54:12 +02:00
gcc_assert (list);
mark_all_v_defs (bsi_stmt (*bsi));
backport: copy-prop, incremental SSA updating of FUD chains and newly exposed symbols. Merge from tree-cleanup-branch: VRP, store CCP, store copy-prop, incremental SSA updating of FUD chains and newly exposed symbols. * Makefile.in (tree-ssa-copy.o): Depend on tree-ssa-propagate.h. (OBJS-common): Add tree-vrp.o. (tree-vrp.o): New rule. * basic-block.h (nearest_common_dominator_for_set): Declare. * common.opt (ftree-store-ccp): New flag. (ftree-copy-prop): New flag. (ftree-vrp): New flag. (ftree-store-copy-prop): New flag. * dominance.c (nearest_common_dominator_for_set): New. * domwalk.c (walk_dominator_tree): Only traverse statements in blocks marked in walk_data->interesting_blocks. * domwalk.h (struct dom_walk_data): Add field interesting_blocks. * fold-const.c (fold): Handle ASSERT_EXPR. * opts.c (decode_options): Set flag_tree_copy_prop at -O1. Set flag_tree_store_ccp, flag_tree_store_copy_prop and flag_tree_vrp at -O2. * timevar.def (TV_TREE_VRP): Define. (TV_TREE_COPY_PROP): Define. (TV_TREE_STORE_COPY_PROP): Define. (TV_TREE_SSA_INCREMENTAL): Define. (TV_TREE_STORE_CCP): Define. * tree-cfg.c (tree_can_merge_blocks_p): Remove reference to kill_redundant_phi_nodes from comment. (verify_expr): Handle ASSERT_EXPR. * tree-dfa.c (mark_new_vars_to_rename): Remove second argument. Update all users. (mark_call_clobbered_vars_to_rename): Remove. Update all users. * tree-flow-inline.h (unmodifiable_var_p): New. * tree-flow.h (enum value_range_type): Declare. (struct value_range_def): Declare. (value_range): Declare. (remove_all_phi_nodes_for): Remove. Update all users. (find_phi_node_for): Declare. (add_type_alias): Declare. (count_uses_and_derefs): Declare. (kill_redundant_phi_nodes): Remove. (rewrite_into_ssa): Remove. (rewrite_def_def_chains): Remove. (update_ssa, register_new_name_mapping, create_new_def_for, need_ssa_update_p, name_registered_for_update_p, release_ssa_name_after_update_ssa, dump_repl_tbl, debug_repl_tbl, dump_names_replaced_by, debug_names_replaced_by, mark_sym_for_renaming, mark_set_for_renaming, get_current_def, set_current_def, get_value_range, dump_value_range, debug_value_range, dump_all_value_ranges, debug_all_value_ranges, expr_computes_nonzero, loop_depth_of_name, unmodifiable_var_p): Declare. * tree-gimple.c (is_gimple_formal_tmp_rhs): Handle ASSERT_EXPR. * tree-into-ssa.c (block_defs_stack): Update comment. (old_ssa_names, new_ssa_names, old_virtual_ssa_names, syms_to_rename, names_to_release, repl_tbl, need_to_initialize_update_ssa_p, need_to_update_vops_p, need_to_replace_names_p): New locals. (NAME_SETS_GROWTH_FACTOR): Define. (struct repl_map_d): Declare. (struct mark_def_sites_global_data): Add field interesting_blocks. (enum rewrite_mode): Declare. (REGISTER_DEFS_IN_THIS_STMT): Define. (compute_global_livein): Use last_basic_block instead of n_basic_blocks. (set_def_block): Remove last argument. Update all callers. (prepare_use_operand_for_rename): Remove. Update all callers. (prepare_def_operand_for_rename): Remove. Update all callers. (symbol_marked_for_renaming): New. (is_old_name): New. (is_new_name): New. (repl_map_hash): New. (repl_map_eq): New. (repl_map_free): New. (names_replaced_by): New. (add_to_repl_tbl): New. (add_new_name_mapping): New. (mark_def_sites): Assume that all the operands in the statement are in normal form. (find_idf): Assert that the block in the stack is valid. (get_default_def_for): New. (insert_phi_nodes_for): Add new argument 'update_p'. Add documentation. If update_p is true, add a new mapping between the LHS of each new PHI and the name that it replaces. (insert_phi_nodes_1): Only call find_idf if needed. (get_reaching_def): Call get_default_def_for. (rewrite_operand): Remove. (rewrite_stmt): Do nothing if REGISTER_DEFS_IN_THIS_STMT and REWRITE_THIS_STMT are false. Assume that all the operands in the statement are in normal form. (rewrite_add_phi_arguments): Don't use PHI_REWRITTEN. (rewrite_virtual_phi_arguments): Remove. (invalidate_name_tags): Remove. (register_new_update_single, register_new_update_set, rewrite_update_init_block, replace_use, rewrite_update_fini_block, rewrite_update_stmt, rewrite_update_phi_arguments): New. rewrite_blocks): Remove argument 'fix_virtual_phis'. Add arguments 'entry', 'what' and 'blocks'. Initialize the dominator walker according to 'what' and 'blocks'. Start the dominator walk at 'entry'. (mark_def_site_blocks): Add argument 'interesting_blocks'. Use it to configure the dominator walker. (rewrite_into_ssa): Remove argument 'all'. Make internal. (rewrite_all_into_ssa): Remove. (rewrite_def_def_chains): Remove. (mark_def_interesting, mark_use_interesting, prepare_phi_args_for_update, prepare_block_for_update, prepare_def_site_for, prepare_def_sites, dump_names_replaced_by, debug_names_replaced_by, dump_repl_tbl, debug_repl_tbl, init_update_ssa, delete_update_ssa, create_new_def_for, register_new_name_mapping, mark_sym_for_renaming, mark_set_for_renaming, need_ssa_update_p, name_registered_for_update_p, ssa_names_to_replace, release_ssa_name_after_update_ssa, insert_updated_phi_nodes_for, update_ssa): New. * tree-loop-linear.c (linear_transform_loops): Call update_ssa instead of rewrite_into_ssa. * tree-optimize.c (vars_to_rename): Remove. Update all users. (init_tree_optimization_passes): Replace pass_redundant_phi with pass_copy_prop. Add pass_vrp. Replace pass_ccp with pass_store_ccp. Add pass_store_copy_prop after pass_store_ccp. (execute_todo): If the TODO_ flags don't include updating the SSA form, assert that it does not need to be updated. Call update_ssa instead of rewrite_into_ssa and rewrite_def_def_chains. If TODO_verify_loops is set, call verify_loop_closed_ssa. (tree_rest_of_compilation): * tree-pass.h (TODO_dump_func, TODO_ggc_collect, TODO_verify_ssa, TODO_verify_flow, TODO_verify_stmts, TODO_cleanup_cfg): Renumber. (TODO_verify_loops, TODO_update_ssa, TODO_update_ssa_no_phi, TODO_update_ssa_full_phi, TODO_update_ssa_only_virtuals): Define. (pass_copy_prop, pass_store_ccp, pass_store_copy_prop, pass_vrp): Declare. * tree-phinodes.c (make_phi_node): Update documentation. (remove_all_phi_nodes_for): Remove. (find_phi_node_for): New. * tree-pretty-print.c (dump_generic_node): Handle ASSERT_EXPR. * tree-scalar-evolution.c (follow_ssa_edge_in_rhs): Likewise. (interpret_rhs_modify_expr): Likewise. * tree-sra.c (decide_instantiations): Mark all symbols in SRA_CANDIDATES for renaming. (mark_all_v_defs_1): Rename from mark_all_v_defs. (mark_all_v_defs): New function. Update all users to call it with the whole list of scalarized statements, not just the first one. * tree-ssa-alias.c (count_ptr_derefs): Make extern. (compute_flow_insensitive_aliasing): If the tag is unmodifiable and the variable isn't or vice-versa, don't make them alias of each other. (setup_pointers_and_addressables): If the type tag for VAR is about to change, mark the old one for renaming. (add_type_alias): New. * tree-ssa-ccp.c: Document SSA-CCP and STORE-CCP. (ccp_lattice_t): Rename from latticevalue. (value): Remove. Update all users. (const_val): New local variable. (do_store_ccp): New local variable. (dump_lattice_value): Handle UNINITIALIZED. (debug_lattice_value): New. (get_default_value): Re-write. (set_lattice_value): Re-write. (def_to_varying): Remove. Update all users. (likely_value): Return VARYING for statements that make stores when STORE_CCP is false. Return VARYING for any statement other than MODIFY_EXPR, COND_EXPR and SWITCH_EXPR. (ccp_initialize): Re-write. (replace_uses_in, replace_vuse_in, substitute_and_fold): Move to tree-ssa-propagate.c. (ccp_lattice_meet): Handle memory stores when DO_STORE_CCP is true. (ccp_visit_phi_node): Likewise. (ccp_fold): Likewise. (evaluate_stmt): Likewise. (visit_assignment): Likewise. (ccp_visit_stmt): Likewise. (execute_ssa_ccp): Add argument 'store_ccp'. Copy it into DO_STORE_CCP. (do_ssa_ccp): New. (pass_ccp): Use it. (do_ssa_store_ccp): New. (gate_store_ccp): New. (pass_store_ccp): Declare. * tree-ssa-copy.c: Include tree-ssa-propagate.h. (may_propagate_copy): Reformat. Don't abort if ORIG is a virtual and DEST isn't. If NEW does not have alias information but DEST does, copy it. (copy_of, cached_last_copy_of, do_store_copy_prop, enum copy_prop_kind, which_copy_prop): Declare. (stmt_may_generate_copy, get_copy_of_val, get_last_copy_of, set_copy_of_val, dump_copy_of, copy_prop_visit_assignment, copy_prop_visit_cond_stmt, copy_prop_visit_stmt, copy_prop_visit_phi_node, init_copy_prop, fini_copy_prop, execute_copy_prop, gate_copy_prop, do_copy_prop, gate_store_copy_prop, store_copy_prop): New. (pass_copy_prop, pass_store_copy_prop): Declare. * tree-ssa-dom.c (struct opt_stats_d): Add fields 'num_const_prop' and 'num_copy_prop'. (cprop_operand): Update them. (dump_dominator_optimization_stats): Dump them. (tree_ssa_dominator_optimize): Call update_ssa instead of rewrite_into_ssa. (loop_depth_of_name): Declare extern. (simplify_cond_and_lookup_avail_expr): Guard against NULL values for LOW or HIGH. (cprop_into_successor_phis): Only propagate if NEW != ORIG. (record_equivalences_from_stmt): Call expr_computes_nonzero. (cprop_operand): Only propagate if VAL != OP. * tree-ssa-dse.c (dse_optimize_stmt): Mark symbols in removed statement for renaming. * tree-ssa-loop-im.c (move_computations): Call update_ssa. * tree-ssa-loop-ivopts.c (rewrite_address_base): Call add_type_alias if necessary. Call mark_new_vars_to_rename. (tree_ssa_iv_optimize): If new symbols need to be renamed, mark every statement updated, call update_ssa and rewrite_into_loop_closed_ssa. * tree-ssa-loop-manip.c (add_exit_phis): Do not remove DEF_BB from LIVEIN if VAR is a virtual. * tree-ssa-loop.c (tree_loop_optimizer_init): Call update_ssa. * tree-ssa-operands.c (get_expr_operands): Handle ASSERT_EXPR. (get_call_expr_operands): Reformat statement. (add_stmt_operand): Don't create V_MAY_DEFs for read-only symbols. * tree-ssa-propagate.c (ssa_prop_init): Initialize SSA_NAME_VALUE for every name. (first_vdef, stmt_makes_single_load, stmt_makes_single_store, get_value_loaded_by): New. (replace_uses_in, replace_vuses_in, replace_phi_args_in, substitute_and_fold): Move from tree-ssa-ccp.c. * tree-ssa-propagate.h (struct prop_value_d, prop_value_t, first_vdef, stmt_makes_single_load, stmt_makes_single_store, get_value_loaded_by, replace_uses_in, substitute_and_fold): Declare. * tree-ssa.c (verify_use): Fix error message. (propagate_into_addr, replace_immediate_uses, get_eq_name, check_phi_redundancy, kill_redundant_phi_nodes, pass_redundant_phi): Remove. Update all users. * tree-vect-transform.c (vect_create_data_ref_ptr): Call add_type_alias, if necessary. * tree-vectorizer.h (struct _stmt_vect_info): Update documentation for field 'memtag'. * tree-vrp.c: New file. * tree.def (ASSERT_EXPR): Define. * tree.h (ASSERT_EXPR_VAR): Define. (ASSERT_EXPR_COND): Define. (SSA_NAME_VALUE_RANGE): Define. (struct tree_ssa_name): Add field 'value_range'. (PHI_REWRITTEN): Remove. (struct tree_phi_node): Remove field 'rewritten'. * doc/invoke.texi (-fdump-tree-storeccp, -ftree-copy-prop, -ftree-store-copy-prop): Document. * doc/tree-ssa.texi: Remove broken link to McCAT's compiler. Document usage of update_ssa. testsuite/ChangeLog * g++.dg/tree-ssa/pr18178.C: New test. * gcc.c-torture/execute/20030216-1.x: Ignore at -O1. * gcc.c-torture/execute/20041019-1.c: New test. * gcc.dg/tree-ssa/20041008-1.c: New test. * gcc.dg/tree-ssa/ssa-ccp-12.c: New test. * gcc.dg/tree-ssa/20030731-2.c: Update to use -fdump-tree-store_ccp. * gcc.dg/tree-ssa/20030917-1.c: Likewise. * gcc.dg/tree-ssa/20030917-3.c: Likewise. * gcc.dg/tree-ssa/20040721-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-3.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-7.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-9.c: Likewise. From-SVN: r97884
2005-04-09 03:37:54 +02:00
mark_all_v_defs (list);
sra_replace (bsi, list);
}
}
/* A subroutine of scalarize_ldst called via walk_tree. Set TREE_NO_TRAP
on all INDIRECT_REFs. */
static tree
mark_notrap (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED)
{
tree t = *tp;
if (TREE_CODE (t) == INDIRECT_REF)
{
TREE_THIS_NOTRAP (t) = 1;
*walk_subtrees = 0;
}
alias.c (find_base_decl): Remove unreachable case '3' block. 2004-09-17 Jeffrey D. Oldham <oldham@codesourcery.com> Zack Weinberg <zack@codesourcery.com> * alias.c (find_base_decl): Remove unreachable case '3' block. * expr.c (safe_from_p): Abort if passed a type. * tree-gimple.c (recalculate_side_effects): Abort if passed anything other than an expression. * tree-ssa-pre.c (phi_translate): Return expr immediately if is_gimple_min_invariant is true for it. Reorder cases for clarity. Abort on un-handled tree classes. (valid_in_set): Likewise. * tree.c (tree_code_class_strings): New static data. * tree.h (enum tree_code_class): New. (tree_code_class_strings): Declare. (TREE_CODE_CLASS_STRING, EXCEPTIONAL_CLASS_P, CONSTANT_CLASS_P) (REFERENCE_CLASS_P, COMPARISON_CLASS_P, UNARY_CLASS_P, BINARY_CLASS_P) (STATEMENT_CLASS_P, EXPRESSION_CLASS_P, IS_TYPE_OR_DECL_P): New macros. (TYPE_P, DECL_P, IS_NON_TYPE_CODE_CLASS, IS_EXPR_CODE_CLASS) (checking macros, EXPR_LOCATION, SET_EXPR_LOCATION, EXPR_LOCUS): Update. * tree.def, c-common.def, objc/objc-tree.def: Use tree_code_class enumeration constants instead of code letters. * alias.c, builtins.c, c-common.c, c-format.c, c-lang.c, c-pragma.c * c-typeck.c, cgraphunit.c, convert.c, dbxout.c, dwarf2out.c * emit-rtl.c expr.c, fold-const.c, gimplify.c, lambda-code.c * langhooks.c, langhooks.h, predict.c, print-tree.c, reload1.c, stmt.c * tree-browser.c, tree-cfg.c, tree-chrec.c, tree-complex.c, tree-dfa.c * tree-dump.c, tree-eh.c, tree-gimple.c, tree-inline.c, tree-nested.c * tree-outof-ssa.c, tree-pretty-print.c, tree-sra.c, tree-ssa-ccp.c * tree-ssa-dce.c, tree-ssa-dom.c, tree-ssa-forwprop.c, tree-ssa-live.c * tree-ssa-loop-im.c, tree-ssa-loop-ivopts.c, tree-ssa-operands.c * tree-ssa-phiopt.c, tree-ssa-pre.c, tree-ssa-propagate.c * tree-ssa.c, tree-ssanames.c, tree-tailcall.c, tree.c, varasm.c * config/sol2-c.c, config/arm/arm.c, config/i386/winnt.c * config/pa/pa.c, config/pa/pa.h, config/sh/sh.c, objc/objc-lang.c Update to match. * LANGUAGES: Add note about change. ada: * ada-tree.def: Use tree_code_class enumeration constants instead of code letters. * ada-tree.h, decl.c, misc.c, trans.c, utils.c, utils2.c: Update for new tree-class enumeration constants. cp: * cp-tree.def: Use tree_code_class enumeration constants instead of code letters. * call.c, class.c, cp-gimplify.c, cp-lang.c, cxx-pretty-print.c * mangle.c, pt.c, semantics.c, tree.c, typeck.c: Update for new tree-class enumeration constants. fortran: * f95-lang.c, trans-expr.c, trans.c: Update for new tree-class enumeration constants. java: * java-tree.def: Use tree_code_class enumeration constants instead of code letters. * java-gimplify.c, jcf-write.c, lang.c, parse.y: Update for new tree-class enumeration constants. treelang: * treetree.c: Update for new tree-class enumeration constants. From-SVN: r87675
2004-09-17 23:55:02 +02:00
else if (IS_TYPE_OR_DECL_P (t))
*walk_subtrees = 0;
return NULL;
}
/* Scalarize a LDST. To recap, this is an assignment between one scalarizable
reference ELT and one non-scalarizable reference OTHER. IS_OUTPUT is true
if ELT is on the left-hand side. */
static void
scalarize_ldst (struct sra_elt *elt, tree other,
block_stmt_iterator *bsi, bool is_output)
{
/* Shouldn't have gotten called for a scalar. */
targhooks.c (default_unwind_emit, [...]): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * targhooks.c (default_unwind_emit, default_scalar_mode_supported_p): Use gcc_assert, gcc_unreachable & internal_error instead of abort. * timevar.c (timevar_push, timevar_pop, timevar_start, timevar_stop): Likewise. * toplev.c (default_pch_valid_p): Likewise. * tracer.c (tail_duplicate): Likewise. * tree-alias-common.c (get_alias_var_decl, get_values_from_constructor, create_alias_var, delete_alias_vars, empty_points_to_set, same_points_to_set, ptr_may_alias_var): Likewise. * tree.c (tree_size, make_node_stat, copy_node_stat, build_int_cst_wide, integer_all_onesp, list_length, chainon, tree_node_structure, type_contains_placeholder_p, substitute_in_expr, substitute_placeholder_in_expr, tabilize_reference_1, build0_stat, build1_stat, build2_stat, build3_stat, build4_stat, is_attribute_p, lookup_attribute, type_hash_canon, host_integerp, iterative_hash_expr, build_method_type_directly, decl_type_context, get_callee_fndecl, get_set_constructor_bits, build_vector_type_for_mode, int_cst_value, tree_fold_gcd): Likewise. * tree-cfg.c (create_bb, make_ctrl_stmt_edges, make_exit_edges, make_cond_expr_edges, group_case_labels, tree_merge_blocks, cleanup_control_expr_graph, find_taken_edge, find_taken_edge_switch_expr, phi_alternatives_equal, is_ctrl_altering_stmt, disband_implicit_edges, set_bb_for_stmt, stmt_for_bsi, tree_find_edge_insert_loc, bsi_insert_on_edge_immediate, tree_split_edge, tree_verify_flow_info, thread_jumps, tree_redirect_edge_and_branch, tree_flow_call_edges_add): Likewise. * tree-chrec.c (chrec_fold_poly_cst, chrec_fold_plus_poly_poly, chrec_fold_multiply_poly_poly): Likewise. * tree-complex.c (extract_component, expand_complex_division, expand_complex_comparison, expand_complex_operations_1, build_replicated_const, expand_vector_operations_1): Likewise. * tree-data-ref.c (tree_fold_bezout, build_classic_dist_vector, build_classic_dir_vector): Likewise. * tree-dfa.c (compute_immediate_uses_for_phi, compute_immediate_uses_for_stmt, create_var_ann, create_stmt_ann, create_tree_ann, collect_dfa_stats, get_virtual_var): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-eh.c (record_stmt_eh_region, add_stmt_to_eh_region, record_in_finally_tree, replace_goto_queue_1, maybe_record_in_goto_queue, verify_norecord_switch_expr, do_return_redirection): Likewise. * tree-if-conv.c (tree_if_convert_stmt, tree_if_convert_cond_expr, add_to_dst_predicate_list, find_phi_replacement_condition, replace_phi_with_cond_modify_expr, get_loop_body_in_if_conv_order): Likewise. * tree-inline.c (remap_decl, remap_type, remap_decls, copy_body_r, initialize_inlined_parameters, declare_return_variable, estimate_num_insns_1, expand_call_inline, expand_calls_inline, optimize_inline_calls, copy_tree_r): Likewise. * tree-into-ssa.c (rewrite_initialize_block_local_data, rewrite_stmt, ssa_rewrite_stmt, rewrite_into_ssa): Likewise. * tree-iterator.c (alloc_stmt_list, tsi_link_before, tsi_link_after, tsi_split_statement_list_after, tsi_split_statement_list_before): Likewise. * tree-mudflap.c (mf_varname_tree): Likewise. * tree-nested.c (create_tmp_var_for, lookup_field_for_decl, lookup_tramp_for_decl, convert_all_function_calls): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (create_temp, eliminate_build, eliminate_phi, coalesce_abnormal_edges, coalesce_ssa_name, eliminate_virtual_phis, free_temp_expr_table, add_dependance, finish_expr, rewrite_trees): Likewise. * tree-phinodes.c (resize_phi_node, add_phi_arg, remove_all_phi_nodes_for): Likewise. * tree-pretty-print.c (op_prio, print_call_name): Likewise. * tree-profile.c (tree_gen_interval_profiler, tree_gen_pow2_profiler, tree_gen_one_value_profiler, tree_gen_const_delta_profiler): Likewise. * tree-sra.c (type_can_instantiate_all_elements, sra_hash_tree, sra_elt_eq, sra_walk_expr, instantiate_missing_elements, generate_one_element_ref, generate_element_copy, generate_element_zero, scalarize_copy, scalarize_init, scalarize_ldst): Likewise. * tree-ssa-alias.c (delete_alias_info, group_aliases, may_alias_p, add_may_alias, add_pointed_to_expr, add_pointed_to_var, collect_points_to_info_r, get_tmt_for, get_ptr_info): Likewise. * tree-ssa.c (walk_use_def_chains, check_phi_redundancy): Likewise. * tree-ssa-ccp.c (dump_lattice_value, get_default_value, get_value, set_lattice_value, likely_value, ccp_visit_phi_node, visit_assignment, widen_bitfield, ccp_fold_builtin): Likewise. * tree-ssa-copy.c (may_propagate_copy, merge_alias_info, replace_exp_1, propagate_tree_value): Likewise. * tree-ssa-copyrename.c (copy_rename_partition_coalesce): Likewise. * tree-ssa-dce.c (set_control_dependence_map_bit, find_control_dependence, find_pdom, mark_operand_necessary, mark_stmt_if_obviously_necessary, mark_control_dependent_edges_necessary, remove_dead_stmt): Likewise. * tree-ssa-dom.c (dom_opt_initialize_block_local_data, simplify_switch_and_lookup_avail_expr, cprop_into_successor_phis, eliminate_redundant_computations, avail_expr_eq): Likewise. * tree-ssa-dse.c (fix_stmt_v_may_defs): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p, duplicate_blocks): Likewise. * tree-ssa-loop-im.c (for_each_index, set_level, is_call_clobbered_ref): Likewise. * tree-ssa-loop-ivopts.c (dump_use, divide, stmt_after_ip_normal_pos, stmt_after_increment, set_iv, contains_abnormal_ssa_name_p, find_interesting_uses_outer_or_nonlin, add_derived_ivs_candidates, peel_address, ptr_difference_cost, may_replace_final_value, determine_use_iv_cost, rewrite_use_nonlinear_expr, rewrite_use_outer, rewrite_use, rewrite_uses): Likewise. * tree-ssa-loop-manip.c (rewrite_into_loop_closed_ssa, check_loop_closed_ssa_use): Likewise. * tree-ssanames.c (make_ssa_name): Likewise. * tree-ssa-operands.c (finalize_ssa_defs, finalize_ssa_uses, finalize_ssa_v_must_defs, finalize_ssa_stmt_operands, get_stmt_operands, get_expr_operands, get_asm_expr_operands, get_indirect_ref_operands, add_stmt_operand): Likewise. * tree-ssa-pre.c (value_exists_in_set_bitmap, value_remove_from_set_bitmap, bitmap_insert_into_set, insert_into_set, phi_translate, valid_in_set, compute_antic, find_or_generate_expression, create_expression_by_pieces, insert_aux, create_value_expr_from, eliminate): Likewise. * tree-ssa-propagate.c (cfg_blocks_get): Likewise. * tree-ssa-threadupdate.c (remove_last_stmt_and_useless_edges): Likewise. * tree-tailcall.c (independent_of_stmt_p, adjust_return_value, eliminate_tail_call): Likewise. * tree-vectorizer.c (vect_create_index_for_array_ref, vect_align_data_ref, vect_create_data_ref, vect_create_destination_var, vect_get_vec_def_for_operand, vect_finish_stmt_generation, vect_transform_stmt, vect_transform_loop_bound, vect_transform_loop, vect_analyze_operations): Likewise. * tree-vn.c (vn_compute, set_value_handle, get_value_handle): Likewise. * tree-flow-inline.h (var_ann, get_var_ann, get_def_from_ptr, get_use_op_ptr, immediate_use, phi_ssa_name_p, bsi_start, bsi_after_labels, bsi_last): Likewise. * tree-ssa-live.c (var_union, change_partition_var, create_ssa_var_map, calculate_live_on_entry, root_var_init, type_var_init, add_coalesce, sort_coalesce_list, pop_best_coalesce): Likewise. * tree-ssa-live.h (partition_is_global, live_entry_blocks, tpa_find_tree): Likewise. (register_ssa_partition_check): Declare. (register_ssa_partition): use it. * tree-ssa-live.c: Include errors.h. (register_ssa_partition_check): New. * tree-ssa-operands.c: Include errors.h. * Makefile.in (tree-ssa-operands.o): Depend on errors.h. Co-Authored-By: Nathan Sidwell <nathan@codesourcery.com> From-SVN: r87223
2004-09-09 09:54:12 +02:00
gcc_assert (!elt->replacement);
if (elt->use_block_copy)
{
/* Since ELT is not fully instantiated, we have to leave the
block copy in place. Treat this as a USE. */
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 Temporarily revert: 2007-04-06 Andreas Tobler <a.tobler@schweiz.org> 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (try_instantiate_multiple_fields): Needlessly initialize align to silence bogus warning. 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (struct sra_elt): Add in_bitfld_block. Remove all_no_warning. (struct sra_walk_fns): Remove use_all parameter from use. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (sra_walk_expr): Don't maintain or pass down use_all_p. (scan_use): Remove use_all parameter. (scalarize_use): Likewise. Re-expand assignment to BIT_FIELD_REF of gimple_reg. De-scalarize before input or output, and re-scalarize after output. Don't mark anything for no warning. (scalarize_ldst): Adjust. (scalarize_walk_gimple_modify_statement): Likewise. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Don't warn for any element whose parent is used as a whole. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. (instantiate_missing_elemnts): Use them. (mark_no_warning): Removed. (generate_one_element_ref): Handle BIT_FIELD_REFs. (REPLDUP, sra_build_elt_assignment): New. (generate_copy_inout): Use them. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_int): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (scalarize_use, scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r124302
2007-04-30 19:41:11 +02:00
scalarize_use (elt, NULL, bsi, is_output, false);
}
else
{
/* The interesting case is when ELT is fully instantiated. In this
case we can have each element stored/loaded directly to/from the
corresponding slot in OTHER. This avoids a block copy. */
tree list = NULL, stmt = bsi_stmt (*bsi);
mark_all_v_defs (stmt);
generate_copy_inout (elt, is_output, other, &list);
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 Temporarily revert: 2007-04-06 Andreas Tobler <a.tobler@schweiz.org> 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (try_instantiate_multiple_fields): Needlessly initialize align to silence bogus warning. 2007-04-05 Alexandre Oliva <aoliva@redhat.com> * tree-sra.c (struct sra_elt): Add in_bitfld_block. Remove all_no_warning. (struct sra_walk_fns): Remove use_all parameter from use. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (sra_walk_expr): Don't maintain or pass down use_all_p. (scan_use): Remove use_all parameter. (scalarize_use): Likewise. Re-expand assignment to BIT_FIELD_REF of gimple_reg. De-scalarize before input or output, and re-scalarize after output. Don't mark anything for no warning. (scalarize_ldst): Adjust. (scalarize_walk_gimple_modify_statement): Likewise. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Don't warn for any element whose parent is used as a whole. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. (instantiate_missing_elemnts): Use them. (mark_no_warning): Removed. (generate_one_element_ref): Handle BIT_FIELD_REFs. (REPLDUP, sra_build_elt_assignment): New. (generate_copy_inout): Use them. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_int): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (scalarize_use, scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r124302
2007-04-30 19:41:11 +02:00
gcc_assert (list);
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
mark_all_v_defs (list);
/* Preserve EH semantics. */
if (stmt_ends_bb_p (stmt))
{
tree_stmt_iterator tsi;
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
tree first, blist = NULL;
bool thr = tree_could_throw_p (stmt);
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
/* If the last statement of this BB created an EH edge
before scalarization, we have to locate the first
statement that can throw in the new statement list and
use that as the last statement of this BB, such that EH
semantics is preserved. All statements up to this one
are added to the same BB. All other statements in the
list will be added to normal outgoing edges of the same
BB. If they access any memory, it's the same memory, so
we can assume they won't throw. */
tsi = tsi_start (list);
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
for (first = tsi_stmt (tsi);
thr && !tsi_end_p (tsi) && !tree_could_throw_p (first);
first = tsi_stmt (tsi))
{
tsi_delink (&tsi);
append_to_statement_list (first, &blist);
}
/* Extract the first remaining statement from LIST, this is
the EH statement if there is one. */
tsi_delink (&tsi);
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
if (blist)
sra_insert_before (bsi, blist);
/* Replace the old statement with this new representative. */
bsi_replace (bsi, first, true);
if (!tsi_end_p (tsi))
{
/* If any reference would trap, then they all would. And more
to the point, the first would. Therefore none of the rest
will trap since the first didn't. Indicate this by
iterating over the remaining statements and set
TREE_THIS_NOTRAP in all INDIRECT_REFs. */
do
{
walk_tree (tsi_stmt_ptr (tsi), mark_notrap, NULL, NULL);
tsi_next (&tsi);
}
while (!tsi_end_p (tsi));
insert_edge_copies (list, bsi->bb);
}
}
else
sra_replace (bsi, list);
}
}
/* Generate initializations for all scalarizable parameters. */
static void
scalarize_parms (void)
{
tree list = NULL;
bitmap.c (bitmap_print): Make bitno unsigned. * bitmap.c (bitmap_print): Make bitno unsigned. * bt-load.c (clear_btr_from_live_range, btr_def_live_range): Likewise. * caller-save.c (save_call_clobbered_regs): Likewise. * cfganal.c (compute_dominance_frontiers_1): Likewise. * cfgcleanup.c (thread_jump): Likewise. * cfgrtl.c (safe_insert_insn_on_edge): Likewise. * conflict.c (conflict_graph_compute): Likewise. * ddg.c (add_deps_for_use): Likewise. * df.c (df_refs_update): Likewise. * except.c (remove_eh_handler): Likewise. * flow.c (verify_local_live_at_start, update_life_info, initialize_uninitialized_subregs, propagate_one_insn, free_propagate_block_info, propagate_block, find_use_as_address, reg_set_to_hard_reg_set): Likewise. * gcse.c (clear_modify_mem_tables): Likewise. * global.c (global_conflicts, build_insn_chain): Likewise. * ifcvt.c (dead_or_predicable): Likewise. * local-alloc.c (update_equiv_regs): Likewise. * loop.c (load_mems): Likewise. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Likewise. * ra-rewrite.c (reloads_to_loads, rewrite_program2, actual_spill): Likewise. * reload1.c (order_regs_for_reload, finish_spills): Likewise. * sched-deps.c (sched_analyze_insn, free_deps): Likewise. * sched-rgn.c (propagate_deps * tree-cfg.c (tree_purge_all_dead_eh_edges): Likewise. * tree-dfa.c (dump_dfa_stats tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags): Likewise. * tree-outof-ssa.c (coalesce_ssa_name, coalesce_vars, free_temp_expr_table, find_replaceable_exprs): Likewise. * tree-sra.c (scan_function, scalarize_parms): Likewise. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var): Likewise. * tree-ssa-dce.c (mark_control_dependent_edges_necessary): Likewise. * tree-ssa-live.c (new_tree_live_info, live_worklist, calculate_live_on_entry, calculate_live_on_exit, compare_pairs, sort_coalesce_list, build_tree_conflict_graph, dump_live_info tree-ssa-loop-manip.c (add_exit_phis_var): Likewise. tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Likewise. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Likewise. * tree-ssa-live.h (num_var_partitions): Return unsigned. From-SVN: r90053
2004-11-04 09:41:16 +01:00
unsigned i;
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style. * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style. (bitmap_iterator): New type. (bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1, bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init, bmp_iter_and_next): New functions. * basic-block.h (EXECUTE_IF_SET_IN_REG_SET, EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to use iterator-style EXECUTE_IF_IN_BITMAP macros. * bitmap.c (bitmap_print): Ditto. * bt-load.c (clear_btr_from_live_range, add_btr_to_live_range, btr_def_live_range): Ditto. * cfganal.c (compute_dominance_frontiers_1) Ditto. * cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics): Ditto. * ddg.c (build_inter_loop_deps): Ditto. * df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update): Ditto. * except.c (remove_eh_handler): Ditto. * flow.c (reg_set_to_hard_reg_set): Ditto. * gcse.c (clear_modify_mem_tables): Ditto. * global.c (build_insn_chain): Ditto. * ifcvt.c (dead_or_predicable): Ditto. * loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg): Ditto. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto. * tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region, tree_purge_all_dead_eh_edges): Ditto. * tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags, rewrite_ssa_into_ssa): Ditto. * tree-outof-ssa.c (find_replaceable_exprs): Ditto. * tree-sra.c (scan_function, decide_instantiations, scalarize_parms): Ditto. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var, dump_points_to_info_for): Ditto. * tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto. * tree-ssa-dse.c (dse_finalize_block): Ditto. * tree-ssa-live.c (live_worklist, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph, dump_live_info): Ditto. * tree-ssa-loop-ivopts.c (find_induction_variables, find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map, determine_use_iv_costs, determine_set_costs, find_best_candidate, set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data): Ditto. * tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto. * tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Ditto. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto. From-SVN: r88145
2004-09-26 21:53:13 +02:00
bitmap_iterator bi;
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style. * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style. (bitmap_iterator): New type. (bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1, bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init, bmp_iter_and_next): New functions. * basic-block.h (EXECUTE_IF_SET_IN_REG_SET, EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to use iterator-style EXECUTE_IF_IN_BITMAP macros. * bitmap.c (bitmap_print): Ditto. * bt-load.c (clear_btr_from_live_range, add_btr_to_live_range, btr_def_live_range): Ditto. * cfganal.c (compute_dominance_frontiers_1) Ditto. * cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics): Ditto. * ddg.c (build_inter_loop_deps): Ditto. * df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update): Ditto. * except.c (remove_eh_handler): Ditto. * flow.c (reg_set_to_hard_reg_set): Ditto. * gcse.c (clear_modify_mem_tables): Ditto. * global.c (build_insn_chain): Ditto. * ifcvt.c (dead_or_predicable): Ditto. * loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg): Ditto. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto. * tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region, tree_purge_all_dead_eh_edges): Ditto. * tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags, rewrite_ssa_into_ssa): Ditto. * tree-outof-ssa.c (find_replaceable_exprs): Ditto. * tree-sra.c (scan_function, decide_instantiations, scalarize_parms): Ditto. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var, dump_points_to_info_for): Ditto. * tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto. * tree-ssa-dse.c (dse_finalize_block): Ditto. * tree-ssa-live.c (live_worklist, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph, dump_live_info): Ditto. * tree-ssa-loop-ivopts.c (find_induction_variables, find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map, determine_use_iv_costs, determine_set_costs, find_best_candidate, set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data): Ditto. * tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto. * tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Ditto. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto. From-SVN: r88145
2004-09-26 21:53:13 +02:00
EXECUTE_IF_SET_IN_BITMAP (needs_copy_in, 0, i, bi)
{
tree var = referenced_var (i);
struct sra_elt *elt = lookup_element (NULL, var, NULL, NO_INSERT);
generate_copy_inout (elt, true, var, &list);
bitmap.h (EXECUTE_IF_SET_IN_BITMAP, [...]): Changed to iterator style. * bitmap.h (EXECUTE_IF_SET_IN_BITMAP, EXECUTE_IF_AND_COMPL_IN_BITMAP, EXECUTE_IF_AND_IN_BITMAP): Changed to iterator style. (bitmap_iterator): New type. (bmp_iter_common_next_1, bmp_iter_single_next_1, bmp_iter_single_init, bmp_iter_end_p, bmp_iter_single_next, bmp_iter_and_not_next_1, bmp_iter_and_not_init, bmp_iter_and_not_next, bmp_iter_and_next_1, bmp_iter_and_init, bmp_iter_and_next): New functions. * basic-block.h (EXECUTE_IF_SET_IN_REG_SET, EXECUTE_IF_AND_COMPL_IN_REG_SET, EXECUTE_IF_AND_IN_REG_SET): Changed to use iterator-style EXECUTE_IF_IN_BITMAP macros. * bitmap.c (bitmap_print): Ditto. * bt-load.c (clear_btr_from_live_range, add_btr_to_live_range, btr_def_live_range): Ditto. * cfganal.c (compute_dominance_frontiers_1) Ditto. * cgraphunit.c (convert_UIDs_in_bitmap, cgraph_characterize_statics): Ditto. * ddg.c (build_inter_loop_deps): Ditto. * df.c (FOR_EACH_BB_IN_BITMAP, df_bb_reg_info_compute, df_refs_update): Ditto. * except.c (remove_eh_handler): Ditto. * flow.c (reg_set_to_hard_reg_set): Ditto. * gcse.c (clear_modify_mem_tables): Ditto. * global.c (build_insn_chain): Ditto. * ifcvt.c (dead_or_predicable): Ditto. * loop-invariant.c (get_inv_cost, set_move_mark, move_invariant_reg): Ditto. * ra-build.c (livethrough_conflicts_bb, conflicts_between_webs): Ditto. * ra-rewrite.c (reloads_to_loads, rewrite_program2, detect_web_parts_to_rebuild, delete_useless_defs, actual_spill): Ditto. * tree-cfg.c (allocate_ssa_names, tree_duplicate_sese_region, tree_purge_all_dead_eh_edges): Ditto. * tree-into-ssa.c (compute_global_livein, insert_phi_nodes, insert_phi_nodes_for, debug_def_blocks_r, invalidate_name_tags, rewrite_ssa_into_ssa): Ditto. * tree-outof-ssa.c (find_replaceable_exprs): Ditto. * tree-sra.c (scan_function, decide_instantiations, scalarize_parms): Ditto. * tree-ssa-alias.c (init_alias_info, compute_points_to_and_addr_escape, compute_flow_sensitive_aliasing, maybe_create_global_var, dump_points_to_info_for): Ditto. * tree-ssa-dce.c (EXECUTE_IF_CONTROL_DEPENDENT): Ditto. * tree-ssa-dse.c (dse_finalize_block): Ditto. * tree-ssa-live.c (live_worklist, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph, dump_live_info): Ditto. * tree-ssa-loop-ivopts.c (find_induction_variables, find_interesting_uses, add_old_ivs_candidates, alloc_use_cost_map, determine_use_iv_costs, determine_set_costs, find_best_candidate, set_cost_up_to, create_new_ivs, remove_unused_ivs, free_loop_data): Ditto. * tree-ssa-loop-manip.c (add_exit_phis_var, add_exit_phis): Ditto. * tree-ssa-operands.c (get_asm_expr_operands, add_call_clobber_ops, add_call_read_ops): Ditto. * tree-ssa-pre.c (bitmap_print_value_set, insert_aux): Ditto. From-SVN: r88145
2004-09-26 21:53:13 +02:00
}
if (list)
backport: copy-prop, incremental SSA updating of FUD chains and newly exposed symbols. Merge from tree-cleanup-branch: VRP, store CCP, store copy-prop, incremental SSA updating of FUD chains and newly exposed symbols. * Makefile.in (tree-ssa-copy.o): Depend on tree-ssa-propagate.h. (OBJS-common): Add tree-vrp.o. (tree-vrp.o): New rule. * basic-block.h (nearest_common_dominator_for_set): Declare. * common.opt (ftree-store-ccp): New flag. (ftree-copy-prop): New flag. (ftree-vrp): New flag. (ftree-store-copy-prop): New flag. * dominance.c (nearest_common_dominator_for_set): New. * domwalk.c (walk_dominator_tree): Only traverse statements in blocks marked in walk_data->interesting_blocks. * domwalk.h (struct dom_walk_data): Add field interesting_blocks. * fold-const.c (fold): Handle ASSERT_EXPR. * opts.c (decode_options): Set flag_tree_copy_prop at -O1. Set flag_tree_store_ccp, flag_tree_store_copy_prop and flag_tree_vrp at -O2. * timevar.def (TV_TREE_VRP): Define. (TV_TREE_COPY_PROP): Define. (TV_TREE_STORE_COPY_PROP): Define. (TV_TREE_SSA_INCREMENTAL): Define. (TV_TREE_STORE_CCP): Define. * tree-cfg.c (tree_can_merge_blocks_p): Remove reference to kill_redundant_phi_nodes from comment. (verify_expr): Handle ASSERT_EXPR. * tree-dfa.c (mark_new_vars_to_rename): Remove second argument. Update all users. (mark_call_clobbered_vars_to_rename): Remove. Update all users. * tree-flow-inline.h (unmodifiable_var_p): New. * tree-flow.h (enum value_range_type): Declare. (struct value_range_def): Declare. (value_range): Declare. (remove_all_phi_nodes_for): Remove. Update all users. (find_phi_node_for): Declare. (add_type_alias): Declare. (count_uses_and_derefs): Declare. (kill_redundant_phi_nodes): Remove. (rewrite_into_ssa): Remove. (rewrite_def_def_chains): Remove. (update_ssa, register_new_name_mapping, create_new_def_for, need_ssa_update_p, name_registered_for_update_p, release_ssa_name_after_update_ssa, dump_repl_tbl, debug_repl_tbl, dump_names_replaced_by, debug_names_replaced_by, mark_sym_for_renaming, mark_set_for_renaming, get_current_def, set_current_def, get_value_range, dump_value_range, debug_value_range, dump_all_value_ranges, debug_all_value_ranges, expr_computes_nonzero, loop_depth_of_name, unmodifiable_var_p): Declare. * tree-gimple.c (is_gimple_formal_tmp_rhs): Handle ASSERT_EXPR. * tree-into-ssa.c (block_defs_stack): Update comment. (old_ssa_names, new_ssa_names, old_virtual_ssa_names, syms_to_rename, names_to_release, repl_tbl, need_to_initialize_update_ssa_p, need_to_update_vops_p, need_to_replace_names_p): New locals. (NAME_SETS_GROWTH_FACTOR): Define. (struct repl_map_d): Declare. (struct mark_def_sites_global_data): Add field interesting_blocks. (enum rewrite_mode): Declare. (REGISTER_DEFS_IN_THIS_STMT): Define. (compute_global_livein): Use last_basic_block instead of n_basic_blocks. (set_def_block): Remove last argument. Update all callers. (prepare_use_operand_for_rename): Remove. Update all callers. (prepare_def_operand_for_rename): Remove. Update all callers. (symbol_marked_for_renaming): New. (is_old_name): New. (is_new_name): New. (repl_map_hash): New. (repl_map_eq): New. (repl_map_free): New. (names_replaced_by): New. (add_to_repl_tbl): New. (add_new_name_mapping): New. (mark_def_sites): Assume that all the operands in the statement are in normal form. (find_idf): Assert that the block in the stack is valid. (get_default_def_for): New. (insert_phi_nodes_for): Add new argument 'update_p'. Add documentation. If update_p is true, add a new mapping between the LHS of each new PHI and the name that it replaces. (insert_phi_nodes_1): Only call find_idf if needed. (get_reaching_def): Call get_default_def_for. (rewrite_operand): Remove. (rewrite_stmt): Do nothing if REGISTER_DEFS_IN_THIS_STMT and REWRITE_THIS_STMT are false. Assume that all the operands in the statement are in normal form. (rewrite_add_phi_arguments): Don't use PHI_REWRITTEN. (rewrite_virtual_phi_arguments): Remove. (invalidate_name_tags): Remove. (register_new_update_single, register_new_update_set, rewrite_update_init_block, replace_use, rewrite_update_fini_block, rewrite_update_stmt, rewrite_update_phi_arguments): New. rewrite_blocks): Remove argument 'fix_virtual_phis'. Add arguments 'entry', 'what' and 'blocks'. Initialize the dominator walker according to 'what' and 'blocks'. Start the dominator walk at 'entry'. (mark_def_site_blocks): Add argument 'interesting_blocks'. Use it to configure the dominator walker. (rewrite_into_ssa): Remove argument 'all'. Make internal. (rewrite_all_into_ssa): Remove. (rewrite_def_def_chains): Remove. (mark_def_interesting, mark_use_interesting, prepare_phi_args_for_update, prepare_block_for_update, prepare_def_site_for, prepare_def_sites, dump_names_replaced_by, debug_names_replaced_by, dump_repl_tbl, debug_repl_tbl, init_update_ssa, delete_update_ssa, create_new_def_for, register_new_name_mapping, mark_sym_for_renaming, mark_set_for_renaming, need_ssa_update_p, name_registered_for_update_p, ssa_names_to_replace, release_ssa_name_after_update_ssa, insert_updated_phi_nodes_for, update_ssa): New. * tree-loop-linear.c (linear_transform_loops): Call update_ssa instead of rewrite_into_ssa. * tree-optimize.c (vars_to_rename): Remove. Update all users. (init_tree_optimization_passes): Replace pass_redundant_phi with pass_copy_prop. Add pass_vrp. Replace pass_ccp with pass_store_ccp. Add pass_store_copy_prop after pass_store_ccp. (execute_todo): If the TODO_ flags don't include updating the SSA form, assert that it does not need to be updated. Call update_ssa instead of rewrite_into_ssa and rewrite_def_def_chains. If TODO_verify_loops is set, call verify_loop_closed_ssa. (tree_rest_of_compilation): * tree-pass.h (TODO_dump_func, TODO_ggc_collect, TODO_verify_ssa, TODO_verify_flow, TODO_verify_stmts, TODO_cleanup_cfg): Renumber. (TODO_verify_loops, TODO_update_ssa, TODO_update_ssa_no_phi, TODO_update_ssa_full_phi, TODO_update_ssa_only_virtuals): Define. (pass_copy_prop, pass_store_ccp, pass_store_copy_prop, pass_vrp): Declare. * tree-phinodes.c (make_phi_node): Update documentation. (remove_all_phi_nodes_for): Remove. (find_phi_node_for): New. * tree-pretty-print.c (dump_generic_node): Handle ASSERT_EXPR. * tree-scalar-evolution.c (follow_ssa_edge_in_rhs): Likewise. (interpret_rhs_modify_expr): Likewise. * tree-sra.c (decide_instantiations): Mark all symbols in SRA_CANDIDATES for renaming. (mark_all_v_defs_1): Rename from mark_all_v_defs. (mark_all_v_defs): New function. Update all users to call it with the whole list of scalarized statements, not just the first one. * tree-ssa-alias.c (count_ptr_derefs): Make extern. (compute_flow_insensitive_aliasing): If the tag is unmodifiable and the variable isn't or vice-versa, don't make them alias of each other. (setup_pointers_and_addressables): If the type tag for VAR is about to change, mark the old one for renaming. (add_type_alias): New. * tree-ssa-ccp.c: Document SSA-CCP and STORE-CCP. (ccp_lattice_t): Rename from latticevalue. (value): Remove. Update all users. (const_val): New local variable. (do_store_ccp): New local variable. (dump_lattice_value): Handle UNINITIALIZED. (debug_lattice_value): New. (get_default_value): Re-write. (set_lattice_value): Re-write. (def_to_varying): Remove. Update all users. (likely_value): Return VARYING for statements that make stores when STORE_CCP is false. Return VARYING for any statement other than MODIFY_EXPR, COND_EXPR and SWITCH_EXPR. (ccp_initialize): Re-write. (replace_uses_in, replace_vuse_in, substitute_and_fold): Move to tree-ssa-propagate.c. (ccp_lattice_meet): Handle memory stores when DO_STORE_CCP is true. (ccp_visit_phi_node): Likewise. (ccp_fold): Likewise. (evaluate_stmt): Likewise. (visit_assignment): Likewise. (ccp_visit_stmt): Likewise. (execute_ssa_ccp): Add argument 'store_ccp'. Copy it into DO_STORE_CCP. (do_ssa_ccp): New. (pass_ccp): Use it. (do_ssa_store_ccp): New. (gate_store_ccp): New. (pass_store_ccp): Declare. * tree-ssa-copy.c: Include tree-ssa-propagate.h. (may_propagate_copy): Reformat. Don't abort if ORIG is a virtual and DEST isn't. If NEW does not have alias information but DEST does, copy it. (copy_of, cached_last_copy_of, do_store_copy_prop, enum copy_prop_kind, which_copy_prop): Declare. (stmt_may_generate_copy, get_copy_of_val, get_last_copy_of, set_copy_of_val, dump_copy_of, copy_prop_visit_assignment, copy_prop_visit_cond_stmt, copy_prop_visit_stmt, copy_prop_visit_phi_node, init_copy_prop, fini_copy_prop, execute_copy_prop, gate_copy_prop, do_copy_prop, gate_store_copy_prop, store_copy_prop): New. (pass_copy_prop, pass_store_copy_prop): Declare. * tree-ssa-dom.c (struct opt_stats_d): Add fields 'num_const_prop' and 'num_copy_prop'. (cprop_operand): Update them. (dump_dominator_optimization_stats): Dump them. (tree_ssa_dominator_optimize): Call update_ssa instead of rewrite_into_ssa. (loop_depth_of_name): Declare extern. (simplify_cond_and_lookup_avail_expr): Guard against NULL values for LOW or HIGH. (cprop_into_successor_phis): Only propagate if NEW != ORIG. (record_equivalences_from_stmt): Call expr_computes_nonzero. (cprop_operand): Only propagate if VAL != OP. * tree-ssa-dse.c (dse_optimize_stmt): Mark symbols in removed statement for renaming. * tree-ssa-loop-im.c (move_computations): Call update_ssa. * tree-ssa-loop-ivopts.c (rewrite_address_base): Call add_type_alias if necessary. Call mark_new_vars_to_rename. (tree_ssa_iv_optimize): If new symbols need to be renamed, mark every statement updated, call update_ssa and rewrite_into_loop_closed_ssa. * tree-ssa-loop-manip.c (add_exit_phis): Do not remove DEF_BB from LIVEIN if VAR is a virtual. * tree-ssa-loop.c (tree_loop_optimizer_init): Call update_ssa. * tree-ssa-operands.c (get_expr_operands): Handle ASSERT_EXPR. (get_call_expr_operands): Reformat statement. (add_stmt_operand): Don't create V_MAY_DEFs for read-only symbols. * tree-ssa-propagate.c (ssa_prop_init): Initialize SSA_NAME_VALUE for every name. (first_vdef, stmt_makes_single_load, stmt_makes_single_store, get_value_loaded_by): New. (replace_uses_in, replace_vuses_in, replace_phi_args_in, substitute_and_fold): Move from tree-ssa-ccp.c. * tree-ssa-propagate.h (struct prop_value_d, prop_value_t, first_vdef, stmt_makes_single_load, stmt_makes_single_store, get_value_loaded_by, replace_uses_in, substitute_and_fold): Declare. * tree-ssa.c (verify_use): Fix error message. (propagate_into_addr, replace_immediate_uses, get_eq_name, check_phi_redundancy, kill_redundant_phi_nodes, pass_redundant_phi): Remove. Update all users. * tree-vect-transform.c (vect_create_data_ref_ptr): Call add_type_alias, if necessary. * tree-vectorizer.h (struct _stmt_vect_info): Update documentation for field 'memtag'. * tree-vrp.c: New file. * tree.def (ASSERT_EXPR): Define. * tree.h (ASSERT_EXPR_VAR): Define. (ASSERT_EXPR_COND): Define. (SSA_NAME_VALUE_RANGE): Define. (struct tree_ssa_name): Add field 'value_range'. (PHI_REWRITTEN): Remove. (struct tree_phi_node): Remove field 'rewritten'. * doc/invoke.texi (-fdump-tree-storeccp, -ftree-copy-prop, -ftree-store-copy-prop): Document. * doc/tree-ssa.texi: Remove broken link to McCAT's compiler. Document usage of update_ssa. testsuite/ChangeLog * g++.dg/tree-ssa/pr18178.C: New test. * gcc.c-torture/execute/20030216-1.x: Ignore at -O1. * gcc.c-torture/execute/20041019-1.c: New test. * gcc.dg/tree-ssa/20041008-1.c: New test. * gcc.dg/tree-ssa/ssa-ccp-12.c: New test. * gcc.dg/tree-ssa/20030731-2.c: Update to use -fdump-tree-store_ccp. * gcc.dg/tree-ssa/20030917-1.c: Likewise. * gcc.dg/tree-ssa/20030917-3.c: Likewise. * gcc.dg/tree-ssa/20040721-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-3.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-7.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-9.c: Likewise. From-SVN: r97884
2005-04-09 03:37:54 +02:00
{
insert_edge_copies (list, ENTRY_BLOCK_PTR);
mark_all_v_defs (list);
}
}
/* Entry point to phase 4. Update the function to match replacements. */
static void
scalarize_function (void)
{
static const struct sra_walk_fns fns = {
scalarize_use, scalarize_copy, scalarize_init, scalarize_ldst, false
};
sra_walk_function (&fns);
scalarize_parms ();
bsi_commit_edge_inserts ();
}
/* Debug helper function. Print ELT in a nice human-readable format. */
static void
dump_sra_elt_name (FILE *f, struct sra_elt *elt)
{
if (elt->parent && TREE_CODE (elt->parent->type) == COMPLEX_TYPE)
{
fputs (elt->element == integer_zero_node ? "__real__ " : "__imag__ ", f);
dump_sra_elt_name (f, elt->parent);
}
else
{
if (elt->parent)
dump_sra_elt_name (f, elt->parent);
if (DECL_P (elt->element))
{
if (TREE_CODE (elt->element) == FIELD_DECL)
fputc ('.', f);
print_generic_expr (f, elt->element, dump_flags);
}
re PR middle-end/22156 (bit-field copying regressed) PR middle-end/22156 * tree-sra.c (struct sra_elt): Add in_bitfld_block. (sra_hash_tree): Handle BIT_FIELD_REFs. (sra_elt_hash): Don't hash bitfld blocks. (sra_elt_eq): Skip them in parent compares as well. Handle BIT_FIELD_REFs. (build_element_name_1): Handle BIT_FIELD_REFs. (instantiate_element): Propagate nowarn from parents. Create BIT_FIELD_REF for variables that are widened by scalarization. Gimple-zero-initialize all bit-field variables that are not part of parameters that are going to be scalarized on entry. (instantiate_missing_elements_1): Return the sra_elt. (canon_type_for_field): New. (try_instantiate_multiple_fields): New. Infer widest possible access mode from decl or member type, but clip it at word size, and only widen it if a field crosses an alignment boundary. (instantiate_missing_elements): Use them. (generate_one_element_ref): Handle BIT_FIELD_REFs. (scalar_bitfield_p): New. (sra_build_assignment): Optimize assignments from scalarizable BIT_FIELD_REFs. Use BITS_BIG_ENDIAN to determine shift counts. (REPLDUP): New. (sra_build_bf_assignment): New. Optimize assignments to scalarizable BIT_FIELD_REFs. (sra_build_elt_assignment): New. Optimize BIT_FIELD_REF assignments to full variables. (generate_copy_inout): Use the new macros and functions. (generate_element_copy): Likewise. Handle bitfld differences. (generate_element_zero): Don't recurse for blocks. Use sra_build_elt_assignment. (generate_one_element_init): Take elt instead of var. Use sra_build_elt_assignment. (generate_element_init_1): Adjust. (bitfield_overlap_info): New struct. (bitfield_overlaps_p): New. (sra_explode_bitfield_assignment): New. Adjust widened variables to account for endianness. (sra_sync_for_bitfield_assignment): New. (scalarize_use): Re-expand assignment to/from scalarized BIT_FIELD_REFs. Explode or sync needed members for BIT_FIELD_REFs accesses or assignments. Use REPLDUP. (scalarize_copy): Use REPLDUP. (scalarize_ldst): Move assert before dereference. Adjust EH handling. (dump_sra_elt_name): Handle BIT_FIELD_REFs. From-SVN: r128908
2007-10-01 18:35:55 +02:00
else if (TREE_CODE (elt->element) == BIT_FIELD_REF)
fprintf (f, "$B" HOST_WIDE_INT_PRINT_DEC "F" HOST_WIDE_INT_PRINT_DEC,
tree_low_cst (TREE_OPERAND (elt->element, 2), 1),
tree_low_cst (TREE_OPERAND (elt->element, 1), 1));
else if (TREE_CODE (elt->element) == RANGE_EXPR)
fprintf (f, "["HOST_WIDE_INT_PRINT_DEC".."HOST_WIDE_INT_PRINT_DEC"]",
TREE_INT_CST_LOW (TREE_OPERAND (elt->element, 0)),
TREE_INT_CST_LOW (TREE_OPERAND (elt->element, 1)));
else
fprintf (f, "[" HOST_WIDE_INT_PRINT_DEC "]",
TREE_INT_CST_LOW (elt->element));
}
}
/* Likewise, but callable from the debugger. */
void
debug_sra_elt_name (struct sra_elt *elt)
{
dump_sra_elt_name (stderr, elt);
fputc ('\n', stderr);
}
Makefile.in: Added rules for ipa-pure-const.c... 2005-07-16 Danny Berlin <dberlin@dberlin.org> Kenneth Zadeck <zadeck@naturalbridge.com> * Makefile.in: Added rules for ipa-pure-const.c, ipa-reference.c, ipa-reference.h, ipa-utils.c, ipa-utils.h, ipa-type-escape.c, ipa-type-escape.h, tree-promote-statics.c * ipa-pure-const.c, ipa-reference.c, ipa-reference.h, ipa-utils.c, ipa-utils.h, ipa-type-escape.c, ipa-type-escape.h, tree-promote-statics.c: new files. * alias.c: (nonlocal_mentioned_p_1, nonlocal_mentioned_p, nonlocal_referenced_p_1, nonlocal_referenced_p, nonlocal_set_p_1, int nonlocal_set_p, mark_constant_function): Deleted. (rest_of_handle_cfg): Removed call to mark_constant_function. (nonoverlapping_component_refs_p): Added calls to support type based aliasing. * tree-ssa-alias.c (may_alias_p, compute_flow_insensitive_aliasing): Ditto. * calls.c (flags_from_decl_or_type): Removed reference to cgraph_rtl_info. (flags_from_decl_or_type): Support ECF_POINTER_NO_CAPTURE attribute. * c-common.c (handle_pointer_no_capture_attribute): New function and added pointer_no_capture attribute. * c-typeck.c (convert_arguments): Make builtins tolerant of having too many arguments. This is necessary for Spec 2000. * cgraph.h (const_function, pure_function): Removed. * common.opt: Added "fipa-pure-const", "fipa-reference", "fipa-type-escape", and "ftree-promote-static". * opts.c: Ditto. * passes.c: Added ipa and tree-promote-statics passes. * timevar.def: Added TV_IPA_PURE_CONST, TV_IPA_REFERENCE, TV_IPA_TYPE_ESCAPE, and TV_PROMOTE_STATICS. * tree.h: Support ECF_POINTER_NO_CAPTURE attribute. * tree-dfa.c (referenced_var_lookup_if_exists): New function. * tree-flow.h: Added exposed sra calls and addition of reference_vars_info field for FUNCTION_DECLS. * tree-pass.h: Added passes. * tree-sra.c: (sra_init_cache): New function. (sra_insert_before, sra_insert_after) Made public. (type_can_be_decomposed_p): Renamed from type_can_be_decomposed_p and made public. * tree-ssa-alias.c (dump_alias_stats): Added stats for type based aliasing. (may_alias_p): Added code to use type escape analysis to improve alias sets. * tree-ssa-operands.c (add_call_clobber_ops): Added parameter and code to prune clobbers of static variables based on information produced in ipa-reference pass. Changed call clobbering so that statics are not marked as clobbered if the call does not clobber them. 2005-07-16 Danny Berlin <dberlin@dberlin.org> Kenneth Zadeck <zadeck@naturalbridge.com> * gcc.dg/tree-ssa/ssa-dce-2.c: Changed dg-options to run at -O2 since pure const detection cannot run at -O1 in c compiler. * gcc.dg/tree-ssa/20030714-1.c Changed scanning patterns because we can now optimize this case properly. * gcc.dg/tree-ssa/sra-2.c: Changed to -O3 and removed xfail because we now pass. * gcc.dg/vect/vect-92.c: Removed out of bounds array access. Co-Authored-By: Kenneth Zadeck <zadeck@naturalbridge.com> From-SVN: r102098
2005-07-16 20:56:53 +02:00
void
sra_init_cache (void)
{
if (sra_type_decomp_cache)
return;
sra_type_decomp_cache = BITMAP_ALLOC (NULL);
sra_type_inst_cache = BITMAP_ALLOC (NULL);
}
/* Main entry point. */
tree-vrp.c (execute_vrp): Return value. 2006-03-02 Daniel Berlin <dberlin@dberlin.org> * gcc/tree-vrp.c (execute_vrp): Return value. * gcc/regrename.c (rest_of_handle_regrename): Ditto. * gcc/tree-into-ssa.c (rewrite_into_ssa): Ditto. * gcc/tree-complex.c (tree_lower_complex): Ditto. (tree_lower_complex_O0): Ditto. * gcc/tracer.c (rest_of_handle_tracer): Ditto. * gcc/postreload-gcse.c (rest_of_handle_gcse2): Ditto. * gcc/postreload.c (rest_of_handle_postreload): Ditto. * gcc/tree-tailcall.c (execute_tail_recursion): Ditto. (execute_tail_calls): Ditto. * gcc/tree-ssa-loop-ch.c (copy_loop_headers): Ditto. * gcc/tree.h (init_function_for_compilation): Ditto. * gcc/ipa-cp.c (ipcp_driver): Ditto. * gcc/tree-scalar-evolution.c (scev_const_prop): Ditto. * gcc/tree-scalar-evolution.h (scev_const_prop): Ditto. * gcc/final.c (compute_alignments): Ditto. (rest_of_handle_final): Ditto. (rest_of_handle_shorten_branches): Ditto. (rest_of_clean_state): Ditto. * gcc/omp-low.c (execute_expand_omp): Ditto. (execute_lower_omp): Ditto. * gcc/tree-ssa-dse.c (tree_ssa_dse): Ditto. * gcc/ipa-reference.c (static_execute): Ditto. * gcc/tree-ssa-uncprop.c (tree_ssa_uncprop): Ditto. * gcc/reorg.c (rest_of_handle_delay_slots): Ditto. (rest_of_handle_machine_reorg): Ditto. * gcc/cgraphunit.c (rebuild_cgraph_edges): Ditto. * gcc/flow.c (recompute_reg_usage): Ditto. (rest_of_handle_remove_death_notes): Ditto. (rest_of_handle_life): Ditto. (rest_of_handle_flow2): Ditto. * gcc/tree-ssa-copyrename.c (rename_ssa_copies): Ditto. * gcc/tree-ssa-ccp.c (do_ssa_ccp): Ditto. (do_ssa_store_ccp): Ditto. (execute_fold_all_builtins): Ditto. * gcc/mode-switching.c (rest_of_handle_mode_switching): Ditto. * gcc/modulo-sched.c (rest_of_handle_sms): Ditto. * gcc/ipa-pure-const.c (static_execute): Ditto. * gcc/cse.c (rest_of_handle_cse): Ditto. (rest_of_handle_cse2): Ditto. * gcc/web.c (rest_of_handle_web): Ditto. * gcc/tree-stdarg.c (execute_optimize_stdarg): Ditto. * gcc/tree-ssa-math-opts.c (execute_cse_reciprocals): Ditto. * gcc/tree-ssa-dom.c (tree_ssa_dominator_optimize): Ditto. * gcc/tree-nrv.c (tree_nrv): Ditto. (execute_return_slot_opt): Ditto. * gcc/tree-ssa-alias.c (compute_may_aliases): Ditto. (create_structure_vars): Ditto. * gcc/loop-init.c (rtl_loop_init): Ditto. (rtl_loop_done): Ditto. (rtl_move_loop_invariants): Ditto. (rtl_unswitch): Ditto. (rtl_unroll_and_peel_loops): Ditto. (rtl_doloop): Ditto. * gcc/gimple-low.c (lower_function_body): Ditto. (mark_used_blocks): Ditto. * gcc/tree-ssa-sink.c (execute_sink_code): Ditto. * gcc/ipa-inline.c (cgraph_decide_inlining): Ditto. (cgraph_early_inlining): Ditto. * gcc/global.c (rest_of_handle_global_alloc): Ditto. * gcc/jump.c (cleanup_barriers): Ditto. (purge_line_number_notes): Ditto. * gcc/ifcvt.c (rest_of_handle_if_conversion): Ditto. (rest_of_handle_if_after_reload): Ditto. * gcc/tree-ssa-loop.c (tree_ssa_loop_init): Ditto. (tree_ssa_loop_im): Ditto. (tree_ssa_loop_unswitch): Ditto. (tree_vectorize): Ditto. (tree_linear_transform): Ditto. (tree_ssa_loop_ivcanon): Ditto. (tree_ssa_empty_loop): Ditto. (tree_ssa_loop_bounds): Ditto. (tree_complete_unroll): Ditto. (tree_ssa_loop_prefetch): Ditto. (tree_ssa_loop_ivopts): Ditto. (tree_ssa_loop_done): Ditto. * gcc/predict.c (tree_estimate_probability): Ditto. * gcc/recog.c (split_all_insns_noflow): Ditto. (rest_of_handle_peephole2): Ditto. (rest_of_handle_split_all_insns): Ditto. * gcc/tree-eh.c (lower_eh_constructs): Ditto. * gcc/regmove.c (rest_of_handle_regmove): Ditto. (rest_of_handle_stack_adjustments): Ditto. * gcc/local-alloc.c (rest_of_handle_local_alloc): Ditto. * gcc/function.c (instantiate_virtual_regs): Ditto. (init_function_for_compilation): Ditto. (rest_of_handle_check_leaf_regs): Ditto. * gcc/gcse.c (rest_of_handle_jump_bypass): Ditto. (rest_of_handle_gcse): Ditto. * gcc/ipa-type-escape.c (type_escape_execute): Ditto. * gcc/alias.c (rest_of_handle_cfg): Ditto. * gcc/tree-if-conv.c (main_tree_if_conversion): Ditto. * gcc/profile.c (rest_of_handle_branch_prob): Ditto. * gcc/tree-ssa-phiopt.c (tree_ssa_phiopt): Ditto. * gcc/rtl-factoring.c (rest_of_rtl_seqabstr): Ditto. * gcc/bt-load.c (rest_of_handle_branch_target_load_optimize): Ditto * gcc/tree-dfa.c (find_referenced_vars): Ditto. * gcc/except.c (set_nothrow_function_flags): Ditto. (convert_to_eh_region_ranges): Ditto. (rest_of_handle_eh): Ditto. * gcc/emit-rtl.c (unshare_all_rtl): Ditto. (remove_unnecessary_notes): Ditto. * gcc/except.h (set_nothrow_function_flags): Ditto. (convert_to_eh_region_ranges): Ditto. * gcc/cfgexpand.c (tree_expand_cfg): Ditto. * gcc/tree-cfgcleanup.c (merge_phi_nodes): Ditto. * gcc/tree-ssa-pre.c (do_pre): Ditto. (execute_fre): Ditto. * gcc/cfgcleanup.c (rest_of_handle_jump): Ditto. (rest_of_handle_jump2): Ditto. * gcc/tree-sra.c (tree_sra): Ditto. * gcc/tree-mudflap.c (execute_mudflap_function_ops): Ditto. (execute_mudflap_function_decls): Ditto. * gcc/tree-ssa-copy.c (do_copy_prop): Ditto. (do_store_copy_prop): Ditto. * gcc/ipa-prop.h (ipcp_driver): Ditto. * gcc/cfglayout.c (insn_locators_initialize): Ditto. * gcc/tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_vars): Ditto. * gcc/cfglayout.h (insn_locators_initialize): Ditto. * gcc/tree-ssa-dce.c (tree_ssa_dce): Ditto. * gcc/tree-ssa.c (execute_early_warn_uninitialized): Ditto. (execute_late_warn_uninitialized): Ditto. * gcc/rtl.h (cleanup_barriers): Ditto. (split_all_insns_noflow): Ditto. (purge_line_number_notes): Ditto. (unshare_all_rtl): Ditto. (remove_unnecessary_notes): Ditto. (recompute_reg_usage): Ditto. (variable_tracking_main): Ditto. * gcc/integrate.c (emit_initial_value_sets): Ditto. * gcc/integrate.h (emit_initial_value_sets): Ditto. * gcc/tree-optimize.c (execute_free_datastructures): Ditto (execute_free_cfg_annotations): Ditto. (execute_fixup_cfg): Ditto. (execute_cleanup_cfg_pre_ipa): Ditto. (execute_cleanup_cfg_post_optimizing): Ditto. (execute_init_datastructures): Ditto. * gcc/tree-object-size.c (compute_object_sizes): Ditto. * gcc/combine.c (rest_of_handle_combine): Ditto. * gcc/tree-outof-ssa.c (rewrite_out_of_ssa): Ditto. * gcc/bb-reorder.c (duplicate_computed_gotos): Ditto. (rest_of_handle_reorder_blocks): Ditto. (rest_of_handle_partition_blocks): Ditto. * gcc/var-tracking.c (variable_tracking_main): Ditto. * gcc/tree-profile.c (tree_profiling): Ditto. * gcc/tree-vect-generic.c (expand_vector_operations): Ditto. * gcc/reg-stack.c (rest_of_handle_stack_regs): Ditto. * gcc/sched-rgn.c (rest_of_handle_sched): Ditto. (rest_of_handle_sched2): Ditto. * gcc/basic-block.h (free_bb_insn): Ditto. * gcc/tree-ssa-structalias.c (ipa_pta_execute): Ditto. * gcc/tree-cfg.c (execute_build_cfg): Ditto. (remove_useless_stmts): Ditto. (split_critical_edges): Ditto. (execute_warn_function_return): Ditto. (execute_warn_function_noreturn): Ditto. * gcc/tree-ssa-reassoc.c (execute_reassoc): Ditto. * gcc/cfgrtl.c (free_bb_for_insn): Ditto. * gcc/passes.c (execute_one_pass): Run additional todos returned by execute function. * gcc/tree-pass.h (struct tree_opt_pass): Make execute return a value. From-SVN: r111643
2006-03-02 20:00:11 +01:00
static unsigned int
tree_sra (void)
{
/* Initialize local variables. */
todoflags = 0;
gcc_obstack_init (&sra_obstack);
bitmap.h (BITMAP_XMALLOC, [...]): Remove. * bitmap.h (BITMAP_XMALLOC, BITMAP_XFREE): Remove. * bb-reorder.c (duplicate_computed_gotos): Use BITMAP_ALLOC and BITMAP_FREE. * bt-load.c (btr_def_live_range, combine_btr_defs, migrate_btr_def, migrate_btr_defs): Likewise. * cfgcleanup.c (thread_jump): Likewise. * cfgloop.c (get_loop_body_in_bfs_order): Likewise. * df.c (df_insn_table_realloc, df_bitmaps_alloc, df_bitmaps_free, df_alloc, df_free, df_du_chain_create, df_bb_rd_local_compute, df_rd_local_compute, df_reg_info_compute): Likewise. * dominance.c (init_dom_info, free_dom_info): Likewise. * flow.c (init_propagate_block_info, free_propagate_block_info): Likewise. * gcse.c (alloc_gcse_mem, free_gcse_mem): Likewise. * global.c (allocate_bb_info, free_bb_info, calculate_reg_pav, modify_reg_pav): Likewise. * loop-invariant.c (find_defs, find_invariant_insn, find_invariants, free_inv_motion_data): Likewise. * predict.c (tree_predict_by_opcode, estimate_bb_frequencies): Likewise. * stmt.c (expand_case): Likewise. * tree-cfg.c (tree_duplicate_sese_region): Likewise. * tree-dfa.c (mark_new_vars_to_rename): Likewise. * tree-if-conv.c (get_loop_body_in_if_conv_order): Likewise. * tree-into-ssa.c (insert_phi_nodes_for, def_blocks_free, get_def_blocks_for, mark_def_site_blocks, rewrite_into_ssa, rewrite_ssa_into_ssa): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (new_temp_expr_table, free_temp_expr_table, analyze_edges_for_bb, perform_edge_inserts): Likewise. * tree-scalar-evolution.c (scev_initialize, scev_finalize): Likewise. * tree-sra.c (tree_sra): Likewise. * tree-ssa-alias.c (init_alias_info, delete_alias_info): Likewise. * tree-ssa-ccp.c (ccp_fold_builtin): Likewise. * tree-ssa-dce.c (tree_dce_init, tree_dce_done): Likewise. * tree-ssa-dom.c (tree_ssa_dominator_optimize): Likewise. * tree-ssa-dse.c (tree_ssa_dse): Likewise. * tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_var): Likewise. * tree-ssa-live.c (new_tree_live_info, delete_tree_live_info, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph): Likewise. * tree-ssa-loop-ivopts.c (tree_ssa_iv_optimize_init, record_use, record_important_candidates, set_use_iv_cost, find_depends, determine_use_iv_costs, iv_ca_new, iv_ca_free, free_loop_data, tree_ssa_iv_optimize_finalize): Likewise. * tree-ssa-loop-manip.c (add_exit_phis_var, get_loops_exit, find_uses_to_rename_use, rewrite_into_loop_closed_ssa, tree_duplicate_loop_to_header_edge): Likewise. * tree-ssa-pre.c (init_pre, fini_pre): Likewise. * tree-ssa.c (verify_flow_insensitive_alias_info, verify_name_tags, verify_ssa, init_tree_ssa, delete_tree_ssa): Likewise. * tree-ssanames.c (marked_ssa_names, init_ssanames, fini_ssanames): Likewise. * tree-vectorizer.c (slpeel_tree_peel_loop_to_edge): Likewise. From-SVN: r95172
2005-02-17 17:19:49 +01:00
sra_candidates = BITMAP_ALLOC (NULL);
needs_copy_in = BITMAP_ALLOC (NULL);
Makefile.in: Added rules for ipa-pure-const.c... 2005-07-16 Danny Berlin <dberlin@dberlin.org> Kenneth Zadeck <zadeck@naturalbridge.com> * Makefile.in: Added rules for ipa-pure-const.c, ipa-reference.c, ipa-reference.h, ipa-utils.c, ipa-utils.h, ipa-type-escape.c, ipa-type-escape.h, tree-promote-statics.c * ipa-pure-const.c, ipa-reference.c, ipa-reference.h, ipa-utils.c, ipa-utils.h, ipa-type-escape.c, ipa-type-escape.h, tree-promote-statics.c: new files. * alias.c: (nonlocal_mentioned_p_1, nonlocal_mentioned_p, nonlocal_referenced_p_1, nonlocal_referenced_p, nonlocal_set_p_1, int nonlocal_set_p, mark_constant_function): Deleted. (rest_of_handle_cfg): Removed call to mark_constant_function. (nonoverlapping_component_refs_p): Added calls to support type based aliasing. * tree-ssa-alias.c (may_alias_p, compute_flow_insensitive_aliasing): Ditto. * calls.c (flags_from_decl_or_type): Removed reference to cgraph_rtl_info. (flags_from_decl_or_type): Support ECF_POINTER_NO_CAPTURE attribute. * c-common.c (handle_pointer_no_capture_attribute): New function and added pointer_no_capture attribute. * c-typeck.c (convert_arguments): Make builtins tolerant of having too many arguments. This is necessary for Spec 2000. * cgraph.h (const_function, pure_function): Removed. * common.opt: Added "fipa-pure-const", "fipa-reference", "fipa-type-escape", and "ftree-promote-static". * opts.c: Ditto. * passes.c: Added ipa and tree-promote-statics passes. * timevar.def: Added TV_IPA_PURE_CONST, TV_IPA_REFERENCE, TV_IPA_TYPE_ESCAPE, and TV_PROMOTE_STATICS. * tree.h: Support ECF_POINTER_NO_CAPTURE attribute. * tree-dfa.c (referenced_var_lookup_if_exists): New function. * tree-flow.h: Added exposed sra calls and addition of reference_vars_info field for FUNCTION_DECLS. * tree-pass.h: Added passes. * tree-sra.c: (sra_init_cache): New function. (sra_insert_before, sra_insert_after) Made public. (type_can_be_decomposed_p): Renamed from type_can_be_decomposed_p and made public. * tree-ssa-alias.c (dump_alias_stats): Added stats for type based aliasing. (may_alias_p): Added code to use type escape analysis to improve alias sets. * tree-ssa-operands.c (add_call_clobber_ops): Added parameter and code to prune clobbers of static variables based on information produced in ipa-reference pass. Changed call clobbering so that statics are not marked as clobbered if the call does not clobber them. 2005-07-16 Danny Berlin <dberlin@dberlin.org> Kenneth Zadeck <zadeck@naturalbridge.com> * gcc.dg/tree-ssa/ssa-dce-2.c: Changed dg-options to run at -O2 since pure const detection cannot run at -O1 in c compiler. * gcc.dg/tree-ssa/20030714-1.c Changed scanning patterns because we can now optimize this case properly. * gcc.dg/tree-ssa/sra-2.c: Changed to -O3 and removed xfail because we now pass. * gcc.dg/vect/vect-92.c: Removed out of bounds array access. Co-Authored-By: Kenneth Zadeck <zadeck@naturalbridge.com> From-SVN: r102098
2005-07-16 20:56:53 +02:00
sra_init_cache ();
sra_map = htab_create (101, sra_elt_hash, sra_elt_eq, NULL);
/* Scan. If we find anything, instantiate and scalarize. */
if (find_candidates_for_sra ())
{
scan_function ();
decide_instantiations ();
scalarize_function ();
if (!bitmap_empty_p (sra_candidates))
todoflags |= TODO_rebuild_alias;
}
/* Free allocated memory. */
htab_delete (sra_map);
sra_map = NULL;
bitmap.h (BITMAP_XMALLOC, [...]): Remove. * bitmap.h (BITMAP_XMALLOC, BITMAP_XFREE): Remove. * bb-reorder.c (duplicate_computed_gotos): Use BITMAP_ALLOC and BITMAP_FREE. * bt-load.c (btr_def_live_range, combine_btr_defs, migrate_btr_def, migrate_btr_defs): Likewise. * cfgcleanup.c (thread_jump): Likewise. * cfgloop.c (get_loop_body_in_bfs_order): Likewise. * df.c (df_insn_table_realloc, df_bitmaps_alloc, df_bitmaps_free, df_alloc, df_free, df_du_chain_create, df_bb_rd_local_compute, df_rd_local_compute, df_reg_info_compute): Likewise. * dominance.c (init_dom_info, free_dom_info): Likewise. * flow.c (init_propagate_block_info, free_propagate_block_info): Likewise. * gcse.c (alloc_gcse_mem, free_gcse_mem): Likewise. * global.c (allocate_bb_info, free_bb_info, calculate_reg_pav, modify_reg_pav): Likewise. * loop-invariant.c (find_defs, find_invariant_insn, find_invariants, free_inv_motion_data): Likewise. * predict.c (tree_predict_by_opcode, estimate_bb_frequencies): Likewise. * stmt.c (expand_case): Likewise. * tree-cfg.c (tree_duplicate_sese_region): Likewise. * tree-dfa.c (mark_new_vars_to_rename): Likewise. * tree-if-conv.c (get_loop_body_in_if_conv_order): Likewise. * tree-into-ssa.c (insert_phi_nodes_for, def_blocks_free, get_def_blocks_for, mark_def_site_blocks, rewrite_into_ssa, rewrite_ssa_into_ssa): Likewise. * tree-optimize.c (tree_rest_of_compilation): Likewise. * tree-outof-ssa.c (new_temp_expr_table, free_temp_expr_table, analyze_edges_for_bb, perform_edge_inserts): Likewise. * tree-scalar-evolution.c (scev_initialize, scev_finalize): Likewise. * tree-sra.c (tree_sra): Likewise. * tree-ssa-alias.c (init_alias_info, delete_alias_info): Likewise. * tree-ssa-ccp.c (ccp_fold_builtin): Likewise. * tree-ssa-dce.c (tree_dce_init, tree_dce_done): Likewise. * tree-ssa-dom.c (tree_ssa_dominator_optimize): Likewise. * tree-ssa-dse.c (tree_ssa_dse): Likewise. * tree-ssa-forwprop.c (tree_ssa_forward_propagate_single_use_var): Likewise. * tree-ssa-live.c (new_tree_live_info, delete_tree_live_info, calculate_live_on_entry, calculate_live_on_exit, build_tree_conflict_graph): Likewise. * tree-ssa-loop-ivopts.c (tree_ssa_iv_optimize_init, record_use, record_important_candidates, set_use_iv_cost, find_depends, determine_use_iv_costs, iv_ca_new, iv_ca_free, free_loop_data, tree_ssa_iv_optimize_finalize): Likewise. * tree-ssa-loop-manip.c (add_exit_phis_var, get_loops_exit, find_uses_to_rename_use, rewrite_into_loop_closed_ssa, tree_duplicate_loop_to_header_edge): Likewise. * tree-ssa-pre.c (init_pre, fini_pre): Likewise. * tree-ssa.c (verify_flow_insensitive_alias_info, verify_name_tags, verify_ssa, init_tree_ssa, delete_tree_ssa): Likewise. * tree-ssanames.c (marked_ssa_names, init_ssanames, fini_ssanames): Likewise. * tree-vectorizer.c (slpeel_tree_peel_loop_to_edge): Likewise. From-SVN: r95172
2005-02-17 17:19:49 +01:00
BITMAP_FREE (sra_candidates);
BITMAP_FREE (needs_copy_in);
BITMAP_FREE (sra_type_decomp_cache);
BITMAP_FREE (sra_type_inst_cache);
obstack_free (&sra_obstack, NULL);
return todoflags;
}
static unsigned int
tree_sra_early (void)
{
unsigned int ret;
early_sra = true;
ret = tree_sra ();
early_sra = false;
return ret & ~TODO_rebuild_alias;
}
static bool
gate_sra (void)
{
return flag_tree_sra != 0;
}
struct tree_opt_pass pass_sra_early =
{
"esra", /* name */
gate_sra, /* gate */
tree_sra_early, /* execute */
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
TV_TREE_SRA, /* tv_id */
PROP_cfg | PROP_ssa, /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
TODO_dump_func
| TODO_update_ssa
| TODO_ggc_collect
| TODO_verify_ssa, /* todo_flags_finish */
0 /* letter */
};
struct tree_opt_pass pass_sra =
{
"sra", /* name */
gate_sra, /* gate */
tree_sra, /* execute */
NULL, /* sub */
NULL, /* next */
0, /* static_pass_number */
TV_TREE_SRA, /* tv_id */
PROP_cfg | PROP_ssa, /* properties_required */
0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
[multiple changes] 2006-12-11 Diego Novillo <dnovillo@redhat.com> * doc/tree-ssa.texi: Update documentation for virtual operands and the use of push_stmt_changes/pop_stmt_changes. * doc/invoke.texi: Remove documentation for params global-var-threshold. Update documentation on max-aliased-vops. * tree-into-ssa.c: Cleanup comments, variables and spacing in various functions. (regs_to_rename): Declare. (mem_syms_to_rename): Declare. (dump_update_ssa): Declare. (debug_update_ssa): Declare. (dump_names_replaced_by): Declare. (debug_names_replaced_by): Declare. (dump_def_blocks): Declare. (debug_def_blocks): Declare. (dump_defs_stack): Declare. (debug_defs_stack): Declare. (dump_currdefs): Declare. (debug_currdefs): Declare. (mark_def_sites): Do not handle virtual operands. (compute_idf): Rename from find_idf. Update users. (register_new_def): Make local. Convert second argument to 'tree'. Use BLOCK_DEFS_STACK directly. If pushing a non-register, also push the underlying symbol. (rewrite_stmt): Do not handle virtual operands. (dump_tree_ssa): Call dump_def_blocks, dump_defs_stack, dump_currdefs and dump_tree_ssa_stats. (dump_tree_ssa_stats): Also dump REPL_TBL. (replace_use): Remove. Update all users to call SET_USE instead. (rewrite_blocks): Move code to free memory to fini_ssa_renamer. (mark_def_site_blocks): Move initialization code to init_ssa_renamer. (init_ssa_renamer): New. (fini_ssa_renamer): New. (rewrite_into_ssa): Call them. (prepare_block_for_update): Process SSA_OP_ALL_USES first and SSA_OP_ALL_DEFS later. Do not process virtual operands separately. (dump_update_ssa): Call dump_decl_set. (init_update_ssa): Initialize regs_to_rename and mem_syms_to_rename. Call init_ssa_renamer. (delete_update_ssa): Call fini_ssa_renamer. Free blocks_with_phis_to_rewrite. (mark_sym_for_renaming): If the variable has sub-variables, also mark them. If the variable belongs to a partition, also mark it. (mark_set_for_renaming): Call mark_sym_for_renaming on every symbol in the set. (switch_virtuals_to_full_rewrite): Call mark_set_for_renaming. (update_ssa): Separate syms_to_rename into regs_to_rename and mem_syms_to_rename. * tree-dump.c (dump_options): Add TDF_MEMSYMS. * tree-pretty-print.c (debug_generic_expr): Add TDF_MEMSYMS. (debug_generic_stmt): Likewise. (debug_tree_chain): Likewise. (dump_symbols): New. (dump_generic_node): Check for TDF_MEMSYMS. Handle MEMORY_PARTITION_TAG. If the statement references memory and TDF_MEMSYMS is given, call dump_symbols. Indicate default names with (D). (dump_vops): Update for new virtual operator format. * tree.c (init_ttree): Add MEMORY_PARTITION_TAG to tree_contains_struct. (tree_code_size): Handle MEMORY_PARTITION_TAG. (tree_node_structure): Likewise. (needs_to_live_in_memory): Handle SSA names. * tree.h (MTAG_P): Likewise. (struct tree_memory_partition_tag): Declare. (MPT_SYMBOLS): Define. (union tree_node): Add field 'mpt'. * treestruct.def (TS_MEMORY_PARTITION_TAG): Define. * tree.def (MEMORY_PARTITION_TAG): Define. * tree-pass.h (TDF_MEMSYMS): Define. * params.h (GLOBAL_VAR_THRESHOLD): Remove. * tree-ssa-alias.c: Include pointer-set.h (struct alias_map_d): Remove fields total_alias_vops, grouped_p and may_aliases. Update all users. (struct mp_info_def): Declare. (mp_info_t): New type. (get_smt_for): Rename from get_tmt_for. Update all users. (add_may_alias): Add argument ALREADY_ADDED. If given, use it to avoid adding duplicate entries to alias sets. (replace_may_alias): Remove. Update all users. (total_alias_vops_cmp): Remove. Update all users. (group_aliases_into): Remove. Update all users. (tree_pointer_compare): Remove. Update all users. (compact_name_tags): Remove. Update all users. (group_aliases): Remove. Update all users. (mark_non_addressable): Move from tree-flow-inline.h. Remove the symbol from the partition holding it, if needed. (dump_mp_info): New. (debug_mp_info): New. (sort_mp_info): New. (create_partition_for): New. (rewrite_alias_set_for): New. (compute_memory_partitions): New. (compute_may_aliases): Call it. (init_alias_info): If computing aliases for the first time, mark every memory symbol for renaming. (have_common_aliases_p): New. (compute_flow_insensitive_aliasing): Call it. (setup_pointers_and_addressables): Do not cache num_referenced_vars. For register promoted symbols, mark their former partition for renaming. (maybe_create_global_var): Only create .GLOBAL_VAR if there are no call-clobbered variables and a mix of pure and non-pure functions were found. (may_alias_p): Tidy comments. (create_tag_raw): Remove unused variable new_type. (dump_alias_info): call dump_memory_partitions. (dump_points_to_info_for): Call dump_decl_set. (may_be_aliased): Tidy comments and formatting. * timevar.def (TV_MEMORY_PARTITIONING): Define. * tree-vectorizer.c (vect_memsyms_to_rename): Rename from vect_vnames_to_rename. Set DECL_UIDs instead of SSA name versions in it. (slpeel_update_phi_nodes_for_guard1): Ignore memory PHIs. * tree-vect-transform.c (vect_transform_loop): Call mark_set_for_renaming with vect_memsyms_to_rename. * tree-flow-inline.h (zero_imm_uses_p): New. (memory_partition): New. (set_memory_partition): New. (factoring_name_p): New. (symbol_mem_tag): New. Update every function that used to access the annotation directly. (set_symbol_mem_tag): Likewise. * tree-ssa-copy.c (may_propagate_copy): Allow copies between a partition and a symbol as long as the symbol belongs to the partition. (merge_alias_info): Ignore merge requests when memory partitions are involved. * tree-ssa.c (verify_ssa_name): Check that default definitions have empty defining statements. (verify_use): Remove argument IS_VIRTUAL. Don't call verify_ssa_name. (verify_phi_args): Call verify_ssa_name. (verify_flow_insensitive_alias_info): Handle MPTs. (verify_flow_sensitive_alias_info): Likewise. (verify_name_tags): Likewise. (verify_call_clobbering): Likewise. (verify_ssa): Check for VOPs only after aliasing information is available. Check virtuals and real operands separately. Call verify_ssa_name on every operand. (stmt_references_memory_p): Move to tree-ssa-operands.c. (walk_use_def_chains_1): Guard against NULL PHI arguments. * tree-ssa-operands.c (stmt_references_memory_p): Move from tree-ssa.c. (get_mpt_for): New. (dump_memory_partitions): New. (debug_memory_partitions): New. * tree-flow.h (struct var_ann_d): Add field mpt. (struct stmt_ann_d): Add bitfield references_memory. * Makefile.in (tree-ssa-structalias.o): Include pointer-set.h (tree-ssa-alias.o): Likewise. * tree-ssa-structalias.c: (update_alias_info): Use STORED_SYMS to determine which variables are being written to by the store operation. * tree-ssa-structalias.h (struct alias_info) <total_alias_vops>: Remove. Update all users. <written_vars>: Change to a pointer set. Update all users. <dereferenced_ptrs_store>: Likewise. <dereferenced_ptrs_load>: Likewise. (NUM_REFERENCES): Remove. Update all users. (NUM_REFERENCES_CLEAR): Remove. Update all users. (NUM_REFERENCES_INC): Remove. Update all users. (NUM_REFERENCES_SET): Remove. Update all users. * params.def (PARAM_GLOBAL_VAR_THRESHOLD): Remove. Update all users. (PARAM_MAX_ALIASED_VOPS): Set to 10. * tree-ssanames.c (make_ssa_name): Initialize SSA_NAME_IS_DEFAULT_DEF to 0. 2006-12-11 Aldy Hernandez <aldyh@redhat.com> * tree-ssa-dse.c (aggregate_vardecl_d): New. (dse_global_data): Add aggregate_vardecl field. (dse_possible_dead_store_p): New. Add prev_defvar variable. Allow immediate uses and previous immediate uses to differ if they are setting different parts of the whole. (get_aggregate_vardecl): New. (dse_record_partial_aggregate_store): New. (dse_whole_aggregate_clobbered_p): New. (dse_partial_kill_p): New. (dse_optimize_stmt): Abstract code checking a possible dead store into new function dse_possible_dead_store_p(). Call dse_maybe_record_aggregate_store(). When checking whether a STMT and its USE_STMT refer to the same memory address, check also for partial kills that clobber the whole. Move some variable definitions to the block where they are used. (aggregate_vardecl_hash): New. (aggregate_vardecl_eq): New. (aggregate_vardecl_free): New. (aggregate_whole_store_p): New. (tree_ssa_dse): Initialize and free aggregate_vardecl. Mark which aggregate stores we care about. 2006-12-11 Andrew Macleod <amacleod@redhat.com> * tree-ssa-operands.h (struct vuse_element_d): Declare. (vuse_element_t): Declare. (struct vuse_vec_d): Declare. (vuse_vec_p): Declare. (VUSE_VECT_NUM_ELEM): Define. (VUSE_VECT_ELEMENT_NC): Define. (VUSE_ELEMENT_PTR_NC): Define. (VUSE_ELEMENT_VAR_NC): Define. (VUSE_VECT_ELEMENT): Define. (VUSE_ELEMENT_PTR): Define. (VUSE_ELEMENT_VAR): Define. (struct maydef_optype_d) <use_var>: Remove. <use_ptr>: Remove. <usev>: Add. (struct vuse_optype_d) <kill_var>: Remove. <use_ptr>: Remove. <usev>: Add. (struct mustdef_optype_d) <kill_var>: Remove. <use_ptr>: Remove. <usev>: Add. (VUSE_OP_PTR): Add argument. Use VUSE_ELEMENT_PTR. (VUSE_OP): Add argument. Use VUSE_ELEMENT_PTR. (VUSE_NUM): Define. (VUSE_VECT): Define. (MAYDEF_OP_PTR): Add argument. Use VUSE_OP_PTR. (MAYDEF_OP): Add argument. Use VUSE_OP. (MAYDEF_NUM): Define. (MAYDEF_VECT): Define. (MUSTDEF_KILL_PTR): Use VUSE_OP_PTR. (MUSTDEF_KILL): Use VUSE_OP. (MUSTDEF_NUM): Define. (MUSTDEF_VECT): Define. (realloc_maydef): Declare. (realloc_vuse): Declare. (struct ssa_operand_iterator_d) <vuse_index>: Add. <mayuse_index>: Add. (LOADED_SYMS): Define. (STORED_SYMS): Define. (FOR_EACH_SSA_MUSTDEF_OPERAND): Call op_iter_next_mustdef. * tree-into-ssa.c: Adapt for multi-operand V_MAY_DEF and VUSE operators. * tree-pretty-print.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-flow-inline.h: Likewise. (op_iter_next_mustdef): New. * tree-ssa-operands.c: Likewise. (ALLOC_OPTYPE): Remove. Update all users. (alloc_def): New. (alloc_use): New. (alloc_maydef): New. (alloc_vuse): New. (alloc_mustdef): New. (realloc_maydef): New. (realloc_vuse): New. 2006-12-11 Aldy Hernandez <aldyh@redhat.com> * tree-ssa-operands.c: Remove build_v_must_defs. (init_ssa_operands): Delete build_v_must_defs. (finalize_ssa_v_must_def_ops): Remove. (finalize_ssa_v_must_defs): Remove. (finalize_ssa_stmt_operands): Do not call finalize_ssa_v_must_defs. (start_ssa_stmt_operands): Do not check build_v_must_defs. (append_v_must_def): Delete. (copy_virtual_operands): Do not copy V_MUST_DEFs. (get_modify_expr_operands): Remove reference to V_MUST_DEF from comment. Remove opf_kill_def. (build_ssa_operands): Remove references to v_must_defs. (copy_virtual_operands): Same. (copy_virtual_operands): Same. (fini_ssa_operands): Same. (free_ssa_operands): Same. (add_mustdef_op): Remove. Remove mustdef_optype_p. (alloc_mustdef): Remove. Remove references to V_MUST_DEFs in comment at top of file. (get_expr_operands): Remove opf_kill_def. (opf_kill_def): Remove. (add_virtual_operand): Remove opf_kill_def. (get_indirect_ref_operands): Same. (get_tmr_operands): Same. * tree-vectorizer.c (rename_variables_in_bb): Remove SSA_OP_ALL_KILLS. * tree-ssa-loop-manip.c (find_uses_to_rename_stmt): Remove SSA_OP_ALL_KILLS. (check_loop_closed_ssa_stmt): Same. * tree-ssa.c (verify_def): Remove V_MUST_DEF from comment. (verify_use): Same. (verify_ssa): Remove V_MUST_DEFs traces. (verify_ssa): Remove SSA_OP_ALL_KILLS. * tree-into-ssa.c (mark_def_sites): Change SSA_OP_VMUSTDEF to SSA_OP_VMAYDEF. (rewrite_update_stmt): Remove SSA_OP_VIRTUAL_KILLS. (rewrite_stmt): Remove SSA_OP_ALL_KILLS. * tree-ssa-operands.h (struct stmt_operands_d): Remove V_MUST_DEF references. (MUSTDEF_OPS): Remove. (SSA_OP_VMUSTDEF): Remove. (FOR_EACH_SSA_MUSTDEF_OPERAND): Remove. (struct mustdef_optype_d): Remove. Remove mustdef_optype_p. (struct stmt_operands_d): Remove mustdef_ops. (ssa_operand_iterator_d): Remove mustdefs and mustkills. (SSA_OP_VIRTUAL_DEFS): Remove SSA_OP_VMUSTDEF. (MUSTDEF_RESULT_PTR): Remove. (MUSTDEF_RESULT): Remove. (MUSTDEF_KILL_PTR): Remove. (MUSTDEF_KILL): Remove. (MUSTDEF_NUM): Remove. (MUSTDEF_VECT): Remove. (SSA_OP_VIRTUAL_KILLS): Remove. (SSA_OP_ALL_VIRTUALS): Remove SSA_OP_VIRTUAL_KILLS. (SSA_OP_VMUSTKILL): Remove. (SSA_OP_ALL_KILLS): Remove. (SSA_OP_ALL_OPERANDS): Remove SSA_OP_ALL_KILLS. * tree-flow-inline.h (op_iter_init_def): Remove SSA_OP_VIRTUAL_KILLS. (delink_stmt_imm_use): Remove SSA_OP_ALL_KILLS. * tree-ssa-pre.c (compute_rvuse_and_antic_safe): Remove SSA_OP_VIRTUAL_KILLS. * tree-ssa-loop-im.c (determine_max_movement): Remove SSA_OP_VIRTUAL_KILLS. (gather_mem_refs_stmt): Same. (gather_mem_refs_stmt): Same. * tree-ssa-dce.c (mark_really_necessary_kill_operand_phis): Delete. (perform_tree_ssa_dce): Remove call to mark_really_necessary_kill_operand_phis. * tree-flow-inline.h (op_iter_init): Remove setting of mustdefs and mustkills. (op_iter_next_use): Do not check mustkills. (op_iter_next_def): Do not check mustdefs. (op_iter_next_tree): Do not check mustkills or mustdefs. (clear_and_done_ssa_iter): Do not set mustdefs or mustkills. (op_iter_next_maymustdef): Do not check mustkills. (op_iter_init_must_and_may_def): Remove SSA_OP_VMUSTKILL. (op_iter_init_mustdef): Remove. * tree-ssa-live.c (create_ssa_var_map): Change SSA_OP_VMUSTDEF to SSA_OP_VMAYDEF. * tree-ssa-dse.c (dse_optimize_stmt): Remove SSA_OP_VMUSTDEF. * tree-ssa-ccp.c: Remove V_MUST_DEF traces from comments. (visit_assignment): Same. * tree-ssa-copy.c (copy_prop_visit_assignment): Same. * tree-sra.c (mark_all_v_defs_1): Remove V_MUST_DEF from comment. * tree-outof-ssa.c (check_replaceable): Remove SSA_OP_VMUSTDEF. * tree-pretty-print.c (dump_vops): Remove printing of V_MUST_DEF. Remove kill_p variable. * tree-dfa.c (struct dfa_stats_d): Remove num_v_must_defs. (dump_dfa_stats): Remove code related to V_MUST_DEFs. (collect_dfa_stats_r): Do not set num_v_must_defs. (mark_new_vars_to_rename): Remove v_must_defs_{before,after} code. * tree-into-ssa.c (mark_def_sites): Change SSA_OP_VMUSTKILL to SSA_OP_VMAYUSE. * tree-ssa-pre.c (compute_rvuse_and_antic_safe): Remove SSA_OP_VMUSTDEF and SSA_OP_VMUSTKILL. * tree-ssa-propagate.c (stmt_makes_single_store): Remove SSA_OP_VMUSTDEF. From-SVN: r119760
2006-12-12 02:48:51 +01:00
TODO_dump_func
| TODO_update_ssa
[multiple changes] 2006-12-11 Diego Novillo <dnovillo@redhat.com> * doc/tree-ssa.texi: Update documentation for virtual operands and the use of push_stmt_changes/pop_stmt_changes. * doc/invoke.texi: Remove documentation for params global-var-threshold. Update documentation on max-aliased-vops. * tree-into-ssa.c: Cleanup comments, variables and spacing in various functions. (regs_to_rename): Declare. (mem_syms_to_rename): Declare. (dump_update_ssa): Declare. (debug_update_ssa): Declare. (dump_names_replaced_by): Declare. (debug_names_replaced_by): Declare. (dump_def_blocks): Declare. (debug_def_blocks): Declare. (dump_defs_stack): Declare. (debug_defs_stack): Declare. (dump_currdefs): Declare. (debug_currdefs): Declare. (mark_def_sites): Do not handle virtual operands. (compute_idf): Rename from find_idf. Update users. (register_new_def): Make local. Convert second argument to 'tree'. Use BLOCK_DEFS_STACK directly. If pushing a non-register, also push the underlying symbol. (rewrite_stmt): Do not handle virtual operands. (dump_tree_ssa): Call dump_def_blocks, dump_defs_stack, dump_currdefs and dump_tree_ssa_stats. (dump_tree_ssa_stats): Also dump REPL_TBL. (replace_use): Remove. Update all users to call SET_USE instead. (rewrite_blocks): Move code to free memory to fini_ssa_renamer. (mark_def_site_blocks): Move initialization code to init_ssa_renamer. (init_ssa_renamer): New. (fini_ssa_renamer): New. (rewrite_into_ssa): Call them. (prepare_block_for_update): Process SSA_OP_ALL_USES first and SSA_OP_ALL_DEFS later. Do not process virtual operands separately. (dump_update_ssa): Call dump_decl_set. (init_update_ssa): Initialize regs_to_rename and mem_syms_to_rename. Call init_ssa_renamer. (delete_update_ssa): Call fini_ssa_renamer. Free blocks_with_phis_to_rewrite. (mark_sym_for_renaming): If the variable has sub-variables, also mark them. If the variable belongs to a partition, also mark it. (mark_set_for_renaming): Call mark_sym_for_renaming on every symbol in the set. (switch_virtuals_to_full_rewrite): Call mark_set_for_renaming. (update_ssa): Separate syms_to_rename into regs_to_rename and mem_syms_to_rename. * tree-dump.c (dump_options): Add TDF_MEMSYMS. * tree-pretty-print.c (debug_generic_expr): Add TDF_MEMSYMS. (debug_generic_stmt): Likewise. (debug_tree_chain): Likewise. (dump_symbols): New. (dump_generic_node): Check for TDF_MEMSYMS. Handle MEMORY_PARTITION_TAG. If the statement references memory and TDF_MEMSYMS is given, call dump_symbols. Indicate default names with (D). (dump_vops): Update for new virtual operator format. * tree.c (init_ttree): Add MEMORY_PARTITION_TAG to tree_contains_struct. (tree_code_size): Handle MEMORY_PARTITION_TAG. (tree_node_structure): Likewise. (needs_to_live_in_memory): Handle SSA names. * tree.h (MTAG_P): Likewise. (struct tree_memory_partition_tag): Declare. (MPT_SYMBOLS): Define. (union tree_node): Add field 'mpt'. * treestruct.def (TS_MEMORY_PARTITION_TAG): Define. * tree.def (MEMORY_PARTITION_TAG): Define. * tree-pass.h (TDF_MEMSYMS): Define. * params.h (GLOBAL_VAR_THRESHOLD): Remove. * tree-ssa-alias.c: Include pointer-set.h (struct alias_map_d): Remove fields total_alias_vops, grouped_p and may_aliases. Update all users. (struct mp_info_def): Declare. (mp_info_t): New type. (get_smt_for): Rename from get_tmt_for. Update all users. (add_may_alias): Add argument ALREADY_ADDED. If given, use it to avoid adding duplicate entries to alias sets. (replace_may_alias): Remove. Update all users. (total_alias_vops_cmp): Remove. Update all users. (group_aliases_into): Remove. Update all users. (tree_pointer_compare): Remove. Update all users. (compact_name_tags): Remove. Update all users. (group_aliases): Remove. Update all users. (mark_non_addressable): Move from tree-flow-inline.h. Remove the symbol from the partition holding it, if needed. (dump_mp_info): New. (debug_mp_info): New. (sort_mp_info): New. (create_partition_for): New. (rewrite_alias_set_for): New. (compute_memory_partitions): New. (compute_may_aliases): Call it. (init_alias_info): If computing aliases for the first time, mark every memory symbol for renaming. (have_common_aliases_p): New. (compute_flow_insensitive_aliasing): Call it. (setup_pointers_and_addressables): Do not cache num_referenced_vars. For register promoted symbols, mark their former partition for renaming. (maybe_create_global_var): Only create .GLOBAL_VAR if there are no call-clobbered variables and a mix of pure and non-pure functions were found. (may_alias_p): Tidy comments. (create_tag_raw): Remove unused variable new_type. (dump_alias_info): call dump_memory_partitions. (dump_points_to_info_for): Call dump_decl_set. (may_be_aliased): Tidy comments and formatting. * timevar.def (TV_MEMORY_PARTITIONING): Define. * tree-vectorizer.c (vect_memsyms_to_rename): Rename from vect_vnames_to_rename. Set DECL_UIDs instead of SSA name versions in it. (slpeel_update_phi_nodes_for_guard1): Ignore memory PHIs. * tree-vect-transform.c (vect_transform_loop): Call mark_set_for_renaming with vect_memsyms_to_rename. * tree-flow-inline.h (zero_imm_uses_p): New. (memory_partition): New. (set_memory_partition): New. (factoring_name_p): New. (symbol_mem_tag): New. Update every function that used to access the annotation directly. (set_symbol_mem_tag): Likewise. * tree-ssa-copy.c (may_propagate_copy): Allow copies between a partition and a symbol as long as the symbol belongs to the partition. (merge_alias_info): Ignore merge requests when memory partitions are involved. * tree-ssa.c (verify_ssa_name): Check that default definitions have empty defining statements. (verify_use): Remove argument IS_VIRTUAL. Don't call verify_ssa_name. (verify_phi_args): Call verify_ssa_name. (verify_flow_insensitive_alias_info): Handle MPTs. (verify_flow_sensitive_alias_info): Likewise. (verify_name_tags): Likewise. (verify_call_clobbering): Likewise. (verify_ssa): Check for VOPs only after aliasing information is available. Check virtuals and real operands separately. Call verify_ssa_name on every operand. (stmt_references_memory_p): Move to tree-ssa-operands.c. (walk_use_def_chains_1): Guard against NULL PHI arguments. * tree-ssa-operands.c (stmt_references_memory_p): Move from tree-ssa.c. (get_mpt_for): New. (dump_memory_partitions): New. (debug_memory_partitions): New. * tree-flow.h (struct var_ann_d): Add field mpt. (struct stmt_ann_d): Add bitfield references_memory. * Makefile.in (tree-ssa-structalias.o): Include pointer-set.h (tree-ssa-alias.o): Likewise. * tree-ssa-structalias.c: (update_alias_info): Use STORED_SYMS to determine which variables are being written to by the store operation. * tree-ssa-structalias.h (struct alias_info) <total_alias_vops>: Remove. Update all users. <written_vars>: Change to a pointer set. Update all users. <dereferenced_ptrs_store>: Likewise. <dereferenced_ptrs_load>: Likewise. (NUM_REFERENCES): Remove. Update all users. (NUM_REFERENCES_CLEAR): Remove. Update all users. (NUM_REFERENCES_INC): Remove. Update all users. (NUM_REFERENCES_SET): Remove. Update all users. * params.def (PARAM_GLOBAL_VAR_THRESHOLD): Remove. Update all users. (PARAM_MAX_ALIASED_VOPS): Set to 10. * tree-ssanames.c (make_ssa_name): Initialize SSA_NAME_IS_DEFAULT_DEF to 0. 2006-12-11 Aldy Hernandez <aldyh@redhat.com> * tree-ssa-dse.c (aggregate_vardecl_d): New. (dse_global_data): Add aggregate_vardecl field. (dse_possible_dead_store_p): New. Add prev_defvar variable. Allow immediate uses and previous immediate uses to differ if they are setting different parts of the whole. (get_aggregate_vardecl): New. (dse_record_partial_aggregate_store): New. (dse_whole_aggregate_clobbered_p): New. (dse_partial_kill_p): New. (dse_optimize_stmt): Abstract code checking a possible dead store into new function dse_possible_dead_store_p(). Call dse_maybe_record_aggregate_store(). When checking whether a STMT and its USE_STMT refer to the same memory address, check also for partial kills that clobber the whole. Move some variable definitions to the block where they are used. (aggregate_vardecl_hash): New. (aggregate_vardecl_eq): New. (aggregate_vardecl_free): New. (aggregate_whole_store_p): New. (tree_ssa_dse): Initialize and free aggregate_vardecl. Mark which aggregate stores we care about. 2006-12-11 Andrew Macleod <amacleod@redhat.com> * tree-ssa-operands.h (struct vuse_element_d): Declare. (vuse_element_t): Declare. (struct vuse_vec_d): Declare. (vuse_vec_p): Declare. (VUSE_VECT_NUM_ELEM): Define. (VUSE_VECT_ELEMENT_NC): Define. (VUSE_ELEMENT_PTR_NC): Define. (VUSE_ELEMENT_VAR_NC): Define. (VUSE_VECT_ELEMENT): Define. (VUSE_ELEMENT_PTR): Define. (VUSE_ELEMENT_VAR): Define. (struct maydef_optype_d) <use_var>: Remove. <use_ptr>: Remove. <usev>: Add. (struct vuse_optype_d) <kill_var>: Remove. <use_ptr>: Remove. <usev>: Add. (struct mustdef_optype_d) <kill_var>: Remove. <use_ptr>: Remove. <usev>: Add. (VUSE_OP_PTR): Add argument. Use VUSE_ELEMENT_PTR. (VUSE_OP): Add argument. Use VUSE_ELEMENT_PTR. (VUSE_NUM): Define. (VUSE_VECT): Define. (MAYDEF_OP_PTR): Add argument. Use VUSE_OP_PTR. (MAYDEF_OP): Add argument. Use VUSE_OP. (MAYDEF_NUM): Define. (MAYDEF_VECT): Define. (MUSTDEF_KILL_PTR): Use VUSE_OP_PTR. (MUSTDEF_KILL): Use VUSE_OP. (MUSTDEF_NUM): Define. (MUSTDEF_VECT): Define. (realloc_maydef): Declare. (realloc_vuse): Declare. (struct ssa_operand_iterator_d) <vuse_index>: Add. <mayuse_index>: Add. (LOADED_SYMS): Define. (STORED_SYMS): Define. (FOR_EACH_SSA_MUSTDEF_OPERAND): Call op_iter_next_mustdef. * tree-into-ssa.c: Adapt for multi-operand V_MAY_DEF and VUSE operators. * tree-pretty-print.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-flow-inline.h: Likewise. (op_iter_next_mustdef): New. * tree-ssa-operands.c: Likewise. (ALLOC_OPTYPE): Remove. Update all users. (alloc_def): New. (alloc_use): New. (alloc_maydef): New. (alloc_vuse): New. (alloc_mustdef): New. (realloc_maydef): New. (realloc_vuse): New. 2006-12-11 Aldy Hernandez <aldyh@redhat.com> * tree-ssa-operands.c: Remove build_v_must_defs. (init_ssa_operands): Delete build_v_must_defs. (finalize_ssa_v_must_def_ops): Remove. (finalize_ssa_v_must_defs): Remove. (finalize_ssa_stmt_operands): Do not call finalize_ssa_v_must_defs. (start_ssa_stmt_operands): Do not check build_v_must_defs. (append_v_must_def): Delete. (copy_virtual_operands): Do not copy V_MUST_DEFs. (get_modify_expr_operands): Remove reference to V_MUST_DEF from comment. Remove opf_kill_def. (build_ssa_operands): Remove references to v_must_defs. (copy_virtual_operands): Same. (copy_virtual_operands): Same. (fini_ssa_operands): Same. (free_ssa_operands): Same. (add_mustdef_op): Remove. Remove mustdef_optype_p. (alloc_mustdef): Remove. Remove references to V_MUST_DEFs in comment at top of file. (get_expr_operands): Remove opf_kill_def. (opf_kill_def): Remove. (add_virtual_operand): Remove opf_kill_def. (get_indirect_ref_operands): Same. (get_tmr_operands): Same. * tree-vectorizer.c (rename_variables_in_bb): Remove SSA_OP_ALL_KILLS. * tree-ssa-loop-manip.c (find_uses_to_rename_stmt): Remove SSA_OP_ALL_KILLS. (check_loop_closed_ssa_stmt): Same. * tree-ssa.c (verify_def): Remove V_MUST_DEF from comment. (verify_use): Same. (verify_ssa): Remove V_MUST_DEFs traces. (verify_ssa): Remove SSA_OP_ALL_KILLS. * tree-into-ssa.c (mark_def_sites): Change SSA_OP_VMUSTDEF to SSA_OP_VMAYDEF. (rewrite_update_stmt): Remove SSA_OP_VIRTUAL_KILLS. (rewrite_stmt): Remove SSA_OP_ALL_KILLS. * tree-ssa-operands.h (struct stmt_operands_d): Remove V_MUST_DEF references. (MUSTDEF_OPS): Remove. (SSA_OP_VMUSTDEF): Remove. (FOR_EACH_SSA_MUSTDEF_OPERAND): Remove. (struct mustdef_optype_d): Remove. Remove mustdef_optype_p. (struct stmt_operands_d): Remove mustdef_ops. (ssa_operand_iterator_d): Remove mustdefs and mustkills. (SSA_OP_VIRTUAL_DEFS): Remove SSA_OP_VMUSTDEF. (MUSTDEF_RESULT_PTR): Remove. (MUSTDEF_RESULT): Remove. (MUSTDEF_KILL_PTR): Remove. (MUSTDEF_KILL): Remove. (MUSTDEF_NUM): Remove. (MUSTDEF_VECT): Remove. (SSA_OP_VIRTUAL_KILLS): Remove. (SSA_OP_ALL_VIRTUALS): Remove SSA_OP_VIRTUAL_KILLS. (SSA_OP_VMUSTKILL): Remove. (SSA_OP_ALL_KILLS): Remove. (SSA_OP_ALL_OPERANDS): Remove SSA_OP_ALL_KILLS. * tree-flow-inline.h (op_iter_init_def): Remove SSA_OP_VIRTUAL_KILLS. (delink_stmt_imm_use): Remove SSA_OP_ALL_KILLS. * tree-ssa-pre.c (compute_rvuse_and_antic_safe): Remove SSA_OP_VIRTUAL_KILLS. * tree-ssa-loop-im.c (determine_max_movement): Remove SSA_OP_VIRTUAL_KILLS. (gather_mem_refs_stmt): Same. (gather_mem_refs_stmt): Same. * tree-ssa-dce.c (mark_really_necessary_kill_operand_phis): Delete. (perform_tree_ssa_dce): Remove call to mark_really_necessary_kill_operand_phis. * tree-flow-inline.h (op_iter_init): Remove setting of mustdefs and mustkills. (op_iter_next_use): Do not check mustkills. (op_iter_next_def): Do not check mustdefs. (op_iter_next_tree): Do not check mustkills or mustdefs. (clear_and_done_ssa_iter): Do not set mustdefs or mustkills. (op_iter_next_maymustdef): Do not check mustkills. (op_iter_init_must_and_may_def): Remove SSA_OP_VMUSTKILL. (op_iter_init_mustdef): Remove. * tree-ssa-live.c (create_ssa_var_map): Change SSA_OP_VMUSTDEF to SSA_OP_VMAYDEF. * tree-ssa-dse.c (dse_optimize_stmt): Remove SSA_OP_VMUSTDEF. * tree-ssa-ccp.c: Remove V_MUST_DEF traces from comments. (visit_assignment): Same. * tree-ssa-copy.c (copy_prop_visit_assignment): Same. * tree-sra.c (mark_all_v_defs_1): Remove V_MUST_DEF from comment. * tree-outof-ssa.c (check_replaceable): Remove SSA_OP_VMUSTDEF. * tree-pretty-print.c (dump_vops): Remove printing of V_MUST_DEF. Remove kill_p variable. * tree-dfa.c (struct dfa_stats_d): Remove num_v_must_defs. (dump_dfa_stats): Remove code related to V_MUST_DEFs. (collect_dfa_stats_r): Do not set num_v_must_defs. (mark_new_vars_to_rename): Remove v_must_defs_{before,after} code. * tree-into-ssa.c (mark_def_sites): Change SSA_OP_VMUSTKILL to SSA_OP_VMAYUSE. * tree-ssa-pre.c (compute_rvuse_and_antic_safe): Remove SSA_OP_VMUSTDEF and SSA_OP_VMUSTKILL. * tree-ssa-propagate.c (stmt_makes_single_store): Remove SSA_OP_VMUSTDEF. From-SVN: r119760
2006-12-12 02:48:51 +01:00
| TODO_ggc_collect
| TODO_verify_ssa, /* todo_flags_finish */
Unify the management of RTL and tree-level dump files. 2004-09-06 Paolo Bonzini <bonzini@gnu.org> Unify the management of RTL and tree-level dump files. * cfgexpand.c (tree_expand_cfg): Fix incorrect comment. Don't print function name to the dump file, the pass manager would do this for us. Add code from the top of rest_of_compilation, up to the initial RTL dump. * passes.c (rest_of_handle_jump): Call fixup_tail_calls and close the DFI_sibling dump file. (rest_of_compilation): Don't do that here. Remove code up to the initial RTL dump. (init_optimization_passes): Remove. (pass_rest_of_compilation): Change pass name to NULL. * toplev.c (lang_dependent_init): Do not use an empty dump file prefix. Do not call init_optimization_passes. * toplev.h (init_optimization_passes): Remove. * graph.c (print_rtl_graph_with_bb, clean_graph_dump_file, finish_graph_dump_file): Remove SUFFIX parameter. * graph.h (print_rtl_graph_with_bb, clean_graph_dump_file, finish_graph_dump_file): Likewise. * tree-pass.h (struct tree_opt_pass): Add `letter' field. * cfgexpand.c (pass_expand): Adjust. * gimple-low.c (pass_lower_cf, pass_remove_useless_vars): Adjust. * passes.c (pass_rest_of_compilation): Adjust. * predict.c (pass_profile): Adjust. * tree-alias-common.c (pass_build_pta, pass_del_pta): Adjust. * tree-cfg.c (pass_build_cfg, pass_remove_useless_stmts, pass_split_crit_edges, pass_warn_function_return): Adjust. * tree-complex.c (pass_lower_vector_ssa, pass_pre_expand): Adjust. * tree-dfa.c (pass_referenced_vars): Adjust. * tree-eh.c (pass_lower_eh): Adjust. * tree-if-conv.c (pass_build_ssa): Adjust. * tree-into-ssa.c (pass_build_ssa): Adjust. * tree-mudflap.c (pass_mudflap_1, pass_mudflap_2): Adjust. * tree-nomudflap.c (pass_mudflap_1, pass_mudflap_2): Adjust. * tree-nrv.c (pass_nrv): Adjust. * tree-optimize.c (pass_gimple, pass_all_optimizations, pass_cleanup_cfg_post_optimizing, pass_free_datastructures, pass_init_datastructures): Adjust. * tree-outof-ssa.c (pass_del_ssa): Adjust. * tree-profile.c (pass_tree_profile): Adjust. * tree-sra.c (pass_sra): Adjust. * tree-ssa-alias.c (pass_may_alias): Adjust. * tree-ssa-ccp.c (pass_ccp, pass_fold_builtins): Adjust. * tree-ssa-copyrename.c (pass_rename_ssa_copies): Adjust. * tree-ssa-dce.c (pass_dce, pass_cd_dce): Adjust. * tree-ssa-dom.c (pass_dominator): Adjust. * tree-ssa-dse.c (pass_dse): Adjust. * tree-ssa-forwprop.c (pass_forwprop): Adjust. * tree-ssa-if-conv.c (pass_if_conversion): Adjust. * tree-ssa-loop-ch.c (pass_ch): Adjust. * tree-ssa-loop.c (pass_loop, pass_loop_init, pass_lim, pass_loop_done, pass_complete_unroll, pass_iv_canon, pass_iv_optimize, pass_vectorize): Adjust. * tree-ssa-phiopt.c (pass_phiopt): Adjust. * tree-ssa-pre.c (pass_pre, pass_fre): Adjust. * tree-ssa.c (pass_redundant_phi, pass_early_warn_uninitialized, pass_late_warn_uninnitialized): Adjust. * tree-tailcall.c (pass_tail_recursion, pass_tail_calls): Adjust. * Makefile.in (tree-dump.o): Add new dependencies. * cgraph.c (cgraph_remove_node): TDF_all -> TDF_tree_all. * cgraphunit.c (cgraph_preserve_function_body_p, cgraph_optimize): Likewise. * toplev.c (dump_file_name): New. * tree-dump.c (dump_enable_all): Add LETTER parameter. (struct dump_file_info): Add NUM and LETTER fields. (dump_files): Adjust and add RTL dump files. (dump_register): Add NUM and LETTER fields. (get_dump_file_name, dump_initialized_p, enable_rtl_dump_file): New. (dump_begin): Use get_dump_file_name. (dump_switch_p_1): Adjust call to dump_enable_all. * tree-dump.h (dump_register): Adjust prototype. * tree-optimize.c (register_one_dump_file): Take dump file index. Support flags for RTL dumps. (register_dump_files): Fill in NUM field of struct dump_file_info. Track properties both when the gate is executed and when it is not. (execute_todo): Dump RTL. Add PROPERTIES parameter. (execute_one_pass): Pass properties to execute_todo. Handle VCG dumps of RTL. * tree-pass.h (dump_file_name): New. * tree.h (TDF_TREE, TDF_RTL, get_dump_file_name, dump_initialized_p): New. * Makefile.in (passes.o): Add new dependencies. * passes.c (struct dump_file_info, enum dump_file_index, dump_file_tbl, init_optimization_passes): Remove. (open_dump_file, close_dump_file): Use tree-dumping infrastructure. (rest_of_handle_new_regalloc, rest_of_handle_old_regalloc): Use dump_enabled_p. (finish_optimization_passes): Update finish_graph_dump_file loop. (enable_rtl_dump_file): Remove. * tree-dump.c (dump_files): Adjust and add RTL dump files. (enable_rtl_dump_file): Add here. * tree.h (enum tree_dump_index): Add RTL dump file indices. * doc/invoke.texi (Debugging options): Document new RTL debugging options. Update. From-SVN: r87113
2004-09-06 12:08:17 +02:00
0 /* letter */
};