From 712d22976c2f8c0053865790f0e0674337864ab9 Mon Sep 17 00:00:00 2001 From: manu Date: Tue, 7 Jul 2009 02:55:59 +0000 Subject: =?UTF-8?q?2009-07-07=20=20Manuel=20L=C3=B3pez-Ib=C3=A1=C3=B1ez=20?= =?UTF-8?q?=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * cgraphunit.c: Replace %J by an explicit location. Update all calls. * c-decl.c: Likewise. * function.c: Likewise. * varasm.c: Likewise. * tree-ssa.c: Likewise. * c-common.c: Likewise. * tree-cfg.c: Likewise. * config/spu/spu.c: Likewise. * config/ia64/ia64.c: Likewise. * config/v850/v850.c: Likewise. java/ * class.c: Replace %J by an explicit location. Update all calls. objc/ * objc-act.c: Replace %J by an explicit location. Update all calls. cp/ * init.c: Replace %J by an explicit location. Update all calls. * decl.c: Likewise. * typeck2.c: Likewise. * pt.c: Likewise. * name-lookup.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149312 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index d63e974cf91..c8a48a3b227 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1270,7 +1270,7 @@ warn_uninit (tree t, const char *gmsgid, void *data) if (xloc.file != floc.file || xloc.line < floc.line || xloc.line > LOCATION_LINE (cfun->function_end_locus)) - inform (location, "%J%qD was declared here", var, var); + inform (DECL_SOURCE_LOCATION (var), "%qD was declared here", var); } } -- cgit v1.2.1 From 3a4438438e8c85036b3cf79cbbf030f0d726db88 Mon Sep 17 00:00:00 2001 From: rguenth Date: Tue, 14 Jul 2009 09:59:18 +0000 Subject: 2009-07-14 Richard Guenther Andrey Belevantsev * tree-ssa-alias.h (refs_may_alias_p_1): Declare. (pt_solution_set): Likewise. * tree-ssa-alias.c (refs_may_alias_p_1): Export. * tree-ssa-structalias.c (pt_solution_set): New function. * final.c (rest_of_clean_state): Free SSA data structures. * print-rtl.c (print_decl_name): Remove. (print_mem_expr): Implement in terms of print_generic_expr. * alias.c (ao_ref_from_mem): New function. (rtx_refs_may_alias_p): Likewise. (true_dependence): Query alias-export info. (canon_true_dependence): Likewise. (write_dependence_p): Likewise. * tree-dfa.c (get_ref_base_and_extent): For void types leave size unknown. * emit-rtl.c (component_ref_for_mem_expr): Remove. (mem_expr_equal_p): Use operand_equal_p. (set_mem_attributes_minus_bitpos): Do not use component_ref_for_mem_expr. * cfgexpand.c (add_partitioned_vars_to_ptset): New function. (update_alias_info_with_stack_vars): Likewise. (partition_stack_vars): Call update_alias_info_with_stack_vars. * tree-ssa.c (delete_tree_ssa): Do not release SSA names explicitly nor clear stmt operands. Free the decl-to-pointer map. * tree-optimize.c (execute_free_datastructures): Do not free SSA data structures here. * tree-flow.h (struct gimple_df): Add decls_to_pointers member. * Makefile.in (emit-rtl.o): Add pointer-set.h dependency. (alias.o): Add tree-ssa-alias.h, pointer-set.h and $(TREE_FLOW_H) dependencies. (print-rtl.o): Add $(DIAGNOSTIC_H) dependency. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149624 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 46 +++------------------------------------------- 1 file changed, 3 insertions(+), 43 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index c8a48a3b227..7ec04f70fad 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -802,52 +802,9 @@ init_tree_ssa (struct function *fn) void delete_tree_ssa (void) { - size_t i; - basic_block bb; - gimple_stmt_iterator gsi; referenced_var_iterator rvi; tree var; - /* Release any ssa_names still in use. */ - for (i = 0; i < num_ssa_names; i++) - { - tree var = ssa_name (i); - if (var && TREE_CODE (var) == SSA_NAME) - { - SSA_NAME_IMM_USE_NODE (var).prev = &(SSA_NAME_IMM_USE_NODE (var)); - SSA_NAME_IMM_USE_NODE (var).next = &(SSA_NAME_IMM_USE_NODE (var)); - } - release_ssa_name (var); - } - - /* FIXME. This may not be necessary. We will release all this - memory en masse in free_ssa_operands. This clearing used to be - necessary to avoid problems with the inliner, but it may not be - needed anymore. */ - FOR_EACH_BB (bb) - { - for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) - { - gimple stmt = gsi_stmt (gsi); - - if (gimple_has_ops (stmt)) - { - gimple_set_def_ops (stmt, NULL); - gimple_set_use_ops (stmt, NULL); - } - - if (gimple_has_mem_ops (stmt)) - { - gimple_set_vdef (stmt, NULL_TREE); - gimple_set_vuse (stmt, NULL_TREE); - } - - gimple_set_modified (stmt, true); - } - if (!(bb->flags & BB_RTL)) - set_phi_nodes (bb, NULL); - } - /* Remove annotations from every referenced local variable. */ FOR_EACH_REFERENCED_VAR (var, rvi) { @@ -873,6 +830,9 @@ delete_tree_ssa (void) cfun->gimple_df->default_defs = NULL; pt_solution_reset (&cfun->gimple_df->escaped); pt_solution_reset (&cfun->gimple_df->callused); + if (cfun->gimple_df->decls_to_pointers != NULL) + pointer_map_destroy (cfun->gimple_df->decls_to_pointers); + cfun->gimple_df->decls_to_pointers = NULL; cfun->gimple_df->modified_noreturn_calls = NULL; cfun->gimple_df = NULL; -- cgit v1.2.1 From efbcb6defd4842cee3bc73eec195fe425457ea13 Mon Sep 17 00:00:00 2001 From: amacleod Date: Thu, 30 Jul 2009 18:36:30 +0000 Subject: Add source_location support to PHI arguments. 2009-07-29 Andrew MacLeod PR debug 26475 * tree-into-ssa.c (insert_phi_nodes_for, rewrite_add_phi_arguments): Set location for phi arguments. (rewrite_update_phi_arguments): Find locations for reaching defs. * tree-ssa-threadupdate.c (create_edge_and_update_destination_phis): Add location to add_phi_arg calls. * tree-loop-districbution.c (update_phis_for_loop_copy): Add locations. * tree-ssa-loop-manip.c (create_iv, add_exit_phis_edge, split_loop_exit_edge, tree_transform_and_unroll_loop): Add locations. * tree-tailcall.c (add_successor_phi_arg, eliminate_tail_call, create_tailcall_accumulator, tree_optimize_tail_calls_1): Add locations. * tree.h (struct phi_arg_d): Add location_t to PHI arguments. * tree-phinodes.c (make_phi_node): Initialize location. (resize_phi_node): Initialize location to UNKNOWN_LOCATION. (add_phi_arg): Add location parameter. (remove_phi_arg_num): Move location when moving phi argument. * omp-low.c (expand_parallel_call, expand_omp_for_static_chunk): Set location. * tree-vect-loop-manip.c (slpeel_update_phis_for_duplicate_loop, slpeel_update_phi_nodes_for_guard1, slpeel_update_phi_nodes_for_guard2, slpeel_tree_duplicate_loop_to_edge_cfg, set_prologue_iterations, vect_loop_versioning): Set locations. * tree-parloops.c (create_phi_for_local_result, transform_to_exit_first_loop, create_parallel_loop): Add locations. * gimple-pretty-print.c (dump_gimple_phi): Dump lineno's if present. * tree-vect-loop.c (get_initial_def_for_induction, vect_create_epilog_for_reduction, vect_finalize_reduction): Add locations. * tree-flow-inline.h (gimple_phi_arg_location): New. Return locus. (gimple_phi_arg_location_from_edge): New. Return locus from an edge. (gimple_phi_arg_set_location): New. Set locus. (gimple_phi_arg_has_location): New. Check for locus. (redirect_edge_var_map_location): New. Return locus from var_map. * tree-vect-data-refs.c (vect_setup_realignment): Set location. * tree-ssa-phiopt.c (conditional_replacement): Set locus when combining PHI arguments. (cond_store_replacement): Set location. * cfgexpand.c (gimple_assign_rhs_to_tree): Transfer locus if possible. * grpahite.c (add_loop_exit_phis, add_guard_exit_phis, scop_add_exit_phis_edge): Add locations. * tree-cfgcleanup.c (remove_forwarder_block, remove_forwarder_block_with_phi): Add locations. * tree-ssa-pre.c (insert_into_preds_of_block): Add locations. * tree-predcom.c (initialize_root_vars, initialize_root_vars_lm): Add locations. * tree-ssa-dce.c (forward_edge_to_pdom): Add locations. * tree-ssa.c (redirect_edge_var_map_add, ssa_redirect_edge, flush_pending_stmts): Add source location. * lambda-code.c (perfect_nestify): Maintain location stack with argument stack to preserve locations. * tree-vect-stmts.c (vectorizable_load): Add location. * tree-inline.c (copy_phis_for_bb): Copy locus. (setup_one_parameter): Add call locus to inlined parameter stmts. (initialize_inlined_parameters): Pass in call location as parameter assignment locus. (tree_function_versioning): Pass location to setup_one_parameter. * tree-ssa-phiprop.c (phiprop_insert_phi): Set locations. * tree-outof-ssa.c (struct _elim_graph): Add source_location vecs for copy and edge lists. (insert_partition_copy_on_edge, insert_value_copy_on_edge, insert_rtx_to_part_on_edge, insert_part_to_rtx_on_edge): Provide a locus parameter and override the stmt default if provided. (new_elim_graph, clear_elim_graph, delete_elim_graph, elim_graph_add_edge, elim_graph_remove_succ_edge, FOR_EACH_ELIM_GRAPH_SUCC, FOR_EACH_ELIM_GRAPH_PRED, eliminate_build, elim_forward, elim_unvisited_predecessor, elim_backward, elim_create, eliminate_phi): Add locus info in elimination graph for each edge and value copy. (insert_backedge_copies): Copy locus if present. * tree-flow.h (struct _edge_var_map): Add locus field. * tree-switch_conversions.c (fix_phi_nodes): Add locations. * tree-cfg.c (reinstall_phi_args, gimple_make_forwarder_block, add_phi_args_after_copy_edge, gimple_lv_adjust_loop_header_phi): Add locations. * ipa-struct-reorg.c (make_edge_and_fix_phis_of_dest): Add locations. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150267 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 7ec04f70fad..e8033cd46ca 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -53,7 +53,7 @@ static struct pointer_map_t *edge_var_maps; /* Add a mapping with PHI RESULT and PHI DEF associated with edge E. */ void -redirect_edge_var_map_add (edge e, tree result, tree def) +redirect_edge_var_map_add (edge e, tree result, tree def, source_location locus) { void **slot; edge_var_map_vector old_head, head; @@ -71,6 +71,7 @@ redirect_edge_var_map_add (edge e, tree result, tree def) } new_node.def = def; new_node.result = result; + new_node.locus = locus; VEC_safe_push (edge_var_map, heap, head, &new_node); if (old_head != head) @@ -193,14 +194,16 @@ ssa_redirect_edge (edge e, basic_block dest) for (gsi = gsi_start_phis (e->dest); !gsi_end_p (gsi); gsi_next (&gsi)) { tree def; + source_location locus ; phi = gsi_stmt (gsi); def = gimple_phi_arg_def (phi, e->dest_idx); + locus = gimple_phi_arg_location (phi, e->dest_idx); if (def == NULL_TREE) continue; - redirect_edge_var_map_add (e, gimple_phi_result (phi), def); + redirect_edge_var_map_add (e, gimple_phi_result (phi), def, locus); } e = redirect_edge_succ_nodup (e, dest); @@ -233,7 +236,7 @@ flush_pending_stmts (edge e) phi = gsi_stmt (gsi); def = redirect_edge_var_map_def (vm); - add_phi_arg (phi, def, e); + add_phi_arg (phi, def, e, redirect_edge_var_map_location (vm)); } redirect_edge_var_map_clear (e); -- cgit v1.2.1 From 2ed8de558d0b7fbcde24bc8c188395c56138aca3 Mon Sep 17 00:00:00 2001 From: rguenth Date: Mon, 3 Aug 2009 10:30:46 +0000 Subject: 2009-08-03 Richard Guenther * tree.c (make_vector_type): Build a main variant first, get the canonical one and then build the variant. * tree-ssa.c (useless_type_conversion_p_1): Handle fixed-point types. (useless_type_conversion_p): Conversions to pointers to incomplete record types are useless. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150370 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index e8033cd46ca..504491040b4 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -897,6 +897,11 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type) && SCALAR_FLOAT_TYPE_P (outer_type)) return true; + /* Fixed point types with the same mode are compatible. */ + else if (FIXED_POINT_TYPE_P (inner_type) + && FIXED_POINT_TYPE_P (outer_type)) + return true; + /* We need to take special care recursing to pointed-to types. */ else if (POINTER_TYPE_P (inner_type) && POINTER_TYPE_P (outer_type)) @@ -1000,12 +1005,17 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type) bool useless_type_conversion_p (tree outer_type, tree inner_type) { - /* If the outer type is (void *), then the conversion is not - necessary. We have to make sure to not apply this while - recursing though. */ + /* If the outer type is (void *) or a pointer to an incomplete record type, + then the conversion is not necessary. + We have to make sure to not apply this while recursing though. */ if (POINTER_TYPE_P (inner_type) && POINTER_TYPE_P (outer_type) - && TREE_CODE (TREE_TYPE (outer_type)) == VOID_TYPE) + && (VOID_TYPE_P (TREE_TYPE (outer_type)) + || (AGGREGATE_TYPE_P (TREE_TYPE (outer_type)) + && TREE_CODE (TREE_TYPE (outer_type)) != ARRAY_TYPE + && (TREE_CODE (TREE_TYPE (outer_type)) + == TREE_CODE (TREE_TYPE (inner_type))) + && !COMPLETE_TYPE_P (TREE_TYPE (outer_type))))) return true; return useless_type_conversion_p_1 (outer_type, inner_type); -- cgit v1.2.1 From cbb04ca92323480471b9475688cc20af9409045a Mon Sep 17 00:00:00 2001 From: jakub Date: Mon, 3 Aug 2009 19:26:10 +0000 Subject: PR middle-end/40943 * tree-ssa.c (warn_uninitialized_var): Even on LHS warn for operand of INDIRECT_REF. * gcc.dg/uninit-6.c: Re-add XFAIL. * gcc.dg/uninit-6-O0.c: Likewise. * gcc.dg/uninit-pr40943.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150379 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 504491040b4..28da94bb21c 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1265,7 +1265,12 @@ warn_uninitialized_var (tree *tp, int *walk_subtrees, void *data_) /* We do not care about LHS. */ if (wi->is_lhs) - return NULL_TREE; + { + /* Except for operands of INDIRECT_REF. */ + if (!INDIRECT_REF_P (t)) + return NULL_TREE; + t = TREE_OPERAND (t, 0); + } switch (TREE_CODE (t)) { -- cgit v1.2.1 From 9fa672189b407b95f332b4701d6679f9babca98c Mon Sep 17 00:00:00 2001 From: rguenth Date: Thu, 6 Aug 2009 11:31:20 +0000 Subject: 2009-08-06 Richard Guenther * tree-ssa.c (useless_type_conversion_p_1): Make function and array type comparisons frontend independent. * Makefile.in (tree-ssa.o): Add $(TARGET_H) dependency. * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Always fill out array reference lower bound and element size operands. (ao_ref_init_from_vn_reference): Properly compute the offset for ARRAY_RANGE_REF. (vn_reference_fold_indirect): Fill out array reference lower bound and element size operands. * tree-ssa-pre.c (phi_translate_1): Fail if we have to translate a non gimple valued reference operand which can happen for array reference lower bound or element size. (create_component_ref_by_pieces_1): Properly generate the element size operand for array references. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150519 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 119 insertions(+), 15 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 28da94bb21c..0b4cc964ee7 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -26,6 +26,7 @@ along with GCC; see the file COPYING3. If not see #include "flags.h" #include "rtl.h" #include "tm_p.h" +#include "target.h" #include "ggc.h" #include "langhooks.h" #include "hard-reg-set.h" @@ -871,8 +872,10 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type) && TYPE_CANONICAL (inner_type) == TYPE_CANONICAL (outer_type)) return true; - /* Changes in machine mode are never useless conversions. */ - if (TYPE_MODE (inner_type) != TYPE_MODE (outer_type)) + /* Changes in machine mode are never useless conversions unless we + deal with aggregate types in which case we defer to later checks. */ + if (TYPE_MODE (inner_type) != TYPE_MODE (outer_type) + && !AGGREGATE_TYPE_P (inner_type)) return false; /* If both the inner and outer types are integral types, then the @@ -919,6 +922,11 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type) && TYPE_VOLATILE (TREE_TYPE (outer_type))) return false; + /* We require explicit conversions from incomplete target types. */ + if (!COMPLETE_TYPE_P (TREE_TYPE (inner_type)) + && COMPLETE_TYPE_P (TREE_TYPE (outer_type))) + return false; + /* Do not lose casts between pointers that when dereferenced access memory with different alias sets. */ if (get_deref_alias_set (inner_type) != get_deref_alias_set (outer_type)) @@ -948,33 +956,129 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type) return useless_type_conversion_p (TREE_TYPE (outer_type), TREE_TYPE (inner_type)); - /* For aggregates we may need to fall back to structural equality - checks. */ - else if (AGGREGATE_TYPE_P (inner_type) - && AGGREGATE_TYPE_P (outer_type)) + else if (TREE_CODE (inner_type) == ARRAY_TYPE + && TREE_CODE (outer_type) == ARRAY_TYPE) { - /* Different types of aggregates are incompatible. */ - if (TREE_CODE (inner_type) != TREE_CODE (outer_type)) + /* Preserve string attributes. */ + if (TYPE_STRING_FLAG (inner_type) != TYPE_STRING_FLAG (outer_type)) return false; /* Conversions from array types with unknown extent to array types with known extent are not useless. */ - if (TREE_CODE (inner_type) == ARRAY_TYPE - && !TYPE_DOMAIN (inner_type) + if (!TYPE_DOMAIN (inner_type) && TYPE_DOMAIN (outer_type)) return false; + /* Nor are conversions from array types with non-constant size to + array types with constant size or to different size. */ + if (TYPE_SIZE (outer_type) + && TREE_CODE (TYPE_SIZE (outer_type)) == INTEGER_CST + && (!TYPE_SIZE (inner_type) + || TREE_CODE (TYPE_SIZE (inner_type)) != INTEGER_CST + || !tree_int_cst_equal (TYPE_SIZE (outer_type), + TYPE_SIZE (inner_type)))) + return false; + + /* Check conversions between arrays with partially known extents. + If the array min/max values are constant they have to match. + Otherwise allow conversions to unknown and variable extents. + In particular this declares conversions that may change the + mode to BLKmode as useless. */ + if (TYPE_DOMAIN (inner_type) + && TYPE_DOMAIN (outer_type) + && TYPE_DOMAIN (inner_type) != TYPE_DOMAIN (outer_type)) + { + tree inner_min = TYPE_MIN_VALUE (TYPE_DOMAIN (inner_type)); + tree outer_min = TYPE_MIN_VALUE (TYPE_DOMAIN (outer_type)); + tree inner_max = TYPE_MAX_VALUE (TYPE_DOMAIN (inner_type)); + tree outer_max = TYPE_MAX_VALUE (TYPE_DOMAIN (outer_type)); + + /* After gimplification a variable min/max value carries no + additional information compared to a NULL value. All that + matters has been lowered to be part of the IL. */ + if (inner_min && TREE_CODE (inner_min) != INTEGER_CST) + inner_min = NULL_TREE; + if (outer_min && TREE_CODE (outer_min) != INTEGER_CST) + outer_min = NULL_TREE; + if (inner_max && TREE_CODE (inner_max) != INTEGER_CST) + inner_max = NULL_TREE; + if (outer_max && TREE_CODE (outer_max) != INTEGER_CST) + outer_max = NULL_TREE; + + /* Conversions NULL / variable <- cst are useless, but not + the other way around. */ + if (outer_min + && (!inner_min + || !tree_int_cst_equal (inner_min, outer_min))) + return false; + if (outer_max + && (!inner_max + || !tree_int_cst_equal (inner_max, outer_max))) + return false; + } + + /* Recurse on the element check. */ + return useless_type_conversion_p (TREE_TYPE (outer_type), + TREE_TYPE (inner_type)); + } + + else if ((TREE_CODE (inner_type) == FUNCTION_TYPE + || TREE_CODE (inner_type) == METHOD_TYPE) + && TREE_CODE (inner_type) == TREE_CODE (outer_type)) + { + tree outer_parm, inner_parm; + + /* If the return types are not compatible bail out. */ + if (!useless_type_conversion_p (TREE_TYPE (outer_type), + TREE_TYPE (inner_type))) + return false; + + /* Method types should belong to a compatible base class. */ + if (TREE_CODE (inner_type) == METHOD_TYPE + && !useless_type_conversion_p (TYPE_METHOD_BASETYPE (outer_type), + TYPE_METHOD_BASETYPE (inner_type))) + return false; + + /* A conversion to an unprototyped argument list is ok. */ + if (!TYPE_ARG_TYPES (outer_type)) + return true; + + /* If the argument types are compatible the conversion is useless. */ + if (TYPE_ARG_TYPES (outer_type) == TYPE_ARG_TYPES (inner_type)) + return true; + + for (outer_parm = TYPE_ARG_TYPES (outer_type), + inner_parm = TYPE_ARG_TYPES (inner_type); + outer_parm && inner_parm; + outer_parm = TREE_CHAIN (outer_parm), + inner_parm = TREE_CHAIN (inner_parm)) + if (!useless_type_conversion_p (TREE_VALUE (outer_parm), + TREE_VALUE (inner_parm))) + return false; + + /* If there is a mismatch in the number of arguments the functions + are not compatible. */ + if (outer_parm || inner_parm) + return false; + + /* Defer to the target if necessary. */ + if (TYPE_ATTRIBUTES (inner_type) || TYPE_ATTRIBUTES (outer_type)) + return targetm.comp_type_attributes (outer_type, inner_type) != 0; + + return true; + } + + /* For aggregates we may need to fall back to structural equality + checks. */ + else if (AGGREGATE_TYPE_P (inner_type) + && TREE_CODE (inner_type) == TREE_CODE (outer_type)) + { /* ??? This seems to be necessary even for aggregates that don't have TYPE_STRUCTURAL_EQUALITY_P set. */ /* ??? This should eventually just return false. */ return lang_hooks.types_compatible_p (inner_type, outer_type); } - /* Also for functions and possibly other types with - TYPE_STRUCTURAL_EQUALITY_P set. */ - else if (TYPE_STRUCTURAL_EQUALITY_P (inner_type) - && TYPE_STRUCTURAL_EQUALITY_P (outer_type)) - return lang_hooks.types_compatible_p (inner_type, outer_type); return false; } -- cgit v1.2.1 From a35525557a1e37e40ece1a05d1cffd7ee6c9fdfe Mon Sep 17 00:00:00 2001 From: rguenth Date: Fri, 7 Aug 2009 08:54:53 +0000 Subject: 2009-08-07 Richard Guenther * tree-ssa.c (useless_type_conversion_p_1): Only for types that require structural equality defer to the langhook. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150559 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 0b4cc964ee7..ddd4cfb7456 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1073,11 +1073,11 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type) else if (AGGREGATE_TYPE_P (inner_type) && TREE_CODE (inner_type) == TREE_CODE (outer_type)) { - /* ??? This seems to be necessary even for aggregates that don't - have TYPE_STRUCTURAL_EQUALITY_P set. */ + if (TYPE_STRUCTURAL_EQUALITY_P (outer_type) + || TYPE_STRUCTURAL_EQUALITY_P (inner_type)) + return lang_hooks.types_compatible_p (inner_type, outer_type); - /* ??? This should eventually just return false. */ - return lang_hooks.types_compatible_p (inner_type, outer_type); + return false; } return false; -- cgit v1.2.1 From 4cf7530495d61b6db1975e4d67913b321d185990 Mon Sep 17 00:00:00 2001 From: rguenth Date: Mon, 10 Aug 2009 09:22:47 +0000 Subject: 2009-08-10 Richard Guenther PR middle-end/41006 * tree-ssa.c (useless_type_conversion_p_1): Fold into ... (useless_type_conversion_p): ... here. Require pointer targets to be compatible. * gcc.c-torture/compile/pr41006-1.c: New testcase. * gcc.c-torture/compile/pr41006-2.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150621 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 88 ++++++++++++++++++++++++++-------------------------------- 1 file changed, 40 insertions(+), 48 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index ddd4cfb7456..97e15aeaef1 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -844,10 +844,31 @@ delete_tree_ssa (void) redirect_edge_var_map_destroy (); } -/* Helper function for useless_type_conversion_p. */ +/* Return true if the conversion from INNER_TYPE to OUTER_TYPE is a + useless type conversion, otherwise return false. -static bool -useless_type_conversion_p_1 (tree outer_type, tree inner_type) + This function implicitly defines the middle-end type system. With + the notion of 'a < b' meaning that useless_type_conversion_p (a, b) + holds and 'a > b' meaning that useless_type_conversion_p (b, a) holds, + the following invariants shall be fulfilled: + + 1) useless_type_conversion_p is transitive. + If a < b and b < c then a < c. + + 2) useless_type_conversion_p is not symmetric. + From a < b does not follow a > b. + + 3) Types define the available set of operations applicable to values. + A type conversion is useless if the operations for the target type + is a subset of the operations for the source type. For example + casts to void* are useless, casts from void* are not (void* can't + be dereferenced or offsetted, but copied, hence its set of operations + is a strict subset of that of all other data pointer types). Casts + to const T* are useless (can't be written to), casts from const T* + to T* are not. */ + +bool +useless_type_conversion_p (tree outer_type, tree inner_type) { /* Do the following before stripping toplevel qualifiers. */ if (POINTER_TYPE_P (inner_type) @@ -909,6 +930,16 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type) else if (POINTER_TYPE_P (inner_type) && POINTER_TYPE_P (outer_type)) { + /* If the outer type is (void *) or a pointer to an incomplete + record type, then the conversion is not necessary. */ + if (VOID_TYPE_P (TREE_TYPE (outer_type)) + || (AGGREGATE_TYPE_P (TREE_TYPE (outer_type)) + && TREE_CODE (TREE_TYPE (outer_type)) != ARRAY_TYPE + && (TREE_CODE (TREE_TYPE (outer_type)) + == TREE_CODE (TREE_TYPE (inner_type))) + && !COMPLETE_TYPE_P (TREE_TYPE (outer_type)))) + return true; + /* Don't lose casts between pointers to volatile and non-volatile qualified types. Doing so would result in changing the semantics of later accesses. For function types the volatile qualifier @@ -938,9 +969,12 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type) /* Otherwise pointers/references are equivalent if their pointed to types are effectively the same. We can strip qualifiers on pointed-to types for further comparison, which is done in - the callee. */ - return useless_type_conversion_p_1 (TREE_TYPE (outer_type), - TREE_TYPE (inner_type)); + the callee. Note we have to use true compatibility here + because addresses are subject to propagation into dereferences + and thus might get the original type exposed which is equivalent + to a reverse conversion. */ + return types_compatible_p (TREE_TYPE (outer_type), + TREE_TYPE (inner_type)); } /* Recurse for complex types. */ @@ -1083,48 +1117,6 @@ useless_type_conversion_p_1 (tree outer_type, tree inner_type) return false; } -/* Return true if the conversion from INNER_TYPE to OUTER_TYPE is a - useless type conversion, otherwise return false. - - This function implicitly defines the middle-end type system. With - the notion of 'a < b' meaning that useless_type_conversion_p (a, b) - holds and 'a > b' meaning that useless_type_conversion_p (b, a) holds, - the following invariants shall be fulfilled: - - 1) useless_type_conversion_p is transitive. - If a < b and b < c then a < c. - - 2) useless_type_conversion_p is not symmetric. - From a < b does not follow a > b. - - 3) Types define the available set of operations applicable to values. - A type conversion is useless if the operations for the target type - is a subset of the operations for the source type. For example - casts to void* are useless, casts from void* are not (void* can't - be dereferenced or offsetted, but copied, hence its set of operations - is a strict subset of that of all other data pointer types). Casts - to const T* are useless (can't be written to), casts from const T* - to T* are not. */ - -bool -useless_type_conversion_p (tree outer_type, tree inner_type) -{ - /* If the outer type is (void *) or a pointer to an incomplete record type, - then the conversion is not necessary. - We have to make sure to not apply this while recursing though. */ - if (POINTER_TYPE_P (inner_type) - && POINTER_TYPE_P (outer_type) - && (VOID_TYPE_P (TREE_TYPE (outer_type)) - || (AGGREGATE_TYPE_P (TREE_TYPE (outer_type)) - && TREE_CODE (TREE_TYPE (outer_type)) != ARRAY_TYPE - && (TREE_CODE (TREE_TYPE (outer_type)) - == TREE_CODE (TREE_TYPE (inner_type))) - && !COMPLETE_TYPE_P (TREE_TYPE (outer_type))))) - return true; - - return useless_type_conversion_p_1 (outer_type, inner_type); -} - /* Return true if a conversion from either type of TYPE1 and TYPE2 to the other is not required. Otherwise return false. */ -- cgit v1.2.1 From dfe8e806805d4f3b1b396b195f7ecfba089b9b1a Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 12 Aug 2009 15:10:47 +0000 Subject: 2009-08-12 Richard Guenther * alias.c (get_alias_set): Honor TYPE_STRUCTURAL_EQUALITY_P. * gimplify.c (gimplify_modify_expr): Do not use lang_hooks.types_compatible_p. * tree-ssa.c (useless_type_conversion_p): For aggregates just return false if the canonical types differ. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150695 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 97e15aeaef1..a40270335df 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1102,17 +1102,12 @@ useless_type_conversion_p (tree outer_type, tree inner_type) return true; } - /* For aggregates we may need to fall back to structural equality - checks. */ + /* For aggregates we rely on TYPE_CANONICAL exclusively and require + explicit conversions for types involving to be structurally + compared types. */ else if (AGGREGATE_TYPE_P (inner_type) && TREE_CODE (inner_type) == TREE_CODE (outer_type)) - { - if (TYPE_STRUCTURAL_EQUALITY_P (outer_type) - || TYPE_STRUCTURAL_EQUALITY_P (inner_type)) - return lang_hooks.types_compatible_p (inner_type, outer_type); - - return false; - } + return false; return false; } -- cgit v1.2.1 From 4c0d4e21db538d3eb4852c8d7957711a3fc7fee3 Mon Sep 17 00:00:00 2001 From: rguenth Date: Thu, 13 Aug 2009 08:19:10 +0000 Subject: 2009-08-13 Richard Guenther PR middle-end/41047 * tree-ssa-ccp.c (ccp_fold): When folding pointer additions use the constant pointer type. * gimplify.c (canonicalize_addr_expr): Canonicalize independent of CV qualifiers on the target pointer type. * tree-ssa.c (useless_type_conversion_p): Move incomplete pointer conversion check before restrict check. * gcc.dg/tree-ssa/ssa-ccp-27.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150715 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index a40270335df..76e4e8b7f1b 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -874,6 +874,16 @@ useless_type_conversion_p (tree outer_type, tree inner_type) if (POINTER_TYPE_P (inner_type) && POINTER_TYPE_P (outer_type)) { + /* If the outer type is (void *) or a pointer to an incomplete + record type, then the conversion is not necessary. */ + if (VOID_TYPE_P (TREE_TYPE (outer_type)) + || (AGGREGATE_TYPE_P (TREE_TYPE (outer_type)) + && TREE_CODE (TREE_TYPE (outer_type)) != ARRAY_TYPE + && (TREE_CODE (TREE_TYPE (outer_type)) + == TREE_CODE (TREE_TYPE (inner_type))) + && !COMPLETE_TYPE_P (TREE_TYPE (outer_type)))) + return true; + /* Do not lose casts to restrict qualified pointers. */ if ((TYPE_RESTRICT (outer_type) != TYPE_RESTRICT (inner_type)) @@ -930,16 +940,6 @@ useless_type_conversion_p (tree outer_type, tree inner_type) else if (POINTER_TYPE_P (inner_type) && POINTER_TYPE_P (outer_type)) { - /* If the outer type is (void *) or a pointer to an incomplete - record type, then the conversion is not necessary. */ - if (VOID_TYPE_P (TREE_TYPE (outer_type)) - || (AGGREGATE_TYPE_P (TREE_TYPE (outer_type)) - && TREE_CODE (TREE_TYPE (outer_type)) != ARRAY_TYPE - && (TREE_CODE (TREE_TYPE (outer_type)) - == TREE_CODE (TREE_TYPE (inner_type))) - && !COMPLETE_TYPE_P (TREE_TYPE (outer_type)))) - return true; - /* Don't lose casts between pointers to volatile and non-volatile qualified types. Doing so would result in changing the semantics of later accesses. For function types the volatile qualifier -- cgit v1.2.1 From a8cefe905b366aaa6b6af15a9f7124153ed18cf3 Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 26 Aug 2009 13:23:04 +0000 Subject: 2009-08-26 Richard Guenther PR middle-end/41163 * gimplify.c (gimplify_addr_expr): Canonicalize ADDR_EXPRs if the types to not match. * tree-cfg.c (verify_gimple_assign_single): Adjust ADDR_EXPR verification. * tree-ssa.c (useless_type_conversion_p): Conversions to pointers to unprototyped functions are useless. * gcc.c-torture/compile/pr41163.c: New testcase. * gcc.dg/pr35899.c: Adjust. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151122 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 76e4e8b7f1b..51b16899121 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -875,13 +875,21 @@ useless_type_conversion_p (tree outer_type, tree inner_type) && POINTER_TYPE_P (outer_type)) { /* If the outer type is (void *) or a pointer to an incomplete - record type, then the conversion is not necessary. */ + record type or a pointer to an unprototyped function, + then the conversion is not necessary. */ if (VOID_TYPE_P (TREE_TYPE (outer_type)) || (AGGREGATE_TYPE_P (TREE_TYPE (outer_type)) && TREE_CODE (TREE_TYPE (outer_type)) != ARRAY_TYPE && (TREE_CODE (TREE_TYPE (outer_type)) == TREE_CODE (TREE_TYPE (inner_type))) - && !COMPLETE_TYPE_P (TREE_TYPE (outer_type)))) + && !COMPLETE_TYPE_P (TREE_TYPE (outer_type))) + || ((TREE_CODE (TREE_TYPE (outer_type)) == FUNCTION_TYPE + || TREE_CODE (TREE_TYPE (outer_type)) == METHOD_TYPE) + && (TREE_CODE (TREE_TYPE (outer_type)) + == TREE_CODE (TREE_TYPE (inner_type))) + && !TYPE_ARG_TYPES (TREE_TYPE (outer_type)) + && useless_type_conversion_p (TREE_TYPE (TREE_TYPE (outer_type)), + TREE_TYPE (TREE_TYPE (inner_type))))) return true; /* Do not lose casts to restrict qualified pointers. */ -- cgit v1.2.1 From 9845d1202fec65574ca05d780859eb8c25489566 Mon Sep 17 00:00:00 2001 From: aoliva Date: Wed, 2 Sep 2009 02:42:21 +0000 Subject: gcc/ChangeLog: * doc/invoke.texi (-fvar-tracking-assignments): New. (-fvar-tracking-assignments-toggle): New. (-fdump-final-insns=file): Mark filename as optional. (--param min-nondebug-insn-uid): New. (-gdwarf-@{version}): Mention version 4. * opts.c (common_handle_option): Accept it. * tree-vrp.c (find_assert_locations_1): Skip debug stmts. * regrename.c (regrename_optimize): Drop last. Don't count debug insns as uses. Don't reject change because of debug insn. (do_replace): Reject DEBUG_INSN as chain starter. Take base_regno from the chain starter, and check for inexact matches in DEBUG_INSNS. (scan_rtx_reg): Accept inexact matches in DEBUG_INSNs. (build_def_use): Simplify and fix the marking of DEBUG_INSNs. * sched-ebb.c (schedule_ebbs): Skip boundary debug insns. * fwprop.c (forward_propagate_and_simplify): ...into debug insns. * doc/gimple.texi (is_gimple_debug): New. (gimple_debug_bind_p): New. (is_gimple_call, gimple_assign_cast_p): End sentence with period. * doc/install.texi (bootstrap-debug): More details. (bootstrap-debug-big, bootstrap-debug-lean): Document. (bootstrap-debug-lib): More details. (bootstrap-debug-ckovw): Update. (bootstrap-time): New. * tree-into-ssa.c (mark_def_sites): Skip debug stmts. (insert_phi_nodes_for): Insert debug stmts. (rewrite_stmt): Take iterator. Insert debug stmts. (rewrite_enter_block): Adjust. (maybe_replace_use_in_debug_stmt): New. (rewrite_update_stmt): Use it. (mark_use_interesting): Return early for debug stmts. * tree-ssa-loop-im.c (rewrite_bittest): Propagate DEFs into debug stmts before replacing stmt. (move_computations_stmt): Likewise. * ira-conflicts.c (add_copies): Skip debug insns. * regstat.c (regstat_init_n_sets_and_refs): Discount debug insns. (regstat_bb_compute_ri): Skip debug insns. * tree-ssa-threadupdate.c (redirection_block_p): Skip debug stmts. * tree-ssa-loop-manip.c (find_uses_to_rename_stmt, check_loop_closed_ssa_stmt): Skip debug stmts. * tree-tailcall.c (find_tail_calls): Likewise. * tree-ssa-loop-ch.c (should_duplicate_loop_header_p): Likewise. * tree.h (MAY_HAVE_DEBUG_STMTS): New. (build_var_debug_value_stat): Declare. (build_var_debug_value): Define. (target_for_debug_bind): Declare. * reload.c (find_equiv_reg): Skip debug insns. * rtlanal.c (reg_used_between_p): Skip debug insns. (side_effects_p): Likewise. (canonicalize_condition): Likewise. * ddg.c (create_ddg_dep_from_intra_loop_link): Check that non-debug insns never depend on debug insns. (create_ddg_dep_no_link): Likewise. (add_cross_iteration_register_deps): Use ANTI_DEP for debug insns. Don't add inter-loop dependencies for debug insns. (build_intra_loop_deps): Likewise. (create_ddg): Count debug insns. * ddg.h (struct ddg::num_debug): New. (num_backargs): Pair up with previous int field. * diagnostic.c (diagnostic_report_diagnostic): Skip notes on -fcompare-debug-second. * final.c (get_attr_length_1): Skip debug insns. (rest_of_clean-state): Don't dump CFA_RESTORE_STATE. * gcc.c (invoke_as): Call compare-debug-dump-opt. (driver_self_specs): Map -fdump-final-insns to -fdump-final-insns=.. (get_local_tick): New. (compare_debug_dump_opt_spec_function): Test for . argument and compute output name. Compute temp output spec without flag name. Compute -frandom-seed. (OPT): Undef after use. * cfgloopanal.c (num_loop_insns): Skip debug insns. (average_num_loop_insns): Likewise. * params.h (MIN_NONDEBUG_INSN_UID): New. * gimple.def (GIMPLE_DEBUG): New. * ipa-reference.c (scan_stmt_for_static_refs): Skip debug stmts. * auto-inc-dec.c (merge_in_block): Skip debug insns. (merge_in_block): Fix whitespace. * toplev.c (flag_var_tracking): Update comment. (flag_var_tracking_assignments): New. (flag_var_tracking_assignments_toggle): New. (process_options): Don't open final insns dump file if we're not going to write to it. Compute defaults for var_tracking. * df-scan.c (df_insn_rescan_debug_internal): New. (df_uses_record): Handle debug insns. * haifa-sched.c (ready): Initialize n_debug. (contributes_to_priority): Skip debug insns. (dep_list_size): New. (priority): Use it. (rank_for_schedule): Likewise. Schedule debug insns as soon as they're ready. Disregard previous debug insns to make decisions. (queue_insn): Never queue debug insns. (ready_add, ready_remove_first, ready_remove): Count debug insns. (schedule_insn): Don't reject debug insns because of issue rate. (get_ebb_head_tail, no_real_insns_p): Skip boundary debug insns. (queue_to_ready): Skip and discount debug insns. (choose_ready): Let debug insns through. (schedule_block): Check boundary debug insns. Discount debug insns, schedule them early. Adjust whitespace. (set_priorities): Check for boundary debug insns. (add_jump_dependencies): Use dep_list_size. (prev_non_location_insn): New. (check_cfg): Use it. * tree-ssa-loop-ivopts.c (find-interesting_users): Skip debug stmts. (remove_unused_ivs): Reset debug stmts. * modulo-sched.c (const_iteration_count): Skip debug insns. (res_MII): Discount debug insns. (loop_single_full_bb_p): Skip debug insns. (sms_schedule): Likewise. (sms_schedule_by_order): Likewise. (ps_has_conflicts): Likewise. * caller-save.c (refmarker_fn): New. (save_call_clobbered_regs): Replace regs with saved mem in debug insns. (mark_referenced_regs): Take pointer, mark and arg. Adjust. Call refmarker_fn mark for hardregnos. (mark_reg_as_referenced): New. (replace_reg_with_saved_mem): New. * ipa-pure-const.c (check_stmt): Skip debug stmts. * cse.c (cse_insn): Canonicalize debug insns. Skip them when searching back. (cse_extended_basic_block): Skip debug insns. (count_reg_usage): Likewise. (is_dead_reg): New, split out of... (set_live_p): ... here. (insn_live_p): Use it for debug insns. * tree-stdarg.c (check_all_va_list_escapes): Skip debug stmts. (execute_optimize_stdarg): Likewise. * tree-ssa-dom.c (propagate_rhs_into_lhs): Likewise. * tree-ssa-propagate.c (substitute_and_fold): Don't regard changes in debug stmts as changes. * sel-sched.c (moving_insn_creates_bookkeeping_block_p): New. (moveup_expr): Don't move across debug insns. Don't move debug insn if it would create a bookkeeping block. (moveup_expr_cached): Don't use cache for debug insns that are heads of blocks. (compute_av_set_inside_bb): Skip debug insns. (sel_rank_for_schedule): Schedule debug insns first. Remove dead code. (block_valid_for_bookkeeping_p); Support lax searches. (create_block_for_bookkeeping): Adjust block numbers when encountering debug-only blocks. (find_place_for_bookkeeping): Deal with debug-only blocks. (generate_bookkeeping_insn): Accept no place to insert. (remove_temp_moveop_nops): New argument full_tidying. (prepare_place_to_insert): Deal with debug insns. (advance_state_on_fence): Debug insns don't start cycles. (update_boundaries): Take fence as argument. Deal with debug insns. (schedule_expr_on_boundary): No full_tidying on debug insns. (fill_insns): Deal with debug insns. (track_scheduled_insns_and_blocks): Don't count debug insns. (need_nop_to_preserve_insn_bb): New, split out of... (remove_insn_from_stream): ... this. (fur_orig_expr_not_found): Skip debug insns. * rtl.def (VALUE): Move up. (DEBUG_INSN): New. * tree-ssa-sink.c (all_immediate_uses_same_place): Skip debug stmts. (nearest_common_dominator_of_uses): Take debug_stmts argument. Set it if debug stmts are found. (statement_sink_location): Skip debug stmts. Propagate moving defs into debug stmts. * ifcvt.c (first_active_insn): Skip debug insns. (last_active_insns): Likewise. (cond_exec_process_insns): Likewise. (noce_process_if_block): Likewise. (check_cond_move_block): Likewise. (cond_move_convert_if_block): Likewise. (block_jumps_and_fallthru_p): Likewise. (dead_or_predicable): Likewise. * dwarf2out.c (debug_str_hash_forced): New. (find_AT_string): Add comment. (gen_label_for_indirect_string): New. (get_debug_string_label): New. (AT_string_form): Use it. (mem_loc_descriptor): Handle non-TLS symbols. Handle MINUS , DIV, MOD, AND, IOR, XOR, NOT, ABS, NEG, and CONST_STRING. Accept but discard COMPARE, IF_THEN_ELSE, ROTATE, ROTATERT, TRUNCATE and several operations that cannot be represented with DWARF opcodes. (loc_descriptor): Ignore SIGN_EXTEND and ZERO_EXTEND. Require dwarf_version 4 for DW_OP_implicit_value and DW_OP_stack_value. (dwarf2out_var_location): Take during-call mark into account. (output_indirect_string): Update comment. Output if there are label and references. (prune_indirect_string): New. (prune_unused_types): Call it if debug_str_hash_forced. More in dwarf2out.c, from Jakub Jelinek : (dw_long_long_const): Remove. (struct dw_val_struct): Change val_long_long type to rtx. (print_die, attr_checksum, same_dw_val_p, loc_descriptor): Adjust for val_long_long change to CONST_DOUBLE rtx from a long hi/lo pair. (output_die): Likewise. Use HOST_BITS_PER_WIDE_INT size of each component instead of HOST_BITS_PER_LONG. (output_loc_operands): Likewise. For const8* assert HOST_BITS_PER_WIDE_INT rather than HOST_BITS_PER_LONG is >= 64. (output_loc_operands_raw): For const8* assert HOST_BITS_PER_WIDE_INT rather than HOST_BITS_PER_LONG is >= 64. (add_AT_long_long): Remove val_hi and val_lo arguments, add val_const_double. (size_of_die): Use HOST_BITS_PER_WIDE_INT size multiplier instead of HOST_BITS_PER_LONG for dw_val_class_long_long. (add_const_value_attribute): Adjust add_AT_long_long caller. Don't handle TLS SYMBOL_REFs. If CONST wraps a constant, tail recurse. (dwarf_stack_op_name): Handle DW_OP_implicit_value and DW_OP_stack_value. (size_of_loc_descr, output_loc_operands, output_loc_operands_raw): Handle DW_OP_implicit_value. (extract_int): Move prototype earlier. (mem_loc_descriptor): For SUBREG punt if inner mode size is wider than DWARF2_ADDR_SIZE. Handle SIGN_EXTEND and ZERO_EXTEND by DW_OP_shl and DW_OP_shr{a,}. Handle EQ, NE, GT, GE, LT, LE, GTU, GEU, LTU, LEU, SMIN, SMAX, UMIN, UMAX, SIGN_EXTRACT, ZERO_EXTRACT. (loc_descriptor): Compare mode size with DWARF2_ADDR_SIZE instead of Pmode size. (loc_descriptor): Add MODE argument. Handle CONST_INT, CONST_DOUBLE, CONST_VECTOR, CONST, LABEL_REF and SYMBOL_REF if mode != VOIDmode, attempt to handle other expressions. Don't handle TLS SYMBOL_REFs. (concat_loc_descriptor, concatn_loc_descriptor, loc_descriptor_from_tree_1): Adjust loc_descriptor callers. (add_location_or_const_value_attribute): Likewise. For single location loc_lists attempt to use add_const_value_attribute for constant decls. Add DW_AT_const_value even if NOTE_VAR_LOCATION is VAR_LOCATION with CONSTANT_P or CONST_STRING in its expression. * cfgbuild.c (inside_basic_block_p): Handle debug insns. (control_flow_insn_p): Likewise. * tree-parloops.c (eliminate_local_variables_stmt): Handle debug stmt. (separate_decls_in_region_debug_bind): New. (separate_decls_in_region): Process debug bind stmts afterwards. * recog.c (verify_changes): Handle debug insns. (extract_insn): Likewise. (peephole2_optimize): Skip debug insns. * dse.c (scan_insn): Skip debug insns. * sel-sched-ir.c (return_nop_to_pool): Take full_tidying argument. Pass it on. (setup_id_for_insn): Handle debug insns. (maybe_tidy_empty_bb): Adjust whitespace. (tidy_control_flow): Skip debug insns. (sel_remove_insn): Adjust for debug insns. (sel_estimate_number_of_insns): Skip debug insns. (create_insn_rtx_from_pattern): Handle debug insns. (create_copy_of_insn_rtx): Likewise. * sel-sched-.h (sel_bb_end): Declare. (sel_bb_empty_or_nop_p): New. (get_all_loop_exits): Use it. (_eligible_successor_edge_p): Likewise. (return_nop_to_pool): Adjust. * tree-eh.c (tre_empty_eh_handler_p): Skip debug stmts. * ira-lives.c (process_bb_node_lives): Skip debug insns. * gimple-pretty-print.c (dump_gimple_debug): New. (dump_gimple_stmt): Use it. (dump_bb_header): Skip gimple debug stmts. * regmove.c (optimize_reg_copy_1): Discount debug insns. (fixup_match_2): Likewise. (regmove_backward_pass): Likewise. Simplify combined replacement. Handle debug insns. * function.c (instantiate_virtual_regs): Handle debug insns. * function.h (struct emit_status): Add x_cur_debug_insn_uid. * print-rtl.h: Include cselib.h. (print_rtx): Print VALUEs. Split out and recurse for VAR_LOCATIONs. * df.h (df_inns_rescan_debug_internal): Declare. * gcse.c (alloc_hash_table): Estimate n_insns. (cprop_insn): Don't regard debug insns as changes. (bypass_conditional_jumps): Skip debug insns. (one_pre_gcse_pass): Adjust. (one_code_hoisting_pass): Likewise. (compute_ld_motion_mems): Skip debug insns. (one_cprop_pass): Adjust. * tree-if-conv.c (tree_if_convert_stmt): Reset debug stmts. (if_convertible_stmt_p): Handle debug stmts. * init-regs.c (initialize_uninitialized_regs): Skip debug insns. * tree-vect-loop.c (vect_is_simple_reduction): Skip debug stmts. * ira-build.c (create_bb_allocnos): Skip debug insns. * tree-flow-inline.h (has_zero_uses): Discount debug stmts. (has_single_use): Likewise. (single_imm_use): Likewise. (num_imm_uses): Likewise. * tree-ssa-phiopt.c (empty_block_p): Skip debug stmts. * tree-ssa-coalesce.c (build_ssa_conflict_graph): Skip debug stmts. (create_outofssa_var_map): Likewise. * lower-subreg.c (adjust_decomposed_uses): New. (resolve_debug): New. (decompose_multiword_subregs): Use it. * tree-dfa.c (find_referenced_vars): Skip debug stmts. * emit-rtl.c: Include params.h. (cur_debug_insn_uid): Define. (set_new_first_and_last_insn): Set cur_debug_insn_uid too. (copy_rtx_if_shared_1): Handle debug insns. (reset_used_flags): Likewise. (set_used_flags): LIkewise. (get_max_insn_count): New. (next_nondebug_insn): New. (prev_nondebug_insn): New. (make_debug_insn_raw): New. (emit_insn_before_noloc): Handle debug insns. (emit_jump_insn_before_noloc): Likewise. (emit_call_insn_before_noloc): Likewise. (emit_debug_insn_before_noloc): New. (emit_insn_after_noloc): Handle debug insns. (emit_jump_insn_after_noloc): Likewise. (emit_call_insn_after_noloc): Likewise. (emit_debug_insn_after_noloc): Likewise. (emit_insn_after): Take loc from earlier non-debug insn. (emit_jump_insn_after): Likewise. (emit_call_insn_after): Likewise. (emit_debug_insn_after_setloc): New. (emit_debug_insn_after): New. (emit_insn_before): Take loc from later non-debug insn. (emit_jump_insn_before): Likewise. (emit_call_insn_before): Likewise. (emit_debug_insn_before_setloc): New. (emit_debug_insn_before): New. (emit_insn): Handle debug insns. (emit_debug_insn): New. (emit_jump_insn): Handle debug insns. (emit_call_insn): Likewise. (emit): Likewise. (init_emit): Take min-nondebug-insn-uid into account. Initialize cur_debug_insn_uid. (emit_copy_of_insn_after): Handle debug insns. * cfgexpand.c (gimple_assign_rhs_to_tree): Do not overwrite location of single rhs in place. (maybe_dump_rtl_for_gimple_stmt): Dump lineno. (floor_sdiv_adjust): New. (cell_sdiv_adjust): New. (cell_udiv_adjust): New. (round_sdiv_adjust): New. (round_udiv_adjust): New. (wrap_constant): Moved from cselib. (unwrap_constant): New. (expand_debug_expr): New. (expand_debug_locations): New. (expand_gimple_basic_block): Drop hiding redeclaration. Expand debug bind stmts. (gimple_expand_cfg): Expand debug locations. * cselib.c: Include tree-pass.h. (struct expand_value_data): New. (cselib_record_sets_hook): New. (PRESERVED_VALUE_P, LONG_TERM_PRESERVED_VALUE_P): New. (cselib_clear_table): Move, and implemnet in terms of... (cselib_reset_table_with_next_value): ... this. (cselib_get_next_unknown_value): New. (discard_useless_locs): Don't discard preserved values. (cselib_preserve_value): New. (cselib_preserved_value_p): New. (cselib_preserve_definitely): New. (cselib_clear_preserve): New. (cselib_preserve_only_values): New. (new_cselib_val): Take rtx argument. Dump it in details. (cselib_lookup_mem): Adjust. (expand_loc): Take regs_active in struct. Adjust. Silence dumps unless details are requested. (cselib_expand_value_rtx_cb): New. (cselib_expand_value_rtx): Rename and reimplment in terms of... (cselib_expand_value_rtx_1): ... this. Adjust. Silence dumps without details. Copy more subregs. Try to resolve values using a callback. Wrap constants. (cselib_subst_to_values): Adjust. (cselib_log_lookup): New. (cselib_lookup): Call it. (cselib_invalidate_regno): Don't count preserved values as useless. (cselib_invalidate_mem): Likewise. (cselib_record_set): Likewise. (struct set): Renamed to cselib_set, moved to cselib.h. (cselib_record_sets): Adjust. Call hook. (cselib_process_insn): Reset table when it would be cleared. (dump_cselib_val): New. (dump_cselib_table): New. * tree-cfgcleanup.c (tree_forwarded_block_p): Skip debug stmts. (remove_forwarder_block): Support moving debug stmts. * cselib.h (cselib_record_sets_hook): Declare. (cselib_expand_callback): New type. (cselib_expand_value_rtx_cb): Declare. (cselib_reset_table_with_next_value): Declare. (cselib_get_next_unknown_value): Declare. (cselib_preserve_value): Declare. (cselib_preserved_value_p): Declare. (cselib_preserve_only_values): Declare. (dump_cselib_table): Declare. * cfgcleanup.c (flow_find_cross_jump): Skip debug insns. (try_crossjump_to_edge): Likewise. (delete_unreachable_blocks): Remove dominant GIMPLE blocks after dominated blocks when debug stmts are present. * simplify-rtx.c (delegitimize_mem_from_attrs): New. * tree-ssa-live.c (remove_unused_locals): Skip debug stmts. (set_var_live_on_entry): Likewise. * loop-invariant.c (find_invariants_bb): Skip debug insns. * cfglayout.c (curr_location, last_location): Make static. (set_curr_insn_source_location): Don't avoid bouncing. (get_curr_insn_source_location): New. (get_curr_insn_block): New. (duplicate_insn_chain): Handle debug insns. * tree-ssa-forwprop.c (forward_propagate_addr_expr): Propagate into debug stmts. * common.opt (fcompare-debug): Move to sort order. (fdump-unnumbered-links): Likewise. (fvar-tracking-assignments): New. (fvar-tracking-assignments-toggle): New. * tree-ssa-dce.c (mark_stmt_necessary): Don't mark blocks because of debug stmts. (mark_stmt_if_obviously_necessary): Mark debug stmts. (eliminate_unnecessary_stmts): Walk dominated blocks before dominators. * tree-ssa-ter.c (find_replaceable_in_bb): Skip debug stmts. * ira.c (memref_used_between_p): Skip debug insns. (update_equiv_regs): Likewise. * sched-deps.c (sd_lists_size): Accept empty list. (sd_init_insn): Mark debug insns. (sd_finish_insn): Unmark them. (sd_add_dep): Reject non-debug deps on debug insns. (fixup_sched_groups): Give debug insns group treatment. Skip debug insns. (sched_analyze_reg): Don't mark debug insns for sched before call. (sched_analyze_2): Handle debug insns. (sched_analyze_insn): Compute next non-debug insn. Handle debug insns. (deps_analyze_insn): Handle debug insns. (deps_start_bb): Skip debug insns. (init_deps): Initialize last_debug_insn. * tree-ssa.c (target_for_debug_bind): New. (find_released_ssa_name): New. (propagate_var_def_into_debug_stmts): New. (propagate_defs_into_debug_stmts): New. (verify_ssa): Skip debug bind stmts without values. (warn_uninialized_vars): Skip debug stmts. * target-def.h (TARGET_DELEGITIMIZE_ADDRESS): Set default. * rtl.c (rtx_equal_p_cb): Handle VALUEs. (rtx_equal_p): Likewise. * ira-costs.c (scan_one_insn): Skip debug insns. (process_bb_node_for_hard_reg_moves): Likewise. * rtl.h (DEBUG_INSN_P): New. (NONDEBUG_INSN_P): New. (MAY_HAVE_DEBUG_INSNS): New. (INSN_P): Accept debug insns. (RTX_FRAME_RELATED_P): Likewise. (INSN_DELETED_P): Likewise (PAT_VAR_LOCATION_DECL): New. (PAT_VAR_LOCATION_LOC): New. (PAT_VAR_OCATION_STATUS): New. (NOTE_VAR_LOCATION_DECL): Reimplement. (NOTE_VAR_LOCATION_LOC): Likewise. (NOTE_VAR_LOCATION_STATUS): Likewise. (INSN_VAR_LOCATION): New. (INSN_VAR_LOCATION_DECL): New. (INSN_VAR_LOCATION_LOC): New. (INSN_VAR_LOCATION_STATUS): New. (gen_rtx_UNKNOWN_VAR_LOC): New. (VAR_LOC_UNKNOWN_P): New. (NOTE_DURING_CALL_P): New. (SCHED_GROUP_P): Accept debug insns. (emit_debug_insn_before): Declare. (emit_debug_insn_before_noloc): Declare. (emit_debug_insn_beore_setloc): Declare. (emit_debug_insn_after): Declare. (emit_debug_insn_after_noloc): Declare. (emit_debug_insn_after_setloc): Declare. (emit_debug_insn): Declare. (make_debug_insn_raw): Declare. (prev_nondebug_insn): Declare. (next_nondebug_insn): Declare. (delegitimize_mem_from_attrs): Declare. (get_max_insn_count): Declare. (wrap_constant): Declare. (unwrap_constant): Declare. (get_curr_insn_source_location): Declare. (get_curr_insn_block): Declare. * tree-inline.c (insert_debug_decl_map): New. (processing_debug_stmt): New. (remap_decl): Don't create new mappings in debug stmts. (remap_gimple_op_r): Don't add references in debug stmts. (copy_tree_body_r): Likewise. (remap_gimple_stmt): Handle debug bind stmts. (copy_bb): Skip debug stmts. (copy_edges_for_bb): Likewise. (copy_debug_stmt): New. (copy_debug_stmts): New. (copy_body): Copy debug stmts at the end. (insert_init_debug_bind): New. (insert_init_stmt): Take id. Skip and emit debug stmts. (setup_one_parameter): Remap variable earlier, register debug mapping. (estimate_num_insns): Skip debug stmts. (expand_call_inline): Preserve debug_map. (optimize_inline_calls): Check for no debug_stmts left-overs. (unsave_expr_now): Preserve debug_map. (copy_gimple_seq_and_replace_locals): Likewise. (tree_function_versioning): Check for no debug_stmts left-overs. Init and destroy debug_map as needed. Split edges unconditionally. (build_duplicate_type): Init and destroy debug_map as needed. * tree-inline.h: Include gimple.h instead of pointer-set.h. (struct copy_body_data): Add debug_stmts and debug_map. * sched-int.h (struct ready_list): Add n_debug. (struct deps): Add last_debug_insn. (DEBUG_INSN_SCHED_P): New. (BOUNDARY_DEBUG_INSN_P): New. (SCHEDULE_DEBUG_INSN_P): New. (sd_iterator_cond): Accept empty list. * combine.c (create_log_links): Skip debug insns. (combine_instructions): Likewise. (cleanup_auto_inc_dec): New. From Jakub Jelinek: Make sure the return value is always unshared. (struct rtx_subst_pair): New. (auto_adjust_pair): New. (propagate_for_debug_subst): New. (propagate_for_debug): New. (try_combine): Skip debug insns. Propagate removed defs into debug insns. (next_nonnote_nondebug_insn): New. (distribute_notes): Use it. Skip debug insns. (distribute_links): Skip debug insns. * tree-outof-ssa.c (set_location_for_edge): Likewise. * resource.c (mark_target_live_regs): Likewise. * var-tracking.c: Include cselib.h and target.h. (enum micro_operation_type): Add MO_VAL_USE, MO_VAL_LOC, and MO_VAL_SET. (micro_operation_type_name): New. (enum emit_note_where): Add EMIT_NOTE_AFTER_CALL_INSN. (struct micro_operation_def): Update comments. (decl_or_value): New type. Use instead of decls. (struct emit_note_data_def): Add vars. (struct attrs_def): Use decl_or_value. (struct variable_tracking_info_def): Add permp, flooded. (struct location_chain_def): Update comment. (struct variable_part_def): Use decl_or_value. (struct variable_def): Make var_part a variable length array. (valvar_pool): New. (scratch_regs): New. (cselib_hook_called): New. (dv_is_decl_p): New. (dv_is_value_p): New. (dv_as_decl): New. (dv_as_value): New. (dv_as_opaque): New. (dv_onepart_p): New. (dv_pool): New. (IS_DECL_CODE): New. (check_value_is_not_decl): New. (dv_from_decl): New. (dv_from_value): New. (dv_htab_hash): New. (variable_htab_hash): Use it. (variable_htab_eq): Support values. (variable_htab_free): Free from the right pool. (attrs_list_member, attrs_list_insert): Use decl_or_value. (attrs_list_union): Adjust. (attrs_list_mpdv_union): New. (tie_break_pointers): New. (canon_value_cmp): New. (unshare_variable): Return possibly-modified slot. (vars_copy_1): Adjust. (var_reg_decl_set): Adjust. Split out of... (var_reg_set): ... this. (get_init_value): Adjust. (var_reg_delete_and_set): Adjust. (var_reg_delete): Adjust. (var_regno_delete): Adjust. (var_mem_decl_set): Split out of... (var_mem_set): ... this. (var_mem_delete_and_set): Adjust. (var_mem_delete): Adjust. (val_store): New. (val_reset): New. (val_resolve): New. (variable_union): Adjust. Speed up merge of 1-part vars. (variable_canonicalize): Use unshared slot. (VALUED_RECURSED_INTO): New. (find_loc_in_1pdv): New. (struct dfset_merge): New. (insert_into_intersection): New. (intersect_loc_chains): New. (loc_cmp): New. (canonicalize_loc_order_check): New. (canonicalize_values_mark): New. (canonicalize_values_star): New. (variable_merge_over_cur): New. (variable_merge_over_src): New. (dataflow_set_merge): New. (dataflow_set_equiv_regs): New. (remove_duplicate_values): New. (struct dfset_post_merge): New. (variable_post_merge_new_vals): New. (variable_post_merge_perm_vals): New. (dataflow_post_merge_adjust): New. (find_mem_expr_in_1pdv): New. (dataflow_set_preserve_mem_locs): New. (dataflow_set_remove_mem_locs): New. (dataflow_set_clear_at_call): New. (onepart_variable_different_p): New. (variable_different_p): Use it. (dataflow_set_different_1): Adjust. Make detailed dump more verbose. (track_expr_p): Add need_rtl parameter. Don't generate rtl if not needed. (track_loc_p): Pass it true. (struct count_use_info): New. (find_use_val): New. (replace_expr_with_values): New. (log_op_type): New. (use_type): New, partially split out of... (count_uses): ... this. Count new micro-ops. (count_uses_1): Adjust. (count_stores): Adjust. (count_with_sets): New. (VAL_NEEDS_RESOLUTION): New. (VAL_HOLDS_TRACK_EXPR): New. (VAL_EXPR_IS_COPIED): New. (VAL_EXPR_IS_CLOBBERED): New. (add_uses): Adjust. Generate new micro-ops. (add_uses_1): Adjust. (add_stores): Generate new micro-ops. (add_with_sets): New. (find_src_status): Adjust. (find_src_set_src): Adjust. (compute_bb_dataflow): Use dataflow_set_clear_at_call. Handle new micro-ops. Canonicalize value equivalances. (vt_find_locations): Compute total size of hash tables for dumping. Perform merge for var-tracking-assignments. Don't disregard single-block loops. (dump_attrs_list): Handle decl_or_value. (dump_variable): Take variable. Deal with decl_or_value. (dump_variable_slot): New. (dump_vars): Use it. (dump_dataflow_sets): Adjust. (set_slot_part): New, extended to support one-part variables after splitting out of... (set_variable_part): ... this. (clobber_slot_part): New, split out of... (clobber_variable_part): ... this. (delete_slot_part): New, split out of... (delete_variable_part): .... this. (check_wrap_constant): New. (vt_expand_loc_callback): New. (vt_expand_loc): New. (emit_note_insn_var_location): Adjust. Handle values. Handle EMIT_NOTE_AFTER_CALL_INSN. (emit_notes_for_differences_1): Adjust. Handle values. (emit_notes_for_differences_2): Likewise. (emit_notes_for_differences): Adjust. (emit_notes_in_bb): Take pointer to set. Emit AFTER_CALL_INSN notes. Adjust. Handle new micro-ops. (vt_add_function_parameters): Adjust. Create and bind values. (vt_initialize): Adjust. Initialize scratch_regs and valvar_pool, flooded and perm.. Initialize and use cselib. Log operations. Move some code to count_with_sets and add_with_sets. (delete_debug_insns): New. (vt_debug_insns_local): New. (vt_finalize): Release permp, valvar_pool, scratch_regs. Finish cselib. (var_tracking_main): If var-tracking-assignments is enabled but var-tracking isn't, delete debug insns and leave. Likewise if we exceed limits or fail the stack adjustments tests, and after all var-tracking processing. More in var-tracking, from Jakub Jelinek : (dataflow_set): Add traversed_vars. (value_chain, const_value_chain): New typedefs. (value_chain_pool, value_chains): New variables. (value_chain_htab_hash, value_chain_htab_eq, add_value_chain, add_value_chains, add_cselib_value_chains, remove_value_chain, remove_value_chains, remove_cselib_value_chains): New functions. (shared_hash_find_slot_unshare_1, shared_hash_find_slot_1, shared_hash_find_slot_noinsert_1, shared_hash_find_1): New static inlines. (shared_hash_find_slot_unshare, shared_hash_find_slot, shared_hash_find_slot_noinsert, shared_hash_find): Update. (dst_can_be_shared): New variable. (unshare_variable): Unshare set->vars if shared, use shared_hash_*. Clear dst_can_be_shared. If set->traversed_vars is non-NULL and different from set->vars, look up slot again instead of using the passed in slot. (dataflow_set_init): Initialize traversed_vars. (variable_union): Use shared_hash_*. Use initially NO_INSERT lookup if set->vars is shared. Don't keep slot cleared before calling unshare_variable. Unshare set->vars if needed. Adjust unshare_variable callers. Clear dst_can_be_shared if needed. Even ->refcount == 1 vars must be unshared if set->vars is shared and var needs to be modified. (dataflow_set_union): Set traversed_vars during canonicalization. (VALUE_CHANGED, DECL_CHANGED): Define. (set_dv_changed, dv_changed_p): New static inlines. (track_expr_p): Clear DECL_CHANGED. (dump_dataflow_sets): Set it. (variable_was_changed): Call set_dv_changed. (emit_note_insn_var_location): Likewise. (changed_variables_stack): New variable. (check_changed_vars_1, check_changed_vars_2): New functions. (emit_notes_for_changes): Do nothing if changed_variables is empty. Traverse changed_variables with check_changed_vars_1, call check_changed_vars_2 on each changed_variables_stack entry. (emit_notes_in_bb): Add SET argument. Just clear it at the beginning, use it instead of local &set, don't destroy it at the end. (vt_emit_notes): Call dataflow_set_clear early on all VTI(bb)->out sets, never use them, instead use emit_notes_in_bb computed set, dataflow_set_clear also VTI(bb)->in when we are done with the basic block. Initialize changed_variables_stack, free it afterwards. If ENABLE_CHECKING verify that after noting differences to an empty set value_chains hash table is empty. (vt_initialize): Initialize value_chains and value_chain_pool. (vt_finalize): Delete value_chains htab, free value_chain_pool. (variable_tracking_main): Call dump_dataflow_sets before calling vt_emit_notes, not after it. * tree-flow.h (propagate_defs_into_debug_stmts): Declare. (propagate_var_def_into_debug_stmts): Declare. * df-problems.c (df_lr_bb_local_compute): Skip debug insns. (df_set_note): Reject debug insns. (df_whole_mw_reg_dead_p): Take added_notes_p argument. Don't add notes to debug insns. (df_note_bb_compute): Adjust. Likewise. (df_simulate_uses): Skip debug insns. (df_simulate_initialize_backwards): Likewise. * reg-stack.c (subst_stack_regs_in_debug_insn): New. (subst_stack_regs_pat): Reject debug insns. (convert_regs_1): Handle debug insns. * Makefile.in (TREE_INLINE_H): Take pointer-set.h from GIMPLE_H. (print-rtl.o): Depend on cselib.h. (cselib.o): Depend on TREE_PASS_H. (var-tracking.o): Depend on cselib.h and TARGET_H. * sched-rgn.c (rgn_estimate_number_of_insns): Discount debug insns. (init_ready_list): Skip boundary debug insns. (add_branch_dependences): Skip debug insns. (free_block_dependencies): Check for blocks with only debug insns. (compute_priorities): Likewise. * gimple.c (gss_for_code): Handle GIMPLE_DEBUG. (gimple_build_with_ops_stat): Take subcode as unsigned. Adjust all callers. (gimple_build_debug_bind_stat): New. (empty_body_p): Skip debug stmts. (gimple_has_side_effects): Likewise. (gimple_rhs_has_side_effects): Likewise. * gimple.h (enum gimple_debug_subcode, GIMPLE_DEBUG_BIND): New. (gimple_build_debug_bind_stat): Declare. (gimple_build_debug_bind): Define. (is_gimple_debug): New. (gimple_debug_bind_p): New. (gimple_debug_bind_get_var): New. (gimple_debug_bind_get_value): New. (gimple_debug_bind_get_value_ptr): New. (gimple_debug_bind_set_var): New. (gimple_debug_bind_set_value): New. (GIMPLE_DEBUG_BIND_NOVALUE): New internal temporary macro. (gimple_debug_bind_reset_value): New. (gimple_debug_bind_has_value_p): New. (gsi_next_nondebug): New. (gsi_prev_nondebug): New. (gsi_start_nondebug_bb): New. (gsi_last_nondebug_bb): New. * sched-vis.c (print_pattern): Handle VAR_LOCATION. (print_insn): Handle DEBUG_INSN. * tree-cfg.c (remove_bb): Walk stmts backwards. Let loc of first insn prevail. (first_stmt): Skip debug stmts. (first_non_label_stmt): Likewise. (last_stmt): Likewise. (has_zero_uses_1): New. (single_imm_use_1): New. (verify_gimple_debug): New. (verify_types_in_gimple_stmt): Handle debug stmts. (verify_stmt): Likewise. (debug_loop_num): Skip debug stmts. (remove_edge_and_dominated_blocks): Remove dominators last. * tree-ssa-reasssoc.c (rewrite_expr_tree): Propagate into debug stmts. (linearize_expr): Likewise. * config/i386/i386.c (ix86_delegitimize_address): Call default implementation. * config/ia64/ia64.c (ia64_safe_itanium_class): Handle debug insns. (group_barrier_needed): Skip debug insns. (emit_insn_group_barriers): Likewise. (emit_all_insn_group_barriers): Likewise. (ia64_variable_issue): Handle debug insns. (ia64_dfa_new_cycle): Likewise. (final_emit_insn_group_barriers): Skip debug insns. (ia64_dwarf2out_def_steady_cfa): Take frame argument. Don't def cfa without frame. (process_set): Likewise. (process_for_unwind_directive): Pass frame on. * config/rs6000/rs6000.c (TARGET_DELEGITIMIZE_ADDRESS): Define. (rs6000_delegitimize_address): New. (rs6000_debug_adjust_cost): Handle debug insns. (is_microcoded_insn): Likewise. (is_cracked_insn): Likewise. (is_nonpipeline_insn): Likewise. (insn_must_be_first_in_group): Likewise. (insn_must_be_last_in_group): Likewise. (force_new_group): Likewise. * cfgrtl.c (rtl_split_block): Emit INSN_DELETED note if block contains only debug insns. (rtl_merge_blocks): Skip debug insns. (purge_dead_edges): Likewise. (rtl_block_ends_with_call_p): Skip debug insns. * dce.c (deletable_insn_p): Handle VAR_LOCATION. (mark_reg_dependencies): Skip debug insns. * params.def (PARAM_MIN_NONDEBUG_INSN_UID): New. * tree-ssanames.c (release_ssa_name): Propagate def into debug stmts. * tree-ssa-threadedge.c (record_temporary_equivalences_from_stmts): Skip debug stmts. * regcprop.c (replace_oldest_value_addr): Skip debug insns. (replace_oldest_value_mem): Use ALL_REGS for debug insns. (copyprop_hardreg_forward_1): Handle debug insns. * reload1.c (reload): Skip debug insns. Replace unassigned pseudos in debug insns with their equivalences. (eliminate_regs_in_insn): Skip debug insns. (emit_input_reload_insns): Skip debug insns at first, adjust them later. * tree-ssa-operands.c (add_virtual_operand): Reject debug stmts. (get_indirect_ref_operands): Pass opf_no_vops on. (get_expr_operands): Likewise. Skip debug stmts. (parse_ssa_operands): Scan debug insns with opf_no_vops. gcc/testsuite/ChangeLog: * gcc.dg/guality/guality.c: New. * gcc.dg/guality/guality.h: New. * gcc.dg/guality/guality.exp: New. * gcc.dg/guality/example.c: New. * lib/gcc-dg.exp (cleanup-dump): Remove .gk files. (cleanup-saved-temps): Likewise, .gkd files too. gcc/cp/ChangeLog: * cp-tree.h (TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS): New. * cp-lang.c (cxx_dwarf_name): Pass it. * error.c (count_non_default_template_args): Take flags as argument. Adjust all callers. Skip counting of default arguments if the new flag is given. ChangeLog: * Makefile.tpl (BUILD_CONFIG): Default to bootstrap-debug. * Makefile.in: Rebuilt. contrib/ChangeLog: * compare-debug: Look for .gkd files and compare them. config/ChangeLog: * bootstrap-debug.mk: Add comments. * bootstrap-debug-big.mk: New. * bootstrap-debug-lean.mk: New. * bootstrap-debug-ckovw.mk: Add comments. * bootstrap-debug-lib.mk: Drop CFLAGS for stages. Use -g0 for TFLAGS in stage1. Drop -fvar-tracking-assignments-toggle. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151312 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 206 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 206 insertions(+) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 51b16899121..db707fb35a9 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -243,6 +243,207 @@ flush_pending_stmts (edge e) redirect_edge_var_map_clear (e); } +/* Given a tree for an expression for which we might want to emit + locations or values in debug information (generally a variable, but + we might deal with other kinds of trees in the future), return the + tree that should be used as the variable of a DEBUG_BIND STMT or + VAR_LOCATION INSN or NOTE. Return NULL if VAR is not to be tracked. */ + +tree +target_for_debug_bind (tree var) +{ + if (!MAY_HAVE_DEBUG_STMTS) + return NULL_TREE; + + if (TREE_CODE (var) != VAR_DECL + && TREE_CODE (var) != PARM_DECL) + return NULL_TREE; + + if (DECL_HAS_VALUE_EXPR_P (var)) + return target_for_debug_bind (DECL_VALUE_EXPR (var)); + + if (DECL_IGNORED_P (var)) + return NULL_TREE; + + if (!is_gimple_reg (var)) + return NULL_TREE; + + return var; +} + +/* Called via walk_tree, look for SSA_NAMEs that have already been + released. */ + +static tree +find_released_ssa_name (tree *tp, int *walk_subtrees, void *data_) +{ + struct walk_stmt_info *wi = (struct walk_stmt_info *) data_; + + if (wi->is_lhs) + return NULL_TREE; + + if (TREE_CODE (*tp) == SSA_NAME) + { + if (SSA_NAME_IN_FREE_LIST (*tp)) + return *tp; + + *walk_subtrees = 0; + } + else if (IS_TYPE_OR_DECL_P (*tp)) + *walk_subtrees = 0; + + return NULL_TREE; +} + +/* Given a VAR whose definition STMT is to be moved to the iterator + position TOGSIP in the TOBB basic block, verify whether we're + moving it across any of the debug statements that use it, and + adjust them as needed. If TOBB is NULL, then the definition is + understood as being removed, and TOGSIP is unused. */ +void +propagate_var_def_into_debug_stmts (tree var, + basic_block tobb, + const gimple_stmt_iterator *togsip) +{ + imm_use_iterator imm_iter; + gimple stmt; + use_operand_p use_p; + tree value = NULL; + bool no_value = false; + + if (!MAY_HAVE_DEBUG_STMTS) + return; + + FOR_EACH_IMM_USE_STMT (stmt, imm_iter, var) + { + basic_block bb; + gimple_stmt_iterator si; + + if (!is_gimple_debug (stmt)) + continue; + + if (tobb) + { + bb = gimple_bb (stmt); + + if (bb != tobb) + { + gcc_assert (dom_info_available_p (CDI_DOMINATORS)); + if (dominated_by_p (CDI_DOMINATORS, bb, tobb)) + continue; + } + else + { + si = *togsip; + + if (gsi_end_p (si)) + continue; + + do + { + gsi_prev (&si); + if (gsi_end_p (si)) + break; + } + while (gsi_stmt (si) != stmt); + + if (gsi_end_p (si)) + continue; + } + } + + /* Here we compute (lazily) the value assigned to VAR, but we + remember if we tried before and failed, so that we don't try + again. */ + if (!value && !no_value) + { + gimple def_stmt = SSA_NAME_DEF_STMT (var); + + if (is_gimple_assign (def_stmt)) + { + if (!dom_info_available_p (CDI_DOMINATORS)) + { + struct walk_stmt_info wi; + + memset (&wi, 0, sizeof (wi)); + + /* When removing blocks without following reverse + dominance order, we may sometimes encounter SSA_NAMEs + that have already been released, referenced in other + SSA_DEFs that we're about to release. Consider: + + : + v_1 = foo; + + : + w_2 = v_1 + bar; + # DEBUG w => w_2 + + If we deleted BB X first, propagating the value of + w_2 won't do us any good. It's too late to recover + their original definition of v_1: when it was + deleted, it was only referenced in other DEFs, it + couldn't possibly know it should have been retained, + and propagating every single DEF just in case it + might have to be propagated into a DEBUG STMT would + probably be too wasteful. + + When dominator information is not readily + available, we check for and accept some loss of + debug information. But if it is available, + there's no excuse for us to remove blocks in the + wrong order, so we don't even check for dead SSA + NAMEs. SSA verification shall catch any + errors. */ + if (!walk_gimple_op (def_stmt, find_released_ssa_name, &wi)) + no_value = true; + } + + if (!no_value) + value = gimple_assign_rhs_to_tree (def_stmt); + } + + if (!value) + no_value = true; + } + + if (no_value) + gimple_debug_bind_reset_value (stmt); + else + FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter) + SET_USE (use_p, unshare_expr (value)); + + update_stmt (stmt); + } +} + + +/* Given a STMT to be moved to the iterator position TOBSIP in the + TOBB basic block, verify whether we're moving it across any of the + debug statements that use it. If TOBB is NULL, then the definition + is understood as being removed, and TOBSIP is unused. */ + +void +propagate_defs_into_debug_stmts (gimple def, basic_block tobb, + const gimple_stmt_iterator *togsip) +{ + ssa_op_iter op_iter; + def_operand_p def_p; + + if (!MAY_HAVE_DEBUG_STMTS) + return; + + FOR_EACH_SSA_DEF_OPERAND (def_p, def, op_iter, SSA_OP_DEF) + { + tree var = DEF_FROM_PTR (def_p); + + if (TREE_CODE (var) != SSA_NAME) + continue; + + propagate_var_def_into_debug_stmts (var, tobb, togsip); + } +} + /* Return true if SSA_NAME is malformed and mark it visited. IS_VIRTUAL is true if this SSA_NAME was found inside a virtual @@ -636,6 +837,9 @@ verify_ssa (bool check_modified_stmt) goto err; } } + else if (gimple_debug_bind_p (stmt) + && !gimple_debug_bind_has_value_p (stmt)) + continue; /* Verify the single virtual operand and its constraints. */ has_err = false; @@ -1480,6 +1684,8 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized) { struct walk_stmt_info wi; data.stmt = gsi_stmt (gsi); + if (is_gimple_debug (data.stmt)) + continue; memset (&wi, 0, sizeof (wi)); wi.info = &data; walk_gimple_op (gsi_stmt (gsi), warn_uninitialized_var, &wi); -- cgit v1.2.1 From 9fc8f414d7309d48e7dc6b23e315c5dedcb1d650 Mon Sep 17 00:00:00 2001 From: rguenth Date: Sat, 5 Sep 2009 15:14:12 +0000 Subject: 2009-09-05 Richard Guenther PR middle-end/41271 * tree-ssa.c (useless_type_conversion_p): Drop qualifiers before comparing function argument types. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151453 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index db707fb35a9..0ff4733f545 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1289,7 +1289,8 @@ useless_type_conversion_p (tree outer_type, tree inner_type) if (!TYPE_ARG_TYPES (outer_type)) return true; - /* If the argument types are compatible the conversion is useless. */ + /* If the unqualified argument types are compatible the conversion + is useless. */ if (TYPE_ARG_TYPES (outer_type) == TYPE_ARG_TYPES (inner_type)) return true; @@ -1298,8 +1299,9 @@ useless_type_conversion_p (tree outer_type, tree inner_type) outer_parm && inner_parm; outer_parm = TREE_CHAIN (outer_parm), inner_parm = TREE_CHAIN (inner_parm)) - if (!useless_type_conversion_p (TREE_VALUE (outer_parm), - TREE_VALUE (inner_parm))) + if (!useless_type_conversion_p + (TYPE_MAIN_VARIANT (TREE_VALUE (outer_parm)), + TYPE_MAIN_VARIANT (TREE_VALUE (inner_parm)))) return false; /* If there is a mismatch in the number of arguments the functions -- cgit v1.2.1 From 1b2231948faf0b0611bdb75176304783886730f7 Mon Sep 17 00:00:00 2001 From: aoliva Date: Tue, 8 Sep 2009 17:40:45 +0000 Subject: * tree-ssa-loop-ivopts.c (get_phi_with_result): Remove. (remove_statement): Likewise. (rewrite_use_nonlinear_expr): Adjust. (remove_unused_ivs): Collect SSA NAMEs to remove and call... * tree-ssa.c (release_defs_bitset): ... this. New. * tree-flow.h (release_defs_bitset): Declare. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151520 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 0ff4733f545..b5b6afe15e6 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -444,6 +444,74 @@ propagate_defs_into_debug_stmts (gimple def, basic_block tobb, } } +/* Delete SSA DEFs for SSA versions in the TOREMOVE bitmap, removing + dominated stmts before their dominators, so that release_ssa_defs + stands a chance of propagating DEFs into debug bind stmts. */ + +void +release_defs_bitset (bitmap toremove) +{ + unsigned j; + bitmap_iterator bi; + + /* Performing a topological sort is probably overkill, this will + most likely run in slightly superlinear time, rather than the + pathological quadratic worst case. */ + while (!bitmap_empty_p (toremove)) + EXECUTE_IF_SET_IN_BITMAP (toremove, 0, j, bi) + { + bool remove_now = true; + tree var = ssa_name (j); + gimple stmt; + imm_use_iterator uit; + + FOR_EACH_IMM_USE_STMT (stmt, uit, var) + { + ssa_op_iter dit; + def_operand_p def_p; + + /* We can't propagate PHI nodes into debug stmts. */ + if (gimple_code (stmt) == GIMPLE_PHI + || is_gimple_debug (stmt)) + continue; + + /* If we find another definition to remove that uses + the one we're looking at, defer the removal of this + one, so that it can be propagated into debug stmts + after the other is. */ + FOR_EACH_SSA_DEF_OPERAND (def_p, stmt, dit, SSA_OP_DEF) + { + tree odef = DEF_FROM_PTR (def_p); + + if (bitmap_bit_p (toremove, SSA_NAME_VERSION (odef))) + { + remove_now = false; + break; + } + } + + if (!remove_now) + BREAK_FROM_IMM_USE_STMT (uit); + } + + if (remove_now) + { + gimple def = SSA_NAME_DEF_STMT (var); + gimple_stmt_iterator gsi = gsi_for_stmt (def); + + if (gimple_code (def) == GIMPLE_PHI) + remove_phi_node (&gsi, true); + else + { + gsi_remove (&gsi, true); + release_defs (def); + } + + bitmap_clear_bit (toremove, j); + } + } +} + /* Return true if SSA_NAME is malformed and mark it visited. IS_VIRTUAL is true if this SSA_NAME was found inside a virtual -- cgit v1.2.1 From f5f73210f37d41a21c864ba0a81855a9d12568bb Mon Sep 17 00:00:00 2001 From: aoliva Date: Tue, 8 Sep 2009 17:42:11 +0000 Subject: gcc/ChangeLog: PR debug/41229 PR debug/41291 PR debug/41300 * tree-ssa.c (execute_update_addresses_taken): Update debug insns. gcc/testsuite/ChangeLog: PR debug/41229 PR debug/41291 PR debug/41300 * gfortran.dg/pr41229.f90: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151521 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index b5b6afe15e6..9015d19c189 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1963,7 +1963,8 @@ execute_update_addresses_taken (bool do_optimize) { gimple stmt = gsi_stmt (gsi); - if (gimple_references_memory_p (stmt)) + if (gimple_references_memory_p (stmt) + || is_gimple_debug (stmt)) update_stmt (stmt); } -- cgit v1.2.1 From 688ff29b2a2ea29629307f2a0d444059391dee7b Mon Sep 17 00:00:00 2001 From: aoliva Date: Mon, 12 Oct 2009 18:58:38 +0000 Subject: gcc/ChangeLog: PR debug/41343 PR debug/41447 PR debug/41264 PR debug/41338 * tree.def (DEBUG_EXPR_DECL): New. * rtl.def (DEBUG_EXPR): New. * gengtype.c (adjust_field_rtx_def): Handle it. * tree-ssa.c (propagate_var_def_into_debug_stmts): Rename to... (insert_debug_temp_for_var_def): ... this. Drop support for moving. Take iterator for def stmt; insert debug stmt before it. Scan early for use count and kind in debug stmts. (propagate_defs_into_debug_stmts): Rename to... (insert_debug_temps_for_defs): ... this. Likewise. * tree.h (DEBUG_TEMP_UID): New. * tree.c (next_debug_decl_uid): New. (make_node_stat): Count debug decls separately. (copy_node_stat): Likewise. * cfgexpand.c (expand_debug_expr): Handle DEBUG_EXPR_DECL. * var-tracking.c (dv_is_decl_p): Recognize it. (VALUE_RECURSED_INTO): Apply to DEBUG_EXPRs too. (track_expr_p): Track expanded DEBUG_EXPR_DECLs. (vt_expand_loc_callback): Expand DEBUG_EXPRs. (emit_note_insn_var_location): Don't emit notes for DEBUG_EXPR_DECLs. * cselib.c (rtx_equal_for_cselib_p): Handle DEBUG_EXPR. (cselib_hash_rtx): Likewise. (cselib_expand_value_rtx_1): Use callback for DEBUG_EXPR. * tree-ssa-operands.c (get_expr_operands): Skip DEBUG_EXPR_DECLs in debug bind stmts. * emit-rtl.c (verify_rtx_sharing): Handle DEBUG_EXPR and VALUE. (copy_rtx_if_shared_1, reset_used_flags, set_used_flags): Likewise. * rtl.c (copy_rtx): Likewise. (rtx_equal_p_cb, rtx_equal_p): Handle DEBUG_EXPR. * print-rtl.c (print_rtx): Likewise. * sched-vis.c (print_value): Likewise. (print_insn): Handle DEBUG_EXPR_DECL. * tree-dump.c (dequeue_and_dump): Likewise. * tree-pretty-print.c (dump_decl_name, dump_generic_node): Likewise. * gimple-iterator (gsi_replace): Check for same lhs. (gsi_remove): Insert debug temps. * tree-ssa-loop-im.c (rewrite_reciprocal): Replace with same lhs. (move_computations_stmt): Drop explicit propagation into debug stmts. (rewrite_bittest): Likewise. Use gsi_remove for propagation. * tree-ssa-reassoc.c (rewrite_expr_tree, linearize_expr): Likewise. * tree-ssa-sink.c (statement_sink_location): Likewise. * tree-ssa-forwprop (forward_propagate_addr_expr): Likewise. * tree-ssanames.c (release_ssa_name): Adjust for rename. * tree-flow.h: Likewise. * tree-ssa-dce.c (mark_stmt_if_obviously_necessary): Don't mark debug temps without values. (eliminate_unnecessary_stmts): Don't discard just-inserted debug stmts. gcc/testsuite/ChangeLog: PR debug/41343 PR debug/41447 PR debug/41264 PR debug/41338 * gcc.dg/guality/pr41447-1.c: New. * gcc.dg/debug/pr41264-1.c: New. * gcc.dg/debug/pr41343-1.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@152681 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 240 ++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 143 insertions(+), 97 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 9015d19c189..9858b109d03 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -295,152 +295,198 @@ find_released_ssa_name (tree *tp, int *walk_subtrees, void *data_) return NULL_TREE; } -/* Given a VAR whose definition STMT is to be moved to the iterator - position TOGSIP in the TOBB basic block, verify whether we're - moving it across any of the debug statements that use it, and - adjust them as needed. If TOBB is NULL, then the definition is - understood as being removed, and TOGSIP is unused. */ +/* Insert a DEBUG BIND stmt before the DEF of VAR if VAR is referenced + by other DEBUG stmts, and replace uses of the DEF with the + newly-created debug temp. */ + void -propagate_var_def_into_debug_stmts (tree var, - basic_block tobb, - const gimple_stmt_iterator *togsip) +insert_debug_temp_for_var_def (gimple_stmt_iterator *gsi, tree var) { imm_use_iterator imm_iter; - gimple stmt; use_operand_p use_p; + gimple stmt; + gimple def_stmt = NULL; + int usecount = 0; tree value = NULL; - bool no_value = false; if (!MAY_HAVE_DEBUG_STMTS) return; - FOR_EACH_IMM_USE_STMT (stmt, imm_iter, var) + /* First of all, check whether there are debug stmts that reference + this variable and, if there are, decide whether we should use a + debug temp. */ + FOR_EACH_IMM_USE_FAST (use_p, imm_iter, var) { - basic_block bb; - gimple_stmt_iterator si; + stmt = USE_STMT (use_p); - if (!is_gimple_debug (stmt)) + if (!gimple_debug_bind_p (stmt)) continue; - if (tobb) + if (usecount++) + break; + + if (gimple_debug_bind_get_value (stmt) != var) { - bb = gimple_bb (stmt); + /* Count this as an additional use, so as to make sure we + use a temp unless VAR's definition has a SINGLE_RHS that + can be shared. */ + usecount++; + break; + } + } - if (bb != tobb) - { - gcc_assert (dom_info_available_p (CDI_DOMINATORS)); - if (dominated_by_p (CDI_DOMINATORS, bb, tobb)) - continue; - } - else - { - si = *togsip; + if (!usecount) + return; - if (gsi_end_p (si)) - continue; + if (gsi) + def_stmt = gsi_stmt (*gsi); + else + def_stmt = SSA_NAME_DEF_STMT (var); - do - { - gsi_prev (&si); - if (gsi_end_p (si)) - break; - } - while (gsi_stmt (si) != stmt); + /* If we didn't get an insertion point, and the stmt has already + been removed, we won't be able to insert the debug bind stmt, so + we'll have to drop debug information. */ + if (is_gimple_assign (def_stmt)) + { + bool no_value = false; - if (gsi_end_p (si)) - continue; - } + if (!dom_info_available_p (CDI_DOMINATORS)) + { + struct walk_stmt_info wi; + + memset (&wi, 0, sizeof (wi)); + + /* When removing blocks without following reverse dominance + order, we may sometimes encounter SSA_NAMEs that have + already been released, referenced in other SSA_DEFs that + we're about to release. Consider: + + : + v_1 = foo; + + : + w_2 = v_1 + bar; + # DEBUG w => w_2 + + If we deleted BB X first, propagating the value of w_2 + won't do us any good. It's too late to recover their + original definition of v_1: when it was deleted, it was + only referenced in other DEFs, it couldn't possibly know + it should have been retained, and propagating every + single DEF just in case it might have to be propagated + into a DEBUG STMT would probably be too wasteful. + + When dominator information is not readily available, we + check for and accept some loss of debug information. But + if it is available, there's no excuse for us to remove + blocks in the wrong order, so we don't even check for + dead SSA NAMEs. SSA verification shall catch any + errors. */ + if ((!gsi && !gimple_bb (def_stmt)) + || !walk_gimple_op (def_stmt, find_released_ssa_name, + &wi)) + no_value = true; } - /* Here we compute (lazily) the value assigned to VAR, but we - remember if we tried before and failed, so that we don't try - again. */ - if (!value && !no_value) + if (!no_value) + value = gimple_assign_rhs_to_tree (def_stmt); + } + + if (value) + { + /* If there's a single use of VAR, and VAR is the entire debug + expression (usecount would have been incremented again + otherwise), and the definition involves only constants and + SSA names, then we can propagate VALUE into this single use, + avoiding the temp. + + We can also avoid using a temp if VALUE can be shared and + propagated into all uses, without generating expressions that + wouldn't be valid gimple RHSs. + + Other cases that would require unsharing or non-gimple RHSs + are deferred to a debug temp, although we could avoid temps + at the expense of duplication of expressions. */ + + if (CONSTANT_CLASS_P (value) + || (usecount == 1 + && (!gimple_assign_single_p (def_stmt) + || is_gimple_min_invariant (value))) + || is_gimple_reg (value)) + value = unshare_expr (value); + else { - gimple def_stmt = SSA_NAME_DEF_STMT (var); + gimple def_temp; + tree vexpr = make_node (DEBUG_EXPR_DECL); - if (is_gimple_assign (def_stmt)) - { - if (!dom_info_available_p (CDI_DOMINATORS)) - { - struct walk_stmt_info wi; - - memset (&wi, 0, sizeof (wi)); - - /* When removing blocks without following reverse - dominance order, we may sometimes encounter SSA_NAMEs - that have already been released, referenced in other - SSA_DEFs that we're about to release. Consider: - - : - v_1 = foo; - - : - w_2 = v_1 + bar; - # DEBUG w => w_2 - - If we deleted BB X first, propagating the value of - w_2 won't do us any good. It's too late to recover - their original definition of v_1: when it was - deleted, it was only referenced in other DEFs, it - couldn't possibly know it should have been retained, - and propagating every single DEF just in case it - might have to be propagated into a DEBUG STMT would - probably be too wasteful. - - When dominator information is not readily - available, we check for and accept some loss of - debug information. But if it is available, - there's no excuse for us to remove blocks in the - wrong order, so we don't even check for dead SSA - NAMEs. SSA verification shall catch any - errors. */ - if (!walk_gimple_op (def_stmt, find_released_ssa_name, &wi)) - no_value = true; - } + def_temp = gimple_build_debug_bind (vexpr, + unshare_expr (value), + def_stmt); + + DECL_ARTIFICIAL (vexpr) = 1; + TREE_TYPE (vexpr) = TREE_TYPE (value); + if (DECL_P (value)) + DECL_MODE (vexpr) = DECL_MODE (value); + else + DECL_MODE (vexpr) = TYPE_MODE (TREE_TYPE (value)); - if (!no_value) - value = gimple_assign_rhs_to_tree (def_stmt); + if (gsi) + gsi_insert_before (gsi, def_temp, GSI_SAME_STMT); + else + { + gimple_stmt_iterator ngsi = gsi_for_stmt (def_stmt); + gsi_insert_before (&ngsi, def_temp, GSI_SAME_STMT); } - if (!value) - no_value = true; + value = vexpr; } + } - if (no_value) - gimple_debug_bind_reset_value (stmt); - else + FOR_EACH_IMM_USE_STMT (stmt, imm_iter, var) + { + if (!gimple_debug_bind_p (stmt)) + continue; + + if (value) FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter) - SET_USE (use_p, unshare_expr (value)); + /* unshare_expr is not needed here. vexpr is either a + SINGLE_RHS, that can be safely shared, some other RHS + that was unshared when we found it had a single debug + use, or a DEBUG_EXPR_DECL, that can be safely + shared. */ + SET_USE (use_p, value); + else + gimple_debug_bind_reset_value (stmt); update_stmt (stmt); } } -/* Given a STMT to be moved to the iterator position TOBSIP in the - TOBB basic block, verify whether we're moving it across any of the - debug statements that use it. If TOBB is NULL, then the definition - is understood as being removed, and TOBSIP is unused. */ +/* Insert a DEBUG BIND stmt before STMT for each DEF referenced by + other DEBUG stmts, and replace uses of the DEF with the + newly-created debug temp. */ void -propagate_defs_into_debug_stmts (gimple def, basic_block tobb, - const gimple_stmt_iterator *togsip) +insert_debug_temps_for_defs (gimple_stmt_iterator *gsi) { + gimple stmt; ssa_op_iter op_iter; def_operand_p def_p; if (!MAY_HAVE_DEBUG_STMTS) return; - FOR_EACH_SSA_DEF_OPERAND (def_p, def, op_iter, SSA_OP_DEF) + stmt = gsi_stmt (*gsi); + + FOR_EACH_SSA_DEF_OPERAND (def_p, stmt, op_iter, SSA_OP_DEF) { tree var = DEF_FROM_PTR (def_p); if (TREE_CODE (var) != SSA_NAME) continue; - propagate_var_def_into_debug_stmts (var, tobb, togsip); + insert_debug_temp_for_var_def (gsi, var); } } -- cgit v1.2.1 From bd1a81f7e1665d2e33cc824dd05dd7988da9f1a8 Mon Sep 17 00:00:00 2001 From: uweigand Date: Mon, 26 Oct 2009 21:55:59 +0000 Subject: 2009-10-26 Ben Elliston Michael Meissner Ulrich Weigand * doc/extend.texi (Named Address Spaces): New section. * coretypes.h (addr_space_t): New type. (ADDR_SPACE_GENERIC): New define. (ADDR_SPACE_GENERIC_P): New macro. * doc/tm.texi (Named Address Spaces): New section. (TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P): Document. (TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS): Document. (TARGET_ADDR_SPACE_SUBSET_P): Document. (TARGET_ADDR_SPACE_CONVERT): Document. * target.h (struct gcc_target): Add addr_space substructure. * target-def.h (TARGET_ADDR_SPACE_LEGITIMATE_ADDRESS_P): Define. (TARGET_ADDR_SPACE_LEGITIMIZE_ADDRESS): Likewise. (TARGET_ADDR_SPACE_SUBSET_P): Likewise. (TARGET_ADDR_SPACE_CONVERT): Likewise. (TARGET_ADDR_SPACE_HOOKS): Likewise. (TARGET_INITIALIZER): Initialize addr_space hooks. * targhooks.c (default_addr_space_legitimate_address_p): New function. (default_addr_space_legitimize_address): Likewise. (default_addr_space_subset_p): Likewise. (default_addr_space_convert): Likewise. * targhooks.h (default_addr_space_legitimate_address_p): Add prototype. (default_addr_space_legitimize_address): Likewise. (default_addr_space_subset_p): Likewise. (default_addr_space_convert): Likewise. * doc/rtl.texi (MEM_ADDR_SPACE): Document. * rtl.h (mem_attrs): Add ADDRSPACE memory attribute. (MEM_ADDR_SPACE): New macro. * emit-rtl.c (get_mem_attrs): Add ADDRSPACE argument and set address space memory attribute. (mem_attrs_htab_hash): Handle address space memory attribute. (mem_attrs_htab_eq): Likewise. (set_mem_attributes_minus_bitpos): Likewise. (set_mem_alias_set): Likewise. (set_mem_align): Likewise. (set_mem_expr): Likewise. (set_mem_offset): Likewise. (set_mem_size): Likewise. (adjust_address_1): Likewise. (offset_address): Likewise. (widen_memoy_address): Likewise. (get_spill_slot_decl): Likewise. (set_mem_attrs_for_spill): Likewise. (set_mem_addr_space): New function. * emit-rtl.h (set_mem_addr_space): Add prototype. * print-rtl.c (print_rtx): Print address space memory attribute. * expr.c (expand_assignment): Set address space memory attribute of generated MEM RTXes as appropriate. (expand_expr_real_1): Likewise. * cfgexpand.c (expand_debug_expr): Likewise. * tree-ssa-loop-ivopts.c (produce_memory_decl_rtl): Likewise. * tree.h (struct tree_base): Add address_space bitfield. Reduce size of "spare" bitfield. (TYPE_ADDR_SPACE): New macro. (ENCODE_QUAL_ADDR_SPACE): Likewise. (DECODE_QUAL_ADDR_SPACE): Likewise. (CLEAR_QUAL_ADDR_SPACE): Likewise. (KEEP_QUAL_ADDR_SPACE): Likewise. (TYPE_QUALS): Encode type address space. (TYPE_QUALS_NO_ADDR_SPACE): New macro. * tree.c (set_type_quals): Set type address space. (build_array_type): Inherit array address space from element type. * print-tree.c (print_node_brief): Print type address space. (print_node): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. * explow.c (memory_address): Rename to ... (memory_address_addr_space): ... this. Add ADDRSPACE argument. Use address-space aware variants of memory address routines. * recog.c (memory_address_p): Rename to ... (memory_address_addr_space_p): ... this. Add ADDSPACE argument. Use address-space aware variants of memory address routines. (offsettable_address_p): Rename to ... (offsettable_address_addr_space_p): ... this. Add ADDRSPACE argument. Use address-space aware variants of memory address routines. * reload.c (strict_memory_address_p): Rename to ... (strict_memory_address_addr_space_p): ... this. Add ADDSPACE argument. Use address-space aware variants of memory address routines. (maybe_memory_address_p): Rename to ... (maybe_memory_address_addr_space_p): ... this. Add ADDSPACE argument. Use address-space aware variants of memory address routines. * expr.h (memory_address_addr_space): Add prototype. (memory_address): Define as macro. * recog.h (memory_address_addr_space_p): Add prototype. (memory_address_p): Define as macro. (offsettable_address_addr_space_p): Add prototype. (offsettable_address_p): Define as macro. (strict_memory_address_addr_space_p): Add prototype. (strict_memory_address_p): Define as macro. * combine.c (find_split_point): Use address-space aware variants of memory address routines. * emit-rtl.c (operand_subword): Likewise. (change_address_1): Likewise. (adjust_address_1): Likewise. (offset_address): Likewise. * expr.c (emit_move_insn): Likewise. (expand_assignment): Likewise. (expand_expr_real_1): Likewise. * recog.c (verify_changes): Likewise. (general_operand): Likewise. (offsettable_memref_p): Likewise. (offsettable_nonstrict_memref_p): Likewise. (constrain_operands): Likewise. * reload.c (get_secondary_mem): Likewise. (find_reloads_toplev): Likewise. (find_reloads_address): Likewise. (find_reloads_subreg_address): Likewise. * reload1.c (reload): Likewise. * rtlhooks.c (gen_lowpart_if_possible): Likewise. * rtl.h (address_cost): Add ADDRSPACE argument. * rtlanal.c (address_cost): Add ADDRSPACE argument. Use address-space aware variant of memory address routines. * loop-invariant.c (create_new_invariant): Update address_cost call. * tree-ssa-loop-ivopts.c (computation_cost): Likewise. * fwprop.c (should_replace_address): Add ADDRSPACE argument. Use address-space aware variant of memory address routines. (propagate_rtx_1): Update call to should_replace_address. * tree-flow.h (multiplier_allowed_in_address_p): Add ADDRSPACE argument. * tree-ssa-loop-ivopts.c (multiplier_allowed_in_address_p): Add ADDRSPACE argument. Use per-address-space instead of global cache. Use address-space aware variant of memory address routines. (get_address_cost): Likewise. (get_computation_cost_at): Update calls. * tree-ssa-address.c (valid_mem_ref_p): Add ADDRSPACE argument. Use address-space aware variant of memory address routines. (create_mem_ref_raw): Update call to valid_mem_ref_p. (most_expensive_mult_to_index): Update call to multiplier_allowed_in_address_p. * dwarf2out.c (modified_type_die): Output DW_AT_address_class attribute to indicate named address spaces. * varasm.c (get_variable_section): DECLs in named address spaces cannot be "common". * reload.c (find_reloads_address): Do not use LEGITIMIZE_RELOAD_ADDRESS for addresses in a non-generic address space. * expr.c (emit_block_move_hints): Do not use libcalls for memory in non-generic address spaces. (clear_storage_hints): Likewise. (expand_assignment): Likewise. * fold-const.c (operand_equal_p): Expressions refering to different address spaces are not equivalent. * rtl.c (rtx_equal_p_cb): MEMs refering to different address spaces are not equivalent. (rtx_equal_p): Likewise. * cse.c (exp_equiv_p): Likewise. * jump.c (rtx_renumbered_equal_p): Likewise. * reload.c (operands_match_p): Likewise. * alias.c (nonoverlapping_memrefs_p): MEMs refering to different address spaces may alias. (true_dependence): Likewise. (canon_true_dependence): Likewise. (write_dependence_p): Likewise. * dse.c (canon_address): Handle named address spaces. * ifcvt.c (noce_try_cmove_arith): Likewise. * tree.def (ADDR_SPACE_CONVERT_EXPR): New tree code. * expr.c (expand_expr_real_2): Expand ADDR_SPACE_CONVERT_EXPR. * convert.c (convert_to_pointer): Generate ADDR_SPACE_CONVERT_EXPR to handle conversions between different address spaces. * fold-const.c (fold_convert_loc): Likewise. (fold_unary_loc): Handle ADDR_SPACE_CONVERT_EXPR. * tree-pretty-print.c (dump_generic_node): Likewise. * gimple-pretty-print.c (dump_unary_rhs): Likewise. * tree-cfg.c (verify_gimple_assign_unary): Likewise. * tree-inline.c (estimate_operator_cost): Likewise. * tree-ssa.c (useless_type_conversion_p): Conversions between pointers to different address spaces are not useless. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153572 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 9858b109d03..b646ded59e7 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1192,6 +1192,11 @@ useless_type_conversion_p (tree outer_type, tree inner_type) if (POINTER_TYPE_P (inner_type) && POINTER_TYPE_P (outer_type)) { + /* Do not lose casts between pointers to different address spaces. */ + if (TYPE_ADDR_SPACE (TREE_TYPE (outer_type)) + != TYPE_ADDR_SPACE (TREE_TYPE (inner_type))) + return false; + /* If the outer type is (void *) or a pointer to an incomplete record type or a pointer to an unprototyped function, then the conversion is not necessary. */ -- cgit v1.2.1 From d508766fcb7a88e59bc2a0d94a2150bff9c6ea6f Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 28 Oct 2009 14:48:34 +0000 Subject: 2009-10-28 Richard Guenther PR lto/41808 PR lto/41839 * tree-ssa.c (useless_type_conversion_p): Do not treat conversions to pointers to incomplete types as useless. * gimple.c (gimple_types_compatible_p): Compare struct tags, not typedef names. * gcc.dg/lto/20091027-1_0.c: New testcase. * gcc.dg/lto/20091027-1_1.c: Likewise. * g++.dg/lto/20091026-1_0.C: Likewise. * g++.dg/lto/20091026-1_1.C: Likewise. * g++.dg/lto/20091026-1_a.h: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153671 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index b646ded59e7..8e88c2f73b0 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1201,11 +1201,6 @@ useless_type_conversion_p (tree outer_type, tree inner_type) record type or a pointer to an unprototyped function, then the conversion is not necessary. */ if (VOID_TYPE_P (TREE_TYPE (outer_type)) - || (AGGREGATE_TYPE_P (TREE_TYPE (outer_type)) - && TREE_CODE (TREE_TYPE (outer_type)) != ARRAY_TYPE - && (TREE_CODE (TREE_TYPE (outer_type)) - == TREE_CODE (TREE_TYPE (inner_type))) - && !COMPLETE_TYPE_P (TREE_TYPE (outer_type))) || ((TREE_CODE (TREE_TYPE (outer_type)) == FUNCTION_TYPE || TREE_CODE (TREE_TYPE (outer_type)) == METHOD_TYPE) && (TREE_CODE (TREE_TYPE (outer_type)) -- cgit v1.2.1 From 0c297edc21c4ab6f2129cc25ed52772ad2f79a7b Mon Sep 17 00:00:00 2001 From: amylaar Date: Sun, 8 Nov 2009 21:10:08 +0000 Subject: * cfgrtl.c (pass_free_cfg): Add pass name. * cgraphbuild.c (pass_build_cgraph_edges): Likewise. (pass_rebuild_cgraph_edges, pass_remove_cgraph_callee_edges): Likewise. * dce.c (pass_ud_rtl_dce, pass_fast_rtl_dce): Change pass name. * df-core.c (pass_df_initialize_no_opt): Likewise. * except.c (pass_rtl_eh): Likewise. * function.c (pass_init_function, pass_leaf_regs): Likewise. * gcse.c (pass_rtl_pre): Change pass name. * passes.c (pass_postreload): Add pass name. (make_pass_instance): Don't use duplicate-tracking logic for names starting with '*'. (next_pass_1): Assert that pass has a name. (register_one_dump_file): If there is an space in the name, skip past it. * predict.c (pass_strip_predict_hints): Add pass name. * reg-stack.c (pass_stack_regs): Likewise. * stack-ptr-mod.c (pass_stack_ptr_mod): Likewise. * tree-cfg.c (pass_warn_function_return, pass_warn_function_noreturn): Add pass name. * tree-dfa.c (pass_referenced_vars): Likewise. * tree-optimize.c (pass_cleanup_cfg_post_optimizing): Fix whitespace before comment. (pass_fixup_cfg): Add pass name, fix whitespace before comment. (pass_init_datastructures): Add pass name. * tree-ssa-loop.c (pass_record_bounds): Likewise. * tree-ssa.c (pass_early_warn_uninitialized, pass_late_warn_uninitialized): Likewise. * tree.c (pass_ipa_free_lang_data): Likewise. * doc/passes.texi (pass manager): Document how to disambiguate pass names. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154013 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 8e88c2f73b0..e6a9a07a5d8 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1856,7 +1856,7 @@ struct gimple_opt_pass pass_early_warn_uninitialized = { { GIMPLE_PASS, - NULL, /* name */ + "*early_warn_uninitialized", /* name */ gate_warn_uninitialized, /* gate */ execute_early_warn_uninitialized, /* execute */ NULL, /* sub */ @@ -1875,7 +1875,7 @@ struct gimple_opt_pass pass_late_warn_uninitialized = { { GIMPLE_PASS, - NULL, /* name */ + "*late_warn_uninitialized", /* name */ gate_warn_uninitialized, /* gate */ execute_late_warn_uninitialized, /* execute */ NULL, /* sub */ -- cgit v1.2.1 From 7f9256fea6b55fb2c6b118dcf7e3a51112b6039c Mon Sep 17 00:00:00 2001 From: aoliva Date: Wed, 18 Nov 2009 06:02:42 +0000 Subject: * tree-ssa.c (insert_debug_temp_for_var_def): Fix handling of released SSA names. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154280 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index e6a9a07a5d8..15dddabd97c 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -383,8 +383,7 @@ insert_debug_temp_for_var_def (gimple_stmt_iterator *gsi, tree var) dead SSA NAMEs. SSA verification shall catch any errors. */ if ((!gsi && !gimple_bb (def_stmt)) - || !walk_gimple_op (def_stmt, find_released_ssa_name, - &wi)) + || walk_gimple_op (def_stmt, find_released_ssa_name, &wi)) no_value = true; } -- cgit v1.2.1 From 43e54ec3e93dd2ef495375ead1f1eac467a727d1 Mon Sep 17 00:00:00 2001 From: aoliva Date: Sat, 21 Nov 2009 05:06:24 +0000 Subject: * tree-ssa.c (find_released_ssa_name): Handle NULL wi. (insert_debug_temp_for_var_def): Handle degenerate PHI nodes. (insert_debug_temps_for_defs): Handle PHI nodes. * tree-ssa-dom.c (degenerate_phi_result): Don't crash on released SSA names. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154402 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 15dddabd97c..4d0ccb066b1 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -279,7 +279,7 @@ find_released_ssa_name (tree *tp, int *walk_subtrees, void *data_) { struct walk_stmt_info *wi = (struct walk_stmt_info *) data_; - if (wi->is_lhs) + if (wi && wi->is_lhs) return NULL_TREE; if (TREE_CODE (*tp) == SSA_NAME) @@ -346,7 +346,13 @@ insert_debug_temp_for_var_def (gimple_stmt_iterator *gsi, tree var) /* If we didn't get an insertion point, and the stmt has already been removed, we won't be able to insert the debug bind stmt, so we'll have to drop debug information. */ - if (is_gimple_assign (def_stmt)) + if (gimple_code (def_stmt) == GIMPLE_PHI) + { + value = degenerate_phi_result (def_stmt); + if (value && walk_tree (&value, find_released_ssa_name, NULL, NULL)) + value = NULL; + } + else if (is_gimple_assign (def_stmt)) { bool no_value = false; @@ -408,6 +414,7 @@ insert_debug_temp_for_var_def (gimple_stmt_iterator *gsi, tree var) at the expense of duplication of expressions. */ if (CONSTANT_CLASS_P (value) + || gimple_code (def_stmt) == GIMPLE_PHI || (usecount == 1 && (!gimple_assign_single_p (def_stmt) || is_gimple_min_invariant (value))) @@ -478,7 +485,7 @@ insert_debug_temps_for_defs (gimple_stmt_iterator *gsi) stmt = gsi_stmt (*gsi); - FOR_EACH_SSA_DEF_OPERAND (def_p, stmt, op_iter, SSA_OP_DEF) + FOR_EACH_PHI_OR_STMT_DEF (def_p, stmt, op_iter, SSA_OP_DEF) { tree var = DEF_FROM_PTR (def_p); -- cgit v1.2.1 From 8cee8dc0e0c993d62de992c0b1acdd962232c48d Mon Sep 17 00:00:00 2001 From: matz Date: Tue, 24 Nov 2009 15:37:32 +0000 Subject: * tree.h (union tree_ann_d): Don't declare. (tree_base): Remove ann field. (struct var_ann_d): Declare forward. (tree_result_decl, tree_parm_decl, tree_var_decl): Add ann field. (DECL_VAR_ANN_PTR): New macro. * tree-dfa.c (create_var_ann): Rewrite in terms of above macro, accept only VAR, PARM or RESULT decls. (create_tree_common_ann): Remove. (remove_referenced_var): Use DECL_VAR_ANN_PTR. * tree-eh.c (lookup_expr_eh_lp): Remove. * tree-flow-inline.h (var_ann, get_var_ann): Rewrite in terms of DECL_VAR_ANN_PTR. (ann_type, tree_common_ann, get_tree_common_ann): Remove. * tree-flow.h (enum tree_ann_type): Remove. (struct tree_ann_common_d): Remove. (struct var_ann_d): Remove common field. (union tree_ann_d): Remove. (tree_ann_t, tree_ann_common_t): Remove typedefs. (tree_common_ann, get_tree_common_ann, ann_type, create_tree_common_ann, lookup_expr_eh_lp): Don't declare. * tree-ssa.c (delete_tree_ssa): Use DECL_VAR_ANN_PTR. * tree.c (copy_node_stat): Use DECL_VAR_ANN_PTR. * builtins.c (expand_builtin_memcpy): Use currently_expanding_gimple_stmt instead of tree annotation. (expand_builtin_memset_args): Ditto. * cfgexpand.c (currently_expanding_gimple_stmt): Add global variable. (expand_call_stmt): Don't set tree annotation. (expand_gimple_basic_block): Set currently_expanding_gimple_stmt. * expr.c (expand_expr_real): Don't call lookup_expr_eh_lp. * gimple.h (currently_expanding_gimple_stmt): Declare. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154502 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 4d0ccb066b1..7fe94ee944d 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1138,9 +1138,11 @@ delete_tree_ssa (void) { if (is_global_var (var)) continue; - if (var->base.ann) - ggc_free (var->base.ann); - var->base.ann = NULL; + if (var_ann (var)) + { + ggc_free (var_ann (var)); + *DECL_VAR_ANN_PTR (var) = NULL; + } } htab_delete (gimple_referenced_vars (cfun)); cfun->gimple_df->referenced_vars = NULL; -- cgit v1.2.1 From 48e1416a24d50cacbb2a5e06a9ee61dd8cbee313 Mon Sep 17 00:00:00 2001 From: hjl Date: Wed, 25 Nov 2009 10:55:54 +0000 Subject: Remove trailing white spaces. 2009-11-25 H.J. Lu * alias.c: Remove trailing white spaces. * alloc-pool.c: Likewise. * alloc-pool.h: Likewise. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * basic-block.h: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * builtins.c: Likewise. * builtins.def: Likewise. * c-common.c: Likewise. * c-common.h: Likewise. * c-cppbuiltin.c: Likewise. * c-decl.c: Likewise. * c-format.c: Likewise. * c-lex.c: Likewise. * c-omp.c: Likewise. * c-opts.c: Likewise. * c-parser.c: Likewise. * c-pretty-print.c: Likewise. * c-tree.h: Likewise. * c-typeck.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgexpand.c: Likewise. * cfghooks.c: Likewise. * cfghooks.h: Likewise. * cfglayout.c: Likewise. * cfgloop.c: Likewise. * cfgloop.h: Likewise. * cfgloopmanip.c: Likewise. * cfgrtl.c: Likewise. * cgraph.c: Likewise. * cgraph.h: Likewise. * cgraphbuild.c: Likewise. * cgraphunit.c: Likewise. * cif-code.def: Likewise. * collect2.c: Likewise. * combine.c: Likewise. * convert.c: Likewise. * coverage.c: Likewise. * crtstuff.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dbgcnt.c: Likewise. * dbgcnt.def: Likewise. * dbgcnt.h: Likewise. * dbxout.c: Likewise. * dce.c: Likewise. * ddg.c: Likewise. * ddg.h: Likewise. * defaults.h: Likewise. * df-byte-scan.c: Likewise. * df-core.c: Likewise. * df-problems.c: Likewise. * df-scan.c: Likewise. * df.h: Likewise. * dfp.c: Likewise. * diagnostic.c: Likewise. * diagnostic.h: Likewise. * dominance.c: Likewise. * domwalk.c: Likewise. * double-int.c: Likewise. * double-int.h: Likewise. * dse.c: Likewise. * dwarf2asm.c: Likewise. * dwarf2asm.h: Likewise. * dwarf2out.c: Likewise. * ebitmap.c: Likewise. * ebitmap.h: Likewise. * emit-rtl.c: Likewise. * et-forest.c: Likewise. * except.c: Likewise. * except.h: Likewise. * expmed.c: Likewise. * expr.c: Likewise. * expr.h: Likewise. * final.c: Likewise. * flags.h: Likewise. * fold-const.c: Likewise. * function.c: Likewise. * function.h: Likewise. * fwprop.c: Likewise. * gcc.c: Likewise. * gcov-dump.c: Likewise. * gcov-io.c: Likewise. * gcov-io.h: Likewise. * gcov.c: Likewise. * gcse.c: Likewise. * genattr.c: Likewise. * genattrtab.c: Likewise. * genautomata.c: Likewise. * genchecksum.c: Likewise. * genconfig.c: Likewise. * genflags.c: Likewise. * gengtype-parse.c: Likewise. * gengtype.c: Likewise. * gengtype.h: Likewise. * genmddeps.c: Likewise. * genmodes.c: Likewise. * genopinit.c: Likewise. * genpreds.c: Likewise. * gensupport.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * ggc-zone.c: Likewise. * ggc.h: Likewise. * gimple-iterator.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimple.c: Likewise. * gimple.def: Likewise. * gimple.h: Likewise. * gimplify.c: Likewise. * graphds.c: Likewise. * graphite-clast-to-gimple.c: Likewise. * gthr-nks.h: Likewise. * gthr-posix.c: Likewise. * gthr-posix.h: Likewise. * gthr-posix95.h: Likewise. * gthr-single.h: Likewise. * gthr-tpf.h: Likewise. * gthr-vxworks.h: Likewise. * gthr.h: Likewise. * haifa-sched.c: Likewise. * hard-reg-set.h: Likewise. * hooks.c: Likewise. * hooks.h: Likewise. * hosthooks.h: Likewise. * hwint.h: Likewise. * ifcvt.c: Likewise. * incpath.c: Likewise. * init-regs.c: Likewise. * integrate.c: Likewise. * ipa-cp.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-pure-const.c: Likewise. * ipa-reference.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-struct-reorg.h: Likewise. * ipa-type-escape.c: Likewise. * ipa-type-escape.h: Likewise. * ipa-utils.c: Likewise. * ipa-utils.h: Likewise. * ipa.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-emit.c: Likewise. * ira-int.h: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * jump.c: Likewise. * lambda-code.c: Likewise. * lambda-mat.c: Likewise. * lambda-trans.c: Likewise. * lambda.h: Likewise. * langhooks.c: Likewise. * lcm.c: Likewise. * libgcov.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-init.c: Likewise. * loop-invariant.c: Likewise. * loop-iv.c: Likewise. * loop-unroll.c: Likewise. * lower-subreg.c: Likewise. * lto-cgraph.c: Likewise. * lto-compress.c: Likewise. * lto-opts.c: Likewise. * lto-section-in.c: Likewise. * lto-section-out.c: Likewise. * lto-streamer-in.c: Likewise. * lto-streamer-out.c: Likewise. * lto-streamer.c: Likewise. * lto-streamer.h: Likewise. * lto-symtab.c: Likewise. * lto-wpa-fixup.c: Likewise. * matrix-reorg.c: Likewise. * mcf.c: Likewise. * mode-switching.c: Likewise. * modulo-sched.c: Likewise. * omega.c: Likewise. * omega.h: Likewise. * omp-low.c: Likewise. * optabs.c: Likewise. * optabs.h: Likewise. * opts-common.c: Likewise. * opts.c: Likewise. * params.def: Likewise. * params.h: Likewise. * passes.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * predict.def: Likewise. * pretty-print.c: Likewise. * pretty-print.h: Likewise. * print-rtl.c: Likewise. * print-tree.c: Likewise. * profile.c: Likewise. * read-rtl.c: Likewise. * real.c: Likewise. * recog.c: Likewise. * reg-stack.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regmove.c: Likewise. * regrename.c: Likewise. * regs.h: Likewise. * regstat.c: Likewise. * reload.c: Likewise. * reload1.c: Likewise. * resource.c: Likewise. * rtl.c: Likewise. * rtl.def: Likewise. * rtl.h: Likewise. * rtlanal.c: Likewise. * sbitmap.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-int.h: Likewise. * sched-rgn.c: Likewise. * sched-vis.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-dump.h: Likewise. * sel-sched-ir.c: Likewise. * sel-sched-ir.h: Likewise. * sel-sched.c: Likewise. * sel-sched.h: Likewise. * sese.c: Likewise. * sese.h: Likewise. * simplify-rtx.c: Likewise. * stack-ptr-mod.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * stringpool.c: Likewise. * stub-objc.c: Likewise. * sync-builtins.def: Likewise. * target-def.h: Likewise. * target.h: Likewise. * targhooks.c: Likewise. * targhooks.h: Likewise. * timevar.c: Likewise. * tlink.c: Likewise. * toplev.c: Likewise. * toplev.h: Likewise. * tracer.c: Likewise. * tree-affine.c: Likewise. * tree-affine.h: Likewise. * tree-browser.def: Likewise. * tree-call-cdce.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-chrec.c: Likewise. * tree-chrec.h: Likewise. * tree-complex.c: Likewise. * tree-data-ref.c: Likewise. * tree-data-ref.h: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-dump.h: Likewise. * tree-eh.c: Likewise. * tree-flow-inline.h: Likewise. * tree-flow.h: Likewise. * tree-if-conv.c: Likewise. * tree-inline.c: Likewise. * tree-into-ssa.c: Likewise. * tree-loop-distribution.c: Likewise. * tree-loop-linear.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-nomudflap.c: Likewise. * tree-nrv.c: Likewise. * tree-object-size.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-parloops.c: Likewise. * tree-pass.h: Likewise. * tree-phinodes.c: Likewise. * tree-predcom.c: Likewise. * tree-pretty-print.c: Likewise. * tree-profile.c: Likewise. * tree-scalar-evolution.c: Likewise. * tree-ssa-address.c: Likewise. * tree-ssa-alias.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-copy.c: Likewise. * tree-ssa-copyrename.c: Likewise. * tree-ssa-dce.c: Likewise. * tree-ssa-dom.c: Likewise. * tree-ssa-dse.c: Likewise. * tree-ssa-forwprop.c: Likewise. * tree-ssa-ifcombine.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-live.h: Likewise. * tree-ssa-loop-ch.c: Likewise. * tree-ssa-loop-im.c: Likewise. * tree-ssa-loop-ivcanon.c: Likewise. * tree-ssa-loop-ivopts.c: Likewise. * tree-ssa-loop-manip.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop-unswitch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-operands.c: Likewise. * tree-ssa-operands.h: Likewise. * tree-ssa-phiopt.c: Likewise. * tree-ssa-phiprop.c: Likewise. * tree-ssa-pre.c: Likewise. * tree-ssa-propagate.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-sink.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-ter.c: Likewise. * tree-ssa-threadedge.c: Likewise. * tree-ssa-threadupdate.c: Likewise. * tree-ssa-uncprop.c: Likewise. * tree-ssa.c: Likewise. * tree-ssanames.c: Likewise. * tree-switch-conversion.c: Likewise. * tree-tailcall.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-generic.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-slp.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vectorizer.c: Likewise. * tree-vectorizer.h: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * tree.def: Likewise. * tree.h: Likewise. * treestruct.def: Likewise. * unwind-compat.c: Likewise. * unwind-dw2-fde-glibc.c: Likewise. * unwind-dw2.c: Likewise. * value-prof.c: Likewise. * value-prof.h: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. * varpool.c: Likewise. * vec.c: Likewise. * vec.h: Likewise. * vmsdbgout.c: Likewise. * web.c: Likewise. * xcoffout.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154645 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 7fe94ee944d..b5d60b305af 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -725,7 +725,7 @@ verify_use (basic_block bb, basic_block def_bb, use_operand_p use_p, err = true; } - /* Make sure the use is in an appropriate list by checking the previous + /* Make sure the use is in an appropriate list by checking the previous element to make sure it's the same. */ if (use_p->prev == NULL) { @@ -1044,7 +1044,7 @@ verify_ssa (bool check_modified_stmt) free_dominance_info (CDI_DOMINATORS); else set_dom_info_availability (CDI_DOMINATORS, orig_dom_state); - + BITMAP_FREE (names_defined_in_bb); timevar_pop (TV_TREE_SSA_VERIFY); return; @@ -1114,9 +1114,9 @@ void init_tree_ssa (struct function *fn) { fn->gimple_df = GGC_CNEW (struct gimple_df); - fn->gimple_df->referenced_vars = htab_create_ggc (20, uid_decl_map_hash, + fn->gimple_df->referenced_vars = htab_create_ggc (20, uid_decl_map_hash, uid_decl_map_eq, NULL); - fn->gimple_df->default_defs = htab_create_ggc (20, uid_ssaname_map_hash, + fn->gimple_df->default_defs = htab_create_ggc (20, uid_ssaname_map_hash, uid_ssaname_map_eq, NULL); pt_solution_reset (&fn->gimple_df->escaped); pt_solution_reset (&fn->gimple_df->callused); @@ -1444,7 +1444,7 @@ useless_type_conversion_p (tree outer_type, tree inner_type) else if (AGGREGATE_TYPE_P (inner_type) && TREE_CODE (inner_type) == TREE_CODE (outer_type)) return false; - + return false; } @@ -1494,7 +1494,7 @@ tree_ssa_strip_useless_type_conversions (tree exp) /* Internal helper for walk_use_def_chains. VAR, FN and DATA are as described in walk_use_def_chains. - + VISITED is a pointer set used to mark visited SSA_NAMEs to avoid infinite loops. We used to have a bitmap for this to just mark SSA versions we had visited. But non-sparse bitmaps are way too @@ -1552,10 +1552,10 @@ walk_use_def_chains_1 (tree var, walk_use_def_chains_fn fn, void *data, if (fn (gimple_phi_arg_def (def_stmt, i), def_stmt, data)) return true; } - + return false; } - + /* Walk use-def chains starting at the SSA variable VAR. Call @@ -1563,7 +1563,7 @@ walk_use_def_chains_1 (tree var, walk_use_def_chains_fn fn, void *data, arguments: VAR, its defining statement (DEF_STMT) and a generic pointer to whatever state information that FN may want to maintain (DATA). FN is able to stop the walk by returning true, otherwise - in order to continue the walk, FN should return false. + in order to continue the walk, FN should return false. Note, that if DEF_STMT is a PHI node, the semantics are slightly different. The first argument to FN is no longer the original @@ -1657,7 +1657,7 @@ warn_uninit (tree t, const char *gmsgid, void *data) /* Do not warn if it can be initialized outside this module. */ if (is_global_var (var)) return; - + location = (context != NULL && gimple_has_location (context)) ? gimple_location (context) : DECL_SOURCE_LOCATION (var); @@ -1714,7 +1714,7 @@ warn_uninitialized_var (tree *tp, int *walk_subtrees, void *data_) use_operand_p vuse; tree op; - /* If there is not gimple stmt, + /* If there is not gimple stmt, or alias information has not been computed, then we cannot check VUSE ops. */ if (data->stmt == NULL) @@ -1729,7 +1729,7 @@ warn_uninitialized_var (tree *tp, int *walk_subtrees, void *data_) return NULL_TREE; op = USE_FROM_PTR (vuse); - if (t != SSA_NAME_VAR (op) + if (t != SSA_NAME_VAR (op) || !SSA_NAME_IS_DEFAULT_DEF (op)) return NULL_TREE; /* If this is a VUSE of t and it is the default definition, @@ -1928,7 +1928,7 @@ execute_update_addresses_taken (bool do_optimize) if (code == GIMPLE_ASSIGN || code == GIMPLE_CALL) { tree lhs = gimple_get_lhs (stmt); - + /* We may not rewrite TMR_SYMBOL to SSA. */ if (lhs && TREE_CODE (lhs) == TARGET_MEM_REF && TMR_SYMBOL (lhs)) -- cgit v1.2.1 From afed704cb9967667505d9c330ee5ce4113872a55 Mon Sep 17 00:00:00 2001 From: rth Date: Mon, 7 Dec 2009 22:42:10 +0000 Subject: PR debug/42299 PR debug/42166 * tree-ssa.c (insert_debug_temp_for_var_def): Skip propagation for ssa names already registered for update. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155063 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index b5d60b305af..9947e57fa9f 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -312,9 +312,13 @@ insert_debug_temp_for_var_def (gimple_stmt_iterator *gsi, tree var) if (!MAY_HAVE_DEBUG_STMTS) return; - /* First of all, check whether there are debug stmts that reference - this variable and, if there are, decide whether we should use a - debug temp. */ + /* If this name has already been registered for replacement, do nothing + as anything that uses this name isn't in SSA form. */ + if (name_registered_for_update_p (var)) + return; + + /* Check whether there are debug stmts that reference this variable and, + if there are, decide whether we should use a debug temp. */ FOR_EACH_IMM_USE_FAST (use_p, imm_iter, var) { stmt = USE_STMT (use_p); -- cgit v1.2.1 From cb24521686308314fadcd96cdfd23858aa19aa95 Mon Sep 17 00:00:00 2001 From: rguenth Date: Mon, 12 Apr 2010 15:20:48 +0000 Subject: 2010-04-12 Richard Guenther * gsstruct.def (GSS_CALL): New. * gimple.def (GIMPLE_CALL): Change to GSS_CALL. * gimple.h: Include tree-ssa-alias.h. (struct gimple_statement_call): New. (union gimple_statement_struct_d): Add gimple_call member. (gimple_call_reset_alias_info): Declare. (gimple_call_use_set): New function. (gimple_call_clobber_set): Likewise. * Makefile.in (GIMPLE_H): Add tree-ssa-alias.h. * gimple.c (gimple_call_reset_alias_info): New function. (gimple_build_call_1): Call it. * lto-streamer-in.c (input_gimple_stmt): Likewise. * tree-inline.c (remap_gimple_stmt): Likewise. (expand_call_inline): Remove callused handling. * cfgexpand.c (update_alias_info_with_stack_vars): Likewise. * tree-dfa.c (dump_variable): Likewise. * tree-parloops.c (parallelize_loops): Likewise. * tree-ssa.c (init_tree_ssa): Likewise. (delete_tree_ssa): Likewise. * tree-flow-inline.h (is_call_used): Remove. * tree-flow.h (struct gimple_df): Remove callused member. * tree-nrv.c (dest_safe_for_nrv_p): Adjust predicate. * tree-ssa-alias.c (dump_alias_info): Remove callused handling. (ref_maybe_used_by_call_p_1): Simplify. (call_may_clobber_ref_p_1): Likewise. * tree-ssa-structalias.c (compute_points_to_sets): Set the call stmt used and clobbered sets. * tree-tailcall.c (suitable_for_tail_opt_p): Adjust predicate. (find_tail_calls): Verify the tail call. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158226 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 9947e57fa9f..7915bb88b22 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1123,7 +1123,6 @@ init_tree_ssa (struct function *fn) fn->gimple_df->default_defs = htab_create_ggc (20, uid_ssaname_map_hash, uid_ssaname_map_eq, NULL); pt_solution_reset (&fn->gimple_df->escaped); - pt_solution_reset (&fn->gimple_df->callused); init_ssanames (fn, 0); init_phinodes (); } @@ -1163,7 +1162,6 @@ delete_tree_ssa (void) htab_delete (cfun->gimple_df->default_defs); cfun->gimple_df->default_defs = NULL; pt_solution_reset (&cfun->gimple_df->escaped); - pt_solution_reset (&cfun->gimple_df->callused); if (cfun->gimple_df->decls_to_pointers != NULL) pointer_map_destroy (cfun->gimple_df->decls_to_pointers); cfun->gimple_df->decls_to_pointers = NULL; -- cgit v1.2.1 From a7d4604bc678dd3d354e0bc935550b0e0168ab59 Mon Sep 17 00:00:00 2001 From: davidxl Date: Wed, 28 Apr 2010 17:41:31 +0000 Subject: predicate aware uninitialized analysis git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158835 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 89 +++++----------------------------------------------------- 1 file changed, 7 insertions(+), 82 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 7915bb88b22..820eb3b376a 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1603,25 +1603,6 @@ walk_use_def_chains (tree var, walk_use_def_chains_fn fn, void *data, } -/* Return true if T, an SSA_NAME, has an undefined value. */ - -bool -ssa_undefined_value_p (tree t) -{ - tree var = SSA_NAME_VAR (t); - - /* Parameters get their initial value from the function entry. */ - if (TREE_CODE (var) == PARM_DECL) - return false; - - /* Hard register variables get their initial value from the ether. */ - if (TREE_CODE (var) == VAR_DECL && DECL_HARD_REGISTER (var)) - return false; - - /* The value is undefined iff its definition statement is empty. */ - return gimple_nop_p (SSA_NAME_DEF_STMT (t)); -} - /* Emit warnings for uninitialized variables. This is done in two passes. The first pass notices real uses of SSA names with undefined values. @@ -1640,7 +1621,7 @@ ssa_undefined_value_p (tree t) /* Emit a warning for T, an SSA_NAME, being uninitialized. The exact warning text is in MSGID and LOCUS may contain a location or be null. */ -static void +void warn_uninit (tree t, const char *gmsgid, void *data) { tree var = SSA_NAME_VAR (t); @@ -1770,28 +1751,7 @@ warn_uninitialized_var (tree *tp, int *walk_subtrees, void *data_) return NULL_TREE; } -/* Look for inputs to PHI that are SSA_NAMEs that have empty definitions - and warn about them. */ - -static void -warn_uninitialized_phi (gimple phi) -{ - size_t i, n = gimple_phi_num_args (phi); - - /* Don't look at memory tags. */ - if (!is_gimple_reg (gimple_phi_result (phi))) - return; - - for (i = 0; i < n; ++i) - { - tree op = gimple_phi_arg_def (phi, i); - if (TREE_CODE (op) == SSA_NAME) - warn_uninit (op, "%qD may be used uninitialized in this function", - NULL); - } -} - -static unsigned int +unsigned int warn_uninitialized_vars (bool warn_possibly_uninitialized) { gimple_stmt_iterator gsi; @@ -1800,7 +1760,6 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized) data.warn_possibly_uninitialized = warn_possibly_uninitialized; - calculate_dominance_info (CDI_POST_DOMINATORS); FOR_EACH_BB (bb) { @@ -1818,10 +1777,6 @@ warn_uninitialized_vars (bool warn_possibly_uninitialized) } } - /* Post-dominator information can not be reliably updated. Free it - after the use. */ - - free_dominance_info (CDI_POST_DOMINATORS); return 0; } @@ -1834,25 +1789,14 @@ execute_early_warn_uninitialized (void) as possible, thus don't do it here. However, without optimization we need to warn here about "may be uninitialized". */ - warn_uninitialized_vars (/*warn_possibly_uninitialized=*/!optimize); - return 0; -} - -static unsigned int -execute_late_warn_uninitialized (void) -{ - basic_block bb; - gimple_stmt_iterator gsi; + calculate_dominance_info (CDI_POST_DOMINATORS); - /* Re-do the plain uninitialized variable check, as optimization may have - straightened control flow. Do this first so that we don't accidentally - get a "may be" warning when we'd have seen an "is" warning later. */ - warn_uninitialized_vars (/*warn_possibly_uninitialized=*/1); + warn_uninitialized_vars (/*warn_possibly_uninitialized=*/!optimize); - FOR_EACH_BB (bb) - for (gsi = gsi_start_phis (bb); !gsi_end_p (gsi); gsi_next (&gsi)) - warn_uninitialized_phi (gsi_stmt (gsi)); + /* Post-dominator information can not be reliably updated. Free it + after the use. */ + free_dominance_info (CDI_POST_DOMINATORS); return 0; } @@ -1881,25 +1825,6 @@ struct gimple_opt_pass pass_early_warn_uninitialized = } }; -struct gimple_opt_pass pass_late_warn_uninitialized = -{ - { - GIMPLE_PASS, - "*late_warn_uninitialized", /* name */ - gate_warn_uninitialized, /* gate */ - execute_late_warn_uninitialized, /* execute */ - NULL, /* sub */ - NULL, /* next */ - 0, /* static_pass_number */ - TV_NONE, /* tv_id */ - PROP_ssa, /* properties_required */ - 0, /* properties_provided */ - 0, /* properties_destroyed */ - 0, /* todo_flags_start */ - 0 /* todo_flags_finish */ - } -}; - /* Compute TREE_ADDRESSABLE and DECL_GIMPLE_REG_P for local variables. */ void -- cgit v1.2.1 From 3f9da5596a39ec1c557502bf3f559aaeaf48fc0d Mon Sep 17 00:00:00 2001 From: steven Date: Fri, 30 Apr 2010 11:58:49 +0000 Subject: gcc/ChangeLog: * toplev.c: Include varray.h for statistics dumping. * tree.h: Do not declare varray_head_tag. * tree-into-ssa.c, tree-ssa-uninit.c, tree-phinodes.c, omega.c, regs.h, lto-cgraph.c, tree-ssa-loop-ivopts.c, tree-nomudflap.c, c-objc-common.c, lto-streamer-out.c, tree-ssa-propagate.c, gimple-low.c, c-semantics.c, dwarf2out.c, lto-streamer-in.c, lto-section-in.c, alias.c, tree-if-conv.c, gimplify.c, ggc-zone.c, tree-ssa.c, tree-ssa-loop-prefetch.c, integrate.h, c-gimplify.c, c-common.c, c-common.h, reg-stack.c, basic-block.h, tree-ssa-structalias.c, lto-section-out.c, tree-ssanames.c: Do not include varray.h. * Makefile.in: Update for abovementioned changes. objc/ChangeLog: * objc-act.c: Do not include varray.h. objcp/ChangeLog: * objcp-decl.c: Do not include varray.h. cp/ChangeLog: * optimize.c, parser.c,mangle.c, cp-tree.h: DO not include varray.h. * Make-lang.in: Don't include varray.h dependency in CXX_TREE_H. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158933 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 1 - 1 file changed, 1 deletion(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 820eb3b376a..f51e35d2bf7 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -40,7 +40,6 @@ along with GCC; see the file COPYING3. If not see #include "tree-flow.h" #include "gimple.h" #include "tree-inline.h" -#include "varray.h" #include "timevar.h" #include "hashtab.h" #include "tree-dump.h" -- cgit v1.2.1 From a7a4626828090600459358ca745c4482cf9551a1 Mon Sep 17 00:00:00 2001 From: steven Date: Fri, 21 May 2010 13:53:22 +0000 Subject: gcc/ChangeLog: * tree.h: Include real.h and fixed-value.h as basic datatypes. * dfp.c, convert.c, reload1.c, reginfo.c, tree-flow.h, tree-ssa-threadedge.c, tree-ssanames.c, tree-loop-linear.c, tree-into-ssa.c, tree-vect-generic.c, tree-ssa-structalias.c, tree-ssa-loop-im.c, tree-dump.c, tree-complex.c, tree-ssa-uninit.c, genrecog.c, tree-ssa-threadupdate.c, tree-ssa-loop-niter.c, tree-pretty-print.c, tree-loop-distribution.c, tree-ssa-loop-unswitch.c, c-lex.c, optabs.c, postreload-gcse.c, tree-ssa-loop-manip.c, postreload.c, tree-ssa-loop-ch.c, tree-tailcall.c, tree.c, reload.c, tree-scalar-evolution.c, rtlanal.c, tree-phinodes.c, builtins.c, final.c, genoutput.c, fold-const.c, tree-ssa-dse.c, genautomata.c, tree-ssa-uncprop.c, toplev.c, tree-chrec.c, genemit.c, c-cppbuiltin.c, tree-ssa-sccvn.c, tree-ssa-ccp.c, tree-ssa-loop-ivopts.c, mode-switching.c, tree-call-cdce.c, cse.c, genpeep.c, tree-ssa-math-opts.c, tree-ssa-dom.c, tree-nrv.c, tree-ssa-propagate.c, tree-ssa-alias.c, tree-ssa-sink.c, jump.c, ifcvt.c, dwarf2out.c, expr.c, genattrtab.c, genconditions.c, tree-ssa-loop-ivcanon.c, tree-ssa-loop.c, tree-parloops.c, recog.c, tree-ssa-address.c, lcm.c, tree-eh.c, gimple-pretty-print.c, c-pretty-print.c, print-rtl.c, gcse.c, tree-if-conv.c, tree-data-ref.c, tree-affine.c, gimplify.c, tree-ssa-phiopt.c, implicit-zee.c, expmed.c, tree-dfa.c, emit-rtl.c, store-motion.c, cselib.c, tree-cfgcleanup.c, simplify-rtx.c, tree-ssa-pre.c, genpreds.c, tree-mudflap.c, print-tree.c, tree-ssa-copy.c, tree-ssa-forwprop.c, tree-ssa-dce.c, varasm.c, tree-nested.c, tree-ssa.c, tree-ssa-loop-prefetch.c, rtl.c, tree-inline.c, integrate.c, tree-optimize.c, tree-ssa-phiprop.c, fixed-value.c, combine.c, tree-profile.c, c-common.c, sched-vis.c, tree-cfg.c, passes.c, tree-ssa-reassoc.c, config/alpha/alpha.c, config/frv/frv.c, config/s390/s390.c, config/m32c/m32c.c, config/spu/spu.c, config/sparc/sparc.c, config/mep/mep.c, config/m32r/m32r.c, config/rx/rx.c, config/i386/i386.c, config/sh/sh.c, config/pdp11/pdp11.c, config/avr/avr.c, config/crx/crx.c, config/xtensa/xtensa.c, config/stormy16/stormy16.c, config/fr30/fr30.c, config/lm32/lm32.c, config/moxie/moxie.c, config/m68hc11/m68hc11.c, config/cris/cris.c, config/iq2000/iq2000.c, config/mn10300/mn10300.c, config/ia64/ia64.c, config/m68k/m68k.c, config/rs6000/rs6000.c, config/picochip/picochip.c, config/darwin.c, config/arc/arc.c, config/mcore/mcore.c, config/score/score3.c, config/score/score7.c, config/score/score.c, config/arm/arm.c, config/pa/pa.c, config/mips/mips.c, config/vax/vax.c, config/h8300/h8300.c, config/v850/v850.c, config/mmix/mmix.c, config/bfin/bfin.c: Clean up redundant includes. * Makefile.in: Update accordingly. java/ChangeLog: * typeck.c, decl.c, jcf-parse.c, except.c, expr.c: cp/Changelog: * error.c, tree.c, typeck2.c, cxx-pretty-print.c, mangle.c: Clean up redundant includes. fortran/ChangeLog: * trans-const.c, trans-types.c, trans-intrinsic.c: Clean up redundant includes. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159663 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index f51e35d2bf7..2a964850ec4 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -24,12 +24,10 @@ along with GCC; see the file COPYING3. If not see #include "tm.h" #include "tree.h" #include "flags.h" -#include "rtl.h" #include "tm_p.h" #include "target.h" #include "ggc.h" #include "langhooks.h" -#include "hard-reg-set.h" #include "basic-block.h" #include "output.h" #include "expr.h" -- cgit v1.2.1 From ce084dfc1cd60d867d38dbed86a914d82fa908d1 Mon Sep 17 00:00:00 2001 From: jsm28 Date: Fri, 21 May 2010 22:34:26 +0000 Subject: * diagnostic.c: Don't include tm.h, tree.h, tm_p.h, langhooks.h or langhooks-def.h. (diagnostic_initialize): Initialize x_data not last_function. (diagnostic_report_current_function): Move to tree-diagnostic.c. (default_diagnostic_starter): Call diagnostic_report_current_module not diagnostic_report_current_function. (diagnostic_report_diagnostic): Initialize x_data not abstract_origin. (verbatim): Likewise. * diagnostic.h (struct diagnostic_info): Change abstract_origin to x_data. (struct diagnostic_context): Change last_function to x_data. (diagnostic_auxiliary_data): Replace with diagnostic_context_auxiliary_data and diagnostic_info_auxiliary_data. (diagnostic_last_function_changed, diagnostic_set_last_function, diagnostic_report_current_function): Move to tree-diagnostic.h. (print_declaration, dump_generic_node, print_generic_stmt, print_generic_stmt_indented, print_generic_expr, print_generic_decl, debug_c_tree, dump_omp_clauses, print_call_name, debug_generic_expr, debug_generic_stmt, debug_tree_chain, default_tree_printer): Move to tree-pretty-print.h. (debug_gimple_stmt, debug_gimple_seq, print_gimple_seq, print_gimple_stmt, print_gimple_expr, dump_gimple_stmt): Move to gimple-pretty-print.h. * pretty-print.c: Don't include tree.h (pp_base_format): Don't handle %K here. (pp_base_tree_identifier): Move to tree-pretty-print.c. * pretty-print.h (text_info): Change abstract_origin to x_data. (pp_tree_identifier, pp_unsupported_tree, pp_base_tree_identifier): Move to tree-pretty-print.h. * gimple-pretty-print.h, tree-diagnostic.c, tree-diagnostic.h, tree-pretty-print.h: New files. * tree-pretty-print.c: Include tree-pretty-print.h. (percent_K_format): New. Moved from pretty-print.c. (pp_base_tree_identifier): Move from pretty-print.c. * c-objc-common.c: Include tree-pretty-print.h. (c_tree_printer): Handle %K here. * langhooks.c: Include tree-diagnostic.h. (lhd_print_error_function): Use diagnostic_abstract_origin macro. * toplev.c: Include tree-diagnostic.h and tree-pretty-print.h. (default_tree_printer): Handle %K using percent_K_format. (general_init): Use default_tree_diagnostic_starter. * tree.c: Include tree-diagnostic.h and tree-pretty-print.h. (free_lang_data): Use default_tree_diagnostic_starter. * c-pretty-print.c: Include tree-pretty-print.h. * cfgexpand.c: Include tree-pretty-print.h and gimple-pretty-print.h. * cgraphunit.c: Include tree-pretty-print.h and gimple-pretty-print.h. * dwarf2out.c: Include tree-pretty-print.h. * except.c: Include tree-pretty-print.h. * gimple-pretty-print.c: Include tree-pretty-print.h and gimple-pretty-print.h. * gimplify.c: Include tree-pretty-print.h. * graphite-poly.c: Include tree-pretty-print.h and gimple-pretty-print.h. * ipa-cp.c: Include tree-pretty-print.h. * ipa-inline.c: Include gimple-pretty-print.h. * ipa-prop.c: Include tree-pretty-print.h and gimple-pretty-print.h. * ipa-pure-const.c: Include gimple-pretty-print.h. * ipa-struct-reorg.c: Include tree-pretty-print.h and gimple-pretty-print.h. * ipa-type-escape.c: Include tree-pretty-print.h. * print-rtl.c: Include tree-pretty-print.h. * print-tree.c: Include gimple-pretty-print.h. * sese.c: Include tree-pretty-print.h. * tree-affine.c: Include tree-pretty-print.h. * tree-browser.c: Include tree-pretty-print.h. * tree-call-cdce.c: Include gimple-pretty-print.h. * tree-cfg.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-chrec.c: Include tree-pretty-print.h. * tree-data-ref.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-dfa.c: Include tree-pretty-print.h. * tree-if-conv.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-inline.c: Include tree-pretty-print.h. * tree-into-ssa.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-nrv.c: Include tree-pretty-print.h. * tree-object-size.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-outof-ssa.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-parloops.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-predcom.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-scalar-evolution.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-sra.c: Include tree-pretty-print.h. * tree-ssa-address.c: Include tree-pretty-print.h. * tree-ssa-alias.c: Include tree-pretty-print.h. * tree-ssa-ccp.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-coalesce.c: Include tree-pretty-print.h. * tree-ssa-copy.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-copyrename.c: Include tree-pretty-print.h. * tree-ssa-dce.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-dom.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-dse.c: Include gimple-pretty-print.h. * tree-ssa-forwprop.c: Include tree-pretty-print.h. * tree-ssa-ifcombine.c: Include tree-pretty-print.h. * tree-ssa-live.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-im.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-ivcanon.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-ivopts.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-niter.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-loop-prefetch.c: Include tree-pretty-print.h. * tree-ssa-math-opts.c: Include gimple-pretty-print.h. * tree-ssa-operands.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-phiprop.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-pre.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-propagate.c: Include gimple-pretty-print.h. * tree-ssa-reassoc.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-sccvn.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-sink.c: Include gimple-pretty-print.h. * tree-ssa-ter.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-ssa-uninit.c: Include gimple-pretty-print.h. * tree-ssa.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-stdarg.c: Include gimple-pretty-print.h. * tree-switch-conversion.c: Include gimple-pretty-print.h. * tree-tailcall.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-data-refs.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-loop-manip.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-loop.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-patterns.c: Include gimple-pretty-print.h. * tree-vect-slp.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vect-stmts.c: Include tree-pretty-print.h and gimple-pretty-print.h. * tree-vectorizer.c: Include tree-pretty-print.h. * tree-vrp.c: Include tree-pretty-print.h and gimple-pretty-print.h. * value-prof.c: Include tree-pretty-print.h and gimple-pretty-print.h. * var-tracking.c: Include tree-pretty-print.h. * Makefile.in (OBJS-common): Add tree-diagnostic.o. (tree-diagnostic.o): New dependencies. (c-objc-common.o, c-pretty-print.o, langhooks.o, tree.o, tree-inline.o, print-tree.o, stor-layout.o, tree-ssa-uninit.o, tree-ssa.o, tree-into-ssa.o, tree-ssa-ter.o, tree-ssa-coalesce.o, tree-outof-ssa.o, tree-ssa-forwprop.o, tree-ssa-phiprop.o, tree-ssa-ifcombine.o, tree-nrv.o, tree-ssa-copy.o, tree-ssa-propagate.o, tree-ssa-dom.o, tree-ssa-uncprop.o, tree-ssa-live.o, tree-ssa-copyrename.o, tree-ssa-pre.o, tree-ssa-sccvn.o, tree-vrp.o, tree-cfg.o, tree-tailcall.o, tree-ssa-sink.o, tree-if-conv.o, tree-dfa.o, tree-ssa-operands.o, tree-ssa-address.o, tree-ssa-loop-niter.o, tree-ssa-loop-ivcanon.o, tree-ssa-loop-prefetch.o, tree-predcom.o, tree-ssa-loop-ivopts.o, tree-affine.o, tree-ssa-loop-im.o, tree-ssa-math-opts.o, tree-ssa-alias.o, tree-ssa-reassoc.o, gimplify.o, tree-browser.o, tree-chrec.o, tree-scalar-evolution.o, tree-data-ref.o, sese.o, graphite-poly.o, tree-vect-loop.o, tree-vect-loop-manip.o, tree-vect-patterns.o, tree-vect-slp.o, tree-vect-stmts.o, tree-vect-data-refs.o, tree-vectorizer.o, tree-parloops.o, tree-stdarg.o, tree-object-size.o, gimple-pretty-print.o, tree-pretty-print.o, diagnostic.o, toplev.o, print-rtl.o, except.o, dwarf2out.o, cgraphunit.o, ipa-prop.o, ipa-cp.o, ipa-inline.o, ipa-pure-const.o, ipa-type-escape.o, ipa-struct-reorg.o, tree-ssa-dce.o, tree-call-cdce.o, tree-ssa-ccp.o, tree-sra.o, tree-switch-conversion.o, var-tracking.o, value-prof.o, cfgexpand.o, pretty-print.o): Update dependencies. cp: * error.c: Include tree-diagnostic.h and tree-pretty-print.h. (cp_print_error_function): Use diagnostic_abstract_origin macro. (cp_printer): Handle %K here using percent_K_format. * cxx-pretty-print.c: Include tree-pretty-print.h. * Make-lang.in (cp/error.o, cp/cxx-pretty-print.o): Update dependencies. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159685 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 2a964850ec4..dfea0258ea1 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1,5 +1,5 @@ /* Miscellaneous SSA utility functions. - Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009 + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. This file is part of GCC. @@ -33,6 +33,8 @@ along with GCC; see the file COPYING3. If not see #include "expr.h" #include "function.h" #include "diagnostic.h" +#include "tree-pretty-print.h" +#include "gimple-pretty-print.h" #include "bitmap.h" #include "pointer-set.h" #include "tree-flow.h" -- cgit v1.2.1 From 4b987facd8ba658d00c277a7e9c46548b492854f Mon Sep 17 00:00:00 2001 From: hubicka Date: Sat, 29 May 2010 20:31:45 +0000 Subject: * tree-vrp.c (debug_value_range, debug_all_value_ranges, debug_asserts_for, debug_all_asserts): Annotate with DEBUG_FUNCTION. * tree-into-ssa.c (debug_decl_set, debug_defs_stack, debug_currdefs, debug_tree_ssa, debug_tree_ssa_stats, debug_def_blocks, debug_names_replaced_by, debug_update_ssa): Likewise. * sbitmap.c (debug_sbitmap): Likewise. * genrecog.c (debug_decision, debug_decision_list): Likewise. * tree-pretty-print.c (debug_generic_expr, debug_generic_stmt, debug_tree_chain): Likewise. * tree-loop-distribution.c (debug_rdg_partitions): Likewise. * cgraph.c (debug_cgraph_node, debug_cgraph): Likewise. * optabs.c (debug_optab_libfuncs): Likewise. (verify_loop_closed_ssa): Likewise. * value-prof.c (verify_histograms): Likewise. * reload.c (debug_reload_to_stream, debug_reload): Likewise. * bitmap.c (debug_bitmap_file, debug_bitmap, bitmap_print): Likewise. * cfghooks.c (verify_flow_info): Likewise. * fold-const.c (debug_fold_checksum): Likewise. * omp-low.c (debug_omp_region, debug_all_omp_regions): Likewise. * cfg.c (debug_regset, debug_flow_info, debug_bb, debug_bb_n): Likewise. * omega.c (debug_omega_problem): Likewise. * cgraphunit.c (verify_cgraph_node, verify_cgraph): Likewise. * tree-ssa-ccp.c (debug_lattice_value): Likewise. * dominance.c (verify_dominators, debug_dominance_info, debug_dominance_tree): Likewise. * df-core.c (df_insn_uid_debug, df_insn_debug, df_insn_debug_regno, * df_regno_debug, df_ref_debug, debug_df_insn, debug_df_reg, debug_df_regno, debug_df_ref, debug_df_defno, debug_df_useno, debug_df_chain): Likewise. * tree-ssa-dom.c (debug_dominator_optimization_stats): Likewise. * sel-sched.c (debug_state): Likewise. * tree-ssa-alias.c (debug_alias_info, debug_points_to_info_for): Likewise. * cfganal.c (print_edge_list, verify_edge_list): Likewise. * dwarf2out.c (debug_dwarf_die, debug_dwarf): Likewise. * tree-eh.c (verify_eh_edges, verify_eh_dispatch_edge): Likewise. * gimple-pretty-print.c (debug_gimple_stmt, debug_gimple_seq): Likewise. * c-pretty-print.c (debug_c_tree): Likewise. * sel-sched-dump.c (debug_insn_rtx, debug_vinsn, debug_expr, debug_insn debug_av_set, debug_lv_set, debug_ilist, debug_blist, debug_insn_vector, debug_hard_reg_set, debug_mem_addr_value): Likewise. * ebitmap.c (debug_ebitmap): Likewise. * function.c (debug_find_var_in_block_tree): Likewise. * print-rtl.c (debug_rtx): Likewise. (debug_rtx_count): Likewise. (debug_rtx_list, debug_rtx_range, debug_rtx_find): Likewise. * stor-layout.c (debug_rli): Likewise. * ipa.c (debug_cgraph_node_set, debug_varpool_node_set): Likewise. * tree-data-ref.c (debug_data_references, debug_data_dependence_relations, debug_data_reference, debug_data_dependence_relation, debug_rdg_vertex, debug_rdg_component, debug_rdg): Likewise. * tree-affine.c (debug_aff): Likewise. * tree-dfa.c (debug_referenced_vars, debug_variable, debug_dfa_stats): Likewise. * except.c (debug_eh_tree, verify_eh_tree): Likewise. * emit-rtl.c (verify_rtl_sharing): Likewise. * tree-ssa-pre.c (debug_pre_expr, debug_bitmap_set, debug_value_expressions): Likewise. * tree-ssa-live.c (debug_scope_block, debug_scope_blocks): Likewise. * sese.c (debug_rename_map, debug_ivtype_map): Likewise. * print-tree.c (debug_tree, debug_vec_tree): Likewise. * cfglayout.c (verify_insn_chain): Likewise. * graphite-clast-to-gimple.c (debug_clast_name_indexes, debug_clast_stmt, debug_generated_program): Likewise. * ggc-page.c (debug_print_page_list): Likewise. * tree-ssa-ter.c (debug_ter): Likewise. * graphite-dependences.c (debug_pddr): Likewise. * sched-deps.c (debug_ds): Likewise. * tree-ssa.c (verify_ssa): Likewise. * graphite-poly.c (debug_scattering_function, debug_iteration_domain, debug_scattering_functions, debug_iteration_domains, debug_pdr, debug_pdrs, debug_pbb_domain, debug_pbb, debug_scop_context, debug_scop, debug_cloog, debug_scop_params, debug_lst): Likewise. * tree-inline.c (debug_find_tree): Likewise. * graphite-ppl.c (debug_ppl_linear_expr, debug_ppl_polyhedron_matrix, debug_ppl_powerset_matrix): Likewise. * var-tracking.c (debug_dv): Likewise. * system.h (DEBUG_FUNCTION, DEBUG_VARIABLE): Define. * cfgloop.c (verify_loop_structure): Likewise. * plugin.c (dump_active_plugins, debug_active_plugins): Likewise. * c-common.c (verify_sequence_points): Likewise. * sched-rgn.c (debug_regions, debug_region, debug_candidate, debug_candidates, debug_rgn_dependencies): Likewise. * tree-ssa-structalias.c (debug_constraint, debug_constraints, * debug_constraint_graph, debug_solution_for_var, debug_sa_points_to_info): Likewise. * sched-vis.c (debug_insn_slim, debug_bb_slim, debug_bb_n_slim): Likewie. * tree-cfg.c (debug_cfg_stats, verify_stmts, debug_function, debug_loops, debug_loop, debug_loop_num): Likewise. * passes.c (debug_pass): Likewise. (dump_properties): Likewise; add cfglayout property. (debug_properties): Likewise. * tree-ssa-reassoc.c (debug_ops_vector): Likewise. * varpool.c (debug_varpool): Likewise. * regcprop.c (debug_value_data): Likewise. * tree-ssa-operands.c (verify_imm_links, debug_immediate_uses, debug_immediate_uses_for): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160036 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index dfea0258ea1..d07c61d0468 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -857,7 +857,7 @@ error: /* Verify common invariants in the SSA web. TODO: verify the variable annotations. */ -void +DEBUG_FUNCTION void verify_ssa (bool check_modified_stmt) { size_t i; -- cgit v1.2.1 From 8e3cb73bc66100e137b20bcd98316bc415b6e53c Mon Sep 17 00:00:00 2001 From: steven Date: Tue, 1 Jun 2010 22:00:56 +0000 Subject: * gimplify.c: Do not include except.h and optabs.h. (gimplify_body): Do not initialize RTL profiling. * gimple-low.c: Do not include rtl.h, diagnostic.h, langhooks.h, langhooks-def.h, timevar.h, except.h, hashtab.h, and expr.h. * gimple-fold.c: Do not include rtl.h, tm_p.h, ggc.h, basic-block.h, output.h, expr.h, diagnostic.h, timevar.h, value-prof.h, and langhooks.h. * tree-pretty-print.h: Include pretty-print.h. * gimple-pretty-print.h: Include pretty-print.h. * tree-pretty-print.c: Do not include diagnostic.h. * tree-vrp.c: Likewise. * tree-tailcall.c: Likewise * tree-scalar-evolution.c: Likewise * tree-ssa-dse.c: Likewise * tree-chrec.c: Likewise * tree-ssa-sccvn.c: Likewise * tree-ssa-copyrename.c: Likewise * tree-nomudflap.c: Likewise * tree-call-cdce.c: Likewise * tree-stdarg.c: Likewise * tree-ssa-math-opts.c: Likewise * tree-nrv.c: Likewise * tree-ssa-sink.c: Likewise * tree-browser.c: Likewise * tree-ssa-loop-ivcanon.c: Likewise * tree-ssa-loop.c: Likewise * tree-parloops.c: Likewise * tree-ssa-address.c: Likewise * tree-ssa-ifcombine.c: Likewise * tree-if-conv.c: Likewise * tree-data-ref.c: Likewise * tree-affine.c: Likewise * tree-ssa-phiopt.c: Likewise * tree-ssa-coalesce.c: Likewise * tree-ssa-pre.c: Likewise * tree-ssa-live.c: Likewise * tree-predcom.c: Likewise * tree-ssa-forwprop.c: Likewise * tree-ssa-dce.c: Likewise * tree-ssa-ter.c: Likewise * tree-ssa-loop-prefetch.c: Likewise * tree-optimize.c: Likewise * tree-ssa-phiprop.c: Likewise * tree-object-size.c: Likewise * tree-outof-ssa.c: Likewise * tree-ssa-structalias.c: Likewise * tree-switch-conversion.c: Likewise * tree-ssa-reassoc.c: Likewise * tree-ssa-operands.c: Likewise * tree-vectorizer.c: Likewise * tree-vect-data-refs.c: Likewise * tree-vect-generic.c: Likewise * tree-vect-stmts.c: Likewise * tree-vect-patterns.c: Likewise * tree-vect-slp.c: Likewise * tree-vect-loop.c: Likewise * tree-ssa-loop-ivopts.c: Likewise * tree-ssa-loop-im.c: Likewise * tree-ssa-loop-niter.c: Likewise * tree-ssa-loop-unswitch.c: Likewise * tree-ssa-loop-manip.c: Likewise * tree-ssa-loop-ch.c: Likewise * tree-dump.c: Likewise * tree-complex.c: Likewise * tree-into-ssa.c: Do not include diagnostic.h and expr.h. * tree-ssa-uninit.c: Likewise * tree-ssa-threadupdate.c: Likewise * tree-ssa-uncprop.c: Likewise * tree-ssa-ccp.c: Likewise * tree-ssa-dom.c: Likewise * tree-ssa-propagate.c: Likewise * tree-ssa-alias.c: Likewise * tree-dfa.c: Likewise * tree-cfgcleanup.c: Likewise * tree-sra.c: Likewise * tree-ssa-copy.c: Likewise * tree-ssa.c: Likewise * tree-profile.c: Likewise * tree-cfg.c: Likewise * tree-ssa-threadedge.c: Likewise * tree-vect-loop-manip.c: Likewise * tree-inline.c: Do not include diagnostic.h and expr.h. Include rtl.h. (copy_decl_for_dup_finish): Do not use NULL_RTX. * tree-loop-linear.c: Do not include diagnostic.h, expr.h, and optabs.h. * tree-loop-distribution.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160125 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index d07c61d0468..ec9c50ceb77 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -30,9 +30,7 @@ along with GCC; see the file COPYING3. If not see #include "langhooks.h" #include "basic-block.h" #include "output.h" -#include "expr.h" #include "function.h" -#include "diagnostic.h" #include "tree-pretty-print.h" #include "gimple-pretty-print.h" #include "bitmap.h" -- cgit v1.2.1 From ba72912a012b97cad825eebee3f5f22253d0afe4 Mon Sep 17 00:00:00 2001 From: lauras Date: Tue, 8 Jun 2010 07:25:24 +0000 Subject: gcc/ada: 2010-06-08 Laurynas Biveinis * gcc-interface/utils.c (init_gnat_to_gnu): Use typed GC allocation. (init_dummy_type): Likewise. (gnat_pushlevel): Likewise. * gcc-interface/trans.c (Attribute_to_gnu): Likewise. (Subprogram_Body_to_gnu): Likewise. (Compilation_Unit_to_gnu): Likewise. (start_stmt_group): Likewise. (extract_encoding): Likewise. (decode_name): Likewise. * gcc-interface/misc.c (gnat_printable_name): Likewise. * gcc-interface/decl.c (annotate_value): Likewise. * gcc-interface/ada-tree.h (struct lang_type): Add variable_size GTY option. (struct lang_decl): Likewise. (SET_TYPE_LANG_SPECIFIC): Use typed GC allocation. (SET_DECL_LANG_SPECIFIC): Likewise. gcc/c-family: 2010-06-08 Laurynas Biveinis * c-pragma.c (push_alignment): Use typed GC allocation. (handle_pragma_push_options): Likewise. * c-common.c (parse_optimize_options): Likewise. * c-common.h (struct sorted_fields_type): Add variable_size GTY option. gcc/cp: 2010-06-08 Laurynas Biveinis * typeck2.c (abstract_virtuals_error): Likewise. * pt.c (maybe_process_partial_specialization): Likewise. (register_specialization): Likewise. (add_pending_template): Likewise. (lookup_template_class): Likewise. (push_tinst_level): Likewise. * parser.c (cp_lexer_new_main): Likewise. (cp_lexer_new_from_tokens): Likewise. (cp_token_cache_new): Likewise. (cp_parser_context_new): Likewise. (cp_parser_new): Likewise. (cp_parser_nested_name_specifier_opt): Likewise. (cp_parser_template_id): Likewise. * name-lookup.c (binding_entry_make): Likewise. (binding_table_construct): Likewise. (binding_table_new): Likewise. (cxx_binding_make): Likewise. (pushdecl_maybe_friend): Likewise. (begin_scope): Likewise. (push_to_top_level): Likewise. * lex.c (init_reswords): Likewise. (retrofit_lang_decl): Likewise. (cxx_dup_lang_specific_decl): Likewise. (copy_lang_type): Likewise. (cxx_make_type): Likewise. * decl.c (make_label_decl): Likewise. (check_goto): Likewise. (start_preparsed_function): Likewise. (save_function_data): Likewise. * cp-tree.h (TYPE_SET_PTRMEMFUNC_TYPE): Likewise. * cp-objcp-common.c (decl_shadowed_for_var_insert): Likewise. * class.c (finish_struct_1): Likewise. * cp-tree.h (struct lang_type): Add variable_size GTY option. (struct lang_decl): Likewise. * parser.c (cp_parser_new): Update comment to not reference ggc_alloc. gcc/fortran: 2010-06-08 Laurynas Biveinis * trans-types.c (gfc_get_nodesc_array_type): Use typed GC allocation. (gfc_get_array_type_bounds): Likewise. * trans-decl.c (gfc_allocate_lang_decl): Likewise. (gfc_find_module): Likewise. * f95-lang.c (pushlevel): Likewise. * trans.h (struct lang_type): Add variable_size GTY option. (struct lang_decl): Likewise. gcc/java: 2010-06-08 Laurynas Biveinis * jcf-reader.c (jcf_parse_constant_pool): Use typed GC allocation. * jcf-parse.c (java_parse_file): Likewise. (process_zip_dir): Likewise. * java-tree.h (MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC): Likewise. (MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC): Likewise. * expr.c (add_type_assertion): Likewise. * decl.c (make_binding_level): Likewise. (java_dup_lang_specific_decl): Likewise. * constants.c (set_constant_entry): Likewise. (cpool_for_class): Likewise. * class.c (add_method_1): Likewise. (java_treetreehash_new): Likewise. * java-tree.h (struct lang_type): Add variable_size GTY option. (struct lang_decl): Likewise. * jch.h (struct cpool_entry): Likewise. * java-tree.h (java_treetreehash_create): Remove parameter ggc. * except.c (prepare_eh_table_type): Update java_treetreehash_create call. * class.c (add_method_1): Update java_treetreehash_create call. (java_treetreehash_create): Remove parameter gc. Use htab_create_ggc. gcc/lto: 2010-06-08 Laurynas Biveinis * lto.c (lto_read_in_decl_state): Use typed GC allocation. (lto_file_read): Likewise. (new_partition): Likewise. (read_cgraph_and_symbols): Likewise. gcc/objc: 2010-06-08 Laurynas Biveinis * objc-act.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Use typed GC allocation. * objc-act.c (objc_volatilize_decl): Likewise. (objc_build_string_object): Likewise. (hash_init): Likewise. (hash_enter): Likewise. (hash_add_attr): Likewise. (add_class): Likewise. (start_class): Likewise. gcc/objcp: 2010-06-08 Laurynas Biveinis * objcp-decl.h (ALLOC_OBJC_TYPE_LANG_SPECIFIC): Use typed GC allocation. gcc: 2010-06-08 Laurynas Biveinis * doc/tm.texi (Per-Function Data): Do not reference ggc_alloc. * doc/gty.texi (GTY Options): Document typed GC allocation and variable_size GTY option. * ggc-internal.h: New. * ggc.h: Update copyright year. (digit_string): Move to stringpool.c. (ggc_mark_stringpool, ggc_purge_stringpool, ggc_mark_roots) (gt_pch_save_stringpool, gt_pch_fixup_stringpool) (gt_pach_restore_stringpool, gt_pch_p_S, gt_pch_note_object) (init_ggc_pch, ggc_pch_count_object, ggc_pch_total_size) (ggc_pch_this_base, ggc_pch_alloc_object, ggc_pch_prepare_write) (ggc_pch_write_object, ggc_pch_finish, ggc_pch_read) (ggc_force_collect, ggc_get_size, ggc_statistics) (ggc_print_common_statistics): Move to ggc-internal.h. (digit_vector, new_ggc_zone, destroy_ggc_zone, ggc_alloc_stat) (ggc_alloc, ggc_alloc_cleared, ggc_realloc, ggc_calloc, GGC_NEW) (GGC_CNEW, GGC_NEWVEC, GGC_CNEWVEC, GGC_NEWVAR, ggc_alloc_rtvec) (ggc_alloc_tree, gt_pch_save, ggc_min_expand_heuristic) (ggc_min_heapsize_heuristic, ggc_alloc_zone) (ggc_alloc_zone_pass_stat): Remove. (ggc_internal_alloc_stat, ggc_internal_alloc) (ggc_internal_cleared_alloc_stat): New. (GGC_RESIZEVEC, GGC_RESIZEVAR): Redefine. (ggc_internal_vec_alloc_stat) (ggc_internal_cleared_vec_alloc_stat) (ggc_internal_vec_alloc_stat, ggc_internal_cleared_vec_alloc) (ggc_alloc_atomic_stat, ggc_alloc_atomic) (ggc_alloc_cleared_atomic, ggc_cleared_alloc_htab_ignore_args) (ggc_cleared_alloc_ptr_array_two_args): New. (htab_create_ggc, splay_tree_new_ggc): Redefine. (ggc_splay_alloc): Change the type of the first argument to enum gt_types_enum. (ggc_alloc_string): Make macro. (ggc_alloc_string_stat): New. (ggc_strdup): Redefine. (rtl_zone, tree_zone, tree_id_zone): Declare unconditionally. (ggc_alloc_rtvec_sized): New. (ggc_alloc_zone_stat): Rename to ggc_internal_alloc_zone_stat. (ggc_internal_alloc_zone_pass_stat, ggc_internal_alloc_zone_stat) (ggc_internal_cleared_alloc_zone_stat) (ggc_internal_zone_alloc_stat) (ggc_internal_zone_cleared_alloc_stat) (ggc_internal_zone_vec_alloc_stat) (ggc_alloc_zone_rtx_def_stat) (ggc_alloc_zone_tree_node_stat) (ggc_alloc_zone_cleared_tree_node_stat) (ggc_alloc_cleared_gimple_statement_d_stat): New. * ggc-common.c: Include ggc-internal.h. (ggc_internal_cleared_alloc_stat): Rename from ggc_alloc_cleared_stat. (ggc_realloc_stat): Use ggc_internal_alloc_stat. (ggc_calloc): Remove. (ggc_cleared_alloc_htab_ignore_args): New. (ggc_cleared_alloc_ptr_array_two_args): New. (ggc_splay_alloc): Add obj_type parameter. (init_ggc_heuristics): Formatting fixes. * ggc-none.c: Update copyright year. (ggc_alloc_stat): Rename to ggc_alloc_stat. (ggc_alloc_cleared_stat): Rename to ggc_internal_cleared_alloc_stat. (struct alloc_zone, rtl_zone, tree_zone, tree_id_zone): New. * ggc-page.c: Update copyright year. Include ggc-internal.h. Remove references to ggc_alloc in comments. (ggc_alloc_typed_stat): Call ggc_internal_alloc_stat. (ggc_alloc_stat): Rename to ggc_internal_alloc_stat. (new_ggc_zone, destroy_ggc_zone): Remove. (struct alloc_zone, rtl_zone, tree_zone, tree_id_zone): New. * ggc-zone.c: Include ggc-internal.h. Remove references to ggc_alloc in comments. (ggc_alloc_zone_stat): ggc_internal_alloc_zone_stat. (ggc_internal_alloc_zone_pass_stat): New. (ggc_internal_cleared_alloc_zone_stat): New. (ggc_alloc_typed_stat): Use ggc_internal_alloc_zone_pass_stat. (ggc_alloc_stat): Rename ggc_internal_alloc_stat. (new_ggc_zone, destroy_ggc_zone): Remove. * stringpool.c: Update copyright year. Include ggc-internal.h (digit_vector): Make static. (digit_string): Moved from ggc.h. (stringpool_ggc_alloc): Use ggc_alloc_atomic. (ggc_alloc_string): Rename to ggc_alloc_string_stat. * Makefile.in (GGC_INTERNAL_H): New. (ggc_common.o, ggc-page.o, ggc-zone.o, stringpool.o): Add $(GGC_INTERNAL_H) to dependencies. * gentype.c: Update copyright year. (walk_type): Accept variable_size GTY option. (USED_BY_TYPED_GC_P): New macro. (write_enum_defn): Use USED_BY_TYPED_GC_P. Do not output whitespace at the end of strings. (get_type_specifier, variable_size_p): New functions. (alloc_quantity, alloc_zone): New enums. (write_typed_alloc_def): New function. (write_typed_struct_alloc_def): Likewise. (write_typed_typed_typedef_alloc_def): Likewise. (write_typed_alloc_defns): Likewise. (output_typename, write_splay_tree_allocator_def): Likewise. (write_splay_tree_allocators): Likewise. (main): Call write_typed_alloc_defns and write_splay_tree_allocators. * lto-streamer.h (lto_file_decl_data_ptr): New. * passes.c (order): Define using cgraph_node_ptr. * strinpool.c (struct string_pool_data): Declare nested_ptr using ht_identifier_ptr. * gimple.h (union gimple_statement_d): Likewise. * rtl.h (struct rtx_def): Likewise. (struct rtvec_def): Likewise. * tree.h (union tree_node): Likewise. * tree-ssa-operands.h (struct ssa_operand_memory_d): Likewise. * cfgloop.c (record_loop_exits): Use htab_create_ggc. * tree-scalar-evolution.c (scev_initialize): Likewise. * alias.c (record_alias_subset): Update splay_tree_new_ggc call. * dwarf2asm.c (dw2_force_const_mem): Likewise. * omp-low.c (lower_omp_critical): Likewise. * bitmap.h (struct bitmap_head_def): Update comment to not reference ggc_alloc. * config/pa/pa.c (get_deferred_label): Use GGC_RESIZEVEC. * ira.c (fix_reg_equiv_init): Use GGC_RESIZEVEC. * ipa-prop.c (duplicate_ggc_array): Rename to duplicate_ipa_jump_func_array. Use typed GC allocation. (ipa_edge_duplication_hook): Call duplicate_ipa_jump_func_array. * gimple.c (gimple_alloc_stat): Use ggc_alloc_cleared_gimple_statement_d_stat. * varasm.c (create_block_symbol): Use ggc_alloc_zone_rtx_def. * tree.c (make_node_stat): Use ggc_alloc_zone_cleared_tree_node_stat. (make_tree_vec_stat): Likewise. (build_vl_exp_stat): Likewise. (copy_node_stat): Use ggc_alloc_zone_tree_node_stat. (make_tree_binfo_stat): Likewise. (tree_cons_stat): Likewise. * rtl.c (rtx_alloc_stat): Use ggc_alloc_zone_rtx_def_stat. (shallow_copy_rtx_stat): Likewise. (make_node_stat): Likewise. * lto-symtab.c: Fix comment. * tree-cfg.c (create_bb): Update comment to not reference ggc_alloc_cleared. * tree-ssa-structalias.c (struct heapvar_for_stmt): Fix param_is value. * varpool.c (varpool_node): Use typed GC allocation. (varpool_extra_name_alias): Likewise. * varasm.c (emutls_decl): Likewise. (get_unnamed_section): Likewise. (get_noswitch_section): Likewise. (get_section): Likewise. (get_block_for_section): Likewise. (build_constant_desc): Likewise. (create_constant_pool): Likewise. (force_const_mem): Likewise. * tree.c (build_vl_exp_stat): Likewise. (build_real): Likewise. (build_string): Likewise. (decl_debug_expr_insert): Likewise. (decl_value_expr_insert): Likewise. (type_hash_add): Likewise. (build_omp_clause): Likewise. * tree-ssanames.c (duplicate_ssa_name_ptr_info): Likewise. * tree-ssa.c (init_tree_ssa): Likewise. * tree-ssa-structalias.c (heapvar_insert): Likewise. * tree-ssa-operands.c (ssa_operand_alloc): Likewise. * tree-ssa-loop-niter.c (record_estimate): Likewise. * tree-ssa-alias.c (get_ptr_info): Likewise. * tree-scalar-evolution.c (new_scev_info_str): Likewise. * tree-phinodes.c (allocate_phi_node): Likewise. * tree-iterator.c (tsi_link_before): Likewise. (tsi_link_after): Likewise. * tree-eh.c (add_stmt_to_eh_lp_fn): Likewise. * tree-dfa.c (create_var_ann): Likewise. * tree-cfg.c (create_bb): Likewise. * toplev.c (alloc_for_identifier_to_locale): Likewise. (general_init): Likewise. * stringpool.c (stringpool_ggc_alloc): Likewise. (gt_pch_save_stringpool): Likewise. * sese.c (if_region_set_false_region): Likewise. * passes.c (do_per_function_toporder): Likewise. * optabs.c (set_optab_libfunc): Likewise. (set_conv_libfunc): Likewise. * lto-symtab.c (lto_symtab_register_decl): Likewise. * lto-streamer-in.c (lto_input_eh_catch_list): Likewise. (input_eh_region): Likewise. (input_eh_lp): Likewise. (make_new_block): Likewise. (unpack_ts_real_cst_value_fields): Likewise. * lto-section-in.c (lto_new_in_decl_state): Likewise. * lto-cgraph.c (input_node_opt_summary): Likewise. * loop-init.c (loop_optimizer_init): Likewise. * lambda.h (lambda_vector_new): Likewise. * lambda-code.c (replace_uses_equiv_to_x_with_y): Likewise. * ira.c (update_equiv_regs): Likewise. * ipa.c (cgraph_node_set_new): Likewise. (cgraph_node_set_add): Likewise. (varpool_node_set_new): Likewise. (varpool_node_set_add): Likewise. * ipa-prop.c (ipa_compute_jump_functions_for_edge): Likewise. (duplicate_ipa_jump_func_array): Likewise. (ipa_read_node_info): Likewise. * ipa-cp.c (ipcp_create_replace_map): Likewise. * integrate.c (get_hard_reg_initial_val): Likewise. * gimple.c (gimple_alloc_stat): Likewise. (gimple_build_omp_for): Likewise. (gimple_seq_alloc): Likewise. (gimple_copy): Likewise. * gimple-iterator.c (gsi_insert_before_without_update): Likewise. (gsi_insert_after_without_update): Likewise. * function.c (add_frame_space): Likewise. (insert_temp_slot_address): Likewise. (assign_stack_temp_for_type): Likewise. (allocate_struct_function): Likewise. (types_used_by_var_decl_insert): Likewise. * except.c (init_eh_for_function): Likewise. (gen_eh_region): Likewise. (gen_eh_region_catch): Likewise. (gen_eh_landing_pad): Likewise. (add_call_site): Likewise. * emit-rtl.c (get_mem_attrs): Likewise. (get_reg_attrs): Likewise. (start_sequence): Likewise. (init_emit): Likewise. * dwarf2out.c (new_cfi): Likewise. (queue_reg_save): Likewise. (dwarf2out_frame_init): Likewise. (new_loc_descr): Likewise. (find_AT_string): Likewise. (new_die): Likewise. (add_var_loc_to_decl): Likewise. (clone_die): Likewise. (clone_as_declaration): Likewise. (break_out_comdat_types): Likewise. (new_loc_list): Likewise. (loc_descriptor): Likewise. (add_loc_descr_to_each): Likewise. (add_const_value_attribute): Likewise. (tree_add_const_value_attribute): Likewise. (add_comp_dir_attribute): Likewise. (add_name_and_src_coords_attributes): Likewise. (lookup_filename): Likewise. (store_vcall_insn): Likewise. (dwarf2out_init): Likewise. * dbxout.c (dbxout_init): Likewise. * config/xtensa/xtensa.c (xtensa_init_machine_status): Likewise. * config/sparc/sparc.c (sparc_init_machine_status): Likewise. * config/score/score7.c (score7_output_external): Likewise. * config/score/score3.c (score3_output_external): Likewise. * config/s390/s390.c (s390_init_machine_status): Likewise. * config/rs6000/rs6000.c (builtin_function_type): Likewise. (rs6000_init_machine_status): Likewise. (output_toc): Likewise. * config/pa/pa.c (pa_init_machine_status): Likewise. (get_deferred_plabel): Likewise. * config/moxie/moxie.c (moxie_init_machine_status): Likewise. * config/mmix/mmix.c (mmix_init_machine_status): Likewise. * config/mips/mips.c (mflip_mips16_use_mips16_p): Likewise. * config/mep/mep.c (mep_init_machine_status): Likewise. (mep_note_pragma_flag): Likewise. * config/m32c/m32c.c (m32c_init_machine_status): Likewise. * config/iq2000/iq2000.c (iq2000_init_machine_status): Likewise. * config/ia64/ia64.c (ia64_init_machine_status): Likewise. * config/i386/winnt.c (i386_pe_record_external_function): Likewise. (i386_pe_maybe_record_exported_symbol): Likewise. * config/i386/i386.c (get_dllimport_decl): Likewise. (ix86_init_machine_status): Likewise. (assign_386_stack_local): Likewise. * config/frv/frv.c (frv_init_machine_status): Likewise. * config/darwin.c (machopic_indirection_name): Likewise. * config/cris/cris.c (cris_init_machine_status): Likewise. * config/bfin/bfin.c (bfin_init_machine_status): Likewise. * config/avr/avr.c (avr_init_machine_status): Likewise. * config/arm/arm.c (arm_init_machine_status): Likewise. * config/alpha/alpha.c (alpha_init_machine_status): Likewise. (alpha_need_linkage): Likewise. (alpha_use_linkage): Likewise. * cgraph.c (cgraph_allocate_node): Likewise. (cgraph_create_edge_1): Likewise. (cgraph_create_indirect_edge): Likewise. (cgraph_add_asm_node): Likewise. * cfgrtl.c (init_rtl_bb_info): Likewise. * cfgloop.c (alloc_loop): Likewise. (rescan_loop_exit): Likewise. * cfg.c (init_flow): Likewise. (alloc_block): Likewise. (unchecked_make_edge): Likewise. * c-parser.c (c_parse_init): Likewise. (c_parse_file): Likewise. * c-decl.c (bind): Likewise. (record_inline_static): Likewise. (push_scope): Likewise. (make_label): Likewise. (lookup_label_for_goto): Likewise. (finish_struct): Likewise. (finish_enum): Likewise. (c_push_function_context): Likewise. * bitmap.c (bitmap_element_allocate): Likewise. (bitmap_gc_alloc_stat): Likewise. * alias.c (record_alias_subset): Likewise. (init_alias_analysis): Likewise. include: 2010-06-08 Laurynas Biveinis * splay-tree.h: Update copyright years. (splay_tree_s): Document fields. (splay_tree_new_typed_alloc): New. * hashtab.h: Update copyright years. (htab_create_typed_alloc): New. libcpp: 2010-06-08 Laurynas Biveinis * include/symtab.h (ht_identifier_ptr): New. libiberty: 2010-06-08 Laurynas Biveinis * splay-tree.c: Update copyright years. (splay_tree_new_typed_alloc): New. (splay_tree_new_with_allocator): Use it. * hashtab.c: Update copyright years. (htab_create_typed_alloc): New. (htab_create_alloc): Use it. * functions.texi: Regenerate. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160425 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index ec9c50ceb77..866ce6eb2b7 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1114,7 +1114,7 @@ uid_ssaname_map_hash (const void *item) void init_tree_ssa (struct function *fn) { - fn->gimple_df = GGC_CNEW (struct gimple_df); + fn->gimple_df = ggc_alloc_cleared_gimple_df (); fn->gimple_df->referenced_vars = htab_create_ggc (20, uid_decl_map_hash, uid_decl_map_eq, NULL); fn->gimple_df->default_defs = htab_create_ggc (20, uid_ssaname_map_hash, -- cgit v1.2.1 From 182cf5a9a415f31df0f9a10e46faed1221484a35 Mon Sep 17 00:00:00 2001 From: rguenth Date: Thu, 1 Jul 2010 08:49:19 +0000 Subject: 2010-07-01 Richard Guenther PR middle-end/42834 PR middle-end/44468 * doc/gimple.texi (is_gimple_mem_ref_addr): Document. * doc/generic.texi (References to storage): Document MEM_REF. * tree-pretty-print.c (dump_generic_node): Handle MEM_REF. (print_call_name): Likewise. * tree.c (recompute_tree_invariant_for_addr_expr): Handle MEM_REF. (build_simple_mem_ref_loc): New function. (mem_ref_offset): Likewise. * tree.h (build_simple_mem_ref_loc): Declare. (build_simple_mem_ref): Define. (mem_ref_offset): Declare. * fold-const.c: Include tree-flow.h. (operand_equal_p): Handle MEM_REF. (build_fold_addr_expr_with_type_loc): Likewise. (fold_comparison): Likewise. (fold_unary_loc): Fold VIEW_CONVERT_EXPR > to MEM_REF . (fold_binary_loc): Fold MEM[&MEM[p, CST1], CST2] to MEM[p, CST1 + CST2], fold MEM[&a.b, CST2] to MEM[&a, offsetof (a, b) + CST2]. * tree-ssa-alias.c (ptr_deref_may_alias_decl_p): Handle MEM_REF. (ptr_deref_may_alias_ref_p_1): Likewise. (ao_ref_base_alias_set): Properly differentiate base object for offset and TBAA. (ao_ref_init_from_ptr_and_size): Use MEM_REF. (indirect_ref_may_alias_decl_p): Handle MEM_REFs properly. (indirect_refs_may_alias_p): Likewise. (refs_may_alias_p_1): Likewise. Remove pointer SSA name def chasing code. (ref_maybe_used_by_call_p_1): Handle MEM_REF. (call_may_clobber_ref_p_1): Likewise. * dwarf2out.c (loc_list_from_tree): Handle MEM_REF. * expr.c (expand_assignment): Handle MEM_REF. (store_expr): Handle MEM_REFs from STRING_CSTs. (store_field): If expanding a MEM_REF of a non-addressable decl use bitfield operations. (get_inner_reference): Handle MEM_REF. (expand_expr_addr_expr_1): Likewise. (expand_expr_real_1): Likewise. * tree-eh.c (tree_could_trap_p): Handle MEM_REF. * alias.c (ao_ref_from_mem): Handle MEM_REF. (get_alias_set): Likewise. Properly handle VIEW_CONVERT_EXPRs. * tree-data-ref.c (dr_analyze_innermost): Handle MEM_REF. (dr_analyze_indices): Likewise. (dr_analyze_alias): Likewise. (object_address_invariant_in_loop_p): Likewise. * gimplify.c (mark_addressable): Handle MEM_REF. (gimplify_cond_expr): Build MEM_REFs. (gimplify_modify_expr_to_memcpy): Likewise. (gimplify_init_ctor_preeval_1): Handle MEM_REF. (gimple_fold_indirect_ref): Adjust. (gimplify_expr): Handle MEM_REF. Gimplify INDIRECT_REF to MEM_REF. * tree.def (MEM_REF): New tree code. * tree-dfa.c: Include toplev.h. (get_ref_base_and_extent): Handle MEM_REF. (get_addr_base_and_unit_offset): New function. * emit-rtl.c (set_mem_attributes_minus_bitpos): Handle MEM_REF. * gimple-fold.c (may_propagate_address_into_dereference): Handle MEM_REF. (maybe_fold_offset_to_array_ref): Allow possibly out-of bounds accesses if the array has just one dimension. Remove always true parameter. Do not require type compatibility here. (maybe_fold_offset_to_component_ref): Remove. (maybe_fold_stmt_indirect): Remove. (maybe_fold_reference): Remove INDIRECT_REF handling. Fold back to non-MEM_REF. (maybe_fold_offset_to_address): Simplify. Deal with type mismatches here. (maybe_fold_reference): Likewise. (maybe_fold_stmt_addition): Likewise. Also handle &ARRAY + I in addition to &ARRAY[0] + I. (fold_gimple_assign): Handle ADDR_EXPR of MEM_REFs. (gimple_get_relevant_ref_binfo): Handle MEM_REF. * cfgexpand.c (expand_debug_expr): Handle MEM_REF. * tree-ssa.c (useless_type_conversion_p): Make most pointer conversions useless. (warn_uninitialized_var): Handle MEM_REF. (maybe_rewrite_mem_ref_base): New function. (execute_update_addresses_taken): Implement re-writing of MEM_REFs to SSA form. * tree-inline.c (remap_gimple_op_r): Handle MEM_REF, remove INDIRECT_REF handling. (copy_tree_body_r): Handle MEM_REF. * gimple.c (is_gimple_addressable): Adjust. (is_gimple_address): Likewise. (is_gimple_invariant_address): ADDR_EXPRs of MEM_REFs with invariant base are invariant. (is_gimple_min_lval): Adjust. (is_gimple_mem_ref_addr): New function. (get_base_address): Handle MEM_REF. (count_ptr_derefs): Likewise. (get_base_loadstore): Likewise. * gimple.h (is_gimple_mem_ref_addr): Declare. (gimple_call_fndecl): Handle invariant MEM_REF addresses. * tree-cfg.c (verify_address): New function, split out from ... (verify_expr): ... here. Use for verifying ADDR_EXPRs and the address operand of MEM_REFs. Verify MEM_REFs. Reject INDIRECT_REFs. (verify_types_in_gimple_min_lval): Handle MEM_REF. Disallow INDIRECT_REF. Allow conversions. (verify_types_in_gimple_reference): Verify VIEW_CONVERT_EXPR of a register does not change its size. (verify_types_in_gimple_reference): Verify MEM_REF. (verify_gimple_assign_single): Disallow INDIRECT_REF. Handle MEM_REF. * tree-ssa-operands.c (opf_non_addressable, opf_not_non_addressable): New. (mark_address_taken): Handle MEM_REF. (get_indirect_ref_operands): Pass through opf_not_non_addressable. (get_asm_expr_operands): Pass opf_not_non_addressable. (get_expr_operands): Handle opf_[not_]non_addressable. Handle MEM_REF. Remove INDIRECT_REF handling. * tree-vrp.c: (check_array_ref): Handle MEM_REF. (search_for_addr_array): Likewise. (check_array_bounds): Likewise. (vrp_stmt_computes_nonzero): Adjust for MEM_REF. * tree-ssa-loop-im.c (for_each_index): Handle MEM_REF. (ref_always_accessed_p): Likewise. (gen_lsm_tmp_name): Likewise. Handle ADDR_EXPR. * tree-complex.c (extract_component): Do not handle INDIRECT_REF. Handle MEM_REF. * cgraphbuild.c (mark_load): Properly check for NULL result from get_base_address. (mark_store): Likewise. * tree-ssa-loop-niter.c (array_at_struct_end_p): Handle MEM_REF. * tree-loop-distribution.c (generate_builtin): Exchange INDIRECT_REF handling for MEM_REF. * tree-scalar-evolution.c (follow_ssa_edge_expr): Handle &MEM[ptr + CST] similar to POINTER_PLUS_EXPR. * builtins.c (stabilize_va_list_loc): Use the function ABI valist type if we couldn't canonicalize the argument type. Always dereference with the canonical va-list type. (maybe_emit_free_warning): Handle MEM_REF. (fold_builtin_memory_op): Simplify and handle MEM_REFs in folding memmove to memcpy. * builtins.c (fold_builtin_memory_op): Use ref-all types for all memcpy foldings. * omp-low.c (build_receiver_ref): Adjust for MEM_REF. (build_outer_var_ref): Likewise. (scan_omp_1_op): Likewise. (lower_rec_input_clauses): Likewise. (lower_lastprivate_clauses): Likewise. (lower_reduction_clauses): Likewise. (lower_copyprivate_clauses): Likewise. (expand_omp_atomic_pipeline): Likewise. (expand_omp_atomic_mutex): Likewise. (create_task_copyfn): Likewise. * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Handle MEM_REF. Remove old union trick. Initialize constant offsets. (ao_ref_init_from_vn_reference): Likewise. Do not handle INDIRECT_REF. Init base_alias_set properly. (vn_reference_lookup_3): Replace INDIRECT_REF handling with MEM_REF. (vn_reference_fold_indirect): Adjust for MEM_REFs. (valueize_refs): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. (may_insert): Remove. (visit_reference_op_load): Do not test may_insert. (run_scc_vn): Remove parameter, do not fiddle with may_insert. * tree-ssa-sccvn.h (struct vn_reference_op_struct): Add a field to store the constant offset this op applies. (run_scc_vn): Adjust prototype. * cgraphunit.c (thunk_adjust): Adjust for MEM_REF. * tree-ssa-ccp.c (ccp_fold): Replace INDIRECT_REF folding with MEM_REF. Propagate &foo + CST as &MEM[&foo, CST]. Do not bother about volatile qualifiers on pointers. (fold_const_aggregate_ref): Handle MEM_REF, do not handle INDIRECT_REF. * tree-ssa-loop-ivopts.c * tree-ssa-loop-ivopts.c (determine_base_object): Adjust for MEM_REF. (strip_offset_1): Likewise. (find_interesting_uses_address): Replace INDIRECT_REF handling with MEM_REF handling. (get_computation_cost_at): Likewise. * ipa-pure-const.c (check_op): Handle MEM_REF. * tree-stdarg.c (check_all_va_list_escapes): Adjust for MEM_REF. * tree-ssa-sink.c (is_hidden_global_store): Handle MEM_REF and constants. * ipa-inline.c (likely_eliminated_by_inlining_p): Handle MEM_REF. * tree-parloops.c (take_address_of): Adjust for MEM_REF. (eliminate_local_variables_1): Likewise. (create_call_for_reduction_1): Likewise. (create_loads_for_reductions): Likewise. (create_loads_and_stores_for_name): Likewise. * matrix-reorg.c (may_flatten_matrices_1): Sanitize. (ssa_accessed_in_tree): Handle MEM_REF. (ssa_accessed_in_assign_rhs): Likewise. (update_type_size): Likewise. (analyze_accesses_for_call_stmt): Likewise. (analyze_accesses_for_assign_stmt): Likewise. (transform_access_sites): Likewise. (transform_allocation_sites): Likewise. * tree-affine.c (tree_to_aff_combination): Handle MEM_REF. * tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): Do not handle INDIRECT_REF. * tree-ssa-phiopt.c (add_or_mark_expr): Handle MEM_REF. (cond_store_replacement): Likewise. * tree-ssa-pre.c (create_component_ref_by_pieces_1): Handle MEM_REF, no not handle INDIRECT_REFs. (insert_into_preds_of_block): Properly initialize avail. (phi_translate_1): Fold MEM_REFs. Re-evaluate constant offset for ARRAY_REFs. Properly handle reference lookups that require a bit re-interpretation. (can_PRE_operation): Do not handle INDIRECT_REF. Handle MEM_REF. * tree-sra.c * tree-sra.c (build_access_from_expr_1): Handle MEM_REF. (build_ref_for_offset_1): Remove. (build_ref_for_offset): Build MEM_REFs. (gate_intra_sra): Disable for now. (sra_ipa_modify_expr): Handle MEM_REF. (ipa_early_sra_gate): Disable for now. * tree-sra.c (create_access): Swap INDIRECT_REF handling for MEM_REF handling. (disqualify_base_of_expr): Likewise. (ptr_parm_has_direct_uses): Swap INDIRECT_REF handling for MEM_REF handling. (sra_ipa_modify_expr): Remove INDIRECT_REF handling. Use mem_ref_offset. Remove bogus folding. (build_access_from_expr_1): Properly handle MEM_REF for non IPA-SRA. (make_fancy_name_1): Add support for MEM_REF. * tree-predcom.c (ref_at_iteration): Handle MEM_REFs. * tree-mudflap.c (mf_xform_derefs_1): Adjust for MEM_REF. * ipa-prop.c (compute_complex_assign_jump_func): Handle MEM_REF. (compute_complex_ancestor_jump_func): Likewise. (ipa_analyze_virtual_call_uses): Likewise. * tree-ssa-forwprop.c (forward_propagate_addr_expr_1): Replace INDIRECT_REF folding with more generalized MEM_REF folding. (tree_ssa_forward_propagate_single_use_vars): Adjust accordingly. (forward_propagate_addr_into_variable_array_index): Also handle &ARRAY + I in addition to &ARRAY[0] + I. * tree-ssa-dce.c (ref_may_be_aliased): Handle MEM_REF. * tree-ssa-ter.c (find_replaceable_in_bb): Avoid TER if that creates assignments with overlap. * tree-nested.c (get_static_chain): Adjust for MEM_REF. (get_frame_field): Likewise. (get_nonlocal_debug_decl): Likewise. (convert_nonlocal_reference_op): Likewise. (struct nesting_info): Add mem_refs pointer-set. (create_nesting_tree): Allocate it. (convert_local_reference_op): Insert to be folded mem-refs. (fold_mem_refs): New function. (finalize_nesting_tree_1): Perform defered folding of mem-refs (free_nesting_tree): Free the pointer-set. * tree-vect-stmts.c (vectorizable_store): Adjust for MEM_REF. (vectorizable_load): Likewise. * tree-ssa-phiprop.c (phiprop_insert_phi): Adjust for MEM_REF. (propagate_with_phi): Likewise. * tree-object-size.c (addr_object_size): Handle MEM_REFs instead of INDIRECT_REFs. (compute_object_offset): Handle MEM_REF. (plus_stmt_object_size): Handle MEM_REF. (collect_object_sizes_for): Dispatch to plus_stmt_object_size for &MEM_REF. * tree-flow.h (get_addr_base_and_unit_offset): Declare. (symbol_marked_for_renaming): Likewise. * Makefile.in (tree-dfa.o): Add $(TOPLEV_H). (fold-const.o): Add $(TREE_FLOW_H). * tree-ssa-structalias.c (get_constraint_for_1): Handle MEM_REF. (find_func_clobbers): Likewise. * ipa-struct-reorg.c (decompose_indirect_ref_acc): Handle MEM_REF. (decompose_access): Likewise. (replace_field_acc): Likewise. (replace_field_access_stmt): Likewise. (insert_new_var_in_stmt): Likewise. (get_stmt_accesses): Likewise. (reorg_structs_drive): Disable. * config/i386/i386.c (ix86_va_start): Adjust for MEM_REF. (ix86_canonical_va_list_type): Likewise. cp/ * cp-gimplify.c (cp_gimplify_expr): Open-code the rhs predicate we are looking for, allow non-gimplified INDIRECT_REFs. testsuite/ * gcc.c-torture/execute/20100316-1.c: New testcase. * gcc.c-torture/execute/pr44468.c: Likewise. * gcc.c-torture/compile/20100609-1.c: Likewise. * gcc.dg/volatile2.c: Adjust. * gcc.dg/plugin/selfassign.c: Likewise. * gcc.dg/pr36902.c: Likewise. * gcc.dg/tree-ssa/foldaddr-2.c: Remove. * gcc.dg/tree-ssa/foldaddr-3.c: Likewise. * gcc.dg/tree-ssa/forwprop-8.c: Adjust. * gcc.dg/tree-ssa/pr17141-1.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-13.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-14.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-21.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-1.c: Likewise. * gcc.dg/tree-ssa/20030807-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-10.c: Likewise. * gcc.dg/tree-ssa/ssa-fre-1.c: Likewise. * gcc.dg/tree-ssa/pta-ptrarith-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-23.c: Likewise. * gcc.dg/tree-ssa/forwprop-1.c: Likewise. * gcc.dg/tree-ssa/forwprop-2.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-1.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-25.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-26.c: Likewise. * gcc.dg/tree-ssa/struct-aliasing-2.c: Likewise. * gcc.dg/tree-ssa/ssa-ccp-26.c: Likewise. * gcc.dg/tree-ssa/ssa-sccvn-4.c: Likewise. * gcc.dg/tree-ssa/ssa-pre-7.c: Likewise. * gcc.dg/tree-ssa/forwprop-5.c: Likewise. * gcc.dg/struct/w_prof_two_strs.c: XFAIL. * gcc.dg/struct/wo_prof_escape_arg_to_local.c: Likewise. * gcc.dg/struct/wo_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_malloc_size_var.c: Likewise. * gcc.dg/struct/w_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_str_init.c: Likewise. * gcc.dg/struct/wo_prof_array_through_pointer.c: Likewise. * gcc.dg/struct/w_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_array_field.c: Likewise. * gcc.dg/struct/wo_prof_single_str_local.c: Likewise. * gcc.dg/struct/w_prof_local_var.c: Likewise. * gcc.dg/struct/wo_prof_two_strs.c: Likewise. * gcc.dg/struct/wo_prof_empty_str.c: Likewise. * gcc.dg/struct/wo_prof_local_array.c: Likewise. * gcc.dg/struct/w_prof_global_var.c: Likewise. * gcc.dg/struct/wo_prof_single_str_global.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_value.c: Likewise. * gcc.dg/struct/wo_prof_global_array.c: Likewise. * gcc.dg/struct/wo_prof_escape_return.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_array.c: Likewise. * gcc.dg/struct/wo_prof_double_malloc.c: Likewise. * gcc.dg/struct/w_ratio_cold_str.c: Likewise. * gcc.dg/struct/wo_prof_escape_substr_pointer.c: Likewise. * gcc.dg/struct/wo_prof_local_var.c: Likewise. * gcc.dg/tree-prof/stringop-1.c: Adjust. * g++.dg/tree-ssa/pr31146.C: Likewise. * g++.dg/tree-ssa/copyprop-1.C: Likewise. * g++.dg/tree-ssa/pr33604.C: Likewise. * g++.dg/plugin/selfassign.c: Likewise. * gfortran.dg/array_memcpy_3.f90: Likewise. * gfortran.dg/array_memcpy_4.f90: Likewise. * c-c++-common/torture/pr42834.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161655 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 206 ++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 152 insertions(+), 54 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 866ce6eb2b7..2ea2e685b9d 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1204,6 +1204,12 @@ useless_type_conversion_p (tree outer_type, tree inner_type) != TYPE_ADDR_SPACE (TREE_TYPE (inner_type))) return false; + /* Do not lose casts to restrict qualified pointers. */ + if ((TYPE_RESTRICT (outer_type) + != TYPE_RESTRICT (inner_type)) + && TYPE_RESTRICT (outer_type)) + return false; + /* If the outer type is (void *) or a pointer to an incomplete record type or a pointer to an unprototyped function, then the conversion is not necessary. */ @@ -1216,12 +1222,6 @@ useless_type_conversion_p (tree outer_type, tree inner_type) && useless_type_conversion_p (TREE_TYPE (TREE_TYPE (outer_type)), TREE_TYPE (TREE_TYPE (inner_type))))) return true; - - /* Do not lose casts to restrict qualified pointers. */ - if ((TYPE_RESTRICT (outer_type) - != TYPE_RESTRICT (inner_type)) - && TYPE_RESTRICT (outer_type)) - return false; } /* From now on qualifiers on value types do not matter. */ @@ -1273,41 +1273,18 @@ useless_type_conversion_p (tree outer_type, tree inner_type) else if (POINTER_TYPE_P (inner_type) && POINTER_TYPE_P (outer_type)) { - /* Don't lose casts between pointers to volatile and non-volatile - qualified types. Doing so would result in changing the semantics - of later accesses. For function types the volatile qualifier - is used to indicate noreturn functions. */ - if (TREE_CODE (TREE_TYPE (outer_type)) != FUNCTION_TYPE - && TREE_CODE (TREE_TYPE (outer_type)) != METHOD_TYPE - && TREE_CODE (TREE_TYPE (inner_type)) != FUNCTION_TYPE - && TREE_CODE (TREE_TYPE (inner_type)) != METHOD_TYPE - && (TYPE_VOLATILE (TREE_TYPE (outer_type)) - != TYPE_VOLATILE (TREE_TYPE (inner_type))) - && TYPE_VOLATILE (TREE_TYPE (outer_type))) - return false; - - /* We require explicit conversions from incomplete target types. */ - if (!COMPLETE_TYPE_P (TREE_TYPE (inner_type)) - && COMPLETE_TYPE_P (TREE_TYPE (outer_type))) - return false; - - /* Do not lose casts between pointers that when dereferenced access - memory with different alias sets. */ - if (get_deref_alias_set (inner_type) != get_deref_alias_set (outer_type)) + /* Do not lose casts to function pointer types. */ + if ((TREE_CODE (TREE_TYPE (outer_type)) == FUNCTION_TYPE + || TREE_CODE (TREE_TYPE (outer_type)) == METHOD_TYPE) + && !useless_type_conversion_p (TREE_TYPE (outer_type), + TREE_TYPE (inner_type))) return false; /* We do not care for const qualification of the pointed-to types as const qualification has no semantic value to the middle-end. */ - /* Otherwise pointers/references are equivalent if their pointed - to types are effectively the same. We can strip qualifiers - on pointed-to types for further comparison, which is done in - the callee. Note we have to use true compatibility here - because addresses are subject to propagation into dereferences - and thus might get the original type exposed which is equivalent - to a reverse conversion. */ - return types_compatible_p (TREE_TYPE (outer_type), - TREE_TYPE (inner_type)); + /* Otherwise pointers/references are equivalent. */ + return true; } /* Recurse for complex types. */ @@ -1673,8 +1650,9 @@ warn_uninitialized_var (tree *tp, int *walk_subtrees, void *data_) /* We do not care about LHS. */ if (wi->is_lhs) { - /* Except for operands of INDIRECT_REF. */ - if (!INDIRECT_REF_P (t)) + /* Except for operands of dereferences. */ + if (!INDIRECT_REF_P (t) + && TREE_CODE (t) != MEM_REF) return NULL_TREE; t = TREE_OPERAND (t, 0); } @@ -1822,6 +1800,34 @@ struct gimple_opt_pass pass_early_warn_uninitialized = } }; + +/* If necessary, rewrite the base of the reference tree *TP from + a MEM_REF to a plain or converted symbol. */ + +static void +maybe_rewrite_mem_ref_base (tree *tp) +{ + tree sym; + + while (handled_component_p (*tp)) + tp = &TREE_OPERAND (*tp, 0); + if (TREE_CODE (*tp) == MEM_REF + && TREE_CODE (TREE_OPERAND (*tp, 0)) == ADDR_EXPR + && integer_zerop (TREE_OPERAND (*tp, 1)) + && (sym = TREE_OPERAND (TREE_OPERAND (*tp, 0), 0)) + && DECL_P (sym) + && !TREE_ADDRESSABLE (sym) + && symbol_marked_for_renaming (sym)) + { + if (!useless_type_conversion_p (TREE_TYPE (*tp), + TREE_TYPE (sym))) + *tp = build1 (VIEW_CONVERT_EXPR, + TREE_TYPE (*tp), sym); + else + *tp = sym; + } +} + /* Compute TREE_ADDRESSABLE and DECL_GIMPLE_REG_P for local variables. */ void @@ -1853,17 +1859,50 @@ execute_update_addresses_taken (bool do_optimize) { tree lhs = gimple_get_lhs (stmt); - /* We may not rewrite TMR_SYMBOL to SSA. */ - if (lhs && TREE_CODE (lhs) == TARGET_MEM_REF - && TMR_SYMBOL (lhs)) - bitmap_set_bit (not_reg_needs, DECL_UID (TMR_SYMBOL (lhs))); + /* A plain decl does not need it set. */ + if (lhs && !DECL_P (lhs)) + { + if (handled_component_p (lhs)) + lhs = get_base_address (lhs); + + if (DECL_P (lhs)) + bitmap_set_bit (not_reg_needs, DECL_UID (lhs)); + else if (TREE_CODE (lhs) == MEM_REF + && TREE_CODE (TREE_OPERAND (lhs, 0)) == ADDR_EXPR) + { + tree decl = TREE_OPERAND (TREE_OPERAND (lhs, 0), 0); + if (DECL_P (decl) + && (!integer_zerop (TREE_OPERAND (lhs, 1)) + || (DECL_SIZE (decl) + != TYPE_SIZE (TREE_TYPE (lhs))))) + bitmap_set_bit (not_reg_needs, DECL_UID (decl)); + } + } + } + + if (gimple_assign_single_p (stmt)) + { + tree rhs = gimple_assign_rhs1 (stmt); /* A plain decl does not need it set. */ - else if (lhs && handled_component_p (lhs)) - { - var = get_base_address (lhs); - if (DECL_P (var)) - bitmap_set_bit (not_reg_needs, DECL_UID (var)); + if (!DECL_P (rhs)) + { + tree base = rhs; + while (handled_component_p (base)) + base = TREE_OPERAND (base, 0); + + /* But watch out for MEM_REFs we cannot lower to a + VIEW_CONVERT_EXPR. */ + if (TREE_CODE (base) == MEM_REF + && TREE_CODE (TREE_OPERAND (base, 0)) == ADDR_EXPR) + { + tree decl = TREE_OPERAND (TREE_OPERAND (base, 0), 0); + if (DECL_P (decl) + && (!integer_zerop (TREE_OPERAND (base, 1)) + || (DECL_SIZE (decl) + != TYPE_SIZE (TREE_TYPE (base))))) + bitmap_set_bit (not_reg_needs, DECL_UID (decl)); + } } } } @@ -1937,14 +1976,73 @@ execute_update_addresses_taken (bool do_optimize) if (update_vops) { FOR_EACH_BB (bb) - for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) - { - gimple stmt = gsi_stmt (gsi); + for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) + { + gimple stmt = gsi_stmt (gsi); - if (gimple_references_memory_p (stmt) - || is_gimple_debug (stmt)) - update_stmt (stmt); - } + /* Re-write TARGET_MEM_REFs of symbols we want to + rewrite into SSA form. */ + if (gimple_assign_single_p (stmt)) + { + tree lhs = gimple_assign_lhs (stmt); + tree rhs, *rhsp = gimple_assign_rhs1_ptr (stmt); + tree sym; + + /* We shouldn't have any fancy wrapping of + component-refs on the LHS, but look through + VIEW_CONVERT_EXPRs as that is easy. */ + while (TREE_CODE (lhs) == VIEW_CONVERT_EXPR) + lhs = TREE_OPERAND (lhs, 0); + if (TREE_CODE (lhs) == MEM_REF + && TREE_CODE (TREE_OPERAND (lhs, 0)) == ADDR_EXPR + && integer_zerop (TREE_OPERAND (lhs, 1)) + && (sym = TREE_OPERAND (TREE_OPERAND (lhs, 0), 0)) + && DECL_P (sym) + && !TREE_ADDRESSABLE (sym) + && symbol_marked_for_renaming (sym)) + lhs = sym; + else + lhs = gimple_assign_lhs (stmt); + + /* Rewrite the RHS and make sure the resulting assignment + is validly typed. */ + maybe_rewrite_mem_ref_base (rhsp); + rhs = gimple_assign_rhs1 (stmt); + if (gimple_assign_lhs (stmt) != lhs + && !useless_type_conversion_p (TREE_TYPE (lhs), + TREE_TYPE (rhs))) + rhs = fold_build1 (VIEW_CONVERT_EXPR, + TREE_TYPE (lhs), rhs); + + if (gimple_assign_lhs (stmt) != lhs) + gimple_assign_set_lhs (stmt, lhs); + + if (gimple_assign_rhs1 (stmt) != rhs) + { + gimple_stmt_iterator gsi = gsi_for_stmt (stmt); + gimple_assign_set_rhs_from_tree (&gsi, rhs); + } + } + + if (gimple_code (stmt) == GIMPLE_ASM) + { + unsigned i; + for (i = 0; i < gimple_asm_noutputs (stmt); ++i) + { + tree link = gimple_asm_output_op (stmt, i); + maybe_rewrite_mem_ref_base (&TREE_VALUE (link)); + } + for (i = 0; i < gimple_asm_ninputs (stmt); ++i) + { + tree link = gimple_asm_input_op (stmt, i); + maybe_rewrite_mem_ref_base (&TREE_VALUE (link)); + } + } + + if (gimple_references_memory_p (stmt) + || is_gimple_debug (stmt)) + update_stmt (stmt); + } /* Update SSA form here, we are called as non-pass as well. */ update_ssa (TODO_update_ssa); -- cgit v1.2.1 From 524a05313c645ed67701d7de7837bc5fa65d3104 Mon Sep 17 00:00:00 2001 From: hubicka Date: Wed, 7 Jul 2010 01:00:42 +0000 Subject: PR middle-end/44813 * tree-ssa-uninit.c (ssa_undefined_value_p): Result decl is defined for functions passed by reference. * tree.c (needs_to_live_in_memory): RESULT_DECL don't need to live in memory when passed by reference. * tree-ssa-ccp.c (get_default_value): Only VAR_DECL is undefined at beggining. * ipa-split.c (split_function): Cleanup way return value is passed; handle SSA DECL_BY_REFERENCE retvals. * tree-ssa.c (verify_def): Verify that RESULT_DECL is read only when DECL_BY_REFERENCE is set. * tree-ssa-structalias.c (get_constraint_for_ssa_var, get_fi_for_callee, find_what_p_points_to): Handle RESULT_DECL. * tree-inline.c (declare_return_variable): Get new entry_block argument; when passing by reference ensure that RESULT_DECL is gimple_val. (remap_gimple_op_r): Remap RESULT_DECL ssa name. (remap_gimple_stmt): Handle SSA DECL_BY_REFERENCE returns. * g++.dg/torture/pr44813.C: New testcase. * g++.dg/torture/pr44826.C: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161898 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 2ea2e685b9d..f3a7a103ea9 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -638,6 +638,13 @@ verify_def (basic_block bb, basic_block *definition_block, tree ssa_name, if (verify_ssa_name (ssa_name, is_virtual)) goto err; + if (TREE_CODE (SSA_NAME_VAR (ssa_name)) == RESULT_DECL + && DECL_BY_REFERENCE (SSA_NAME_VAR (ssa_name))) + { + error ("RESULT_DECL should be read only when DECL_BY_REFERENCE is set."); + goto err; + } + if (definition_block[SSA_NAME_VERSION (ssa_name)]) { error ("SSA_NAME created in two different blocks %i and %i", -- cgit v1.2.1 From 0b205f4ca112a643f4f1b9c9886648b569e0b380 Mon Sep 17 00:00:00 2001 From: manu Date: Thu, 8 Jul 2010 04:22:54 +0000 Subject: =?UTF-8?q?2010-07-08=20=20Manuel=20L=C3=B3pez-Ib=C3=A1=C3=B1ez=20?= =?UTF-8?q?=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * toplev.h: Do not include diagnostic-core.h. Include diagnostic-core.h in every file that includes toplev.h. * c-tree.h: Do not include toplev.h. * pretty-print.h: Update comment. * Makefile.in: Update dependencies. * alias.c: Include diagnostic-core.h in every file that includes toplev.h. * attribs.c: Likewise. * auto-inc-dec.c: Likewise. * bb-reorder.c: Likewise. * bt-load.c: Likewise. * caller-save.c: Likewise. * calls.c: Likewise. * cfg.c: Likewise. * cfganal.c: Likewise. * cfgbuild.c: Likewise. * cfgcleanup.c: Likewise. * cfghooks.c: Likewise. * cfgloop.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arc/arc.c: Likewise. * config/arm/arm.c: Likewise. * config/arm/pe.c: Likewise. * config/avr/avr.c: Likewise. * config/bfin/bfin.c: Likewise. * config/cris/cris.c: Likewise. * config/crx/crx.c: Likewise. * config/darwin-c.c: Likewise. * config/darwin.c: Likewise. * config/fr30/fr30.c: Likewise. * config/frv/frv.c: Likewise. * config/h8300/h8300.c: Likewise. * config/host-darwin.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/netware.c: Likewise. * config/i386/nwld.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/i386/winnt-stubs.c: Likewise. * config/i386/winnt.c: Likewise. * config/ia64/ia64-c.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/lm32/lm32.c: Likewise. * config/m32c/m32c-pragma.c: Likewise. * config/m32c/m32c.c: Likewise. * config/m32r/m32r.c: Likewise. * config/m68hc11/m68hc11.c: Likewise. * config/m68k/m68k.c: Likewise. * config/mcore/mcore.c: Likewise. * config/mep/mep-pragma.c: Likewise. * config/mep/mep.c: Likewise. * config/mmix/mmix.c: Likewise. * config/mn10300/mn10300.c: Likewise. * config/moxie/moxie.c: Likewise. * config/pa/pa.c: Likewise. * config/pdp11/pdp11.c: Likewise. * config/picochip/picochip.c: Likewise. * config/rs6000/rs6000-c.c: Likewise. * config/rs6000/rs6000.c: Likewise. * config/rx/rx.c: Likewise. * config/s390/s390.c: Likewise. * config/score/score.c: Likewise. * config/score/score3.c: Likewise. * config/score/score7.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-base.c: Likewise. * config/sh/symbian-c.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sol2-c.c: Likewise. * config/sol2.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/v850/v850-c.c: Likewise. * config/v850/v850.c: Likewise. * config/vax/vax.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * convert.c: Likewise. * cse.c: Likewise. * cselib.c: Likewise. * dbgcnt.c: Likewise. * dbxout.c: Likewise. * ddg.c: Likewise. * dominance.c: Likewise. * emit-rtl.c: Likewise. * explow.c: Likewise. * expmed.c: Likewise. * fixed-value.c: Likewise. * fold-const.c: Likewise. * fwprop.c: Likewise. * gcse.c: Likewise. * ggc-common.c: Likewise. * ggc-page.c: Likewise. * ggc-zone.c: Likewise. * gimple-low.c: Likewise. * gimplify.c: Likewise. * graph.c: Likewise. * haifa-sched.c: Likewise. * ifcvt.c: Likewise. * implicit-zee.c: Likewise. * integrate.c: Likewise. * ira-build.c: Likewise. * ira-color.c: Likewise. * ira-conflicts.c: Likewise. * ira-costs.c: Likewise. * ira-lives.c: Likewise. * ira.c: Likewise. * lists.c: Likewise. * loop-doloop.c: Likewise. * loop-iv.c: Likewise. * lto-opts.c: Likewise. * lto-symtab.c: Likewise. * main.c: Likewise. * modulo-sched.c: Likewise. * optabs.c: Likewise. * params.c: Likewise. * plugin.c: Likewise. * postreload-gcse.c: Likewise. * postreload.c: Likewise. * predict.c: Likewise. * profile.c: Likewise. * real.c: Likewise. * regcprop.c: Likewise. * reginfo.c: Likewise. * regmove.c: Likewise. * reorg.c: Likewise. * resource.c: Likewise. * rtl.c: Likewise. * rtlanal.c: Likewise. * sched-deps.c: Likewise. * sched-ebb.c: Likewise. * sched-rgn.c: Likewise. * sdbout.c: Likewise. * sel-sched-dump.c: Likewise. * sel-sched-ir.c: Likewise. * simplify-rtx.c: Likewise. * stmt.c: Likewise. * stor-layout.c: Likewise. * store-motion.c: Likewise. * targhooks.c: Likewise. * tree-cfg.c: Likewise. * tree-cfgcleanup.c: Likewise. * tree-dump.c: Likewise. * tree-eh.c: Likewise. * tree-inline.c: Likewise. * tree-nomudflap.c: Likewise. * tree-object-size.c: Likewise. * tree-optimize.c: Likewise. * tree-outof-ssa.c: Likewise. * tree-phinodes.c: Likewise. * tree-profile.c: Likewise. * tree-ssa-ccp.c: Likewise. * tree-ssa-coalesce.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-loop-prefetch.c: Likewise. * tree-ssa-loop.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-ssa-uninit.c: Likewise. * tree-ssa.c: Likewise. * tree-vect-data-refs.c: Likewise. * tree-vect-loop-manip.c: Likewise. * tree-vect-loop.c: Likewise. * tree-vect-patterns.c: Likewise. * tree-vect-stmts.c: Likewise. * tree-vrp.c: Likewise. * varasm.c: Likewise. * vec.c: Likewise. * web.c: Likewise. * xcoffout.c: Likewise. c-family/ * c-common.h: Include diagnostic-core.h. Error if already included. * c-semantics.c: Do not define GCC_DIAG_STYLE here. cp/ * cp-tree.h: Do not include toplev.h. java/ * boehm.c: Include diagnostic-core.h in every file that includes toplev.h. * class.c: Likewise. * constants.c: Likewise. * decl.c: Likewise. * except.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * mangle.c: Likewise. * mangle_name.c: Likewise. * resource.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. ada/ * gcc-interface/utils.c: Include diagnostic-core.h in every file that includes toplev.h. lto/ * lto-coff.c: Include diagnostic-core.h in every file that includes toplev.h. * lto-elf.c: Likewise. * lto-lang.c: Likewise. * lto-macho.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161943 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index f3a7a103ea9..94b3561343a 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -42,7 +42,7 @@ along with GCC; see the file COPYING3. If not see #include "hashtab.h" #include "tree-dump.h" #include "tree-pass.h" -#include "toplev.h" +#include "diagnostic-core.h" /* Pointer map of variable mappings, keyed by edge. */ static struct pointer_map_t *edge_var_maps; -- cgit v1.2.1 From cfe3cae32d819232826fded4bab11bca6d79c943 Mon Sep 17 00:00:00 2001 From: rguenth Date: Tue, 20 Jul 2010 11:28:56 +0000 Subject: 2010-07-20 Richard Guenther PR middle-end/44971 PR middle-end/44988 * tree-ssa.c (maybe_optimize_var): New function split out from ... (execute_update_addresses_taken): ... here. (non_rewritable_mem_ref_base): Likewise. (execute_update_addresses_taken): Do not iterate over all referenced vars but just all local decls and parms. Properly check call and asm arguments and rewrite call arguments. * gcc.dg/pr44971.c: New testcase. * gcc.c-torture/compile/pr44988.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162329 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 206 +++++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 140 insertions(+), 66 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 94b3561343a..bba49ffeaf5 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1835,18 +1835,103 @@ maybe_rewrite_mem_ref_base (tree *tp) } } +/* For a tree REF return its base if it is the base of a MEM_REF + that cannot be rewritten into SSA form. Otherwise return NULL_TREE. */ + +static tree +non_rewritable_mem_ref_base (tree ref) +{ + tree base = ref; + + /* A plain decl does not need it set. */ + if (DECL_P (ref)) + return NULL_TREE; + + while (handled_component_p (base)) + base = TREE_OPERAND (base, 0); + + /* But watch out for MEM_REFs we cannot lower to a + VIEW_CONVERT_EXPR. */ + if (TREE_CODE (base) == MEM_REF + && TREE_CODE (TREE_OPERAND (base, 0)) == ADDR_EXPR) + { + tree decl = TREE_OPERAND (TREE_OPERAND (base, 0), 0); + if (DECL_P (decl) + && (!integer_zerop (TREE_OPERAND (base, 1)) + || (DECL_SIZE (decl) + != TYPE_SIZE (TREE_TYPE (base))))) + return decl; + } + + return NULL_TREE; +} + +/* When possible, clear ADDRESSABLE bit or set the REGISTER bit + and mark the variable VAR for conversion into SSA. Returns true + when updating stmts is required. */ + +static bool +maybe_optimize_var (tree var, bitmap addresses_taken, bitmap not_reg_needs) +{ + bool update_vops = false; + + /* Global Variables, result decls cannot be changed. */ + if (is_global_var (var) + || TREE_CODE (var) == RESULT_DECL + || bitmap_bit_p (addresses_taken, DECL_UID (var))) + return false; + + if (TREE_ADDRESSABLE (var) + /* Do not change TREE_ADDRESSABLE if we need to preserve var as + a non-register. Otherwise we are confused and forget to + add virtual operands for it. */ + && (!is_gimple_reg_type (TREE_TYPE (var)) + || !bitmap_bit_p (not_reg_needs, DECL_UID (var)))) + { + TREE_ADDRESSABLE (var) = 0; + if (is_gimple_reg (var)) + mark_sym_for_renaming (var); + update_vops = true; + if (dump_file) + { + fprintf (dump_file, "No longer having address taken "); + print_generic_expr (dump_file, var, 0); + fprintf (dump_file, "\n"); + } + } + if (!DECL_GIMPLE_REG_P (var) + && !bitmap_bit_p (not_reg_needs, DECL_UID (var)) + && (TREE_CODE (TREE_TYPE (var)) == COMPLEX_TYPE + || TREE_CODE (TREE_TYPE (var)) == VECTOR_TYPE) + && !TREE_THIS_VOLATILE (var) + && (TREE_CODE (var) != VAR_DECL || !DECL_HARD_REGISTER (var))) + { + DECL_GIMPLE_REG_P (var) = 1; + mark_sym_for_renaming (var); + update_vops = true; + if (dump_file) + { + fprintf (dump_file, "Decl is now a gimple register "); + print_generic_expr (dump_file, var, 0); + fprintf (dump_file, "\n"); + } + } + + return update_vops; +} + /* Compute TREE_ADDRESSABLE and DECL_GIMPLE_REG_P for local variables. */ void execute_update_addresses_taken (bool do_optimize) { tree var; - referenced_var_iterator rvi; gimple_stmt_iterator gsi; basic_block bb; bitmap addresses_taken = BITMAP_ALLOC (NULL); bitmap not_reg_needs = BITMAP_ALLOC (NULL); bool update_vops = false; + unsigned i; /* Collect into ADDRESSES_TAKEN all variables whose address is taken within the function body. */ @@ -1856,6 +1941,7 @@ execute_update_addresses_taken (bool do_optimize) { gimple stmt = gsi_stmt (gsi); enum gimple_code code = gimple_code (stmt); + tree decl; /* Note all addresses taken by the stmt. */ gimple_ior_addresses_taken (addresses_taken, stmt); @@ -1877,7 +1963,7 @@ execute_update_addresses_taken (bool do_optimize) else if (TREE_CODE (lhs) == MEM_REF && TREE_CODE (TREE_OPERAND (lhs, 0)) == ADDR_EXPR) { - tree decl = TREE_OPERAND (TREE_OPERAND (lhs, 0), 0); + decl = TREE_OPERAND (TREE_OPERAND (lhs, 0), 0); if (DECL_P (decl) && (!integer_zerop (TREE_OPERAND (lhs, 1)) || (DECL_SIZE (decl) @@ -1890,27 +1976,34 @@ execute_update_addresses_taken (bool do_optimize) if (gimple_assign_single_p (stmt)) { tree rhs = gimple_assign_rhs1 (stmt); + if ((decl = non_rewritable_mem_ref_base (rhs))) + bitmap_set_bit (not_reg_needs, DECL_UID (decl)); + } - /* A plain decl does not need it set. */ - if (!DECL_P (rhs)) + else if (code == GIMPLE_CALL) + { + for (i = 0; i < gimple_call_num_args (stmt); ++i) { - tree base = rhs; - while (handled_component_p (base)) - base = TREE_OPERAND (base, 0); - - /* But watch out for MEM_REFs we cannot lower to a - VIEW_CONVERT_EXPR. */ - if (TREE_CODE (base) == MEM_REF - && TREE_CODE (TREE_OPERAND (base, 0)) == ADDR_EXPR) - { - tree decl = TREE_OPERAND (TREE_OPERAND (base, 0), 0); - if (DECL_P (decl) - && (!integer_zerop (TREE_OPERAND (base, 1)) - || (DECL_SIZE (decl) - != TYPE_SIZE (TREE_TYPE (base))))) - bitmap_set_bit (not_reg_needs, DECL_UID (decl)); - } - } + tree arg = gimple_call_arg (stmt, i); + if ((decl = non_rewritable_mem_ref_base (arg))) + bitmap_set_bit (not_reg_needs, DECL_UID (decl)); + } + } + + else if (code == GIMPLE_ASM) + { + for (i = 0; i < gimple_asm_noutputs (stmt); ++i) + { + tree link = gimple_asm_output_op (stmt, i); + if ((decl = non_rewritable_mem_ref_base (TREE_VALUE (link)))) + bitmap_set_bit (not_reg_needs, DECL_UID (decl)); + } + for (i = 0; i < gimple_asm_ninputs (stmt); ++i) + { + tree link = gimple_asm_input_op (stmt, i); + if ((decl = non_rewritable_mem_ref_base (TREE_VALUE (link)))) + bitmap_set_bit (not_reg_needs, DECL_UID (decl)); + } } } @@ -1933,50 +2026,21 @@ execute_update_addresses_taken (bool do_optimize) /* When possible, clear ADDRESSABLE bit or set the REGISTER bit and mark variable for conversion into SSA. */ if (optimize && do_optimize) - FOR_EACH_REFERENCED_VAR (var, rvi) - { - /* Global Variables, result decls cannot be changed. */ - if (is_global_var (var) - || TREE_CODE (var) == RESULT_DECL - || bitmap_bit_p (addresses_taken, DECL_UID (var))) - continue; - - if (TREE_ADDRESSABLE (var) - /* Do not change TREE_ADDRESSABLE if we need to preserve var as - a non-register. Otherwise we are confused and forget to - add virtual operands for it. */ - && (!is_gimple_reg_type (TREE_TYPE (var)) - || !bitmap_bit_p (not_reg_needs, DECL_UID (var)))) - { - TREE_ADDRESSABLE (var) = 0; - if (is_gimple_reg (var)) - mark_sym_for_renaming (var); - update_vops = true; - if (dump_file) - { - fprintf (dump_file, "No longer having address taken "); - print_generic_expr (dump_file, var, 0); - fprintf (dump_file, "\n"); - } - } - if (!DECL_GIMPLE_REG_P (var) - && !bitmap_bit_p (not_reg_needs, DECL_UID (var)) - && (TREE_CODE (TREE_TYPE (var)) == COMPLEX_TYPE - || TREE_CODE (TREE_TYPE (var)) == VECTOR_TYPE) - && !TREE_THIS_VOLATILE (var) - && (TREE_CODE (var) != VAR_DECL || !DECL_HARD_REGISTER (var))) - { - DECL_GIMPLE_REG_P (var) = 1; - mark_sym_for_renaming (var); - update_vops = true; - if (dump_file) - { - fprintf (dump_file, "Decl is now a gimple register "); - print_generic_expr (dump_file, var, 0); - fprintf (dump_file, "\n"); - } - } - } + { + /* We cannot iterate over all referenced vars as that can contain + unused vars from BLOCK trees which cause code generation + differences for -g vs. -g0. */ + for (var = DECL_ARGUMENTS (cfun->decl); var; var = DECL_CHAIN (var)) + { + /* ??? Not all arguments are in referenced vars. */ + if (!var_ann (var)) + continue; + update_vops + |= maybe_optimize_var (var, addresses_taken, not_reg_needs); + } + for (i = 0; VEC_iterate (tree, cfun->local_decls, i, var); ++i) + update_vops |= maybe_optimize_var (var, addresses_taken, not_reg_needs); + } /* Operand caches needs to be recomputed for operands referencing the updated variables. */ @@ -2031,7 +2095,17 @@ execute_update_addresses_taken (bool do_optimize) } } - if (gimple_code (stmt) == GIMPLE_ASM) + else if (gimple_code (stmt) == GIMPLE_CALL) + { + unsigned i; + for (i = 0; i < gimple_call_num_args (stmt); ++i) + { + tree *argp = gimple_call_arg_ptr (stmt, i); + maybe_rewrite_mem_ref_base (argp); + } + } + + else if (gimple_code (stmt) == GIMPLE_ASM) { unsigned i; for (i = 0; i < gimple_asm_noutputs (stmt); ++i) -- cgit v1.2.1 From 003c7ce58f3ba2b5d755bcbe64b7218e4f17e31b Mon Sep 17 00:00:00 2001 From: rguenth Date: Tue, 20 Jul 2010 12:05:59 +0000 Subject: 2010-07-20 Richard Guenther * lto-symtab.c (lto_symtab_merge): Use gimple_types_compatible_p. (lto_symtab_merge_decls_2): Likewise. * gimple.h (gimple_types_compatible_p): Declare. * gimple.c (gimple_queue_type_fixup): Remove. (gimple_fixup_complete_and_incomplete_subtype_p): Likewise. (gimple_compatible_complete_and_incomplete_type_p): New function. (gimple_types_compatible_p): Adjust. (gimple_register_type): Remove type fixup code. (print_gimple_types_stats): Adjust. (free_gimple_type_tables): Likewise. * lto-streamer-in.c (input_gimple_stmt): Use gimple_types_compatible_p. * tree-ssa.c (useless_type_conversion_p): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162330 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index bba49ffeaf5..d4c519fdfe2 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1426,7 +1426,7 @@ useless_type_conversion_p (tree outer_type, tree inner_type) compared types. */ else if (AGGREGATE_TYPE_P (inner_type) && TREE_CODE (inner_type) == TREE_CODE (outer_type)) - return false; + return gimple_types_compatible_p (outer_type, inner_type, false); return false; } -- cgit v1.2.1 From 11bbec1341e4d8a1ddfc7e5f81e1ef251dd3cff4 Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 21 Jul 2010 09:46:11 +0000 Subject: 2010-07-21 Richard Guenther * tree-flow.h (referenced_var): Move define ... * tree-flow-inline.h (referenced_var): ... here as an inline function. Assert here ... * tree-dfa.c (referenced_var_lookup): ... instead of here. * tree-ssa.c (maybe_optimize_var): Check if the variable is in referenced vars. (execute_update_addresses_taken): Remove old broken check. * gimple-pretty-print.c (pp_points_to_solution): Use referenced_var_lookup. * tree-into-ssa.c (dump_decl_set): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162368 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index d4c519fdfe2..0be459118e5 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1881,6 +1881,11 @@ maybe_optimize_var (tree var, bitmap addresses_taken, bitmap not_reg_needs) || bitmap_bit_p (addresses_taken, DECL_UID (var))) return false; + /* If the variable is not in the list of referenced vars then we + do not need to touch it nor can we rename it. */ + if (!referenced_var_lookup (DECL_UID (var))) + return false; + if (TREE_ADDRESSABLE (var) /* Do not change TREE_ADDRESSABLE if we need to preserve var as a non-register. Otherwise we are confused and forget to @@ -2031,13 +2036,7 @@ execute_update_addresses_taken (bool do_optimize) unused vars from BLOCK trees which cause code generation differences for -g vs. -g0. */ for (var = DECL_ARGUMENTS (cfun->decl); var; var = DECL_CHAIN (var)) - { - /* ??? Not all arguments are in referenced vars. */ - if (!var_ann (var)) - continue; - update_vops - |= maybe_optimize_var (var, addresses_taken, not_reg_needs); - } + update_vops |= maybe_optimize_var (var, addresses_taken, not_reg_needs); for (i = 0; VEC_iterate (tree, cfun->local_decls, i, var); ++i) update_vops |= maybe_optimize_var (var, addresses_taken, not_reg_needs); } -- cgit v1.2.1 From b858a81abac92c4d3d7f6c1c5c233da22a0f59d7 Mon Sep 17 00:00:00 2001 From: rguenth Date: Wed, 21 Jul 2010 11:45:27 +0000 Subject: 2010-07-21 Richard Guenther PR middle-end/45013 * tree-ssa.c (useless_type_conversion_p): Dispatch to gimple_types_compatible_p only when in lto. * gimple.c (gimple_types_compatible_p): Use canonical types to speed up comparison. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162371 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index 0be459118e5..ba28c64fc83 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1426,7 +1426,8 @@ useless_type_conversion_p (tree outer_type, tree inner_type) compared types. */ else if (AGGREGATE_TYPE_P (inner_type) && TREE_CODE (inner_type) == TREE_CODE (outer_type)) - return gimple_types_compatible_p (outer_type, inner_type, false); + return (in_lto_p + && gimple_types_compatible_p (outer_type, inner_type, false)); return false; } -- cgit v1.2.1 From 8e3b5e90c9521674dbc02422831fbdc08673d034 Mon Sep 17 00:00:00 2001 From: bernds Date: Wed, 21 Jul 2010 12:36:44 +0000 Subject: PR middle-end/44738 * tree-ssa.c (warn_uninit): Avoid emitting an unnecessary message. PR middle-end/44738 * c-c++-common/uninit-17.c: Correct expected error. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162372 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index ba28c64fc83..c31b0d1ce08 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1632,6 +1632,8 @@ warn_uninit (tree t, const char *gmsgid, void *data) { TREE_NO_WARNING (var) = 1; + if (location == DECL_SOURCE_LOCATION (var)) + return; if (xloc.file != floc.file || xloc.line < floc.line || xloc.line > LOCATION_LINE (cfun->function_end_locus)) -- cgit v1.2.1 From a9b8ddbe56eac92f5a4620418f3070266ff08d34 Mon Sep 17 00:00:00 2001 From: rguenth Date: Fri, 23 Jul 2010 14:01:49 +0000 Subject: 2010-07-23 Richard Guenther * lto-symtab.c (lto_symtab_merge): Use gtc_mode enum values. (lto_symtab_merge_decls_2): Likewise. * tree-ssa.c (useless_type_conversion_p): Likewise. * lto-streamer-in.c (input_gimple_stmt): Likewise. * gimple.c (gtc_visited2, gtc_ob2): Remove. (struct type_pair_d): Make same_p an array indexed by mode. Update comment. (lookup_type_pair): Update initialization. (struct sccs): Adjust same_p type. (gimple_types_compatible_p_1, gtc_visit, gimple_types_compatible_p): Adjust. (print_gimple_types_stats): Likewise. * gimple.h (enum gtc_mode): New. (gimple_types_compatible_p): Adjust prototype. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162461 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/tree-ssa.c') diff --git a/gcc/tree-ssa.c b/gcc/tree-ssa.c index c31b0d1ce08..687c6393aaa 100644 --- a/gcc/tree-ssa.c +++ b/gcc/tree-ssa.c @@ -1427,7 +1427,7 @@ useless_type_conversion_p (tree outer_type, tree inner_type) else if (AGGREGATE_TYPE_P (inner_type) && TREE_CODE (inner_type) == TREE_CODE (outer_type)) return (in_lto_p - && gimple_types_compatible_p (outer_type, inner_type, false)); + && gimple_types_compatible_p (outer_type, inner_type, GTC_DIAG)); return false; } -- cgit v1.2.1