From 8115f0afdaff380da01d555b0584cd0fceb789b8 Mon Sep 17 00:00:00 2001 From: rguenth Date: Mon, 29 Jun 2009 12:20:39 +0000 Subject: 2009-06-29 Richard Guenther PR middle-end/38212 * alias.c (find_base_decl): Remove. (get_deref_alias_set_1): Remove restrict handling. * c-common.c (c_apply_type_quals_to_decl): Do not set DECL_POINTER_ALIAS_SET. * gimplify.c (find_single_pointer_decl_1): Remove. (find_single_pointer_decl): Likewise. (internal_get_tmp_var): Remove restrict handling. (gimple_regimplify_operands): Likewise. * omp-low.c (expand_omp_atomic_pipeline): Do not set DECL_POINTER_ALIAS_SET. Use ref-all pointers. * print-tree.c (print_node): Do not print DECL_POINTER_ALIAS_SET. * tree.c (restrict_base_for_decl): Remove. (init_ttree): Do not allocate it. (make_node_stat): Do not set DECL_POINTER_ALIAS_SET. Set LABEL_DECL_UID for label decls. (copy_node_stat): Do not copy restrict information. (decl_restrict_base_lookup): Remove. (decl_restrict_base_insert): Likewise. (print_restrict_base_statistics): Likewise. (dump_tree_statistics): Do not call print_restrict_base_statistics. * tree.h (DECL_POINTER_ALIAS_SET): Remove. (DECL_POINTER_ALIAS_SET_KNOWN_P): Likewise. (struct tree_decl_common): Rename pointer_alias_set to label_decl_uid. (LABEL_DECL_UID): Adjust. (DECL_BASED_ON_RESTRICT_P): Remove. (DECL_GET_RESTRICT_BASE): Likewise. (SET_DECL_RESTRICT_BASE): Likewise. (struct tree_decl_with_vis): Remove based_on_restrict_p flag. * config/i386/i386.c (ix86_gimplify_va_arg): Use ref-all pointers instead of DECL_POINTER_ALIAS_SET. * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Likewise. * config/s390/s390.c (s390_gimplify_va_arg): Likewise. * config/spu/spu.c (spu_gimplify_va_arg_expr): Likewise. * gcc.c-torture/execute/pr38212.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149047 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 83 +++------------------------------------------------------- 1 file changed, 4 insertions(+), 79 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 15005c379bd..33e5a2e8669 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -430,57 +430,6 @@ remove_suffix (char *name, int len) } } -/* Subroutine for find_single_pointer_decl. */ - -static tree -find_single_pointer_decl_1 (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED, - void *data) -{ - tree *pdecl = (tree *) data; - - /* We are only looking for pointers at the same level as the - original tree; we must not look through any indirections. - Returning anything other than NULL_TREE will cause the caller to - not find a base. */ - if (REFERENCE_CLASS_P (*tp)) - return *tp; - - if (DECL_P (*tp) && POINTER_TYPE_P (TREE_TYPE (*tp))) - { - if (*pdecl) - { - /* We already found a pointer decl; return anything other - than NULL_TREE to unwind from walk_tree signalling that - we have a duplicate. */ - return *tp; - } - *pdecl = *tp; - } - - return NULL_TREE; -} - -/* Find the single DECL of pointer type in the tree T, used directly - rather than via an indirection, and return it. If there are zero - or more than one such DECLs, return NULL. */ - -static tree -find_single_pointer_decl (tree t) -{ - tree decl = NULL_TREE; - - if (walk_tree (&t, find_single_pointer_decl_1, &decl, NULL)) - { - /* find_single_pointer_decl_1 returns a nonzero value, causing - walk_tree to return a nonzero value, to indicate that it - found more than one pointer DECL or that it found an - indirection. */ - return NULL_TREE; - } - - return decl; -} - /* Create a new temporary name with PREFIX. Returns an identifier. */ static GTY(()) unsigned int tmp_var_id_num; @@ -653,27 +602,10 @@ internal_get_tmp_var (tree val, gimple_seq *pre_p, gimple_seq *post_p, t = lookup_tmp_var (val, is_formal); - if (is_formal) - { - tree u = find_single_pointer_decl (val); - - if (u && TREE_CODE (u) == VAR_DECL && DECL_BASED_ON_RESTRICT_P (u)) - u = DECL_GET_RESTRICT_BASE (u); - if (u && TYPE_RESTRICT (TREE_TYPE (u))) - { - if (DECL_BASED_ON_RESTRICT_P (t)) - gcc_assert (u == DECL_GET_RESTRICT_BASE (t)); - else - { - DECL_BASED_ON_RESTRICT_P (t) = 1; - SET_DECL_RESTRICT_BASE (t, u); - } - } - - if (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE - || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE) - DECL_GIMPLE_REG_P (t) = 1; - } + if (is_formal + && (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE + || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE)) + DECL_GIMPLE_REG_P (t) = 1; mod = build2 (INIT_EXPR, TREE_TYPE (t), t, unshare_expr (val)); @@ -7766,13 +7698,6 @@ gimple_regimplify_operands (gimple stmt, gimple_stmt_iterator *gsi_p) DECL_GIMPLE_REG_P (temp) = 1; if (TREE_CODE (orig_lhs) == SSA_NAME) orig_lhs = SSA_NAME_VAR (orig_lhs); - if (TREE_CODE (orig_lhs) == VAR_DECL - && DECL_BASED_ON_RESTRICT_P (orig_lhs)) - { - DECL_BASED_ON_RESTRICT_P (temp) = 1; - SET_DECL_RESTRICT_BASE (temp, - DECL_GET_RESTRICT_BASE (orig_lhs)); - } if (gimple_in_ssa_p (cfun)) temp = make_ssa_name (temp, NULL); -- cgit v1.2.1 From 5fb6a9126a7c9e63e0330e2e089f5a6c664335a9 Mon Sep 17 00:00:00 2001 From: manu Date: Tue, 7 Jul 2009 02:10:19 +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 * c-lex.c: Replace %H by an explicit location. Update all calls. * c-common.c: Likewise. * c-decl.c: Likewise. * c-typeck.c: Likewise. * fold-const.c: Likewise. * gimplify.c: Likewise. * stmt.c: Likewise. * tree-cfg.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-vrp.c: Likewise. * value-prof.c: Likewise. java/ * jcf-parse.c: Replace %H by an explicit location. Update all calls. objc/ * objc-act.c: Replace %H by an explicit location. Update all calls. testsuite/ * gcc.dg/plugin/selfassign.c: Replace %H by an explicit location. Update all calls. * g++.dg/plugin/selfassign.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149310 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 33e5a2e8669..c5fb18569ba 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -5377,7 +5377,7 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code) case OMP_CLAUSE_DEFAULT_NONE: error ("%qE not specified in enclosing parallel", DECL_NAME (decl)); - error ("%Henclosing parallel", &ctx->location); + error_at (ctx->location, "enclosing parallel"); /* FALLTHRU */ case OMP_CLAUSE_DEFAULT_SHARED: flags |= GOVD_SHARED; -- cgit v1.2.1 From 1cf1742e4834f67465fd29068ec87ac427940a6c Mon Sep 17 00:00:00 2001 From: manu Date: Tue, 7 Jul 2009 21:52:01 +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 * tree.c (set_expr_locus): Remove. * tree.h (EXPR_LOCUS,SET_EXPR_LOCUS,set_expr_locus): Remove. * c-typeck.c (c_finish_stmt_expr): Replace EXPR_LOCUS by EXPR_LOCATION. * gimplify.c (internal_get_tmp_var): Likewise. (gimplify_call_expr): Likewise. (gimplify_one_sizepos): Likewise. objc/ * objc-act.c (next_sjlj_build_catch_list): Replace EXPR_LOCUS by EXPR_LOCATION. cp/ * semantics.c (finalize_nrv_r): Replace EXPR_LOCUS by EXPR_LOCATION. ada/ * gcc-interface/trans.c (gnat_gimplify_expr): Replace EXPR_LOCUS by EXPR_LOCATION. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149350 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index c5fb18569ba..032228d2a28 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -610,7 +610,7 @@ internal_get_tmp_var (tree val, gimple_seq *pre_p, gimple_seq *post_p, mod = build2 (INIT_EXPR, TREE_TYPE (t), t, unshare_expr (val)); if (EXPR_HAS_LOCATION (val)) - SET_EXPR_LOCUS (mod, EXPR_LOCUS (val)); + SET_EXPR_LOCATION (mod, EXPR_LOCATION (val)); else SET_EXPR_LOCATION (mod, input_location); @@ -814,7 +814,7 @@ gimple_set_do_not_emit_location (gimple g) gimple_set_plf (g, GF_PLF_1, true); } -/* Set the location for gimple statement GS to LOCUS. */ +/* Set the location for gimple statement GS to LOCATION. */ static void annotate_one_with_location (gimple gs, location_t location) @@ -854,7 +854,7 @@ annotate_all_with_location_after (gimple_seq seq, gimple_stmt_iterator gsi, } -/* Set the location for all the statements in a sequence STMT_P to LOCUS. */ +/* Set the location for all the statements in a sequence STMT_P to LOCATION. */ void annotate_all_with_location (gimple_seq stmt_p, location_t location) @@ -2375,7 +2375,7 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value) = CALL_EXPR_RETURN_SLOT_OPT (call); CALL_FROM_THUNK_P (*expr_p) = CALL_FROM_THUNK_P (call); CALL_CANNOT_INLINE_P (*expr_p) = CALL_CANNOT_INLINE_P (call); - SET_EXPR_LOCUS (*expr_p, EXPR_LOCUS (call)); + SET_EXPR_LOCATION (*expr_p, EXPR_LOCATION (call)); TREE_BLOCK (*expr_p) = TREE_BLOCK (call); /* Set CALL_EXPR_VA_ARG_PACK. */ @@ -7360,7 +7360,7 @@ gimplify_one_sizepos (tree *expr_p, gimple_seq *stmt_p) tmp = build1 (NOP_EXPR, type, expr); stmt = gimplify_assign (*expr_p, tmp, stmt_p); if (EXPR_HAS_LOCATION (expr)) - gimple_set_location (stmt, *EXPR_LOCUS (expr)); + gimple_set_location (stmt, EXPR_LOCATION (expr)); else gimple_set_location (stmt, input_location); } -- cgit v1.2.1 From e627cda1433a6aa4f632ec896cea9568a6ce734a Mon Sep 17 00:00:00 2001 From: manu Date: Tue, 7 Jul 2009 22:18:35 +0000 Subject: =?UTF-8?q?2009-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 PR c++/31246 * gimplify.c (gimplify_expr): Propagate no_warning flag when gimplifying. * gimple (gimple_build_call_from_tree): Likewise. * tree-cfg.c (remove_useless_stmts_warn_notreached): Check no_warning flag before warning. cp/ * init.c (build_new_1): Set TREE_NO_WARNING for compiler-generated code. * cp-gimplify.c (genericize_eh_spec_block): Likewise. testsuite/ * g++.dg/warn/pr31246.C: New. * g++.dg/warn/pr31246-2.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149354 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 032228d2a28..b20c8ac3e5e 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -6787,6 +6787,7 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, gimplify_and_add (EH_FILTER_FAILURE (*expr_p), &failure); ehf = gimple_build_eh_filter (EH_FILTER_TYPES (*expr_p), failure); + gimple_set_no_warning (ehf, TREE_NO_WARNING (*expr_p)); gimple_eh_filter_set_must_not_throw (ehf, EH_FILTER_MUST_NOT_THROW (*expr_p)); gimplify_seq_add_stmt (pre_p, ehf); -- cgit v1.2.1 From 389dd41bd043170e7dc7660304f14a5f16af3562 Mon Sep 17 00:00:00 2001 From: manu Date: Thu, 16 Jul 2009 22:29:52 +0000 Subject: =?UTF-8?q?2009-07-17=20=20Aldy=20Hernandez=20=20=20=09=20=20=20=20Manuel=20L=C3=B3pez-Ib=C3=A1=C3=B1ez=20=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR 40435 * tree-complex.c, tree-loop-distribution.c, tree.c, tree.h, builtins.c, fold-const.c, omp-low.c, cgraphunit.c, tree-ssa-ccp.c, tree-ssa-dom.c, gimple-low.c, expr.c, tree-ssa-ifcombine.c, c-decl.c, stor-layout.c, tree-if-conv.c, c-typeck.c, gimplify.c, calls.c, tree-sra.c, tree-mudflap.c, tree-ssa-copy.c, tree-ssa-forwprop.c, c-convert.c, c-omp.c, varasm.c, tree-inline.c, c-common.c, c-common.h, gimple.c, tree-switch-conversion.c, gimple.h, tree-cfg.c, c-parser.c, convert.c: Add location argument to fold_{unary,binary,ternary}, fold_build[123], build_call_expr, build_size_arg, build_fold_addr_expr, build_call_array, non_lvalue, size_diffop, fold_build1_initializer, fold_build2_initializer, fold_build3_initializer, fold_build_call_array, fold_build_call_array_initializer, fold_single_bit_test, omit_one_operand, omit_two_operands, invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref, combine_comparisons, fold_builtin_*, fold_call_expr, build_range_check, maybe_fold_offset_to_address, round_up, round_down. objc/ * objc-act.c: Add location argument to all calls to build_fold_addr_expr. testsuite/ * gcc.dg/pr36902.c: Add column info. * g++.dg/gcov/gcov-2.C: Change count for definition. cp/ * typeck.c, init.c, class.c, method.c, rtti.c, except.c, error.c, tree.c, cp-gimplify.c, cxx-pretty-print.c, pt.c, semantics.c, call.c, cvt.c, mangle.c: Add location argument to fold_{unary,binary,ternary}, fold_build[123], build_call_expr, build_size_arg, build_fold_addr_expr, build_call_array, non_lvalue, size_diffop, fold_build1_initializer, fold_build2_initializer, fold_build3_initializer, fold_build_call_array, fold_build_call_array_initializer, fold_single_bit_test, omit_one_operand, omit_two_operands, invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref, combine_comparisons, fold_builtin_*, fold_call_expr, build_range_check, maybe_fold_offset_to_address, round_up, round_down. fortran/ * trans-expr.c, trans-array.c, trans-openmp.c, trans-stmt.c, trans.c, trans-io.c, trans-decl.c, trans-intrinsic.c: Add location argument to fold_{unary,binary,ternary}, fold_build[123], build_call_expr, build_size_arg, build_fold_addr_expr, build_call_array, non_lvalue, size_diffop, fold_build1_initializer, fold_build2_initializer, fold_build3_initializer, fold_build_call_array, fold_build_call_array_initializer, fold_single_bit_test, omit_one_operand, omit_two_operands, invert_truthvalue, fold_truth_not_expr, build_fold_indirect_ref, fold_indirect_ref, combine_comparisons, fold_builtin_*, fold_call_expr, build_range_check, maybe_fold_offset_to_address, round_up, round_down. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149722 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 86 ++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 50 insertions(+), 36 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index b20c8ac3e5e..cd3de9d5c6a 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1786,6 +1786,7 @@ static enum gimplify_status gimplify_conversion (tree *expr_p) { tree tem; + location_t loc = EXPR_LOCATION (*expr_p); gcc_assert (CONVERT_EXPR_P (*expr_p)); /* Then strip away all but the outermost conversion. */ @@ -1827,7 +1828,7 @@ gimplify_conversion (tree *expr_p) /* If we have a conversion to a non-register type force the use of a VIEW_CONVERT_EXPR instead. */ if (!is_gimple_reg_type (TREE_TYPE (*expr_p))) - *expr_p = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (*expr_p), + *expr_p = fold_build1_loc (loc, VIEW_CONVERT_EXPR, TREE_TYPE (*expr_p), TREE_OPERAND (*expr_p, 0)); return GS_OK; @@ -1933,6 +1934,7 @@ gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, VEC(tree,heap) *stack; enum gimplify_status ret = GS_OK, tret; int i; + location_t loc = EXPR_LOCATION (*expr_p); /* Create a stack of the subexpressions so later we can walk them in order from inner to outer. */ @@ -1944,7 +1946,7 @@ gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, restart: /* Fold INDIRECT_REFs now to turn them into ARRAY_REFs. */ if (TREE_CODE (*p) == INDIRECT_REF) - *p = fold_indirect_ref (*p); + *p = fold_indirect_ref_loc (loc, *p); if (handled_component_p (*p)) ; @@ -2003,7 +2005,7 @@ gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, /* Divide the element size by the alignment of the element type (above). */ - elmt_size = size_binop (EXACT_DIV_EXPR, elmt_size, factor); + elmt_size = size_binop_loc (loc, EXACT_DIV_EXPR, elmt_size, factor); if (!is_gimple_min_invariant (elmt_size)) { @@ -2026,7 +2028,7 @@ gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, = size_int (DECL_OFFSET_ALIGN (field) / BITS_PER_UNIT); /* Divide the offset by its alignment. */ - offset = size_binop (EXACT_DIV_EXPR, offset, factor); + offset = size_binop_loc (loc, EXACT_DIV_EXPR, offset, factor); if (!is_gimple_min_invariant (offset)) { @@ -2116,6 +2118,7 @@ gimplify_self_mod_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, bool postfix; enum tree_code arith_code; enum gimplify_status ret; + location_t loc = EXPR_LOCATION (*expr_p); code = TREE_CODE (*expr_p); @@ -2159,9 +2162,9 @@ gimplify_self_mod_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, if (!is_gimple_min_lval (lvalue)) { mark_addressable (lvalue); - lvalue = build_fold_addr_expr (lvalue); + lvalue = build_fold_addr_expr_loc (input_location, lvalue); gimplify_expr (&lvalue, pre_p, post_p, is_gimple_val, fb_rvalue); - lvalue = build_fold_indirect_ref (lvalue); + lvalue = build_fold_indirect_ref_loc (input_location, lvalue); } ret = gimplify_expr (&lhs, pre_p, post_p, is_gimple_val, fb_rvalue); if (ret == GS_ERROR) @@ -2171,9 +2174,9 @@ gimplify_self_mod_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, /* For POINTERs increment, use POINTER_PLUS_EXPR. */ if (POINTER_TYPE_P (TREE_TYPE (lhs))) { - rhs = fold_convert (sizetype, rhs); + rhs = fold_convert_loc (loc, sizetype, rhs); if (arith_code == MINUS_EXPR) - rhs = fold_build1 (NEGATE_EXPR, TREE_TYPE (rhs), rhs); + rhs = fold_build1_loc (loc, NEGATE_EXPR, TREE_TYPE (rhs), rhs); arith_code = POINTER_PLUS_EXPR; } @@ -2268,6 +2271,7 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value) int i, nargs; gimple call; bool builtin_va_start_p = FALSE; + location_t loc = EXPR_LOCATION (*expr_p); gcc_assert (TREE_CODE (*expr_p) == CALL_EXPR); @@ -2291,7 +2295,7 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value) fndecl = get_callee_fndecl (*expr_p); if (fndecl && DECL_BUILT_IN (fndecl)) { - tree new_tree = fold_call_expr (*expr_p, !want_value); + tree new_tree = fold_call_expr (input_location, *expr_p, !want_value); if (new_tree && new_tree != *expr_p) { @@ -2364,8 +2368,9 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value) tree call = *expr_p; --nargs; - *expr_p = build_call_array (TREE_TYPE (call), CALL_EXPR_FN (call), - nargs, CALL_EXPR_ARGP (call)); + *expr_p = build_call_array_loc (loc, TREE_TYPE (call), + CALL_EXPR_FN (call), + nargs, CALL_EXPR_ARGP (call)); /* Copy all CALL_EXPR flags, location and block, except CALL_EXPR_VA_ARG_PACK flag. */ @@ -2408,7 +2413,7 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value) /* Try this again in case gimplification exposed something. */ if (ret != GS_ERROR) { - tree new_tree = fold_call_expr (*expr_p, !want_value); + tree new_tree = fold_call_expr (input_location, *expr_p, !want_value); if (new_tree && new_tree != *expr_p) { @@ -2749,6 +2754,7 @@ tree gimple_boolify (tree expr) { tree type = TREE_TYPE (expr); + location_t loc = EXPR_LOCATION (expr); if (TREE_CODE (type) == BOOLEAN_TYPE) return expr; @@ -2777,7 +2783,7 @@ gimple_boolify (tree expr) default: /* Other expressions that get here must have boolean values, but might need to be converted to the appropriate mode. */ - return fold_convert (boolean_type_node, expr); + return fold_convert_loc (loc, boolean_type_node, expr); } } @@ -2860,6 +2866,7 @@ gimplify_cond_expr (tree *expr_p, gimple_seq *pre_p, fallback_t fallback) gimple gimple_cond; enum tree_code pred_code; gimple_seq seq = NULL; + location_t loc = EXPR_LOCATION (*expr_p); type = TREE_TYPE (expr); @@ -2893,18 +2900,18 @@ gimplify_cond_expr (tree *expr_p, gimple_seq *pre_p, fallback_t fallback) if (TREE_TYPE (TREE_OPERAND (expr, 1)) != void_type_node) TREE_OPERAND (expr, 1) = - build_fold_addr_expr (TREE_OPERAND (expr, 1)); + build_fold_addr_expr_loc (loc, TREE_OPERAND (expr, 1)); if (TREE_TYPE (TREE_OPERAND (expr, 2)) != void_type_node) TREE_OPERAND (expr, 2) = - build_fold_addr_expr (TREE_OPERAND (expr, 2)); + build_fold_addr_expr_loc (loc, TREE_OPERAND (expr, 2)); tmp = create_tmp_var (type, "iftmp"); expr = build3 (COND_EXPR, void_type_node, TREE_OPERAND (expr, 0), TREE_OPERAND (expr, 1), TREE_OPERAND (expr, 2)); - result = build_fold_indirect_ref (tmp); + result = build_fold_indirect_ref_loc (loc, tmp); } /* Build the then clause, 't1 = a;'. But don't build an assignment @@ -3083,17 +3090,18 @@ gimplify_modify_expr_to_memcpy (tree *expr_p, tree size, bool want_value, { tree t, to, to_ptr, from, from_ptr; gimple gs; + location_t loc = EXPR_LOCATION (*expr_p); to = TREE_OPERAND (*expr_p, 0); from = TREE_OPERAND (*expr_p, 1); mark_addressable (from); - from_ptr = build_fold_addr_expr (from); - gimplify_arg (&from_ptr, seq_p, EXPR_LOCATION (*expr_p)); + from_ptr = build_fold_addr_expr_loc (loc, from); + gimplify_arg (&from_ptr, seq_p, loc); mark_addressable (to); - to_ptr = build_fold_addr_expr (to); - gimplify_arg (&to_ptr, seq_p, EXPR_LOCATION (*expr_p)); + to_ptr = build_fold_addr_expr_loc (loc, to); + gimplify_arg (&to_ptr, seq_p, loc); t = implicit_built_in_decls[BUILT_IN_MEMCPY]; @@ -3125,6 +3133,7 @@ gimplify_modify_expr_to_memset (tree *expr_p, tree size, bool want_value, { tree t, from, to, to_ptr; gimple gs; + location_t loc = EXPR_LOCATION (*expr_p); /* Assert our assumptions, to abort instead of producing wrong code silently if they are not met. Beware that the RHS CONSTRUCTOR might @@ -3139,8 +3148,8 @@ gimplify_modify_expr_to_memset (tree *expr_p, tree size, bool want_value, /* Now proceed. */ to = TREE_OPERAND (*expr_p, 0); - to_ptr = build_fold_addr_expr (to); - gimplify_arg (&to_ptr, seq_p, EXPR_LOCATION (*expr_p)); + to_ptr = build_fold_addr_expr_loc (loc, to); + gimplify_arg (&to_ptr, seq_p, loc); t = implicit_built_in_decls[BUILT_IN_MEMSET]; gs = gimple_build_call (t, 3, to_ptr, integer_zero_node, size); @@ -4296,6 +4305,7 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, tree *to_p = &TREE_OPERAND (*expr_p, 0); enum gimplify_status ret = GS_UNHANDLED; gimple assign; + location_t loc = EXPR_LOCATION (*expr_p); gcc_assert (TREE_CODE (*expr_p) == MODIFY_EXPR || TREE_CODE (*expr_p) == INIT_EXPR); @@ -4308,7 +4318,7 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, { STRIP_USELESS_TYPE_CONVERSION (*from_p); if (!useless_type_conversion_p (TREE_TYPE (*to_p), TREE_TYPE (*from_p))) - *from_p = fold_convert (TREE_TYPE (*to_p), *from_p); + *from_p = fold_convert_loc (loc, TREE_TYPE (*to_p), *from_p); } /* See if any simplifications can be done based on what the RHS is. */ @@ -4450,14 +4460,15 @@ gimplify_variable_sized_compare (tree *expr_p) tree op0 = TREE_OPERAND (*expr_p, 0); tree op1 = TREE_OPERAND (*expr_p, 1); tree t, arg, dest, src; + location_t loc = EXPR_LOCATION (*expr_p); arg = TYPE_SIZE_UNIT (TREE_TYPE (op0)); arg = unshare_expr (arg); arg = SUBSTITUTE_PLACEHOLDER_IN_EXPR (arg, op0); - src = build_fold_addr_expr (op1); - dest = build_fold_addr_expr (op0); + src = build_fold_addr_expr_loc (loc, op1); + dest = build_fold_addr_expr_loc (loc, op0); t = implicit_built_in_decls[BUILT_IN_MEMCMP]; - t = build_call_expr (t, 3, dest, src, arg); + t = build_call_expr_loc (loc, t, 3, dest, src, arg); *expr_p = build2 (TREE_CODE (*expr_p), TREE_TYPE (*expr_p), t, integer_zero_node); @@ -4470,17 +4481,18 @@ gimplify_variable_sized_compare (tree *expr_p) static enum gimplify_status gimplify_scalar_mode_aggregate_compare (tree *expr_p) { + location_t loc = EXPR_LOCATION (*expr_p); tree op0 = TREE_OPERAND (*expr_p, 0); tree op1 = TREE_OPERAND (*expr_p, 1); tree type = TREE_TYPE (op0); tree scalar_type = lang_hooks.types.type_for_mode (TYPE_MODE (type), 1); - op0 = fold_build1 (VIEW_CONVERT_EXPR, scalar_type, op0); - op1 = fold_build1 (VIEW_CONVERT_EXPR, scalar_type, op1); + op0 = fold_build1_loc (loc, VIEW_CONVERT_EXPR, scalar_type, op0); + op1 = fold_build1_loc (loc, VIEW_CONVERT_EXPR, scalar_type, op1); *expr_p - = fold_build2 (TREE_CODE (*expr_p), TREE_TYPE (*expr_p), op0, op1); + = fold_build2_loc (loc, TREE_CODE (*expr_p), TREE_TYPE (*expr_p), op0, op1); return GS_OK; } @@ -4502,8 +4514,8 @@ gimplify_boolean_expr (tree *expr_p, location_t locus) tree type = TREE_TYPE (*expr_p); *expr_p = build3 (COND_EXPR, type, *expr_p, - fold_convert (type, boolean_true_node), - fold_convert (type, boolean_false_node)); + fold_convert_loc (locus, type, boolean_true_node), + fold_convert_loc (locus, type, boolean_false_node)); SET_EXPR_LOCATION (*expr_p, locus); @@ -4607,6 +4619,7 @@ gimplify_addr_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) tree expr = *expr_p; tree op0 = TREE_OPERAND (expr, 0); enum gimplify_status ret; + location_t loc = EXPR_LOCATION (*expr_p); switch (TREE_CODE (op0)) { @@ -4628,7 +4641,7 @@ gimplify_addr_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) tree t_op00 = TREE_TYPE (op00); if (!useless_type_conversion_p (t_expr, t_op00)) - op00 = fold_convert (TREE_TYPE (expr), op00); + op00 = fold_convert_loc (loc, TREE_TYPE (expr), op00); *expr_p = op00; ret = GS_OK; } @@ -4647,8 +4660,9 @@ gimplify_addr_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) if (tree_ssa_useless_type_conversion (TREE_OPERAND (op0, 0))) op0 = TREE_OPERAND (op0, 0); - *expr_p = fold_convert (TREE_TYPE (expr), - build_fold_addr_expr (TREE_OPERAND (op0, 0))); + *expr_p = fold_convert_loc (loc, TREE_TYPE (expr), + build_fold_addr_expr_loc (loc, + TREE_OPERAND (op0, 0))); ret = GS_OK; break; @@ -6556,7 +6570,7 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, break; case INDIRECT_REF: - *expr_p = fold_indirect_ref (*expr_p); + *expr_p = fold_indirect_ref_loc (input_location, *expr_p); if (*expr_p != save_expr) break; /* else fall through. */ @@ -7161,7 +7175,7 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, /* An lvalue will do. Take the address of the expression, store it in a temporary, and replace the expression with an INDIRECT_REF of that temporary. */ - tmp = build_fold_addr_expr (*expr_p); + tmp = build_fold_addr_expr_loc (input_location, *expr_p); gimplify_expr (&tmp, pre_p, post_p, is_gimple_reg, fb_rvalue); *expr_p = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (tmp)), tmp); } -- cgit v1.2.1 From 39a1041d4f90b5324a57e86bca96d916638c962c Mon Sep 17 00:00:00 2001 From: jakub Date: Fri, 17 Jul 2009 10:40:09 +0000 Subject: PR c++/40780 * gimplify.c (gimplify_conversion): Don't change non-conversions into VIEW_CONVERT_EXPR. * g++.dg/template/ptrmem19.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149740 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index cd3de9d5c6a..db7de3b573b 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1827,9 +1827,9 @@ gimplify_conversion (tree *expr_p) /* If we have a conversion to a non-register type force the use of a VIEW_CONVERT_EXPR instead. */ - if (!is_gimple_reg_type (TREE_TYPE (*expr_p))) + if (CONVERT_EXPR_P (*expr_p) && !is_gimple_reg_type (TREE_TYPE (*expr_p))) *expr_p = fold_build1_loc (loc, VIEW_CONVERT_EXPR, TREE_TYPE (*expr_p), - TREE_OPERAND (*expr_p, 0)); + TREE_OPERAND (*expr_p, 0)); return GS_OK; } -- cgit v1.2.1 From bfec3452cfb96a7546809ee1af3fffb9eba9d658 Mon Sep 17 00:00:00 2001 From: rguenth Date: Fri, 17 Jul 2009 15:49:34 +0000 Subject: 2009-07-17 Richard Guenther PR c/40401 * tree-pass.h (pass_diagnose_omp_blocks): Declare. (pass_warn_unused_result): Likewise. (TODO_set_props): Remove. * omp-low.c (diagnose_omp_structured_block_errors): Change to run as a pass. (pass_diagnose_omp_blocks): Define. * c-decl.c (pop_file_scope): Do not finalize the CU here. (c_gimple_diagnostics_recursively): Remove. (finish_function): Do not call it. (c_write_global_declarations): Continue after errors. Finalize the CU here. * c-gimplify.c (c_genericize): Do not gimplify here. * c-common.c (c_warn_unused_result): Move ... * tree-cfg.c (do_warn_unused_result): ... here. (run_warn_unused_result): New function. (gate_warn_unused_result): New function. (pass_warn_unused_result): New pass. * c-common.h (c_warn_unused_result): Remove. * flags.h (flag_warn_unused_result): Declare. * c-opts.c (c_common_init_options): Enable flag_warn_unused_result. * opts.c (flag_warn_unused_result): Initialize to false. * toplev.c (compile_file): Add comment. * omp-low.c (create_omp_child_function): Do not register the function with the frontend. (diagnose_omp_structured_block_errors): Prepare to be called as optimization pass. (gate_diagnose_omp_blocks): New function. (pass_diagnose_omp_blocks): New pass. * cgraph.h (cgraph_optimize): Remove. (cgraph_analyze_function): Likewise. * cgraph.c (cgraph_add_new_function): Gimplify C++ thunks. * cgraphunit.c (cgraph_lower_function): Lower nested functions before their parents here. (cgraph_finalize_function): Not here. (cgraph_analyze_function): Gimplify functions here. (cgraph_finalize_compilation_unit): Continue after errors. Optimize the callgraph from here. (cgraph_optimize): Make static. * langhooks.c (write_global_declarations): Finalize the CU. * gimplify.c (gimplify_asm_expr): Do not emit ASMs with errors. (gimplify_function_tree): Assert we gimplify only once. Set PROP_gimple_any property. * tree-nested.c (gimplify_all_functions): New function. (lower_nested_functions): Gimplify all nested functions. * gimple.h (diagnose_omp_structured_block_errors): Remove. * passes.c (init_optimization_passes): Add pass_warn_unused_result and pass_diagnose_omp_blocks after gimplification. Do not set TODO_set_props on all_lowering_passes. (execute_one_pass): Do not handle TODO_set_props. * Makefile.in (cgraphunit.o): Add $(TREE_DUMP_H) dependency. (gimplify.o): Add tree-pass.h dependency. * tree-inline.c (copy_statement_list): Properly copy STATEMENT_LIST. (copy_tree_body_r): Properly handle TARGET_EXPR like SAVE_EXPR. (unsave_r): Likewise. * c-omp.c (c_finish_omp_atomic): Set DECL_CONTEXT on the temporary variable. cp/ * decl.c (finish_function): Do not emit unused result warnings from here. * cp-objcp-common.h (LANG_HOOKS_POST_GIMPLIFY_PASS): Use c_warn_unused_result_pass. * semantics.c (expand_or_defer_fn): Adjust assertion about IL status. * optimize.c (clone_body): Clone in GENERIC. (maybe_clone_body): Do not clear DECL_SAVED_TREE. * decl2.c (cp_write_global_declarations): Fix body test. Do not call cgraph_optimize. * Make-lang.in (optimize.o): Add tree-iterator.h dependency. * method.c (use_thunk): Register thunk with cgraph_finalize_function. * error.c (function_category): Guard access of DECL_LANG_SPECIFIC. java/ * java-gimplify.c (java_genericize): Do not gimplify here. But replace all local references. (java_gimplify_expr): Do not replace local references here. (java_gimplify_modify_expr): Likewise. * jcf-parse.c (java_parse_file): Do not finalize the CU or optimize the cgraph here. * decl.c (java_replace_reference): Make static. (java_replace_references): New function. (end_java_method): Clear base_decl_map. * java-tree.h (java_replace_references): Declare. (java_replace_reference): Remove. ada/ * utils.c (end_subprog_body): Revert to pre-tuples state. Remove unused parameter. (gnat_gimplify_function): Do not gimplify here. Fold into its only caller and remove. (gnat_builtin_function): Adjust for end_subprog_body signature change. (gnat_write_global_declarations): Also finalize the CU. * misc.c (gnat_parse_file): Do not finalize the CU here. * trans.c (gigi): Revert to pre-tuples state. (Subprogram_Body_to_gnu): Adjust for end_subprog_body signature change. * gigi.h (end_subprog_body): Remove unused parameter. fortran/ * f95-lang.c (gfc_be_parse_file): Do not finalize the CU here. * trans-decl.c (gfc_gimplify_function): Remove. (build_entry_thunks): Do not gimplify here. (create_main_function): Likewise. (gfc_generate_function_code): Likewise. * g++.dg/rtti/crash4.C: New testcase. * g++.dg/torture/20090706-1.C: Likewise. * gcc.dg/redecl-17.c: Likewise. * gfortran.dg/missing_optional_dummy_5.f90: Adjust pattern. * gcc.dg/declspec-9.c: Expect extra error. * gcc.dg/declspec-10.c: Likewise. * gcc.dg/declspec-11.c: Likewise. * gcc.dg/redecl-10.c: Expect extra warnings. * gcc.target/i386/pr39082-1.c: Adjust diagnostic location. * gcc.target/i386/pr39545-1.c: Likewise. * g++.dg/ext/asm3.C: Expect more errors. * g++.dg/gomp/block-1.C: Likewise. * g++.dg/gomp/block-2.C: Likewise. * g++.dg/gomp/block-3.C: Likewise. * g++.dg/gomp/block-5.C: Likewise. * g++.old-deja/g++.jason/report.C: Expect extra warnings. * g++.dg/warn/unused-result1.C: XFAIL. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149750 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index db7de3b573b..884d00f0722 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -52,6 +52,7 @@ along with GCC; see the file COPYING3. If not see #include "splay-tree.h" #include "vec.h" #include "gimple.h" +#include "tree-pass.h" enum gimplify_omp_var_data @@ -4913,14 +4914,18 @@ gimplify_asm_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) for (link = ASM_CLOBBERS (expr); link; ++i, link = TREE_CHAIN (link)) VEC_safe_push (tree, gc, clobbers, link); - - stmt = gimple_build_asm_vec (TREE_STRING_POINTER (ASM_STRING (expr)), - inputs, outputs, clobbers); - gimple_asm_set_volatile (stmt, ASM_VOLATILE_P (expr)); - gimple_asm_set_input (stmt, ASM_INPUT_P (expr)); + /* Do not add ASMs with errors to the gimple IL stream. */ + if (ret != GS_ERROR) + { + stmt = gimple_build_asm_vec (TREE_STRING_POINTER (ASM_STRING (expr)), + inputs, outputs, clobbers); - gimplify_seq_add_stmt (pre_p, stmt); + gimple_asm_set_volatile (stmt, ASM_VOLATILE_P (expr)); + gimple_asm_set_input (stmt, ASM_INPUT_P (expr)); + + gimplify_seq_add_stmt (pre_p, stmt); + } return ret; } @@ -7482,6 +7487,8 @@ gimplify_function_tree (tree fndecl) gimple_seq seq; gimple bind; + gcc_assert (!gimple_body (fndecl)); + oldfn = current_function_decl; current_function_decl = fndecl; if (DECL_STRUCT_FUNCTION (fndecl)) @@ -7548,6 +7555,7 @@ gimplify_function_tree (tree fndecl) } DECL_SAVED_TREE (fndecl) = NULL_TREE; + cfun->curr_properties = PROP_gimple_any; current_function_decl = oldfn; pop_cfun (); -- cgit v1.2.1 From a09ce8264aead81033a86bff59c5d2773cf931f5 Mon Sep 17 00:00:00 2001 From: rguenth Date: Sat, 18 Jul 2009 11:16:07 +0000 Subject: 2009-07-18 Richard Guenther PR c/40787 * gimplify.c (gimplify_call_expr): Reject code using results from functions returning void. * gcc.dg/pr35899.c: Adjust. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149770 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 884d00f0722..dc8d0c089a4 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -2411,6 +2411,14 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value) } } + /* Verify the function result. */ + if (want_value && fndecl + && VOID_TYPE_P (TREE_TYPE (TREE_TYPE (fndecl)))) + { + error_at (loc, "using result of function returning %"); + ret = GS_ERROR; + } + /* Try this again in case gimplification exposed something. */ if (ret != GS_ERROR) { -- 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/gimplify.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index dc8d0c089a4..eaea16df19c 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -4322,8 +4322,7 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, /* Insert pointer conversions required by the middle-end that are not required by the frontend. This fixes middle-end type checking for for example gcc.dg/redecl-6.c. */ - if (POINTER_TYPE_P (TREE_TYPE (*to_p)) - && lang_hooks.types_compatible_p (TREE_TYPE (*to_p), TREE_TYPE (*from_p))) + if (POINTER_TYPE_P (TREE_TYPE (*to_p))) { STRIP_USELESS_TYPE_CONVERSION (*from_p); if (!useless_type_conversion_p (TREE_TYPE (*to_p), TREE_TYPE (*from_p))) -- 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/gimplify.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index eaea16df19c..7de2a7e183f 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1763,7 +1763,8 @@ canonicalize_addr_expr (tree *expr_p) the expression pointer type. */ ddatype = TREE_TYPE (datype); pddatype = build_pointer_type (ddatype); - if (!useless_type_conversion_p (pddatype, ddatype)) + if (!useless_type_conversion_p (TYPE_MAIN_VARIANT (TREE_TYPE (expr)), + pddatype)) return; /* The lower bound and element sizes must be constant. */ @@ -1778,6 +1779,10 @@ canonicalize_addr_expr (tree *expr_p) TYPE_MIN_VALUE (TYPE_DOMAIN (datype)), NULL_TREE, NULL_TREE); *expr_p = build1 (ADDR_EXPR, pddatype, *expr_p); + + /* We can have stripped a required restrict qualifier above. */ + if (!useless_type_conversion_p (TREE_TYPE (expr), TREE_TYPE (*expr_p))) + *expr_p = fold_convert (TREE_TYPE (expr), *expr_p); } /* *EXPR_P is a NOP_EXPR or CONVERT_EXPR. Remove it and/or other conversions -- cgit v1.2.1 From 1ea6a73cf7bb61c4a80ad96d66329038114d0d79 Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 19 Aug 2009 14:29:52 +0000 Subject: * omp-low.c (optimize_omp_library_calls): Use types_compatible_p instead of comparing TYPE_MAIN_VARIANT for equality. * tree-vect-patterns.c (vect_recog_dot_prod_pattern, vect_recog_widen_mult_pattern, vect_recog_widen_sum_pattern): Ditto. * tree-vect-loop.c (vect_is_simple_reduction): Ditto. * gimplify.c (goa_lhs_expr_p): Ditto and use STRIP_USELESS_TYPE_CONVERSION. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@150936 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 7de2a7e183f..3ba40a88f19 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -6152,12 +6152,7 @@ goa_lhs_expr_p (tree expr, tree addr) /* Also include casts to other type variants. The C front end is fond of adding these for e.g. volatile variables. This is like STRIP_TYPE_NOPS but includes the main variant lookup. */ - while ((CONVERT_EXPR_P (expr) - || TREE_CODE (expr) == NON_LVALUE_EXPR) - && TREE_OPERAND (expr, 0) != error_mark_node - && (TYPE_MAIN_VARIANT (TREE_TYPE (expr)) - == TYPE_MAIN_VARIANT (TREE_TYPE (TREE_OPERAND (expr, 0))))) - expr = TREE_OPERAND (expr, 0); + STRIP_USELESS_TYPE_CONVERSION (expr); if (TREE_CODE (expr) == INDIRECT_REF) { @@ -6166,8 +6161,7 @@ goa_lhs_expr_p (tree expr, tree addr) && (CONVERT_EXPR_P (expr) || TREE_CODE (expr) == NON_LVALUE_EXPR) && TREE_CODE (expr) == TREE_CODE (addr) - && TYPE_MAIN_VARIANT (TREE_TYPE (expr)) - == TYPE_MAIN_VARIANT (TREE_TYPE (addr))) + && types_compatible_p (TREE_TYPE (expr), TREE_TYPE (addr))) { expr = TREE_OPERAND (expr, 0); addr = TREE_OPERAND (addr, 0); -- cgit v1.2.1 From 1e5ec9ee3f16455cf9ab831de590217fb9b6da97 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Tue, 25 Aug 2009 15:02:19 +0000 Subject: * gimplify.c (prepare_gimple_addressable): New static function. (gimplify_modify_expr_to_memcpy): Invoke it on the RHS before marking it addressable. (gimplify_addr_expr): Invoke it similarly on the operand instead of manually fiddling with it. ada/ * gcc-interface/trans.c (call_to_gnu): Tidy. (gnat_to_gnu) : Set TYPE_ARRAY_MAX_SIZE if the slice has non-constant size but the array itself has constant size. * gcc-interface/utils.c (convert_vms_descriptor64): Fix type consistency error. (convert_vms_descriptor32): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151082 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 3ba40a88f19..bdb64ea88c8 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -3095,6 +3095,25 @@ gimplify_cond_expr (tree *expr_p, gimple_seq *pre_p, fallback_t fallback) return ret; } +/* Prepare the node pointed to by EXPR_P, an is_gimple_addressable expression, + to be marked addressable. + + We cannot rely on such an expression being directly markable if a temporary + has been created by the gimplification. In this case, we create another + temporary and initialize it with a copy, which will become a store after we + mark it addressable. This can happen if the front-end passed us something + that it could not mark addressable yet, like a Fortran pass-by-reference + parameter (int) floatvar. */ + +static void +prepare_gimple_addressable (tree *expr_p, gimple_seq *seq_p) +{ + while (handled_component_p (*expr_p)) + expr_p = &TREE_OPERAND (*expr_p, 0); + if (is_gimple_reg (*expr_p)) + *expr_p = get_initialized_tmp_var (*expr_p, seq_p, NULL); +} + /* A subroutine of gimplify_modify_expr. Replace a MODIFY_EXPR with a call to __builtin_memcpy. */ @@ -3109,6 +3128,10 @@ gimplify_modify_expr_to_memcpy (tree *expr_p, tree size, bool want_value, to = TREE_OPERAND (*expr_p, 0); from = TREE_OPERAND (*expr_p, 1); + /* Mark the RHS addressable. Beware that it may not be possible to do so + directly if a temporary has been created by the gimplification. */ + prepare_gimple_addressable (&from, seq_p); + mark_addressable (from); from_ptr = build_fold_addr_expr_loc (loc, from); gimplify_arg (&from_ptr, seq_p, loc); @@ -4685,22 +4708,15 @@ gimplify_addr_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) gcc.dg/c99-array-lval-1.c. The gimplifier will correctly make the implied temporary explicit. */ - /* Mark the RHS addressable. */ + /* Make the operand addressable. */ ret = gimplify_expr (&TREE_OPERAND (expr, 0), pre_p, post_p, is_gimple_addressable, fb_either); if (ret == GS_ERROR) break; - /* We cannot rely on making the RHS addressable if it is - a temporary created by gimplification. In this case create a - new temporary that is initialized by a copy (which will - become a store after we mark it addressable). - This mostly happens if the frontend passed us something that - it could not mark addressable yet, like a fortran - pass-by-reference parameter (int) floatvar. */ - if (is_gimple_reg (TREE_OPERAND (expr, 0))) - TREE_OPERAND (expr, 0) - = get_initialized_tmp_var (TREE_OPERAND (expr, 0), pre_p, post_p); + /* Then mark it. Beware that it may not be possible to do so directly + if a temporary has been created by the gimplification. */ + prepare_gimple_addressable (&TREE_OPERAND (expr, 0), pre_p); op0 = TREE_OPERAND (expr, 0); -- 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/gimplify.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index bdb64ea88c8..7f1dc4ae94b 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -4725,10 +4725,22 @@ gimplify_addr_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) if (TREE_CODE (op0) == INDIRECT_REF) goto do_indirect_ref; + mark_addressable (TREE_OPERAND (expr, 0)); + + /* The FEs may end up building ADDR_EXPRs early on a decl with + an incomplete type. Re-build ADDR_EXPRs in canonical form + here. */ + if (!types_compatible_p (TREE_TYPE (op0), TREE_TYPE (TREE_TYPE (expr)))) + *expr_p = build_fold_addr_expr (op0); + /* Make sure TREE_CONSTANT and TREE_SIDE_EFFECTS are set properly. */ - recompute_tree_invariant_for_addr_expr (expr); + recompute_tree_invariant_for_addr_expr (*expr_p); + + /* If we re-built the ADDR_EXPR add a conversion to the original type + if required. */ + if (!useless_type_conversion_p (TREE_TYPE (expr), TREE_TYPE (*expr_p))) + *expr_p = fold_convert (TREE_TYPE (expr), *expr_p); - mark_addressable (TREE_OPERAND (expr, 0)); break; } -- cgit v1.2.1 From e38def9ca7953bb5611d08ce8617249516ba5a99 Mon Sep 17 00:00:00 2001 From: rth Date: Mon, 14 Sep 2009 19:18:58 +0000 Subject: Squash commit of EH in gimple git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151696 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 8 -------- 1 file changed, 8 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 7f1dc4ae94b..381e611bc8f 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -6645,11 +6645,6 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, ret = gimplify_decl_expr (expr_p, pre_p); break; - case EXC_PTR_EXPR: - /* FIXME make this a decl. */ - ret = GS_ALL_DONE; - break; - case BIND_EXPR: ret = gimplify_bind_expr (expr_p, pre_p); break; @@ -6841,8 +6836,6 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, gimplify_and_add (EH_FILTER_FAILURE (*expr_p), &failure); ehf = gimple_build_eh_filter (EH_FILTER_TYPES (*expr_p), failure); gimple_set_no_warning (ehf, TREE_NO_WARNING (*expr_p)); - gimple_eh_filter_set_must_not_throw - (ehf, EH_FILTER_MUST_NOT_THROW (*expr_p)); gimplify_seq_add_stmt (pre_p, ehf); ret = GS_ALL_DONE; break; @@ -7178,7 +7171,6 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, && code != GOTO_EXPR && code != LABEL_EXPR && code != LOOP_EXPR - && code != RESX_EXPR && code != SWITCH_EXPR && code != TRY_FINALLY_EXPR && code != OMP_CRITICAL -- cgit v1.2.1 From 78f55ca8366d5fc6a1547b4ab5998397e7618216 Mon Sep 17 00:00:00 2001 From: rth Date: Mon, 14 Sep 2009 20:17:24 +0000 Subject: * builtins.c (expand_builtin_synchronize): Use gimple_build_asm_vec. * cfgbuild.c (make_edges): Handle asm goto. * cfglayout.c (fixup_reorder_chain): Likewise. * cfgrtl.c (patch_jump_insn): Likewise. * gimple-pretty-print.c (dump_gimple_asm): Likewise. * gimple.c (gimple_build_asm_1): Add and use nlabels parameter. (gimple_build_asm_vec): Add and use labels parameter. (gimple_build_asm): Remove. (walk_gimple_asm): Walk labels too. * gimple.def (GIMPLE_ASM): Update docs. * gimple.h: Update decls. (struct gimple_statement_asm): Change nc to use unsigned char; add nl member. (gimple_asm_nlabels): New. (gimple_asm_label_op, gimple_asm_set_label_op): New. * gimplify.c (gimplify_asm_expr): Copy labels from ASM_EXPR into gimple_build_asm_vec. * jump.c (mark_jump_label_asm): New. (mark_jump_label): Use it. (redirect_jump_1): Handle asm goto. (invert_jump_1): Soft fail if X is null. * recog.c (extract_asm_operands): New. (asm_noperands): Use it; handle asm labels. (decode_asm_operands): Use extract_asm_operands. (asm_operand_ok): Properly handle empty string. * reg-stack.c (get_asm_operands_in_out): Rename from get_asm_operand_n_inputs; use extract_asm_operands; return both inputs and outputs by reference; update all callers. * rtl.def (ASM_OPERANDS): Add label vector as operand 6. * rtl.h (ASM_OPERANDS_LABEL_VEC): New. (ASM_OPERANDS_LABEL_LENGTH, ASM_OPERANDS_LABEL): New. (ASM_OPERANDS_SOURCE_LOCATION): Renumber. (extract_asm_operands): Declare. * stmt.c (expand_asm_operands): Add and use labels parameter. (check_unique_operand_names): Likewise. (resolve_asm_operand_names, resolve_operand_name_1): Likewise. (expand_asm_stmt): Handle asm labels. * tree-cfg.c (make_gimple_asm_edges): New. (make_edges): Use it. (cleanup_dead_labels): Handle asm labels. (is_ctrl_altering_stmt): Likewise. (gimple_redirect_edge_and_branch): Likewise. * tree.def (ASM_EXPR): Add 5th operand. * tree.h (ASM_LABELS): New. (resolve_asm_operand_names): Update decl. * c-parser.c (c_parser_asm_statement): Parse asm goto. (c_parser_asm_goto_operands): New. * c-tree.h (build_asm_expr): Update decl. * c-typeck.c (build_asm_expr): Add and use labels parameter. * doc/extend.texi: Document asm goto. gcc/ada/ * gcc-interface/trans.c (Pragma_to_gnu): Use build5 for ASM_EXPR. gcc/cp/ * cp-tree.h (finish_asm_stmt): Update decl. * parser.c (cp_parser_asm_definition): Parse asm goto. (cp_parser_asm_label_list): New. * pt.c (tsubst_copy_asm_operands): Don't recurse on labels. (tsubst_expr): Handle asm labels. * semantics.c (finish_asm_stmt): Add and use labels parameter. gcc/testsuite/ * c-c++-common/asmgoto-1.c, c-c++-common/asmgoto-2.c, c-c++-common/asmgoto-3.c, gcc.c-torture/compile/asmgoto-1.c, gcc.dg/tree-ssa/asmgoto-1.c: New files. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151701 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 381e611bc8f..c0cab205613 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -4765,13 +4765,14 @@ gimplify_asm_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) VEC(tree, gc) *inputs; VEC(tree, gc) *outputs; VEC(tree, gc) *clobbers; + VEC(tree, gc) *labels; tree link_next; expr = *expr_p; noutputs = list_length (ASM_OUTPUTS (expr)); oconstraints = (const char **) alloca ((noutputs) * sizeof (const char *)); - inputs = outputs = clobbers = NULL; + inputs = outputs = clobbers = labels = NULL; ret = GS_ALL_DONE; link_next = NULL_TREE; @@ -4953,13 +4954,16 @@ gimplify_asm_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) } for (link = ASM_CLOBBERS (expr); link; ++i, link = TREE_CHAIN (link)) - VEC_safe_push (tree, gc, clobbers, link); + VEC_safe_push (tree, gc, clobbers, link); + + for (link = ASM_LABELS (expr); link; ++i, link = TREE_CHAIN (link)) + VEC_safe_push (tree, gc, labels, link); /* Do not add ASMs with errors to the gimple IL stream. */ if (ret != GS_ERROR) { stmt = gimple_build_asm_vec (TREE_STRING_POINTER (ASM_STRING (expr)), - inputs, outputs, clobbers); + inputs, outputs, clobbers, labels); gimple_asm_set_volatile (stmt, ASM_VOLATILE_P (expr)); gimple_asm_set_input (stmt, ASM_INPUT_P (expr)); -- cgit v1.2.1 From 1b013d97b21e27f9ce50324503d1115c272e19e2 Mon Sep 17 00:00:00 2001 From: janus Date: Mon, 26 Oct 2009 09:08:03 +0000 Subject: 2009-10-26 Janus Weil PR fortran/41714 * gimple.h (tree_annotate_all_with_location): Remove prototype. * gimplify.c (tree_should_carry_location_p, tree_annotate_one_with_location,tree_annotate_all_with_location): Remove obsolete functions. 2009-10-26 Janus Weil PR fortran/41714 * trans.c (gfc_trans_code): Remove call to 'tree_annotate_all_with_location'. Location should already be set. * trans-openmp.c (gfc_trans_omp_workshare): Ditto. * trans-stmt.c (gfc_trans_allocate): Do correct data initialization for CLASS variables with SOURCE tag, plus some cleanup. 2009-10-26 Janus Weil PR fortran/41714 * gfortran.dg/class_allocate_4.f03: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@153547 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index c0cab205613..d68aacd04f3 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -777,23 +777,6 @@ should_carry_location_p (gimple gs) return true; } -/* Same, but for a tree. */ - -static bool -tree_should_carry_location_p (const_tree stmt) -{ - /* Don't emit a line note for a label. We particularly don't want to - emit one for the break label, since it doesn't actually correspond - to the beginning of the loop/switch. */ - if (TREE_CODE (stmt) == LABEL_EXPR) - return false; - - /* Do not annotate empty statements, since it confuses gcov. */ - if (!TREE_SIDE_EFFECTS (stmt)) - return false; - - return true; -} /* Return true if a location should not be emitted for this statement by annotate_one_with_location. */ @@ -826,16 +809,6 @@ annotate_one_with_location (gimple gs, location_t location) gimple_set_location (gs, location); } -/* Same, but for tree T. */ - -static void -tree_annotate_one_with_location (tree t, location_t location) -{ - if (CAN_HAVE_LOCATION_P (t) - && ! EXPR_HAS_LOCATION (t) && tree_should_carry_location_p (t)) - SET_EXPR_LOCATION (t, location); -} - /* Set LOCATION for all the statements after iterator GSI in sequence SEQ. If GSI is pointing to the end of the sequence, start with the @@ -872,29 +845,6 @@ annotate_all_with_location (gimple_seq stmt_p, location_t location) } } -/* Same, but for statement or statement list in *STMT_P. */ - -void -tree_annotate_all_with_location (tree *stmt_p, location_t location) -{ - tree_stmt_iterator i; - - if (!*stmt_p) - return; - - for (i = tsi_start (*stmt_p); !tsi_end_p (i); tsi_next (&i)) - { - tree t = tsi_stmt (i); - - /* Assuming we've already been gimplified, we shouldn't - see nested chaining constructs anymore. */ - gcc_assert (TREE_CODE (t) != STATEMENT_LIST - && TREE_CODE (t) != COMPOUND_EXPR); - - tree_annotate_one_with_location (t, location); - } -} - /* Similar to copy_tree_r() but do not copy SAVE_EXPR or TARGET_EXPR nodes. These nodes model computations that should only be done once. If we -- cgit v1.2.1 From 960d903e2f4ec1824b9a8738cc0516b25242840d Mon Sep 17 00:00:00 2001 From: jakub Date: Fri, 13 Nov 2009 18:38:36 +0000 Subject: PR middle-end/42029 * gimplify.c (gimplify_omp_atomic): Set DECL_GIMPLE_REG_P on tmp_load if needed. * libgomp.c/pr42029.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@154161 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index d68aacd04f3..8404e0fd13a 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -6231,6 +6231,8 @@ gimplify_omp_atomic (tree *expr_p, gimple_seq *pre_p) tree tmp_load; tmp_load = create_tmp_var (type, NULL); + if (TREE_CODE (type) == COMPLEX_TYPE || TREE_CODE (type) == VECTOR_TYPE) + DECL_GIMPLE_REG_P (tmp_load) = 1; if (goa_stabilize_expr (&rhs, pre_p, addr, tmp_load) < 0) return GS_ERROR; -- 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/gimplify.c | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 8404e0fd13a..a3c6834beff 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -803,7 +803,7 @@ gimple_set_do_not_emit_location (gimple g) static void annotate_one_with_location (gimple gs, location_t location) { - if (!gimple_has_location (gs) + if (!gimple_has_location (gs) && !gimple_do_not_emit_location_p (gs) && should_carry_location_p (gs)) gimple_set_location (gs, location); @@ -1445,12 +1445,12 @@ gimplify_switch_expr (tree *expr_p, gimple_seq *pre_p) tree default_case = NULL_TREE; size_t i, len; gimple gimple_switch; - + /* If someone can be bothered to fill in the labels, they can be bothered to null out the body too. */ gcc_assert (!SWITCH_LABELS (switch_expr)); - /* save old labels, get new ones from body, then restore the old + /* save old labels, get new ones from body, then restore the old labels. Save all the things from the switch body to append after. */ saved_labels = gimplify_ctxp->case_labels; gimplify_ctxp->case_labels = VEC_alloc (tree, heap, 8); @@ -1458,7 +1458,7 @@ gimplify_switch_expr (tree *expr_p, gimple_seq *pre_p) gimplify_stmt (&SWITCH_BODY (switch_expr), &switch_body_seq); labels = gimplify_ctxp->case_labels; gimplify_ctxp->case_labels = saved_labels; - + i = 0; while (i < VEC_length (tree, labels)) { @@ -1547,7 +1547,7 @@ gimplify_switch_expr (tree *expr_p, gimple_seq *pre_p) } } - gimple_switch = gimple_build_switch_vec (SWITCH_COND (switch_expr), + gimple_switch = gimple_build_switch_vec (SWITCH_COND (switch_expr), default_case, labels); gimplify_seq_add_stmt (pre_p, gimple_switch); gimplify_seq_add_seq (pre_p, switch_body_seq); @@ -1793,7 +1793,7 @@ gimplify_conversion (tree *expr_p) /* Nonlocal VLAs seen in the current function. */ static struct pointer_set_t *nonlocal_vlas; -/* Gimplify a VAR_DECL or PARM_DECL. Returns GS_OK if we expanded a +/* Gimplify a VAR_DECL or PARM_DECL. Returns GS_OK if we expanded a DECL_VALUE_EXPR, and it's worth re-examining things. */ static enum gimplify_status @@ -1913,7 +1913,7 @@ gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, goto restart; else break; - + VEC_safe_push (tree, heap, stack, *p); } @@ -2272,7 +2272,7 @@ gimplify_call_expr (tree *expr_p, gimple_seq *pre_p, bool want_value) *expr_p = build_empty_stmt (EXPR_LOCATION (*expr_p)); return GS_OK; } - + if (fold_builtin_next_arg (*expr_p, true)) { *expr_p = build_empty_stmt (EXPR_LOCATION (*expr_p)); @@ -3125,7 +3125,7 @@ gimplify_modify_expr_to_memset (tree *expr_p, tree size, bool want_value, /* Assert our assumptions, to abort instead of producing wrong code silently if they are not met. Beware that the RHS CONSTRUCTOR might not be immediately exposed. */ - from = TREE_OPERAND (*expr_p, 1); + from = TREE_OPERAND (*expr_p, 1); if (TREE_CODE (from) == WITH_SIZE_EXPR) from = TREE_OPERAND (from, 0); @@ -3358,18 +3358,18 @@ gimplify_init_ctor_eval_range (tree object, tree lower, tree upper, } /* Return true if FDECL is accessing a field that is zero sized. */ - + static bool zero_sized_field_decl (const_tree fdecl) { - if (TREE_CODE (fdecl) == FIELD_DECL && DECL_SIZE (fdecl) + if (TREE_CODE (fdecl) == FIELD_DECL && DECL_SIZE (fdecl) && integer_zerop (DECL_SIZE (fdecl))) return true; return false; } /* Return true if TYPE is zero sized. */ - + static bool zero_sized_type (const_tree type) { @@ -3616,7 +3616,7 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, return GS_OK; break; } - + /* Fetch information about the constructor to direct later processing. We might want to make static versions of it in various cases, and can only do so if it known to be a valid constant initializer. */ @@ -4025,7 +4025,7 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, break; case INDIRECT_REF: { - /* If we have code like + /* If we have code like *(const A*)(A*)&x @@ -4196,7 +4196,7 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, *expr_p = wrap; return GS_OK; } - + case COMPOUND_LITERAL_EXPR: { tree complit = TREE_OPERAND (*expr_p, 1); @@ -4717,7 +4717,7 @@ gimplify_asm_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) VEC(tree, gc) *clobbers; VEC(tree, gc) *labels; tree link_next; - + expr = *expr_p; noutputs = list_length (ASM_OUTPUTS (expr)); oconstraints = (const char **) alloca ((noutputs) * sizeof (const char *)); @@ -4902,7 +4902,7 @@ gimplify_asm_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p) TREE_CHAIN (link) = NULL_TREE; VEC_safe_push (tree, gc, inputs, link); } - + for (link = ASM_CLOBBERS (expr); link; ++i, link = TREE_CHAIN (link)) VEC_safe_push (tree, gc, clobbers, link); @@ -5277,7 +5277,7 @@ omp_add_variable (struct gimplify_omp_ctx *ctx, tree decl, unsigned int flags) } /* When adding a variable-sized variable, we have to handle all sorts - of additional bits of data: the pointer replacement variable, and + of additional bits of data: the pointer replacement variable, and the parameters of the type. */ if (DECL_SIZE (decl) && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST) { @@ -5309,7 +5309,7 @@ omp_add_variable (struct gimplify_omp_ctx *ctx, tree decl, unsigned int flags) flags = GOVD_PRIVATE | GOVD_DEBUG_PRIVATE | (flags & (GOVD_SEEN | GOVD_EXPLICIT)); - /* We're going to make use of the TYPE_SIZE_UNIT at least in the + /* We're going to make use of the TYPE_SIZE_UNIT at least in the alloca statement we generate for the variable, so make sure it is available. This isn't automatically needed for the SHARED case, since we won't be allocating local storage then. @@ -5628,7 +5628,7 @@ gimplify_scan_omp_clauses (tree *list_p, gimple_seq *pre_p, push_gimplify_context (&gctx); gimplify_and_add (OMP_CLAUSE_REDUCTION_MERGE (c), &OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c)); - pop_gimplify_context + pop_gimplify_context (gimple_seq_first_stmt (OMP_CLAUSE_REDUCTION_GIMPLE_MERGE (c))); OMP_CLAUSE_REDUCTION_INIT (c) = NULL_TREE; OMP_CLAUSE_REDUCTION_MERGE (c) = NULL_TREE; @@ -5825,7 +5825,7 @@ gimplify_adjust_omp_clauses (tree *list_p) OMP_CLAUSE_LASTPRIVATE_FIRSTPRIVATE (c) = (n->value & GOVD_FIRSTPRIVATE) != 0; break; - + case OMP_CLAUSE_REDUCTION: case OMP_CLAUSE_COPYIN: case OMP_CLAUSE_COPYPRIVATE: @@ -5851,7 +5851,7 @@ gimplify_adjust_omp_clauses (tree *list_p) /* Add in any implicit data sharing. */ splay_tree_foreach (ctx->variables, gimplify_adjust_omp_clauses_1, list_p); - + gimplify_omp_ctxp = ctx->outer_context; delete_omp_context (ctx); } @@ -5975,7 +5975,7 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p) { var = create_tmp_var (TREE_TYPE (decl), get_name (decl)); TREE_OPERAND (t, 0) = var; - + gimplify_seq_add_stmt (&for_body, gimple_build_assign (decl, var)); omp_add_variable (gimplify_omp_ctxp, var, GOVD_PRIVATE | GOVD_SEEN); @@ -6125,14 +6125,14 @@ gimplify_omp_workshare (tree *expr_p, gimple_seq *pre_p) } /* A subroutine of gimplify_omp_atomic. The front end is supposed to have - stabilized the lhs of the atomic operation as *ADDR. Return true if + stabilized the lhs of the atomic operation as *ADDR. Return true if EXPR is this stabilized form. */ static bool goa_lhs_expr_p (tree expr, tree addr) { /* Also include casts to other type variants. The C front end is fond - of adding these for e.g. volatile variables. This is like + of adding these for e.g. volatile variables. This is like STRIP_TYPE_NOPS but includes the main variant lookup. */ STRIP_USELESS_TYPE_CONVERSION (expr); @@ -6178,7 +6178,7 @@ goa_stabilize_expr (tree *expr_p, gimple_seq *pre_p, tree lhs_addr, } if (is_gimple_val (expr)) return 0; - + saw_lhs = 0; switch (TREE_CODE_CLASS (TREE_CODE (expr))) { @@ -7458,7 +7458,7 @@ gimplify_body (tree *body_p, tree fndecl, bool do_parms) /* Entry point to the gimplification pass. FNDECL is the FUNCTION_DECL node for the function we want to gimplify. - + Returns the sequence of GIMPLE statements corresponding to the body of FNDECL. */ -- cgit v1.2.1 From 4569d18c2845831a7e2d4f171d6bd200fe87e2e8 Mon Sep 17 00:00:00 2001 From: aoliva Date: Sat, 9 Jan 2010 14:40:59 +0000 Subject: gcc/ChangeLog: PR middle-end/42363 * gimplify.c (gimplify_modify_expr): Drop lhs on noreturn calls. * tree-cfg.c (is_ctrl_altering_stmt): Don't compute flags twice. (verify_gimple_call): Reject LHS in noreturn calls. gcc/testsuite/ChangeLog: PR middle-end/42363 * gcc.dg/torture/pr42363.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155762 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index a3c6834beff..e09cb3e429b 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -4407,7 +4407,8 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, /* Since the RHS is a CALL_EXPR, we need to create a GIMPLE_CALL instead of a GIMPLE_ASSIGN. */ assign = gimple_build_call_from_tree (*from_p); - gimple_call_set_lhs (assign, *to_p); + if (!gimple_call_noreturn_p (assign)) + gimple_call_set_lhs (assign, *to_p); } else { -- cgit v1.2.1 From 7368569212f3e0ab9a02ad46b5721b760ea5971d Mon Sep 17 00:00:00 2001 From: aoliva Date: Sat, 9 Jan 2010 14:46:25 +0000 Subject: Update copyright notices of my recent commits. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@155766 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index e09cb3e429b..ccae4d89a72 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1,6 +1,6 @@ /* Tree lowering pass. This pass converts the GENERIC functions-as-trees tree representation into the GIMPLE form. - Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 + Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Major work done by Sebastian Pop , Diego Novillo and Jason Merrill . -- cgit v1.2.1 From ff5d4405563d347577370dc92cdf21c0af907f2e Mon Sep 17 00:00:00 2001 From: rguenth Date: Sun, 31 Jan 2010 17:01:38 +0000 Subject: 2010-01-31 Richard Guenther PR middle-end/42898 * gimplify.c (gimplify_init_constructor): For volatile LHS initialize a temporary. * gcc.dg/torture/pr42898.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156404 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index ccae4d89a72..fac3fdaa223 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -3745,6 +3745,21 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, } } + /* If the target is volatile and we have non-zero elements + initialize the target from a temporary. */ + if (TREE_THIS_VOLATILE (object) + && !TREE_ADDRESSABLE (type) + && num_nonzero_elements > 0) + { + tree temp = create_tmp_var (TYPE_MAIN_VARIANT (type), NULL); + TREE_OPERAND (*expr_p, 0) = temp; + *expr_p = build2 (COMPOUND_EXPR, TREE_TYPE (*expr_p), + *expr_p, + build2 (MODIFY_EXPR, void_type_node, + object, temp)); + return GS_OK; + } + if (notify_temp_creation) return GS_OK; -- cgit v1.2.1 From 0d9f1189f3df5ce5c0efc3ecadc7c0a4f75b202d Mon Sep 17 00:00:00 2001 From: rguenth Date: Sun, 7 Feb 2010 13:42:52 +0000 Subject: 2010-02-07 Richard Guenther PR middle-end/42956 * gimplify.c (gimple_fold_indirect_ref): Avoid generating new ARRAY_REFs on variable size element or minimal index arrays. Complete. * tree-ssa-loop-ivopts.c (find_interesting_uses_address): Use gimple_fold_indirect_ref. * gcc.c-torture/compile/pr42956.c: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156571 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 66 insertions(+), 3 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index fac3fdaa223..91dabd1aa92 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -3935,7 +3935,7 @@ gimple_fold_indirect_ref (tree t) tree sub = t; tree subtype; - STRIP_USELESS_TYPE_CONVERSION (sub); + STRIP_NOPS (sub); subtype = TREE_TYPE (sub); if (!POINTER_TYPE_P (subtype)) return NULL_TREE; @@ -3950,18 +3950,80 @@ gimple_fold_indirect_ref (tree t) /* *(foo *)&fooarray => fooarray[0] */ if (TREE_CODE (optype) == ARRAY_TYPE + && TREE_CODE (TYPE_SIZE (TREE_TYPE (optype))) == INTEGER_CST && useless_type_conversion_p (type, TREE_TYPE (optype))) { tree type_domain = TYPE_DOMAIN (optype); tree min_val = size_zero_node; if (type_domain && TYPE_MIN_VALUE (type_domain)) min_val = TYPE_MIN_VALUE (type_domain); - return build4 (ARRAY_REF, type, op, min_val, NULL_TREE, NULL_TREE); + if (TREE_CODE (min_val) == INTEGER_CST) + return build4 (ARRAY_REF, type, op, min_val, NULL_TREE, NULL_TREE); } + /* *(foo *)&complexfoo => __real__ complexfoo */ + else if (TREE_CODE (optype) == COMPLEX_TYPE + && useless_type_conversion_p (type, TREE_TYPE (optype))) + return fold_build1 (REALPART_EXPR, type, op); + /* *(foo *)&vectorfoo => BIT_FIELD_REF */ + else if (TREE_CODE (optype) == VECTOR_TYPE + && useless_type_conversion_p (type, TREE_TYPE (optype))) + { + tree part_width = TYPE_SIZE (type); + tree index = bitsize_int (0); + return fold_build3 (BIT_FIELD_REF, type, op, part_width, index); + } + } + + /* ((foo*)&vectorfoo)[1] => BIT_FIELD_REF */ + if (TREE_CODE (sub) == POINTER_PLUS_EXPR + && TREE_CODE (TREE_OPERAND (sub, 1)) == INTEGER_CST) + { + tree op00 = TREE_OPERAND (sub, 0); + tree op01 = TREE_OPERAND (sub, 1); + tree op00type; + + STRIP_NOPS (op00); + op00type = TREE_TYPE (op00); + if (TREE_CODE (op00) == ADDR_EXPR + && TREE_CODE (TREE_TYPE (op00type)) == VECTOR_TYPE + && useless_type_conversion_p (type, TREE_TYPE (TREE_TYPE (op00type)))) + { + HOST_WIDE_INT offset = tree_low_cst (op01, 0); + tree part_width = TYPE_SIZE (type); + unsigned HOST_WIDE_INT part_widthi + = tree_low_cst (part_width, 0) / BITS_PER_UNIT; + unsigned HOST_WIDE_INT indexi = offset * BITS_PER_UNIT; + tree index = bitsize_int (indexi); + if (offset / part_widthi + <= TYPE_VECTOR_SUBPARTS (TREE_TYPE (op00type))) + return fold_build3 (BIT_FIELD_REF, type, TREE_OPERAND (op00, 0), + part_width, index); + } + } + + /* ((foo*)&complexfoo)[1] => __imag__ complexfoo */ + if (TREE_CODE (sub) == POINTER_PLUS_EXPR + && TREE_CODE (TREE_OPERAND (sub, 1)) == INTEGER_CST) + { + tree op00 = TREE_OPERAND (sub, 0); + tree op01 = TREE_OPERAND (sub, 1); + tree op00type; + + STRIP_NOPS (op00); + op00type = TREE_TYPE (op00); + if (TREE_CODE (op00) == ADDR_EXPR + && TREE_CODE (TREE_TYPE (op00type)) == COMPLEX_TYPE + && useless_type_conversion_p (type, TREE_TYPE (TREE_TYPE (op00type)))) + { + tree size = TYPE_SIZE_UNIT (type); + if (tree_int_cst_equal (size, op01)) + return fold_build1 (IMAGPART_EXPR, type, TREE_OPERAND (op00, 0)); + } } /* *(foo *)fooarrptr => (*fooarrptr)[0] */ if (TREE_CODE (TREE_TYPE (subtype)) == ARRAY_TYPE + && TREE_CODE (TYPE_SIZE (TREE_TYPE (TREE_TYPE (subtype)))) == INTEGER_CST && useless_type_conversion_p (type, TREE_TYPE (TREE_TYPE (subtype)))) { tree type_domain; @@ -3973,7 +4035,8 @@ gimple_fold_indirect_ref (tree t) type_domain = TYPE_DOMAIN (TREE_TYPE (sub)); if (type_domain && TYPE_MIN_VALUE (type_domain)) min_val = TYPE_MIN_VALUE (type_domain); - return build4 (ARRAY_REF, type, sub, min_val, NULL_TREE, NULL_TREE); + if (TREE_CODE (min_val) == INTEGER_CST) + return build4 (ARRAY_REF, type, sub, min_val, NULL_TREE, NULL_TREE); } return NULL_TREE; -- cgit v1.2.1 From 2527d57bd74cfb880c08fdce9bc909f63923322d Mon Sep 17 00:00:00 2001 From: jakub Date: Fri, 19 Feb 2010 09:50:30 +0000 Subject: PR middle-end/42233 * gimplify.c (gimple_boolify): For __builtin_expect call gimple_boolify also on its first argument. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156888 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 91dabd1aa92..618e3a66137 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -2720,6 +2720,32 @@ gimple_boolify (tree expr) tree type = TREE_TYPE (expr); location_t loc = EXPR_LOCATION (expr); + if (TREE_CODE (expr) == NE_EXPR + && TREE_CODE (TREE_OPERAND (expr, 0)) == CALL_EXPR + && integer_zerop (TREE_OPERAND (expr, 1))) + { + tree call = TREE_OPERAND (expr, 0); + tree fn = get_callee_fndecl (call); + + /* For __builtin_expect ((long) (x), y) recurse into x as well. */ + if (fn + && DECL_BUILT_IN_CLASS (fn) == BUILT_IN_NORMAL + && DECL_FUNCTION_CODE (fn) == BUILT_IN_EXPECT + && call_expr_nargs (call) == 2) + { + tree arg = CALL_EXPR_ARG (call, 0); + if (arg) + { + if (TREE_CODE (arg) == NOP_EXPR + && TREE_TYPE (arg) == TREE_TYPE (call)) + arg = TREE_OPERAND (arg, 0); + arg = gimple_boolify (arg); + CALL_EXPR_ARG (call, 0) + = fold_convert_loc (loc, TREE_TYPE (call), arg); + } + } + } + if (TREE_CODE (type) == BOOLEAN_TYPE) return expr; -- cgit v1.2.1 From 60d11eb61d10cf3e4eaa040c740cc028843cd35b Mon Sep 17 00:00:00 2001 From: jakub Date: Wed, 24 Feb 2010 10:50:13 +0000 Subject: PR debug/43150 * gimplify.c (gimplify_type_sizes): Clear DECL_IGNORED_P for VLA bounds even for -O+. * var-tracking.c (track_expr_p): If !need_rtl, don't mandate expr needs to have DECL_NAME set. * gcc.dg/guality/vla-1.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157032 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 618e3a66137..183874790be 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -7367,9 +7367,10 @@ gimplify_type_sizes (tree type, gimple_seq *list_p) /* These types may not have declarations, so handle them here. */ gimplify_type_sizes (TREE_TYPE (type), list_p); gimplify_type_sizes (TYPE_DOMAIN (type), list_p); - /* When not optimizing, ensure VLA bounds aren't removed. */ - if (!optimize - && TYPE_DOMAIN (type) + /* Ensure VLA bounds aren't removed, for -O0 they should be variables + with assigned stack slots, for -O1+ -g they should be tracked + by VTA. */ + if (TYPE_DOMAIN (type) && INTEGRAL_TYPE_P (TYPE_DOMAIN (type))) { t = TYPE_MIN_VALUE (TYPE_DOMAIN (type)); -- cgit v1.2.1 From 4847708aa3b5f0e9611dc2c914233db9bc1555d2 Mon Sep 17 00:00:00 2001 From: rguenth Date: Mon, 1 Mar 2010 15:43:32 +0000 Subject: 2010-03-01 Richard Guenther Martin Jambor PR middle-end/41250 * gimplify.c (gimplify_body): Unset DECL_HAS_VALUE_EXPR_P on gimplified parameters. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157148 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 183874790be..f87b5b57553 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -7535,11 +7535,21 @@ gimplify_body (tree *body_p, tree fndecl, bool do_parms) *body_p = NULL_TREE; /* If we had callee-copies statements, insert them at the beginning - of the function. */ + of the function and clear DECL_VALUE_EXPR_P on the parameters. */ if (!gimple_seq_empty_p (parm_stmts)) { + tree parm; + gimplify_seq_add_seq (&parm_stmts, gimple_bind_body (outer_bind)); gimple_bind_set_body (outer_bind, parm_stmts); + + for (parm = DECL_ARGUMENTS (current_function_decl); + parm; parm = TREE_CHAIN (parm)) + if (DECL_HAS_VALUE_EXPR_P (parm)) + { + DECL_HAS_VALUE_EXPR_P (parm) = 0; + DECL_IGNORED_P (parm) = 0; + } } if (nonlocal_vlas) -- cgit v1.2.1 From 26043330575a8b10f048afeaf7ef439cb4886631 Mon Sep 17 00:00:00 2001 From: jakub Date: Thu, 25 Mar 2010 08:16:18 +0000 Subject: PR c/43385 * gimplify.c (gimple_boolify): Only recurse on __builtin_expect argument if the argument is truth_value_p. * gcc.c-torture/execute/pr43385.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@157721 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index f87b5b57553..26906b0800a 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -2727,7 +2727,8 @@ gimple_boolify (tree expr) tree call = TREE_OPERAND (expr, 0); tree fn = get_callee_fndecl (call); - /* For __builtin_expect ((long) (x), y) recurse into x as well. */ + /* For __builtin_expect ((long) (x), y) recurse into x as well + if x is truth_value_p. */ if (fn && DECL_BUILT_IN_CLASS (fn) == BUILT_IN_NORMAL && DECL_FUNCTION_CODE (fn) == BUILT_IN_EXPECT @@ -2739,9 +2740,12 @@ gimple_boolify (tree expr) if (TREE_CODE (arg) == NOP_EXPR && TREE_TYPE (arg) == TREE_TYPE (call)) arg = TREE_OPERAND (arg, 0); - arg = gimple_boolify (arg); - CALL_EXPR_ARG (call, 0) - = fold_convert_loc (loc, TREE_TYPE (call), arg); + if (truth_value_p (TREE_CODE (arg))) + { + arg = gimple_boolify (arg); + CALL_EXPR_ARG (call, 0) + = fold_convert_loc (loc, TREE_TYPE (call), arg); + } } } } -- cgit v1.2.1 From 4cd5bb613c816cf996ca11a356cff1c7870806b0 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Thu, 8 Apr 2010 20:16:36 +0000 Subject: * tree.h (TREE_ADDRESSABLE): Document its effect for function types. * calls.c (expand_call): Pass the function type to aggregate_value_p. * function.c (aggregate_value_p): Do not honor DECL_BY_REFERENCE on the target function of a CALL_EXPR. Honor TREE_ADDRESSABLE on the function type instead. Reorder and simplify checks. * gimplify.c (gimplify_modify_expr_rhs) : New case. ada/ * gcc-interface/ada-tree.h (TYPE_RETURNS_UNCONSTRAINED_P): Rename into. (TYPE_RETURN_UNCONSTRAINED_P): ...this. (TYPE_RETURNS_BY_REF_P): Rename into. (TYPE_RETURN_BY_DIRECT_REF_P): ...this. (TYPE_RETURNS_BY_TARGET_PTR_P): Delete. * gcc-interface/gigi.h (create_subprog_type): Adjust parameter names. (build_return_expr): Likewise. * gcc-interface/decl.c (gnat_to_gnu_entity) : Rename local variables. If the return Mechanism is By_Reference, pass return_by_invisible_ref_p to create_subprog_type instead of toggling TREE_ADDRESSABLE. Test return_by_invisible_ref_p in order to annotate the mechanism. Use regular return for contrained types with non-static size and return by invisible reference for unconstrained return types with default discriminants. Update comment. * gcc-interface/trans.c (Subprogram_Body_to_gnu): If the function returns by invisible reference, turn the RESULT_DECL into a pointer. Do not handle DECL_BY_REF_P in the CICO case here. (call_to_gnu): Remove code handling return by target pointer. For a function call, if the return type has non-constant size, generate the assignment with an INIT_EXPR. (gnat_to_gnu) : Remove dead code in the CICO case. If the function returns by invisible reference, build the copy return operation manually. (add_decl_expr): Initialize the variable with an INIT_EXPR. * gcc-interface/utils.c (create_subprog_type): Adjust parameter names. Adjust for renaming of macros. Copy the node only when necessary. (create_subprog_decl): Do not toggle TREE_ADDRESSABLE on the return type, only change DECL_BY_REFERENCE on the RETURN_DECL. (convert_from_reference): Delete. (is_byref_result): Likewise. (gnat_genericize_r): Likewise. (gnat_genericize): Likewise. (end_subprog_body): Do not call gnat_genericize. * gcc-interface/utils2.c (build_binary_op) : New case. (build_return_expr): Adjust parameter names, logic and comment. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158139 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 26906b0800a..bfe82dd6ad2 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -4278,6 +4278,18 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, ret = GS_UNHANDLED; break; + case WITH_SIZE_EXPR: + /* Likewise for calls that return an aggregate of non-constant size, + since we would not be able to generate a temporary at all. */ + if (TREE_CODE (TREE_OPERAND (*from_p, 0)) == CALL_EXPR) + { + *from_p = TREE_OPERAND (*from_p, 0); + ret = GS_OK; + } + else + ret = GS_UNHANDLED; + break; + /* If we're initializing from a container, push the initialization inside it. */ case CLEANUP_POINT_EXPR: -- cgit v1.2.1 From 30d12889964341eed3f23cab1dbb43d122634784 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Mon, 12 Apr 2010 10:00:13 +0000 Subject: * expr.c (categorize_ctor_elements_1): Properly count sub-elements of non-constant aggregate elements. * gimplify.c (gimplify_init_constructor): Do not pre-evaluate if this is a real initialization. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158219 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index bfe82dd6ad2..a9eed84669f 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -3793,10 +3793,10 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, if (notify_temp_creation) return GS_OK; - /* If there are nonzero elements, pre-evaluate to capture elements - overlapping with the lhs into temporaries. We must do this before - clearing to fetch the values before they are zeroed-out. */ - if (num_nonzero_elements > 0) + /* If there are nonzero elements and if needed, pre-evaluate to capture + elements overlapping with the lhs into temporaries. We must do this + before clearing to fetch the values before they are zeroed-out. */ + if (num_nonzero_elements > 0 && TREE_CODE (*expr_p) != INIT_EXPR) { preeval_data.lhs_base_decl = get_base_address (object); if (!DECL_P (preeval_data.lhs_base_decl)) -- cgit v1.2.1 From 2ac51e484bc36b77832c9cde011095e60c1e08f8 Mon Sep 17 00:00:00 2001 From: jamborm Date: Mon, 19 Apr 2010 17:58:54 +0000 Subject: 2010-04-19 Martin Jambor * gimple.h (create_tmp_reg): Declare. * gimplify.c (create_tmp_reg): New function. (gimplify_return_expr): Use create_tmp_reg. (gimplify_omp_atomic): Likewise. (gimple_regimplify_operands): Likewise. * tree-dfa.c (make_rename_temp): Likewise. * tree-predcom.c (predcom_tmp_var): Likewise. (reassociate_to_the_same_stmt): Likewise. * tree-sra.c (replace_uses_with_default_def_ssa_name): Likewise. (get_replaced_param_substitute): Likewise. * tree-ssa-phiprop.c (phiprop_insert_phi): Likewise. * tree-ssa-phiopt.c (cond_store_replacement): Likewise. * tree-ssa-pre.c (get_representative_for): Likewise. (create_expression_by_pieces): Likewise. * tree-tailcall.c (adjust_return_value_with_ops): Likewise. (create_tailcall_accumulator): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158523 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index a9eed84669f..287d62168f0 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -508,6 +508,23 @@ create_tmp_var (tree type, const char *prefix) return tmp_var; } +/* Create a new temporary variable declaration of type TYPE by calling + create_tmp_var and if TYPE is a vector or a complex number, mark the new + temporary as gimple register. */ + +tree +create_tmp_reg (tree type, const char *prefix) +{ + tree tmp; + + tmp = create_tmp_var (type, prefix); + if (TREE_CODE (type) == COMPLEX_TYPE + || TREE_CODE (type) == VECTOR_TYPE) + DECL_GIMPLE_REG_P (tmp) = 1; + + return tmp; +} + /* Create a temporary with a name derived from VAL. Subroutine of lookup_tmp_var; nobody else should call this function. */ @@ -1219,10 +1236,7 @@ gimplify_return_expr (tree stmt, gimple_seq *pre_p) result = gimplify_ctxp->return_temp; else { - result = create_tmp_var (TREE_TYPE (result_decl), NULL); - if (TREE_CODE (TREE_TYPE (result)) == COMPLEX_TYPE - || TREE_CODE (TREE_TYPE (result)) == VECTOR_TYPE) - DECL_GIMPLE_REG_P (result) = 1; + result = create_tmp_reg (TREE_TYPE (result_decl), NULL); /* ??? With complex control flow (usually involving abnormal edges), we can wind up warning about an uninitialized value for this. Due @@ -6351,9 +6365,7 @@ gimplify_omp_atomic (tree *expr_p, gimple_seq *pre_p) tree type = TYPE_MAIN_VARIANT (TREE_TYPE (TREE_TYPE (addr))); tree tmp_load; - tmp_load = create_tmp_var (type, NULL); - if (TREE_CODE (type) == COMPLEX_TYPE || TREE_CODE (type) == VECTOR_TYPE) - DECL_GIMPLE_REG_P (tmp_load) = 1; + tmp_load = create_tmp_reg (type, NULL); if (goa_stabilize_expr (&rhs, pre_p, addr, tmp_load) < 0) return GS_ERROR; @@ -7828,11 +7840,8 @@ gimple_regimplify_operands (gimple stmt, gimple_stmt_iterator *gsi_p) } if (need_temp) { - tree temp = create_tmp_var (TREE_TYPE (lhs), NULL); + tree temp = create_tmp_reg (TREE_TYPE (lhs), NULL); - if (TREE_CODE (TREE_TYPE (lhs)) == COMPLEX_TYPE - || TREE_CODE (TREE_TYPE (lhs)) == VECTOR_TYPE) - DECL_GIMPLE_REG_P (temp) = 1; if (TREE_CODE (orig_lhs) == SSA_NAME) orig_lhs = SSA_NAME_VAR (orig_lhs); -- cgit v1.2.1 From 71302876ceff89d73ccd7188a1284bdcdb9cfbf1 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Mon, 26 Apr 2010 16:32:45 +0000 Subject: * gimplify.c (gimplify_cond_expr): Use THEN_ and ELSE_ local variables. Use VOID_TYPE_P for all void type tests. Adjust TYPE variable instead of shadowing it. Fix comments. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158737 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 66 +++++++++++++++++++++++++++------------------------------- 1 file changed, 31 insertions(+), 35 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 287d62168f0..2f4e12067e0 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -2867,71 +2867,67 @@ static enum gimplify_status gimplify_cond_expr (tree *expr_p, gimple_seq *pre_p, fallback_t fallback) { tree expr = *expr_p; - tree tmp, type, arm1, arm2; + tree type = TREE_TYPE (expr); + location_t loc = EXPR_LOCATION (expr); + tree tmp, arm1, arm2; enum gimplify_status ret; tree label_true, label_false, label_cont; bool have_then_clause_p, have_else_clause_p; gimple gimple_cond; enum tree_code pred_code; gimple_seq seq = NULL; - location_t loc = EXPR_LOCATION (*expr_p); - - type = TREE_TYPE (expr); /* If this COND_EXPR has a value, copy the values into a temporary within the arms. */ - if (! VOID_TYPE_P (type)) + if (!VOID_TYPE_P (type)) { + tree then_ = TREE_OPERAND (expr, 1), else_ = TREE_OPERAND (expr, 2); tree result; - /* If an rvalue is ok or we do not require an lvalue, avoid creating - an addressable temporary. */ - if (((fallback & fb_rvalue) - || !(fallback & fb_lvalue)) + /* If either an rvalue is ok or we do not require an lvalue, create the + temporary. But we cannot do that if the type is addressable. */ + if (((fallback & fb_rvalue) || !(fallback & fb_lvalue)) && !TREE_ADDRESSABLE (type)) { if (gimplify_ctxp->allow_rhs_cond_expr /* If either branch has side effects or could trap, it can't be evaluated unconditionally. */ - && !TREE_SIDE_EFFECTS (TREE_OPERAND (*expr_p, 1)) - && !generic_expr_could_trap_p (TREE_OPERAND (*expr_p, 1)) - && !TREE_SIDE_EFFECTS (TREE_OPERAND (*expr_p, 2)) - && !generic_expr_could_trap_p (TREE_OPERAND (*expr_p, 2))) + && !TREE_SIDE_EFFECTS (then_) + && !generic_expr_could_trap_p (then_) + && !TREE_SIDE_EFFECTS (else_) + && !generic_expr_could_trap_p (else_)) return gimplify_pure_cond_expr (expr_p, pre_p); - result = tmp = create_tmp_var (TREE_TYPE (expr), "iftmp"); - ret = GS_ALL_DONE; + tmp = create_tmp_var (type, "iftmp"); + result = tmp; } + + /* Otherwise, only create and copy references to the values. */ else { - tree type = build_pointer_type (TREE_TYPE (expr)); + type = build_pointer_type (type); - if (TREE_TYPE (TREE_OPERAND (expr, 1)) != void_type_node) - TREE_OPERAND (expr, 1) = - build_fold_addr_expr_loc (loc, TREE_OPERAND (expr, 1)); + if (!VOID_TYPE_P (TREE_TYPE (then_))) + then_ = build_fold_addr_expr_loc (loc, then_); - if (TREE_TYPE (TREE_OPERAND (expr, 2)) != void_type_node) - TREE_OPERAND (expr, 2) = - build_fold_addr_expr_loc (loc, TREE_OPERAND (expr, 2)); + if (!VOID_TYPE_P (TREE_TYPE (else_))) + else_ = build_fold_addr_expr_loc (loc, else_); + + expr + = build3 (COND_EXPR, type, TREE_OPERAND (expr, 0), then_, else_); tmp = create_tmp_var (type, "iftmp"); - - expr = build3 (COND_EXPR, void_type_node, TREE_OPERAND (expr, 0), - TREE_OPERAND (expr, 1), TREE_OPERAND (expr, 2)); - result = build_fold_indirect_ref_loc (loc, tmp); } - /* Build the then clause, 't1 = a;'. But don't build an assignment - if this branch is void; in C++ it can be, if it's a throw. */ - if (TREE_TYPE (TREE_OPERAND (expr, 1)) != void_type_node) - TREE_OPERAND (expr, 1) - = build2 (MODIFY_EXPR, TREE_TYPE (tmp), tmp, TREE_OPERAND (expr, 1)); + /* Build the new then clause, `tmp = then_;'. But don't build the + assignment if the value is void; in C++ it can be if it's a throw. */ + if (!VOID_TYPE_P (TREE_TYPE (then_))) + TREE_OPERAND (expr, 1) = build2 (MODIFY_EXPR, type, tmp, then_); - /* Build the else clause, 't1 = b;'. */ - if (TREE_TYPE (TREE_OPERAND (expr, 2)) != void_type_node) - TREE_OPERAND (expr, 2) - = build2 (MODIFY_EXPR, TREE_TYPE (tmp), tmp, TREE_OPERAND (expr, 2)); + /* Similarly, build the new else clause, `tmp = else_;'. */ + if (!VOID_TYPE_P (TREE_TYPE (else_))) + TREE_OPERAND (expr, 2) = build2 (MODIFY_EXPR, type, tmp, else_); TREE_TYPE (expr) = void_type_node; recalculate_side_effects (expr); -- cgit v1.2.1 From ecba073ffa9d08ce731cd306ccebac9ca57af69b Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Wed, 28 Apr 2010 19:11:50 +0000 Subject: Uniquization of constants at the Tree level * tree.h (DECL_IN_CONSTANT_POOL): New macro (tree_decl_with_vis): Add in_constant_pool bit, move shadowed_for_var_p bit to the end. (tree_output_constant_def): Declare. * gimplify.c (gimplify_init_constructor): When using block copy, uniquize the constant constructor on the RHS. * lto-streamer-in.c (unpack_ts_decl_with_vis_value_fields): Deal with DECL_IN_CONSTANT_POOL flag. * lto-streamer-out.c (pack_ts_decl_with_vis_value_fields): Likewise. * varasm.c (make_decl_rtl): Deal with variables belonging to the global constant pool. (assemble_variable): Deal with symbols belonging to the tree constant pool. (get_constant_section): Add ALIGN parameter and simplify. (build_constant_desc): Build a VAR_DECL and attach it to the symbol. (assemble_constant_contents): Use the expression of the VAR_DECL. (output_constant_def_contents): Use the alignment of the VAR_DECL. (tree_output_constant_def): New global function. (mark_constant): Use the expression of the VAR_DECL. (place_block_symbol): Use the alignment of the VAR_DECL and the size of its expression. (output_object_block): Likewise and assemble the expression. ada/ * gcc-interface/trans.c (gnat_gimplify_expr) : Uniquize constant constructors before taking their address. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@158838 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 2f4e12067e0..68148a6a7d9 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -3758,25 +3758,11 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, && num_nonzero_elements > 1 && !can_move_by_pieces (size, align)) { - tree new_tree; - if (notify_temp_creation) return GS_ERROR; - new_tree = create_tmp_var_raw (type, "C"); - - gimple_add_tmp_var (new_tree); - TREE_STATIC (new_tree) = 1; - TREE_READONLY (new_tree) = 1; - DECL_INITIAL (new_tree) = ctor; - if (align > DECL_ALIGN (new_tree)) - { - DECL_ALIGN (new_tree) = align; - DECL_USER_ALIGN (new_tree) = 1; - } - walk_tree (&DECL_INITIAL (new_tree), force_labels_r, NULL, NULL); - - TREE_OPERAND (*expr_p, 1) = new_tree; + walk_tree (&ctor, force_labels_r, NULL, NULL); + TREE_OPERAND (*expr_p, 1) = tree_output_constant_def (ctor); /* This is no longer an assignment of a CONSTRUCTOR, but we still may have processing to do on the LHS. So -- 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/gimplify.c | 1 - 1 file changed, 1 deletion(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 68148a6a7d9..b46072506ee 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -27,7 +27,6 @@ along with GCC; see the file COPYING3. If not see #include "tm.h" #include "tree.h" #include "rtl.h" -#include "varray.h" #include "gimple.h" #include "tree-iterator.h" #include "tree-inline.h" -- cgit v1.2.1 From eda3733553b5ca1932c5bf3313b3492cf34cecaf Mon Sep 17 00:00:00 2001 From: jason Date: Wed, 5 May 2010 16:32:20 +0000 Subject: PR c++/43787 gcc: * gimplify.c (gimplify_expr): Keep working if gimplify_modify_expr returns GS_OK. (gimplify_modify_expr_rhs): Return GS_OK if anything changed. gcc/cp: * cp-gimplify.c (cp_gimplify_expr): Remove copies of empty classes. * call.c (build_over_call): Don't try to avoid INIT_EXPR copies here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159072 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 429 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 218 insertions(+), 211 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index b46072506ee..8f7ff89d44c 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -4089,253 +4089,252 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, gimple_seq *pre_p, gimple_seq *post_p, bool want_value) { - enum gimplify_status ret = GS_OK; + enum gimplify_status ret = GS_UNHANDLED; + bool changed; - while (ret != GS_UNHANDLED) - switch (TREE_CODE (*from_p)) - { - case VAR_DECL: - /* If we're assigning from a read-only variable initialized with - a constructor, do the direct assignment from the constructor, - but only if neither source nor target are volatile since this - latter assignment might end up being done on a per-field basis. */ - if (DECL_INITIAL (*from_p) - && TREE_READONLY (*from_p) - && !TREE_THIS_VOLATILE (*from_p) - && !TREE_THIS_VOLATILE (*to_p) - && TREE_CODE (DECL_INITIAL (*from_p)) == CONSTRUCTOR) + do + { + changed = false; + switch (TREE_CODE (*from_p)) + { + case VAR_DECL: + /* If we're assigning from a read-only variable initialized with + a constructor, do the direct assignment from the constructor, + but only if neither source nor target are volatile since this + latter assignment might end up being done on a per-field basis. */ + if (DECL_INITIAL (*from_p) + && TREE_READONLY (*from_p) + && !TREE_THIS_VOLATILE (*from_p) + && !TREE_THIS_VOLATILE (*to_p) + && TREE_CODE (DECL_INITIAL (*from_p)) == CONSTRUCTOR) + { + tree old_from = *from_p; + enum gimplify_status subret; + + /* Move the constructor into the RHS. */ + *from_p = unshare_expr (DECL_INITIAL (*from_p)); + + /* Let's see if gimplify_init_constructor will need to put + it in memory. */ + subret = gimplify_init_constructor (expr_p, NULL, NULL, + false, true); + if (subret == GS_ERROR) + { + /* If so, revert the change. */ + *from_p = old_from; + } + else + { + ret = GS_OK; + changed = true; + } + } + break; + case INDIRECT_REF: { - tree old_from = *from_p; + /* If we have code like - /* Move the constructor into the RHS. */ - *from_p = unshare_expr (DECL_INITIAL (*from_p)); + *(const A*)(A*)&x - /* Let's see if gimplify_init_constructor will need to put - it in memory. If so, revert the change. */ - ret = gimplify_init_constructor (expr_p, NULL, NULL, false, true); - if (ret == GS_ERROR) + where the type of "x" is a (possibly cv-qualified variant + of "A"), treat the entire expression as identical to "x". + This kind of code arises in C++ when an object is bound + to a const reference, and if "x" is a TARGET_EXPR we want + to take advantage of the optimization below. */ + tree t = gimple_fold_indirect_ref_rhs (TREE_OPERAND (*from_p, 0)); + if (t) { - *from_p = old_from; - /* Fall through. */ + *from_p = t; + ret = GS_OK; + changed = true; } - else + break; + } + + case TARGET_EXPR: + { + /* If we are initializing something from a TARGET_EXPR, strip the + TARGET_EXPR and initialize it directly, if possible. This can't + be done if the initializer is void, since that implies that the + temporary is set in some non-trivial way. + + ??? What about code that pulls out the temp and uses it + elsewhere? I think that such code never uses the TARGET_EXPR as + an initializer. If I'm wrong, we'll die because the temp won't + have any RTL. In that case, I guess we'll need to replace + references somehow. */ + tree init = TARGET_EXPR_INITIAL (*from_p); + + if (init + && !VOID_TYPE_P (TREE_TYPE (init))) { + *from_p = init; ret = GS_OK; - break; + changed = true; } } - ret = GS_UNHANDLED; - break; - case INDIRECT_REF: - { - /* If we have code like + break; - *(const A*)(A*)&x + case COMPOUND_EXPR: + /* Remove any COMPOUND_EXPR in the RHS so the following cases will be + caught. */ + gimplify_compound_expr (from_p, pre_p, true); + ret = GS_OK; + changed = true; + break; - where the type of "x" is a (possibly cv-qualified variant - of "A"), treat the entire expression as identical to "x". - This kind of code arises in C++ when an object is bound - to a const reference, and if "x" is a TARGET_EXPR we want - to take advantage of the optimization below. */ - tree t = gimple_fold_indirect_ref_rhs (TREE_OPERAND (*from_p, 0)); - if (t) + case CONSTRUCTOR: + /* If we're initializing from a CONSTRUCTOR, break this into + individual MODIFY_EXPRs. */ + return gimplify_init_constructor (expr_p, pre_p, post_p, want_value, + false); + + case COND_EXPR: + /* If we're assigning to a non-register type, push the assignment + down into the branches. This is mandatory for ADDRESSABLE types, + since we cannot generate temporaries for such, but it saves a + copy in other cases as well. */ + if (!is_gimple_reg_type (TREE_TYPE (*from_p))) { - *from_p = t; - ret = GS_OK; + /* This code should mirror the code in gimplify_cond_expr. */ + enum tree_code code = TREE_CODE (*expr_p); + tree cond = *from_p; + tree result = *to_p; + + ret = gimplify_expr (&result, pre_p, post_p, + is_gimple_lvalue, fb_lvalue); + if (ret != GS_ERROR) + ret = GS_OK; + + if (TREE_TYPE (TREE_OPERAND (cond, 1)) != void_type_node) + TREE_OPERAND (cond, 1) + = build2 (code, void_type_node, result, + TREE_OPERAND (cond, 1)); + if (TREE_TYPE (TREE_OPERAND (cond, 2)) != void_type_node) + TREE_OPERAND (cond, 2) + = build2 (code, void_type_node, unshare_expr (result), + TREE_OPERAND (cond, 2)); + + TREE_TYPE (cond) = void_type_node; + recalculate_side_effects (cond); + + if (want_value) + { + gimplify_and_add (cond, pre_p); + *expr_p = unshare_expr (result); + } + else + *expr_p = cond; + return ret; } - else - ret = GS_UNHANDLED; break; - } - case TARGET_EXPR: - { - /* If we are initializing something from a TARGET_EXPR, strip the - TARGET_EXPR and initialize it directly, if possible. This can't - be done if the initializer is void, since that implies that the - temporary is set in some non-trivial way. - - ??? What about code that pulls out the temp and uses it - elsewhere? I think that such code never uses the TARGET_EXPR as - an initializer. If I'm wrong, we'll die because the temp won't - have any RTL. In that case, I guess we'll need to replace - references somehow. */ - tree init = TARGET_EXPR_INITIAL (*from_p); - - if (init - && !VOID_TYPE_P (TREE_TYPE (init))) + case CALL_EXPR: + /* For calls that return in memory, give *to_p as the CALL_EXPR's + return slot so that we don't generate a temporary. */ + if (!CALL_EXPR_RETURN_SLOT_OPT (*from_p) + && aggregate_value_p (*from_p, *from_p)) { - *from_p = init; - ret = GS_OK; + bool use_target; + + if (!(rhs_predicate_for (*to_p))(*from_p)) + /* If we need a temporary, *to_p isn't accurate. */ + use_target = false; + else if (TREE_CODE (*to_p) == RESULT_DECL + && DECL_NAME (*to_p) == NULL_TREE + && needs_to_live_in_memory (*to_p)) + /* It's OK to use the return slot directly unless it's an NRV. */ + use_target = true; + else if (is_gimple_reg_type (TREE_TYPE (*to_p)) + || (DECL_P (*to_p) && DECL_REGISTER (*to_p))) + /* Don't force regs into memory. */ + use_target = false; + else if (TREE_CODE (*expr_p) == INIT_EXPR) + /* It's OK to use the target directly if it's being + initialized. */ + use_target = true; + else if (!is_gimple_non_addressable (*to_p)) + /* Don't use the original target if it's already addressable; + if its address escapes, and the called function uses the + NRV optimization, a conforming program could see *to_p + change before the called function returns; see c++/19317. + When optimizing, the return_slot pass marks more functions + as safe after we have escape info. */ + use_target = false; + else + use_target = true; + + if (use_target) + { + CALL_EXPR_RETURN_SLOT_OPT (*from_p) = 1; + mark_addressable (*to_p); + } } - else - ret = GS_UNHANDLED; - } - break; + break; - case COMPOUND_EXPR: - /* Remove any COMPOUND_EXPR in the RHS so the following cases will be - caught. */ - gimplify_compound_expr (from_p, pre_p, true); - ret = GS_OK; - break; + case WITH_SIZE_EXPR: + /* Likewise for calls that return an aggregate of non-constant size, + since we would not be able to generate a temporary at all. */ + if (TREE_CODE (TREE_OPERAND (*from_p, 0)) == CALL_EXPR) + { + *from_p = TREE_OPERAND (*from_p, 0); + ret = GS_OK; + changed = true; + } + break; - case CONSTRUCTOR: - /* If we're initializing from a CONSTRUCTOR, break this into - individual MODIFY_EXPRs. */ - return gimplify_init_constructor (expr_p, pre_p, post_p, want_value, - false); - - case COND_EXPR: - /* If we're assigning to a non-register type, push the assignment - down into the branches. This is mandatory for ADDRESSABLE types, - since we cannot generate temporaries for such, but it saves a - copy in other cases as well. */ - if (!is_gimple_reg_type (TREE_TYPE (*from_p))) + /* If we're initializing from a container, push the initialization + inside it. */ + case CLEANUP_POINT_EXPR: + case BIND_EXPR: + case STATEMENT_LIST: { - /* This code should mirror the code in gimplify_cond_expr. */ - enum tree_code code = TREE_CODE (*expr_p); - tree cond = *from_p; - tree result = *to_p; + tree wrap = *from_p; + tree t; - ret = gimplify_expr (&result, pre_p, post_p, - is_gimple_lvalue, fb_lvalue); + ret = gimplify_expr (to_p, pre_p, post_p, is_gimple_min_lval, + fb_lvalue); if (ret != GS_ERROR) ret = GS_OK; - if (TREE_TYPE (TREE_OPERAND (cond, 1)) != void_type_node) - TREE_OPERAND (cond, 1) - = build2 (code, void_type_node, result, - TREE_OPERAND (cond, 1)); - if (TREE_TYPE (TREE_OPERAND (cond, 2)) != void_type_node) - TREE_OPERAND (cond, 2) - = build2 (code, void_type_node, unshare_expr (result), - TREE_OPERAND (cond, 2)); - - TREE_TYPE (cond) = void_type_node; - recalculate_side_effects (cond); + t = voidify_wrapper_expr (wrap, *expr_p); + gcc_assert (t == *expr_p); if (want_value) { - gimplify_and_add (cond, pre_p); - *expr_p = unshare_expr (result); + gimplify_and_add (wrap, pre_p); + *expr_p = unshare_expr (*to_p); } else - *expr_p = cond; - return ret; + *expr_p = wrap; + return GS_OK; } - else - ret = GS_UNHANDLED; - break; - case CALL_EXPR: - /* For calls that return in memory, give *to_p as the CALL_EXPR's - return slot so that we don't generate a temporary. */ - if (!CALL_EXPR_RETURN_SLOT_OPT (*from_p) - && aggregate_value_p (*from_p, *from_p)) + case COMPOUND_LITERAL_EXPR: { - bool use_target; - - if (!(rhs_predicate_for (*to_p))(*from_p)) - /* If we need a temporary, *to_p isn't accurate. */ - use_target = false; - else if (TREE_CODE (*to_p) == RESULT_DECL - && DECL_NAME (*to_p) == NULL_TREE - && needs_to_live_in_memory (*to_p)) - /* It's OK to use the return slot directly unless it's an NRV. */ - use_target = true; - else if (is_gimple_reg_type (TREE_TYPE (*to_p)) - || (DECL_P (*to_p) && DECL_REGISTER (*to_p))) - /* Don't force regs into memory. */ - use_target = false; - else if (TREE_CODE (*expr_p) == INIT_EXPR) - /* It's OK to use the target directly if it's being - initialized. */ - use_target = true; - else if (!is_gimple_non_addressable (*to_p)) - /* Don't use the original target if it's already addressable; - if its address escapes, and the called function uses the - NRV optimization, a conforming program could see *to_p - change before the called function returns; see c++/19317. - When optimizing, the return_slot pass marks more functions - as safe after we have escape info. */ - use_target = false; - else - use_target = true; - - if (use_target) + tree complit = TREE_OPERAND (*expr_p, 1); + tree decl_s = COMPOUND_LITERAL_EXPR_DECL_EXPR (complit); + tree decl = DECL_EXPR_DECL (decl_s); + tree init = DECL_INITIAL (decl); + + /* struct T x = (struct T) { 0, 1, 2 } can be optimized + into struct T x = { 0, 1, 2 } if the address of the + compound literal has never been taken. */ + if (!TREE_ADDRESSABLE (complit) + && !TREE_ADDRESSABLE (decl) + && init) { - CALL_EXPR_RETURN_SLOT_OPT (*from_p) = 1; - mark_addressable (*to_p); + *expr_p = copy_node (*expr_p); + TREE_OPERAND (*expr_p, 1) = init; + return GS_OK; } } - ret = GS_UNHANDLED; - break; - - case WITH_SIZE_EXPR: - /* Likewise for calls that return an aggregate of non-constant size, - since we would not be able to generate a temporary at all. */ - if (TREE_CODE (TREE_OPERAND (*from_p, 0)) == CALL_EXPR) - { - *from_p = TREE_OPERAND (*from_p, 0); - ret = GS_OK; - } - else - ret = GS_UNHANDLED; - break; - - /* If we're initializing from a container, push the initialization - inside it. */ - case CLEANUP_POINT_EXPR: - case BIND_EXPR: - case STATEMENT_LIST: - { - tree wrap = *from_p; - tree t; - - ret = gimplify_expr (to_p, pre_p, post_p, is_gimple_min_lval, - fb_lvalue); - if (ret != GS_ERROR) - ret = GS_OK; - - t = voidify_wrapper_expr (wrap, *expr_p); - gcc_assert (t == *expr_p); - - if (want_value) - { - gimplify_and_add (wrap, pre_p); - *expr_p = unshare_expr (*to_p); - } - else - *expr_p = wrap; - return GS_OK; - } - - case COMPOUND_LITERAL_EXPR: - { - tree complit = TREE_OPERAND (*expr_p, 1); - tree decl_s = COMPOUND_LITERAL_EXPR_DECL_EXPR (complit); - tree decl = DECL_EXPR_DECL (decl_s); - tree init = DECL_INITIAL (decl); - - /* struct T x = (struct T) { 0, 1, 2 } can be optimized - into struct T x = { 0, 1, 2 } if the address of the - compound literal has never been taken. */ - if (!TREE_ADDRESSABLE (complit) - && !TREE_ADDRESSABLE (decl) - && init) - { - *expr_p = copy_node (*expr_p); - TREE_OPERAND (*expr_p, 1) = init; - return GS_OK; - } + default: + break; } - - default: - ret = GS_UNHANDLED; - break; - } + } + while (changed); return ret; } @@ -6616,8 +6615,16 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, case MODIFY_EXPR: case INIT_EXPR: - ret = gimplify_modify_expr (expr_p, pre_p, post_p, - fallback != fb_none); + { + tree from = TREE_OPERAND (*expr_p, 1); + ret = gimplify_modify_expr (expr_p, pre_p, post_p, + fallback != fb_none); + /* Don't let the end of loop logic change GS_OK into GS_ALL_DONE + if the RHS has changed. */ + if (ret == GS_OK && *expr_p == save_expr + && TREE_OPERAND (*expr_p, 1) != from) + continue; + } break; case TRUTH_ANDIF_EXPR: -- cgit v1.2.1 From 646150d6b528b6aa85cef35feb6c7deb408610a7 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Wed, 5 May 2010 17:48:01 +0000 Subject: * gimplify.c (gimplify_return_expr): Gimplify the size expressions of a variable-sized RESULT_DECL. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159074 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 8f7ff89d44c..8d2bc582a7a 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1228,9 +1228,22 @@ gimplify_return_expr (tree stmt, gimple_seq *pre_p) hard_function_value generates a PARALLEL, we'll die during normal expansion of structure assignments; there's special code in expand_return to handle this case that does not exist in expand_expr. */ - if (!result_decl - || aggregate_value_p (result_decl, TREE_TYPE (current_function_decl))) - result = result_decl; + if (!result_decl) + result = NULL_TREE; + else if (aggregate_value_p (result_decl, TREE_TYPE (current_function_decl))) + { + if (TREE_CODE (DECL_SIZE (result_decl)) != INTEGER_CST) + { + if (!TYPE_SIZES_GIMPLIFIED (TREE_TYPE (result_decl))) + gimplify_type_sizes (TREE_TYPE (result_decl), pre_p); + /* Note that we don't use gimplify_vla_decl because the RESULT_DECL + should be effectively allocated by the caller, i.e. all calls to + this function must be subject to the Return Slot Optimization. */ + gimplify_one_sizepos (&DECL_SIZE (result_decl), pre_p); + gimplify_one_sizepos (&DECL_SIZE_UNIT (result_decl), pre_p); + } + result = result_decl; + } else if (gimplify_ctxp->return_temp) result = gimplify_ctxp->return_temp; else -- cgit v1.2.1 From e8f78e99274dd63bcfcbd5f0430248b412018482 Mon Sep 17 00:00:00 2001 From: jason Date: Thu, 6 May 2010 19:46:03 +0000 Subject: * gimplify.c (gimplify_modify_expr_rhs): Don't return GS_OK for stripping WITH_SIZE_EXPR. (gimplify_expr) [MODIFY_EXPR]: Trust GS_OK even if the rhs didn't change. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159124 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 8d2bc582a7a..51ec4b5633d 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -4291,7 +4291,10 @@ gimplify_modify_expr_rhs (tree *expr_p, tree *from_p, tree *to_p, if (TREE_CODE (TREE_OPERAND (*from_p, 0)) == CALL_EXPR) { *from_p = TREE_OPERAND (*from_p, 0); - ret = GS_OK; + /* We don't change ret in this case because the + WITH_SIZE_EXPR might have been added in + gimplify_modify_expr, so returning GS_OK would lead to an + infinite loop. */ changed = true; } break; @@ -6628,16 +6631,12 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, case MODIFY_EXPR: case INIT_EXPR: - { - tree from = TREE_OPERAND (*expr_p, 1); - ret = gimplify_modify_expr (expr_p, pre_p, post_p, - fallback != fb_none); - /* Don't let the end of loop logic change GS_OK into GS_ALL_DONE - if the RHS has changed. */ - if (ret == GS_OK && *expr_p == save_expr - && TREE_OPERAND (*expr_p, 1) != from) - continue; - } + ret = gimplify_modify_expr (expr_p, pre_p, post_p, + fallback != fb_none); + /* Don't let the end of loop logic change GS_OK to GS_ALL_DONE; + gimplify_modify_expr_rhs might have changed the RHS. */ + if (ret == GS_OK && *expr_p) + continue; break; case TRUTH_ANDIF_EXPR: -- cgit v1.2.1 From 5f52d2e22c7355508a5a06812bf150125cbe5e89 Mon Sep 17 00:00:00 2001 From: jason Date: Thu, 6 May 2010 19:46:14 +0000 Subject: gcc: * gimplify.c (gimplify_expr): Set GS_ALL_DONE when appropriate. Don't change GS_OK to GS_ALL_DONE. Make sure that all cases set ret appropriately. (gimplify_compound_lval): Return GS_ALL_DONE as appropriate. gcc/cp: * semantics.c (simplify_aggr_init_expr): Use INIT_EXPR. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159125 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 51ec4b5633d..f6266e10cbc 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1914,9 +1914,10 @@ gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, { tree *p; VEC(tree,heap) *stack; - enum gimplify_status ret = GS_OK, tret; + enum gimplify_status ret = GS_ALL_DONE, tret; int i; location_t loc = EXPR_LOCATION (*expr_p); + tree expr = *expr_p; /* Create a stack of the subexpressions so later we can walk them in order from inner to outer. */ @@ -2070,11 +2071,12 @@ gimplify_compound_lval (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, if ((fallback & fb_rvalue) && TREE_CODE (*expr_p) == COMPONENT_REF) { canonicalize_component_ref (expr_p); - ret = MIN (ret, GS_OK); } VEC_free (tree, heap, stack); + gcc_assert (*expr_p == expr || ret != GS_ALL_DONE); + return ret; } @@ -6567,7 +6569,8 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, else if (ret != GS_UNHANDLED) break; - ret = GS_OK; + /* Make sure that all the cases set 'ret' appropriately. */ + ret = GS_UNHANDLED; switch (TREE_CODE (*expr_p)) { /* First deal with the special cases. */ @@ -6601,6 +6604,7 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, { *expr_p = get_initialized_tmp_var (*expr_p, pre_p, post_p); mark_addressable (*expr_p); + ret = GS_OK; } break; @@ -6615,6 +6619,7 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, { *expr_p = get_initialized_tmp_var (*expr_p, pre_p, post_p); mark_addressable (*expr_p); + ret = GS_OK; } break; @@ -6633,10 +6638,6 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, case INIT_EXPR: ret = gimplify_modify_expr (expr_p, pre_p, post_p, fallback != fb_none); - /* Don't let the end of loop logic change GS_OK to GS_ALL_DONE; - gimplify_modify_expr_rhs might have changed the RHS. */ - if (ret == GS_OK && *expr_p) - continue; break; case TRUTH_ANDIF_EXPR: @@ -6680,6 +6681,7 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, /* Just strip a conversion to void (or in void context) and try again. */ *expr_p = TREE_OPERAND (*expr_p, 0); + ret = GS_OK; break; } @@ -6700,7 +6702,10 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, case INDIRECT_REF: *expr_p = fold_indirect_ref_loc (input_location, *expr_p); if (*expr_p != save_expr) - break; + { + ret = GS_OK; + break; + } /* else fall through. */ case ALIGN_INDIRECT_REF: case MISALIGNED_INDIRECT_REF: @@ -6727,7 +6732,10 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, if (fallback & fb_lvalue) ret = GS_ALL_DONE; else - *expr_p = DECL_INITIAL (*expr_p); + { + *expr_p = DECL_INITIAL (*expr_p); + ret = GS_OK; + } break; case DECL_EXPR: @@ -6762,6 +6770,7 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, } gimplify_seq_add_stmt (pre_p, gimple_build_goto (GOTO_DESTINATION (*expr_p))); + ret = GS_ALL_DONE; break; case PREDICT_EXPR: @@ -6804,7 +6813,7 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, append_to_statement_list (ce->value, &temp); *expr_p = temp; - ret = GS_OK; + ret = temp ? GS_OK : GS_ALL_DONE; } /* C99 code may assign to an array in a constructed structure or union, and this has undefined behavior only @@ -6814,6 +6823,7 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, { *expr_p = get_initialized_tmp_var (*expr_p, pre_p, post_p); mark_addressable (*expr_p); + ret = GS_OK; } else ret = GS_ALL_DONE; @@ -6961,6 +6971,7 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, gimple_test_f, fallback); gimplify_expr (&TREE_OPERAND (*expr_p, 1), pre_p, post_p, is_gimple_val, fb_rvalue); + ret = GS_ALL_DONE; } break; @@ -7048,6 +7059,7 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, TREE_TYPE (*expr_p)))) { *expr_p = tmp; + ret = GS_OK; break; } /* Convert (void *)&a + 4 into (void *)&a[1]. */ @@ -7063,6 +7075,7 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, 0))))) { *expr_p = fold_convert (TREE_TYPE (*expr_p), tmp); + ret = GS_OK; break; } /* FALLTHRU */ @@ -7132,9 +7145,7 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, break; } - /* If we replaced *expr_p, gimplify again. */ - if (ret == GS_OK && (*expr_p == NULL || *expr_p == save_expr)) - ret = GS_ALL_DONE; + gcc_assert (*expr_p || ret != GS_OK); } while (ret == GS_OK); -- cgit v1.2.1 From b0b48c1d97e7aa097e96d348fe7a4b4d7301eba8 Mon Sep 17 00:00:00 2001 From: jakub Date: Wed, 12 May 2010 12:11:00 +0000 Subject: PR middle-end/44085 * gimplify.c (enum omp_region_type): Add ORT_UNTIED_TASK, change value of ORT_TASK. (new_omp_context): Handle ORT_UNTIED_TASK like ORT_TASK. (omp_notice_threadprivate_variable): New function. (omp_notice_variable): Call it for threadprivate variables. If enclosing ctx is a task, print enclosing task rather than enclosing parallel. Handle ORT_UNTIED_TASK like ORT_TASK. (gimplify_omp_task): Pass ORT_UNTIED_TASK instead of ORT_TASK if task has untied clause. * gcc.dg/gomp/pr44085.c: New test. * gfortran.dg/gomp/pr44085.f90: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159316 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 48 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index f6266e10cbc..c74189194bd 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -74,9 +74,10 @@ enum gimplify_omp_var_data enum omp_region_type { ORT_WORKSHARE = 0, - ORT_TASK = 1, ORT_PARALLEL = 2, - ORT_COMBINED_PARALLEL = 3 + ORT_COMBINED_PARALLEL = 3, + ORT_TASK = 4, + ORT_UNTIED_TASK = 5 }; struct gimplify_omp_ctx @@ -318,7 +319,7 @@ new_omp_context (enum omp_region_type region_type) c->privatized_types = pointer_set_create (); c->location = input_location; c->region_type = region_type; - if (region_type != ORT_TASK) + if ((region_type & ORT_TASK) == 0) c->default_kind = OMP_CLAUSE_DEFAULT_SHARED; else c->default_kind = OMP_CLAUSE_DEFAULT_UNSPECIFIED; @@ -5470,6 +5471,31 @@ omp_add_variable (struct gimplify_omp_ctx *ctx, tree decl, unsigned int flags) splay_tree_insert (ctx->variables, (splay_tree_key)decl, flags); } +/* Notice a threadprivate variable DECL used in OpenMP context CTX. + This just prints out diagnostics about threadprivate variable uses + in untied tasks. If DECL2 is non-NULL, prevent this warning + on that variable. */ + +static bool +omp_notice_threadprivate_variable (struct gimplify_omp_ctx *ctx, tree decl, + tree decl2) +{ + splay_tree_node n; + + if (ctx->region_type != ORT_UNTIED_TASK) + return false; + n = splay_tree_lookup (ctx->variables, (splay_tree_key)decl); + if (n == NULL) + { + error ("threadprivate variable %qE used in untied task", DECL_NAME (decl)); + error_at (ctx->location, "enclosing task"); + splay_tree_insert (ctx->variables, (splay_tree_key)decl, 0); + } + if (decl2) + splay_tree_insert (ctx->variables, (splay_tree_key)decl2, 0); + return false; +} + /* Record the fact that DECL was used within the OpenMP context CTX. IN_CODE is true when real code uses DECL, and false when we should merely emit default(none) errors. Return true if DECL is going to @@ -5490,14 +5516,14 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code) if (is_global_var (decl)) { if (DECL_THREAD_LOCAL_P (decl)) - return false; + return omp_notice_threadprivate_variable (ctx, decl, NULL_TREE); if (DECL_HAS_VALUE_EXPR_P (decl)) { tree value = get_base_address (DECL_VALUE_EXPR (decl)); if (value && DECL_P (value) && DECL_THREAD_LOCAL_P (value)) - return false; + return omp_notice_threadprivate_variable (ctx, decl, value); } } @@ -5523,7 +5549,10 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code) case OMP_CLAUSE_DEFAULT_NONE: error ("%qE not specified in enclosing parallel", DECL_NAME (decl)); - error_at (ctx->location, "enclosing parallel"); + if ((ctx->region_type & ORT_TASK) != 0) + error_at (ctx->location, "enclosing task"); + else + error_at (ctx->location, "enclosing parallel"); /* FALLTHRU */ case OMP_CLAUSE_DEFAULT_SHARED: flags |= GOVD_SHARED; @@ -5536,7 +5565,7 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code) break; case OMP_CLAUSE_DEFAULT_UNSPECIFIED: /* decl will be either GOVD_FIRSTPRIVATE or GOVD_SHARED. */ - gcc_assert (ctx->region_type == ORT_TASK); + gcc_assert ((ctx->region_type & ORT_TASK) != 0); if (ctx->outer_context) omp_notice_variable (ctx->outer_context, decl, in_code); for (octx = ctx->outer_context; octx; octx = octx->outer_context) @@ -6039,7 +6068,10 @@ gimplify_omp_task (tree *expr_p, gimple_seq *pre_p) gimple_seq body = NULL; struct gimplify_ctx gctx; - gimplify_scan_omp_clauses (&OMP_TASK_CLAUSES (expr), pre_p, ORT_TASK); + gimplify_scan_omp_clauses (&OMP_TASK_CLAUSES (expr), pre_p, + find_omp_clause (OMP_TASK_CLAUSES (expr), + OMP_CLAUSE_UNTIED) + ? ORT_UNTIED_TASK : ORT_TASK); push_gimplify_context (&gctx); -- cgit v1.2.1 From 73bb17ceddeaafacaf347e7570eb24dfaeed452c Mon Sep 17 00:00:00 2001 From: jason Date: Fri, 14 May 2010 18:55:10 +0000 Subject: PR c++/44127 gcc: * gimplify.c (gimplify_seq_add_stmt): No longer static. * gimple.h: Declare it. * gimple.c (gimple_build_eh_filter): No ops. gcc/cp: * cp-gimplify.c (gimplify_must_not_throw_expr): Use gimple_build_eh_must_not_throw. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159407 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index c74189194bd..6d00fefe9ad 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -158,7 +158,7 @@ gimple_tree_eq (const void *p1, const void *p2) During gimplification, we need to manipulate statement sequences before the def/use vectors have been constructed. */ -static void +void gimplify_seq_add_stmt (gimple_seq *seq_p, gimple gs) { gimple_stmt_iterator si; -- cgit v1.2.1 From 115133dd5f44ff1bfd39b8186874f43b5c39e370 Mon Sep 17 00:00:00 2001 From: steven Date: Sat, 15 May 2010 20:02:11 +0000 Subject: gcc/ChangeLog * vecir.h: New file with VEC primitives for tree, gimple, and rtl. * Makefile.in: Add it. Fix all other Makefile dependencies for changes below. * tree.h: Include it instead of defining VEC primitives here. * gimple.h: Likewise. * rtl.h: Likewise. * tree-inline.h: Inlclude vecir.h instead of gimple.h. * except.h: Include vecir.h, break dependence on tree.h. * gimplify.c (append_to_statement_list_1, append_to_statement_list): Move from here... * tree-iterator.c: ...to here. * tree-iterator.h: Fix file introduction comment. Add extern markers. * c-lex.c: Include fixed-value.h instead of rtl.h. Do not include tm_p.h. * c-cppbuiltin.c: Explain why debug.h and tm_p.h are included. * c-objc-common.h: Do not include tm.h, rtl.h, insn-config.h, integrate.h, function.h, toplev.h, tree-inline.h, ggc.h, tree-mudflap.h, and target.h. * c-semantics.c: Do not include except.h, ggc.h, rtl.h, timevar.h, predict.h, tree-inline.h, gimple.h, and langhooks.h. * c-decl.c: Do not include expr.h, ggc.h, libfuncs.h, except.h. Add FIXME for why gimple.h is still included (should be unnecessary since GCC 4.5 gimplification unit-at-a-time). * c-typeck.c: Do not include rtl.h, tm_p.h, ggc.h, and gimple.h. * c-pragma.c: Add FIXME for why function.h needs to be included just for cfun, at front-end level. Add note that REGISTER_TARGET_PRAGMAS should probably be a target hook. Do not include ggc.h, but include vecprim.h for VEC(char). * c-opts.c: Do not include tm.h, tree-inline.h, and tm_p.h. Explain why target.h is included. * c-omp.h: Do not include tm.h, function.h, and bitmap.h. Explain why gimple.h is included. * c-ppoutput.c: Do not include tm.h. * c-common.c: Do not include gimple.h. Explain why expr.h is included. * c-parses.c: Explain why rtl.h is included, and that this (and only this) is also why tm.h must be included. Do not include except.h. * c-lang.c: Do not include ggc.h. cp/ChangeLog * decl.c: Include tree-iterator.h, as fixup for tree-inline.h changes. * Make-lang.in: Fix dependencies accordingly. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159442 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 41 ----------------------------------------- 1 file changed, 41 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 6d00fefe9ad..2b402720b1a 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -340,47 +340,6 @@ delete_omp_context (struct gimplify_omp_ctx *c) static void omp_add_variable (struct gimplify_omp_ctx *, tree, unsigned int); static bool omp_notice_variable (struct gimplify_omp_ctx *, tree, bool); -/* A subroutine of append_to_statement_list{,_force}. T is not NULL. */ - -static void -append_to_statement_list_1 (tree t, tree *list_p) -{ - tree list = *list_p; - tree_stmt_iterator i; - - if (!list) - { - if (t && TREE_CODE (t) == STATEMENT_LIST) - { - *list_p = t; - return; - } - *list_p = list = alloc_stmt_list (); - } - - i = tsi_last (list); - tsi_link_after (&i, t, TSI_CONTINUE_LINKING); -} - -/* Add T to the end of the list container pointed to by LIST_P. - If T is an expression with no effects, it is ignored. */ - -void -append_to_statement_list (tree t, tree *list_p) -{ - if (t && TREE_SIDE_EFFECTS (t)) - append_to_statement_list_1 (t, list_p); -} - -/* Similar, but the statement is always added, regardless of side effects. */ - -void -append_to_statement_list_force (tree t, tree *list_p) -{ - if (t != NULL_TREE) - append_to_statement_list_1 (t, list_p); -} - /* Both gimplify the statement T and append it to *SEQ_P. This function behaves exactly as gimplify_stmt, but you don't have to pass T as a reference. */ -- cgit v1.2.1 From f96dd70606f789a7982ed4fc70291444a1abc9c7 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Wed, 19 May 2010 17:53:58 +0000 Subject: * langhooks.h (struct lang_hooks): Add new field deep_unsharing. * langhooks-def.h (LANG_HOOKS_DEEP_UNSHARING): New macro. (LANG_HOOKS_INITIALIZER): Add LANG_HOOKS_DEEP_UNSHARING. * gimplify.c: (mostly_copy_tree_r): Copy trees under SAVE_EXPR and TARGET_EXPR nodes, but only once, if instructed to do so. Do not propagate the 'data' argument to copy_tree_r. (copy_if_shared_r): Remove bogus ATTRIBUTE_UNUSED marker. Propagate 'data' argument to walk_tree. (copy_if_shared): New function. (unmark_visited_r): Remove bogus ATTRIBUTE_UNUSED marker. (unmark_visited): New function. (unshare_body): Call copy_if_shared instead of doing it manually. (unvisit_body): Call unmark_visited instead of doing it manually. ada/ * gcc-interface/misc.c (LANG_HOOKS_DEEP_UNSHARING): Redefine. * gcc-interface/trans.c (unshare_save_expr): Delete. (gigi): Do not unshare trees under SAVE_EXPRs here. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159592 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 148 +++++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 113 insertions(+), 35 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 2b402720b1a..8f19cedb053 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -820,9 +820,44 @@ annotate_all_with_location (gimple_seq stmt_p, location_t location) annotate_one_with_location (gs, location); } } - - -/* Similar to copy_tree_r() but do not copy SAVE_EXPR or TARGET_EXPR nodes. + +/* This page contains routines to unshare tree nodes, i.e. to duplicate tree + nodes that are referenced more than once in GENERIC functions. This is + necessary because gimplification (translation into GIMPLE) is performed + by modifying tree nodes in-place, so gimplication of a shared node in a + first context could generate an invalid GIMPLE form in a second context. + + This is achieved with a simple mark/copy/unmark algorithm that walks the + GENERIC representation top-down, marks nodes with TREE_VISITED the first + time it encounters them, duplicates them if they already have TREE_VISITED + set, and finally removes the TREE_VISITED marks it has set. + + The algorithm works only at the function level, i.e. it generates a GENERIC + representation of a function with no nodes shared within the function when + passed a GENERIC function (except for nodes that are allowed to be shared). + + At the global level, it is also necessary to unshare tree nodes that are + referenced in more than one function, for the same aforementioned reason. + This requires some cooperation from the front-end. There are 2 strategies: + + 1. Manual unsharing. The front-end needs to call unshare_expr on every + expression that might end up being shared across functions. + + 2. Deep unsharing. This is an extension of regular unsharing. Instead + of calling unshare_expr on expressions that might be shared across + functions, the front-end pre-marks them with TREE_VISITED. This will + ensure that they are unshared on the first reference within functions + when the regular unsharing algorithm runs. The counterpart is that + this algorithm must look deeper than for manual unsharing, which is + specified by LANG_HOOKS_DEEP_UNSHARING. + + If there are only few specific cases of node sharing across functions, it is + probably easier for a front-end to unshare the expressions manually. On the + contrary, if the expressions generated at the global level are as widespread + as expressions generated within functions, deep unsharing is very likely the + way to go. */ + +/* Similar to copy_tree_r but do not copy SAVE_EXPR or TARGET_EXPR nodes. These nodes model computations that should only be done once. If we were to unshare something like SAVE_EXPR(i++), the gimplification process would create wrong code. */ @@ -830,21 +865,39 @@ annotate_all_with_location (gimple_seq stmt_p, location_t location) static tree mostly_copy_tree_r (tree *tp, int *walk_subtrees, void *data) { - enum tree_code code = TREE_CODE (*tp); - /* Don't unshare types, decls, constants and SAVE_EXPR nodes. */ - if (TREE_CODE_CLASS (code) == tcc_type - || TREE_CODE_CLASS (code) == tcc_declaration - || TREE_CODE_CLASS (code) == tcc_constant - || code == SAVE_EXPR || code == TARGET_EXPR - /* We can't do anything sensible with a BLOCK used as an expression, - but we also can't just die when we see it because of non-expression - uses. So just avert our eyes and cross our fingers. Silly Java. */ - || code == BLOCK) + tree t = *tp; + enum tree_code code = TREE_CODE (t); + + /* Do not copy SAVE_EXPR or TARGET_EXPR nodes themselves, but copy + their subtrees if we can make sure to do it only once. */ + if (code == SAVE_EXPR || code == TARGET_EXPR) + { + if (data && !pointer_set_insert ((struct pointer_set_t *)data, t)) + ; + else + *walk_subtrees = 0; + } + + /* Stop at types, decls, constants like copy_tree_r. */ + else if (TREE_CODE_CLASS (code) == tcc_type + || TREE_CODE_CLASS (code) == tcc_declaration + || TREE_CODE_CLASS (code) == tcc_constant + /* We can't do anything sensible with a BLOCK used as an + expression, but we also can't just die when we see it + because of non-expression uses. So we avert our eyes + and cross our fingers. Silly Java. */ + || code == BLOCK) *walk_subtrees = 0; + + /* Cope with the statement expression extension. */ + else if (code == STATEMENT_LIST) + ; + + /* Leave the bulk of the work to copy_tree_r itself. */ else { gcc_assert (code != BIND_EXPR); - copy_tree_r (tp, walk_subtrees, data); + copy_tree_r (tp, walk_subtrees, NULL); } return NULL_TREE; @@ -852,16 +905,10 @@ mostly_copy_tree_r (tree *tp, int *walk_subtrees, void *data) /* Callback for walk_tree to unshare most of the shared trees rooted at *TP. If *TP has been visited already (i.e., TREE_VISITED (*TP) == 1), - then *TP is deep copied by calling copy_tree_r. - - This unshares the same trees as copy_tree_r with the exception of - SAVE_EXPR nodes. These nodes model computations that should only be - done once. If we were to unshare something like SAVE_EXPR(i++), the - gimplification process would create wrong code. */ + then *TP is deep copied by calling mostly_copy_tree_r. */ static tree -copy_if_shared_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED, - void *data ATTRIBUTE_UNUSED) +copy_if_shared_r (tree *tp, int *walk_subtrees, void *data) { tree t = *tp; enum tree_code code = TREE_CODE (t); @@ -884,27 +931,29 @@ copy_if_shared_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED, any deeper. */ else if (TREE_VISITED (t)) { - walk_tree (tp, mostly_copy_tree_r, NULL, NULL); + walk_tree (tp, mostly_copy_tree_r, data, NULL); *walk_subtrees = 0; } - /* Otherwise, mark the tree as visited and keep looking. */ + /* Otherwise, mark the node as visited and keep looking. */ else TREE_VISITED (t) = 1; return NULL_TREE; } -static tree -unmark_visited_r (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED, - void *data ATTRIBUTE_UNUSED) -{ - if (TREE_VISITED (*tp)) - TREE_VISITED (*tp) = 0; - else - *walk_subtrees = 0; +/* Unshare most of the shared trees rooted at *TP. */ - return NULL_TREE; +static inline void +copy_if_shared (tree *tp) +{ + /* If the language requires deep unsharing, we need a pointer set to make + sure we don't repeatedly unshare subtrees of unshareable nodes. */ + struct pointer_set_t *visited + = lang_hooks.deep_unsharing ? pointer_set_create () : NULL; + walk_tree (tp, copy_if_shared_r, visited, NULL); + if (visited) + pointer_set_destroy (visited); } /* Unshare all the trees in BODY_P, a pointer into the body of FNDECL, and the @@ -916,12 +965,40 @@ unshare_body (tree *body_p, tree fndecl) { struct cgraph_node *cgn = cgraph_node (fndecl); - walk_tree (body_p, copy_if_shared_r, NULL, NULL); + copy_if_shared (body_p); + if (body_p == &DECL_SAVED_TREE (fndecl)) for (cgn = cgn->nested; cgn; cgn = cgn->next_nested) unshare_body (&DECL_SAVED_TREE (cgn->decl), cgn->decl); } +/* Callback for walk_tree to unmark the visited trees rooted at *TP. + Subtrees are walked until the first unvisited node is encountered. */ + +static tree +unmark_visited_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) +{ + tree t = *tp; + + /* If this node has been visited, unmark it and keep looking. */ + if (TREE_VISITED (t)) + TREE_VISITED (t) = 0; + + /* Otherwise, don't look any deeper. */ + else + *walk_subtrees = 0; + + return NULL_TREE; +} + +/* Unmark the visited trees rooted at *TP. */ + +static inline void +unmark_visited (tree *tp) +{ + walk_tree (tp, unmark_visited_r, NULL, NULL); +} + /* Likewise, but mark all trees as not visited. */ static void @@ -929,7 +1006,8 @@ unvisit_body (tree *body_p, tree fndecl) { struct cgraph_node *cgn = cgraph_node (fndecl); - walk_tree (body_p, unmark_visited_r, NULL, NULL); + unmark_visited (body_p); + if (body_p == &DECL_SAVED_TREE (fndecl)) for (cgn = cgn->nested; cgn; cgn = cgn->next_nested) unvisit_body (&DECL_SAVED_TREE (cgn->decl), cgn->decl); -- cgit v1.2.1 From 126740ee0b6facfc578078874afbaaf3b3bffaf7 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Fri, 21 May 2010 10:02:07 +0000 Subject: PR middle-end/44101 * gimplify.c (gimplify_init_constructor): Build a VIEW_CONVERT_EXPR around the uniquized constructor if its type requires a conversion. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159655 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 8f19cedb053..f5bd994ffbb 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -3813,8 +3813,11 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, if (notify_temp_creation) return GS_ERROR; - walk_tree (&ctor, force_labels_r, NULL, NULL); - TREE_OPERAND (*expr_p, 1) = tree_output_constant_def (ctor); + walk_tree (&ctor, force_labels_r, NULL, NULL); + ctor = tree_output_constant_def (ctor); + if (!useless_type_conversion_p (type, TREE_TYPE (ctor))) + ctor = build1 (VIEW_CONVERT_EXPR, type, ctor); + TREE_OPERAND (*expr_p, 1) = ctor; /* This is no longer an assignment of a CONSTRUCTOR, but we still may have processing to do on the LHS. So -- 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/gimplify.c | 1 - 1 file changed, 1 deletion(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index f5bd994ffbb..17215dc02c0 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -39,7 +39,6 @@ along with GCC; see the file COPYING3. If not see #include "except.h" #include "hashtab.h" #include "flags.h" -#include "real.h" #include "function.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/gimplify.c | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 17215dc02c0..66b6b520853 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -31,6 +31,7 @@ along with GCC; see the file COPYING3. If not see #include "tree-iterator.h" #include "tree-inline.h" #include "diagnostic.h" +#include "tree-pretty-print.h" #include "langhooks.h" #include "langhooks-def.h" #include "tree-flow.h" -- cgit v1.2.1 From 852f689eb9b7f6d7aafc2f72007e96129ac9bd45 Mon Sep 17 00:00:00 2001 From: jsm28 Date: Thu, 27 May 2010 20:16:07 +0000 Subject: * diagnostic-core.h: New. Contents moved from diagnostic.h and toplev.h. * diagnostic.c: Don't include toplev.h. (progname): Define. Moved from toplev.c. (seen_error): New function. * diagnostic.h: Include diagnostic-core.h. (diagnostic_t, emit_diagnostic): Don't declare here. * toplev.c (progname): Move to toplev.c. (emit_debug_global_declarations, compile_file, finalize, do_compile, toplev_main): Use seen_error. * toplev.h: Include diagnostic-core.h. (trim_filename, GCC_DIAG_STYLE, ATTRIBUTE_GCC_DIAG, internal_error, warning, warning_at, error, error_n, error_at, fatal_error, pedwarn, permerror, sorry, inform, inform_n, verbatim, fnotice, progname): Move to diagnostic-core.h. * builtins.c: Include diagnostic-core.h instead of diagnostic.h. (expand_builtin_expect): Use seen_error. * c-decl.c: Include diagnostic-core.h instead of diagnostic.h. (c_make_fname_decl, c_write_global_declarations): Use seen_error. * c-format.c: Include diagnostic-core.h instead of diagnostic.h. * c-gimplify.c: Include diagnostic-core.h instead of diagnostic.h. * c-lang.c: Include diagnostic-core.h instead of diagnostic.h. * c-lex.c (c_lex_with_flags, interpret_float): Don't increment errorcount for errors. * c-opts.c (c_common_finish): Use seen_error. * cgraph.c: Include diagnostic-core.h instead of diagnostic.h. * cgraphunit.c (verify_cgraph_node, verify_cgraph, cgraph_output_pending_asms, cgraph_optimize): Use seen_error. * coverage.c: Include diagnostic-core.h instead of diagnostic.h. (get_coverage_counts): Use seen_error. * dwarf2out.c (dwarf2out_finish): Use seen_error. * gimplify.c (gimplify_var_or_parm_decl, gimple_push_cleanup, gimplify_body): Use seen_error. * ipa-inline.c (cgraph_early_inlining): Use seen_error. * ipa-pure-const.c (gate_pure_const): Use seen_error. * ipa-reference.c (gate_reference): Use seen_error. * jump.c: Include diagnostic-core.h instead of diagnostic.h. * lambda-code.c: Include diagnostic-core.h instead of diagnostic.h. * lto-cgraph.c: Include diagnostic-core.h instead of diagnostic.h. * lto-compress.c: Include diagnostic-core.h instead of diagnostic.h. * lto-section-in.c: Include diagnostic-core.h instead of diagnostic.h. * lto-streamer-out.c: Include diagnostic-core.h instead of diagnostic.h. * lto-streamer.c: Include diagnostic-core.h instead of diagnostic.h. (gate_lto_out): Use seen_error. * matrix-reorg.c: Include diagnostic-core.h instead of diagnostic.h. * omega.c: Include diagnostic-core.h instead of diagnostic.h. * omp-low.c: Include diagnostic-core.h instead of diagnostic.h. (gate_expand_omp, lower_omp_1): Use seen_error. * passes.c: Include diagnostic-core.h instead of diagnostic.h. (rest_of_decl_compilation, rest_of_type_compilation, gate_rest_of_compilation, ipa_write_summaries): Use seen_error. * tree-cfg.c (label_to_block_fn): Use seen_error. * tree-inline.c (optimize_inline_calls): Use seen_error. * tree-mudflap.c (mudflap_finish_file): Use seen_error. * tree-optimize.c (gate_all_optimizations, gate_all_early_local_passes, gate_all_early_optimizations): Use seen_error. * tree-ssa-structalias.c (gate_ipa_pta): Use seen_error. * varpool.c: Include diagnostic-core.h instead of diagnostic.h. (varpool_remove_unreferenced_decls, varpool_assemble_pending_decls): Use seen_error. * Makefile.in (DIAGNOSTIC_CORE_H): Define. (TOPLEV_H, DIAGNOSTIC_H): Update. (c-decl.o, c-lang.o, c-format.o, lto-compress.o, lto-cgraph.o, lto-streamer-out.o, lto-section-in.o, lto-streamer.o, c-gimplify.o, omp-low.o, omega.o, diagnostic.o, passes.o, builtins.o, jump.o, cgraph.o, varpool.o, matrix-reorg.o, coverage.o, lambda-code.o): Update dependencies. cp: * call.c: Include diagnostic-core.h instead of diagnostic.h. * cp-lang.c: Don't include diagnostic.h * name-lookup.c: Include diagnostic-core.h instead of diagnostic.h. (cp_emit_debug_info_for_using): Use seen_error. * optimize.c: Include diagnostic-core.h instead of diagnostic.h. * parser.c: Include diagnostic-core.h instead of diagnostic.h. * pt.c (iterative_hash_template_arg): Use seen_error. * repo.c: Include diagnostic-core.h instead of diagnostic.h. * typeck2.c: Include diagnostic-core.h instead of diagnostic.h. * Make-lang.in (cp/cp-lang.o, cp/typeck2.o, cp/call.o, cp/repo.o, cp/optimize.o, cp/parser.o, cp/name-lookup.o): Update dependencies. lto: * lto.c: Include diagnostic-core.h instead of diagnostic.h. (read_cgraph_and_symbols, lto_main): Use seen_error. * Make-lang.in (lto/lto.o): Update dependencies. objc: * objc-act.c: Include diagnostic-core.h instead of diagnostic.h. * Make-lang.in (objc/objc-act.o): Update dependencies. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@159947 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 66b6b520853..855098f5af5 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1876,7 +1876,7 @@ gimplify_var_or_parm_decl (tree *expr_p) && !TREE_STATIC (decl) && !DECL_EXTERNAL (decl) && decl_function_context (decl) == current_function_decl) { - gcc_assert (errorcount || sorrycount); + gcc_assert (seen_error ()); return GS_ERROR; } @@ -5197,7 +5197,7 @@ gimple_push_cleanup (tree var, tree cleanup, bool eh_only, gimple_seq *pre_p) /* Errors can result in improperly nested cleanups. Which results in confusion when trying to resolve the GIMPLE_WITH_CLEANUP_EXPR. */ - if (errorcount || sorrycount) + if (seen_error ()) return; if (gimple_conditional_context ()) @@ -7673,7 +7673,7 @@ gimplify_body (tree *body_p, tree fndecl, bool do_parms) gcc_assert (gimplify_ctxp == NULL); #ifdef ENABLE_TYPES_CHECKING - if (!errorcount && !sorrycount) + if (!seen_error ()) verify_types_in_gimple_seq (gimple_bind_body (outer_bind)); #endif -- 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/gimplify.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 855098f5af5..fd1f05f3d98 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -26,33 +26,30 @@ along with GCC; see the file COPYING3. If not see #include "coretypes.h" #include "tm.h" #include "tree.h" -#include "rtl.h" #include "gimple.h" #include "tree-iterator.h" #include "tree-inline.h" -#include "diagnostic.h" #include "tree-pretty-print.h" #include "langhooks.h" -#include "langhooks-def.h" #include "tree-flow.h" #include "cgraph.h" #include "timevar.h" -#include "except.h" #include "hashtab.h" #include "flags.h" #include "function.h" #include "output.h" -#include "expr.h" #include "ggc.h" #include "toplev.h" #include "target.h" -#include "optabs.h" #include "pointer-set.h" #include "splay-tree.h" #include "vec.h" #include "gimple.h" #include "tree-pass.h" +#include "langhooks-def.h" /* FIXME: for lhd_set_decl_assembler_name. */ +#include "expr.h" /* FIXME: for can_move_by_pieces + and STACK_CHECK_MAX_VAR_SIZE. */ enum gimplify_omp_var_data { @@ -1906,7 +1903,7 @@ gimplify_var_or_parm_decl (tree *expr_p) tree copy = copy_node (decl), block; lang_hooks.dup_lang_specific_decl (copy); - SET_DECL_RTL (copy, NULL_RTX); + SET_DECL_RTL (copy, 0); TREE_USED (copy) = 1; block = DECL_INITIAL (current_function_decl); TREE_CHAIN (copy) = BLOCK_VARS (block); @@ -7601,10 +7598,6 @@ gimplify_body (tree *body_p, tree fndecl, bool do_parms) timevar_push (TV_TREE_GIMPLIFY); - /* Initialize for optimize_insn_for_s{ize,peed}_p possibly called during - gimplification. */ - default_rtl_profile (); - gcc_assert (gimplify_ctxp == NULL); push_gimplify_context (&gctx); -- cgit v1.2.1 From c6871992ae2cb1ee3cb876b0308ccfdea720b354 Mon Sep 17 00:00:00 2001 From: steven Date: Wed, 2 Jun 2010 09:12:50 +0000 Subject: * gimplify.c (gimplify_body): Revert "Do not initialize RTL profiling" change from yesterday. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160144 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index fd1f05f3d98..cb4358ca9bd 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -7598,6 +7598,10 @@ gimplify_body (tree *body_p, tree fndecl, bool do_parms) timevar_push (TV_TREE_GIMPLIFY); + /* Initialize for optimize_insn_for_s{ize,peed}_p possibly called during + gimplification. */ + default_rtl_profile (); + gcc_assert (gimplify_ctxp == NULL); push_gimplify_context (&gctx); -- cgit v1.2.1 From eb1b7c50a469480d0887989fdf170003c92808a8 Mon Sep 17 00:00:00 2001 From: rguenth Date: Mon, 7 Jun 2010 13:10:10 +0000 Subject: 2010-06-07 Richard Guenther * gimplify.c (gimplify_cleanup_point_expr): For empty body and EH-only cleanup drop the cleanup instead of inserting it unconditionally. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160371 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index cb4358ca9bd..354092ae429 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -5140,9 +5140,10 @@ gimplify_cleanup_point_expr (tree *expr_p, gimple_seq *pre_p) { /* Note that gsi_insert_seq_before and gsi_remove do not scan operands, unlike some other sequence mutators. */ - gsi_insert_seq_before_without_update (&iter, - gimple_wce_cleanup (wce), - GSI_SAME_STMT); + if (!gimple_wce_cleanup_eh_only (wce)) + gsi_insert_seq_before_without_update (&iter, + gimple_wce_cleanup (wce), + GSI_SAME_STMT); gsi_remove (&iter, true); break; } -- cgit v1.2.1 From 4ad7515928723c066cc9e064a4ac2a98c3dd5066 Mon Sep 17 00:00:00 2001 From: jakub Date: Tue, 15 Jun 2010 12:15:26 +0000 Subject: PR fortran/44536 * langhooks.h (struct lang_hooks_for_decls): Add omp_report_decl. * langhooks-def.h (LANG_HOOKS_OMP_REPORT_DECL): Define. (LANG_HOOKS_DECLS): Add it. * gimplify.c (omp_notice_variable): Call lang_hooks.decls.omp_report_decl. * trans-openmp.c (gfc_omp_predetermined_sharing): Don't return OMP_CLAUSE_DEFAULT_SHARED for artificial vars with GFC_DECL_SAVED_DESCRIPTOR set. (gfc_omp_report_decl): New function. * trans.h (gfc_omp_report_decl): New prototype. * f95-lang.c (LANG_HOOKS_OMP_REPORT_DECL): Redefine. * gfortran.dg/gomp/pr44536.f90: New test. * gfortran.dg/gomp/sharing-3.f90: Remove xfail. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160779 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 354092ae429..9d2cf8634dc 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -5586,7 +5586,7 @@ omp_notice_variable (struct gimplify_omp_ctx *ctx, tree decl, bool in_code) { case OMP_CLAUSE_DEFAULT_NONE: error ("%qE not specified in enclosing parallel", - DECL_NAME (decl)); + DECL_NAME (lang_hooks.decls.omp_report_decl (decl))); if ((ctx->region_type & ORT_TASK) != 0) error_at (ctx->location, "enclosing task"); else -- cgit v1.2.1 From 6b41190941cfa45ea129a7749c81d45115758712 Mon Sep 17 00:00:00 2001 From: rguenth Date: Thu, 17 Jun 2010 12:22:22 +0000 Subject: 2010-06-17 Richard Guenther * gimplify.c (gimplify_bind_expr): Always promote complex and vector variables to registers if possible. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160903 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 9d2cf8634dc..a374bdaec5f 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1153,14 +1153,9 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p) /* Preliminarily mark non-addressed complex variables as eligible for promotion to gimple registers. We'll transform their uses - as we find them. - We exclude complex types if not optimizing because they can be - subject to partial stores in GNU C by means of the __real__ and - __imag__ operators and we cannot promote them to total stores - (see gimplify_modify_expr_complex_part). */ - if (optimize - && (TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE - || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE) + as we find them. */ + if ((TREE_CODE (TREE_TYPE (t)) == COMPLEX_TYPE + || TREE_CODE (TREE_TYPE (t)) == VECTOR_TYPE) && !TREE_THIS_VOLATILE (t) && (TREE_CODE (t) == VAR_DECL && !DECL_HARD_REGISTER (t)) && !needs_to_live_in_memory (t)) -- cgit v1.2.1 From 81943faa41ebf431930486cfef403394f82ed48a Mon Sep 17 00:00:00 2001 From: manu Date: Fri, 25 Jun 2010 13:09:28 +0000 Subject: =?UTF-8?q?2010-06-25=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 PR 44665 * tree-inline.c (gimple_expand_calls_inline): Fix typo in comment. * gimplify.c (is_gimple_reg_rhs_or_call): Likewise. (gimplify_expr): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161380 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index a374bdaec5f..e1660a350ba 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -534,7 +534,7 @@ lookup_tmp_var (tree val, bool is_formal) /* Return true if T is a CALL_EXPR or an expression that can be - assignmed to a temporary. Note that this predicate should only be + assigned to a temporary. Note that this predicate should only be used during gimplification. See the rationale for this in gimplify_modify_expr. */ @@ -6509,7 +6509,7 @@ gimplify_omp_atomic (tree *expr_p, gimple_seq *pre_p) GIMPLE_TEST_F points to a function that takes a tree T and returns nonzero if T is in the GIMPLE form requested by the - caller. The GIMPLE predicates are in tree-gimple.c. + caller. The GIMPLE predicates are in gimple.c. FALLBACK tells the function what sort of a temporary we want if gimplification cannot produce an expression that complies with -- 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/gimplify.c | 146 +++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 96 insertions(+), 50 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index e1660a350ba..a9c93ac972d 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -110,10 +110,13 @@ mark_addressable (tree x) { while (handled_component_p (x)) x = TREE_OPERAND (x, 0); + if (TREE_CODE (x) == MEM_REF + && TREE_CODE (TREE_OPERAND (x, 0)) == ADDR_EXPR) + x = TREE_OPERAND (TREE_OPERAND (x, 0), 0); if (TREE_CODE (x) != VAR_DECL && TREE_CODE (x) != PARM_DECL && TREE_CODE (x) != RESULT_DECL) - return ; + return; TREE_ADDRESSABLE (x) = 1; } @@ -2961,7 +2964,7 @@ gimplify_cond_expr (tree *expr_p, gimple_seq *pre_p, fallback_t fallback) = build3 (COND_EXPR, type, TREE_OPERAND (expr, 0), then_, else_); tmp = create_tmp_var (type, "iftmp"); - result = build_fold_indirect_ref_loc (loc, tmp); + result = build_simple_mem_ref_loc (loc, tmp); } /* Build the new then clause, `tmp = then_;'. But don't build the @@ -3185,7 +3188,7 @@ gimplify_modify_expr_to_memcpy (tree *expr_p, tree size, bool want_value, gimple_call_set_lhs (gs, t); gimplify_seq_add_stmt (seq_p, gs); - *expr_p = build1 (INDIRECT_REF, TREE_TYPE (to), t); + *expr_p = build_simple_mem_ref (t); return GS_ALL_DONE; } @@ -3269,13 +3272,16 @@ gimplify_init_ctor_preeval_1 (tree *tp, int *walk_subtrees, void *xdata) /* If the constructor component is indirect, determine if we have a potential overlap with the lhs. The only bits of information we have to go on at this point are addressability and alias sets. */ - if (TREE_CODE (t) == INDIRECT_REF + if ((INDIRECT_REF_P (t) + || TREE_CODE (t) == MEM_REF) && (!data->lhs_base_decl || TREE_ADDRESSABLE (data->lhs_base_decl)) && alias_sets_conflict_p (data->lhs_alias_set, get_alias_set (t))) return t; /* If the constructor component is a call, determine if it can hide a - potential overlap with the lhs through an INDIRECT_REF like above. */ + potential overlap with the lhs through an INDIRECT_REF like above. + ??? Ugh - this is completely broken. In fact this whole analysis + doesn't look conservative. */ if (TREE_CODE (t) == CALL_EXPR) { tree type, fntype = TREE_TYPE (TREE_TYPE (CALL_EXPR_FN (t))); @@ -4004,7 +4010,7 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, tree gimple_fold_indirect_ref (tree t) { - tree type = TREE_TYPE (TREE_TYPE (t)); + tree ptype = TREE_TYPE (t), type = TREE_TYPE (ptype); tree sub = t; tree subtype; @@ -4047,51 +4053,52 @@ gimple_fold_indirect_ref (tree t) } } - /* ((foo*)&vectorfoo)[1] => BIT_FIELD_REF */ + /* *(p + CST) -> ... */ if (TREE_CODE (sub) == POINTER_PLUS_EXPR && TREE_CODE (TREE_OPERAND (sub, 1)) == INTEGER_CST) { - tree op00 = TREE_OPERAND (sub, 0); - tree op01 = TREE_OPERAND (sub, 1); - tree op00type; + tree addr = TREE_OPERAND (sub, 0); + tree off = TREE_OPERAND (sub, 1); + tree addrtype; + + STRIP_NOPS (addr); + addrtype = TREE_TYPE (addr); - STRIP_NOPS (op00); - op00type = TREE_TYPE (op00); - if (TREE_CODE (op00) == ADDR_EXPR - && TREE_CODE (TREE_TYPE (op00type)) == VECTOR_TYPE - && useless_type_conversion_p (type, TREE_TYPE (TREE_TYPE (op00type)))) + /* ((foo*)&vectorfoo)[1] -> BIT_FIELD_REF */ + if (TREE_CODE (addr) == ADDR_EXPR + && TREE_CODE (TREE_TYPE (addrtype)) == VECTOR_TYPE + && useless_type_conversion_p (type, TREE_TYPE (TREE_TYPE (addrtype)))) { - HOST_WIDE_INT offset = tree_low_cst (op01, 0); - tree part_width = TYPE_SIZE (type); - unsigned HOST_WIDE_INT part_widthi - = tree_low_cst (part_width, 0) / BITS_PER_UNIT; - unsigned HOST_WIDE_INT indexi = offset * BITS_PER_UNIT; - tree index = bitsize_int (indexi); - if (offset / part_widthi - <= TYPE_VECTOR_SUBPARTS (TREE_TYPE (op00type))) - return fold_build3 (BIT_FIELD_REF, type, TREE_OPERAND (op00, 0), - part_width, index); + HOST_WIDE_INT offset = tree_low_cst (off, 0); + tree part_width = TYPE_SIZE (type); + unsigned HOST_WIDE_INT part_widthi + = tree_low_cst (part_width, 0) / BITS_PER_UNIT; + unsigned HOST_WIDE_INT indexi = offset * BITS_PER_UNIT; + tree index = bitsize_int (indexi); + if (offset / part_widthi + <= TYPE_VECTOR_SUBPARTS (TREE_TYPE (addrtype))) + return fold_build3 (BIT_FIELD_REF, type, TREE_OPERAND (addr, 0), + part_width, index); } - } - /* ((foo*)&complexfoo)[1] => __imag__ complexfoo */ - if (TREE_CODE (sub) == POINTER_PLUS_EXPR - && TREE_CODE (TREE_OPERAND (sub, 1)) == INTEGER_CST) - { - tree op00 = TREE_OPERAND (sub, 0); - tree op01 = TREE_OPERAND (sub, 1); - tree op00type; + /* ((foo*)&complexfoo)[1] -> __imag__ complexfoo */ + if (TREE_CODE (addr) == ADDR_EXPR + && TREE_CODE (TREE_TYPE (addrtype)) == COMPLEX_TYPE + && useless_type_conversion_p (type, TREE_TYPE (TREE_TYPE (addrtype)))) + { + tree size = TYPE_SIZE_UNIT (type); + if (tree_int_cst_equal (size, off)) + return fold_build1 (IMAGPART_EXPR, type, TREE_OPERAND (addr, 0)); + } - STRIP_NOPS (op00); - op00type = TREE_TYPE (op00); - if (TREE_CODE (op00) == ADDR_EXPR - && TREE_CODE (TREE_TYPE (op00type)) == COMPLEX_TYPE - && useless_type_conversion_p (type, TREE_TYPE (TREE_TYPE (op00type)))) - { - tree size = TYPE_SIZE_UNIT (type); - if (tree_int_cst_equal (size, op01)) - return fold_build1 (IMAGPART_EXPR, type, TREE_OPERAND (op00, 0)); - } + /* *(p + CST) -> MEM_REF . */ + if (TREE_CODE (addr) != ADDR_EXPR + || DECL_P (TREE_OPERAND (addr, 0))) + return fold_build2 (MEM_REF, type, + addr, + build_int_cst_wide (ptype, + TREE_INT_CST_LOW (off), + TREE_INT_CST_HIGH (off))); } /* *(foo *)fooarrptr => (*fooarrptr)[0] */ @@ -6558,7 +6565,8 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, || gimple_test_f == is_gimple_mem_rhs_or_call || gimple_test_f == is_gimple_reg_rhs || gimple_test_f == is_gimple_reg_rhs_or_call - || gimple_test_f == is_gimple_asm_val) + || gimple_test_f == is_gimple_asm_val + || gimple_test_f == is_gimple_mem_ref_addr) gcc_assert (fallback & fb_rvalue); else if (gimple_test_f == is_gimple_min_lval || gimple_test_f == is_gimple_lvalue) @@ -6764,19 +6772,57 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, recalculate_side_effects (*expr_p); break; + case ALIGN_INDIRECT_REF: + case MISALIGNED_INDIRECT_REF: + /* We can only reach this through re-gimplification from + tree optimizers. */ + ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p, + is_gimple_reg, fb_rvalue); + recalculate_side_effects (*expr_p); + break; + case INDIRECT_REF: - *expr_p = fold_indirect_ref_loc (input_location, *expr_p); - if (*expr_p != save_expr) + { + bool volatilep = TREE_THIS_VOLATILE (*expr_p); + tree saved_ptr_type = TREE_TYPE (TREE_OPERAND (*expr_p, 0)); + + *expr_p = fold_indirect_ref_loc (input_location, *expr_p); + if (*expr_p != save_expr) + { + ret = GS_OK; + break; + } + + ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p, + is_gimple_reg, fb_rvalue); + recalculate_side_effects (*expr_p); + + *expr_p = fold_build2_loc (input_location, MEM_REF, + TREE_TYPE (*expr_p), + TREE_OPERAND (*expr_p, 0), + build_int_cst (saved_ptr_type, 0)); + TREE_THIS_VOLATILE (*expr_p) = volatilep; + ret = GS_OK; + break; + } + + /* We arrive here through the various re-gimplifcation paths. */ + case MEM_REF: + /* First try re-folding the whole thing. */ + tmp = fold_binary (MEM_REF, TREE_TYPE (*expr_p), + TREE_OPERAND (*expr_p, 0), + TREE_OPERAND (*expr_p, 1)); + if (tmp) { + *expr_p = tmp; + recalculate_side_effects (*expr_p); ret = GS_OK; break; } - /* else fall through. */ - case ALIGN_INDIRECT_REF: - case MISALIGNED_INDIRECT_REF: ret = gimplify_expr (&TREE_OPERAND (*expr_p, 0), pre_p, post_p, - is_gimple_reg, fb_rvalue); + is_gimple_mem_ref_addr, fb_rvalue); recalculate_side_effects (*expr_p); + ret = GS_ALL_DONE; break; /* Constants need not be gimplified. */ -- cgit v1.2.1 From e660f7eeca5986b291ed0deede7cdeed73331231 Mon Sep 17 00:00:00 2001 From: ebotcazou Date: Sat, 3 Jul 2010 13:14:48 +0000 Subject: * gimplify.c (mostly_copy_tree_r): Deal with BIND_EXPR. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161774 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index a9c93ac972d..9eb8fa70d3e 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -868,9 +868,9 @@ mostly_copy_tree_r (tree *tp, int *walk_subtrees, void *data) tree t = *tp; enum tree_code code = TREE_CODE (t); - /* Do not copy SAVE_EXPR or TARGET_EXPR nodes themselves, but copy - their subtrees if we can make sure to do it only once. */ - if (code == SAVE_EXPR || code == TARGET_EXPR) + /* Do not copy SAVE_EXPR, TARGET_EXPR or BIND_EXPR nodes themselves, but + copy their subtrees if we can make sure to do it only once. */ + if (code == SAVE_EXPR || code == TARGET_EXPR || code == BIND_EXPR) { if (data && !pointer_set_insert ((struct pointer_set_t *)data, t)) ; @@ -895,10 +895,7 @@ mostly_copy_tree_r (tree *tp, int *walk_subtrees, void *data) /* Leave the bulk of the work to copy_tree_r itself. */ else - { - gcc_assert (code != BIND_EXPR); - copy_tree_r (tp, walk_subtrees, NULL); - } + copy_tree_r (tp, walk_subtrees, NULL); return NULL_TREE; } -- cgit v1.2.1 From 42e6c49cd9cc5bafb39b9b9610c639cecb869c9e Mon Sep 17 00:00:00 2001 From: rguenth Date: Sun, 4 Jul 2010 16:55:40 +0000 Subject: 2010-07-04 Richard Guenther PR middle-end/44809 * gimplify.c (gimplify_expr): Properly build a MEM_REF instead of an INDIRECT_REF. * g++.dg/torture/pr44809.C: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161803 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 9eb8fa70d3e..02d0bb0ac26 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -7416,7 +7416,7 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, that temporary. */ tmp = build_fold_addr_expr_loc (input_location, *expr_p); gimplify_expr (&tmp, pre_p, post_p, is_gimple_reg, fb_rvalue); - *expr_p = build1 (INDIRECT_REF, TREE_TYPE (TREE_TYPE (tmp)), tmp); + *expr_p = build_simple_mem_ref (tmp); } else if ((fallback & fb_rvalue) && is_gimple_reg_rhs_or_call (*expr_p)) { -- cgit v1.2.1 From 86638c2ef3b5ed40e2c8f19e5ce0cdbf86593413 Mon Sep 17 00:00:00 2001 From: rguenth Date: Mon, 5 Jul 2010 12:25:20 +0000 Subject: 2010-07-05 Richard Guenther * tree-ssa-loop-im.c (for_each_index): Do not handle ALIGN_INDIRECT_REF. (gen_lsm_tmp_name): Likewise. * tree-dump.c (dequeue_and_dump): Likewise. * tree-pretty-print.c (dump_generic_node): Likewise. (op_code_prio): Likewise. (op_symbol_code): Likewise. * tree.c (staticp): Likewise. (build1_stat): Likewise. * tree.h (INDIRECT_REF_P): Likewise. * fold-const.c (maybe_lvalue_p): Likewise. (operand_equal_p): Likewise. * tree-ssa-sccvn.c (copy_reference_ops_from_ref): Likewise. (ao_ref_init_from_vn_reference): Likewise. * tree-ssa-loop-ivopts.c (idx_find_step): Likewise. (find_interesting_uses_address): Likewise. * dwarf2out.c (loc_list_from_tree): Likewise. * gimplify.c (gimplify_expr): Likewise. * tree-eh.c (tree_could_trap_p): Likewise. * emit-rtl.c (set_mem_attributes_minus_bitpos): Likewise. * cfgexpand.c (expand_debug_expr): Likewise. * tree-ssa-pre.c (create_component_ref_by_pieces_1): Likewise. * tree-ssa-loop-prefetch.c (idx_analyze_ref): Likewise. * tree-cfg.c (verify_types_in_gimple_min_lval): Likewise. * config/rs6000/rs6000 (rs6000_check_sdmode): Likewise. * tree-ssa-operands.c (get_expr_operands): Likewise. * expr.c (safe_from_p): Likewise. (expand_expr_real_1): Likewise. TER BIT_AND_EXPRs into MEM_REFs. * tree-vect-data-refs.c (vect_setup_realignment): Build BIT_AND_EXPR and MEM_REF instead of ALIGN_INDIRECT_REF. * tree-vect-stmts.c (vectorizable_load): Likewise. * tree.def (ALIGN_INDIRECT_REF): Remove. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161830 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 1 - 1 file changed, 1 deletion(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 02d0bb0ac26..5559f0e3698 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -6769,7 +6769,6 @@ gimplify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, recalculate_side_effects (*expr_p); break; - case ALIGN_INDIRECT_REF: case MISALIGNED_INDIRECT_REF: /* We can only reach this through re-gimplification from tree optimizers. */ -- cgit v1.2.1 From 9dcc4d7a4f275af013140ff7221b9c76c66cd843 Mon Sep 17 00:00:00 2001 From: jakub Date: Mon, 5 Jul 2010 14:42:20 +0000 Subject: PR c++/44808 * gimplify.c (gimplify_modify_expr): Only SET_DECL_DEBUG_EXPR if *from_p is VAR_DECL. * g++.dg/opt/nrv16.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@161838 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 5559f0e3698..4440af50b7f 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -4559,7 +4559,7 @@ gimplify_modify_expr (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p, /* Try to alleviate the effects of the gimplification creating artificial temporaries (see for example is_gimple_reg_rhs) on the debug info. */ if (!gimplify_ctxp->into_ssa - && DECL_P (*from_p) + && TREE_CODE (*from_p) == VAR_DECL && DECL_IGNORED_P (*from_p) && DECL_P (*to_p) && !DECL_IGNORED_P (*to_p)) -- 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/gimplify.c | 1 + 1 file changed, 1 insertion(+) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 4440af50b7f..8fbe1bafd44 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -39,6 +39,7 @@ along with GCC; see the file COPYING3. If not see #include "function.h" #include "output.h" #include "ggc.h" +#include "diagnostic-core.h" #include "toplev.h" #include "target.h" #include "pointer-set.h" -- cgit v1.2.1 From 1767a056f10a2ccbc900df04d01193da73a3d272 Mon Sep 17 00:00:00 2001 From: froydnj Date: Thu, 15 Jul 2010 14:31:28 +0000 Subject: gcc/ * tree.h (DECL_CHAIN): Define. * alias.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-decl.c: Likewise. * c-parser.c: Likewise. * c-typeck.c: Likewise. * cfgexpand.c: Likewise. * cgraph.c: Likewise. * cgraphunit.c: Likewise. * combine.c: Likewise. * config/alpha/alpha.c: Likewise. * config/arm/arm.c: Likewise. * config/frv/frv.c: Likewise. * config/i386/i386.c: Likewise. * config/i386/winnt-cxx.c: Likewise. * config/ia64/ia64.c: Likewise. * config/iq2000/iq2000.c: Likewise. * config/mep/mep.c: Likewise. * config/mips/mips.c: Likewise. * config/pa/som.h: Likewise. * config/rs6000/rs6000.c: Likewise. * config/s390/s390.c: Likewise. * config/sh/sh.c: Likewise. * config/sh/symbian-cxx.c: Likewise. * config/sparc/sparc.c: Likewise. * config/spu/spu.c: Likewise. * config/stormy16/stormy16.c: Likewise. * config/vxworks.c: Likewise. * config/xtensa/xtensa.c: Likewise. * coverage.c: Likewise. * dbxout.c: Likewise. * dwarf2out.c: Likewise. * emit-rtl.c: Likewise. * expr.c: Likewise. * function.c: Likewise. * gimple-low.c: Likewise. * gimple-pretty-print.c: Likewise. * gimplify.c: Likewise. * integrate.c: Likewise. * ipa-inline.c: Likewise. * ipa-prop.c: Likewise. * ipa-split.c: Likewise. * ipa-struct-reorg.c: Likewise. * ipa-type-escape.c: Likewise. * langhooks.c: Likewise. * lto-cgraph.c: Likewise. * omp-low.c: Likewise. * stor-layout.c: Likewise. * tree-cfg.c: Likewise. * tree-complex.c: Likewise. * tree-dfa.c: Likewise. * tree-dump.c: Likewise. * tree-inline.c: Likewise. * tree-mudflap.c: Likewise. * tree-nested.c: Likewise. * tree-object-size.c: Likewise. * tree-pretty-print.c: Likewise. * tree-sra.c: Likewise. * tree-ssa-live.c: Likewise. * tree-ssa-loop-niter.c: Likewise. * tree-ssa-math-opts.c: Likewise. * tree-ssa-reassoc.c: Likewise. * tree-ssa-sccvn.c: Likewise. * tree-ssa-structalias.c: Likewise. * tree-tailcall.c: Likewise. * tree-vrp.c: Likewise. * tree.c: Likewise. * var-tracking.c: Likewise. * varasm.c: Likewise. gcc/ada/ * gcc-interface/decl.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * gcc-interface/trans.c: Likewise. * gcc-interface/utils.c: Likewise. * gcc-interface/utils2.c: Likewise. gcc/c-family/ * c-common.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * c-format.c: Likewise. gcc/cp/ * cp-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * call.c: Likewise. * class.c: Likewise. * cp-gimplify.c: Likewise. * decl.c: Likewise. * decl2.c: Likewise. * init.c: Likewise. * mangle.c: Likewise. * name-lookup.c: Likewise. * optimize.c: Likewise. * parser.c: Likewise. * pt.c: Likewise. * rtti.c: Likewise. * search.c: Likewise. * semantics.c: Likewise. * typeck.c: Likewise. * typeck2.c: Likewise. gcc/fortran/ * f95-lang.c: Carefully replace TREE_CHAIN with DECL_CHAIN. * trans-common.c: Likewise. * trans-decl.c: Likewise. * trans-types.c: Likewise. * trans.c: Likewise. gcc/java/ * java-tree.h: Carefully replace TREE_CHAIN with DECL_CHAIN. * boehm.c: Likewise. * class.c: Likewise. * decl.c: Likewise. * expr.c: Likewise. * jcf-parse.c: Likewise. * typeck.c: Likewise. * verify-glue.c: Likewise. gcc/objc/ * objc-act.c: Carefully replace TREE_CHAIN with DECL_CHAIN. gcc/testsuite/ * g++.dg/plugin/attribute_plugin.c: Carefully replace TREE_CHAIN with DECL_CHAIN. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162223 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/gimplify.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'gcc/gimplify.c') diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 8fbe1bafd44..8b97ee3d0e8 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -653,7 +653,7 @@ declare_vars (tree vars, gimple scope, bool debug_info) gcc_assert (!block || TREE_CODE (block) == BLOCK); if (!block || !debug_info) { - TREE_CHAIN (last) = gimple_bind_vars (scope); + DECL_CHAIN (last) = gimple_bind_vars (scope); gimple_bind_set_vars (scope, temps); } else @@ -701,7 +701,7 @@ force_constant_size (tree var) void gimple_add_tmp_var (tree tmp) { - gcc_assert (!TREE_CHAIN (tmp) && !DECL_SEEN_IN_BIND_EXPR_P (tmp)); + gcc_assert (!DECL_CHAIN (tmp) && !DECL_SEEN_IN_BIND_EXPR_P (tmp)); /* Later processing assumes that the object size is constant, which might not be true at this point. Force the use of a constant upper bound in @@ -714,7 +714,7 @@ gimple_add_tmp_var (tree tmp) if (gimplify_ctxp) { - TREE_CHAIN (tmp) = gimplify_ctxp->temps; + DECL_CHAIN (tmp) = gimplify_ctxp->temps; gimplify_ctxp->temps = tmp; /* Mark temporaries local within the nearest enclosing parallel. */ @@ -1133,7 +1133,7 @@ gimplify_bind_expr (tree *expr_p, gimple_seq *pre_p) tree temp = voidify_wrapper_expr (bind_expr, NULL); /* Mark variables seen in this bind expr. */ - for (t = BIND_EXPR_VARS (bind_expr); t ; t = TREE_CHAIN (t)) + for (t = BIND_EXPR_VARS (bind_expr); t ; t = DECL_CHAIN (t)) { if (TREE_CODE (t) == VAR_DECL) { @@ -1902,7 +1902,7 @@ gimplify_var_or_parm_decl (tree *expr_p) SET_DECL_RTL (copy, 0); TREE_USED (copy) = 1; block = DECL_INITIAL (current_function_decl); - TREE_CHAIN (copy) = BLOCK_VARS (block); + DECL_CHAIN (copy) = BLOCK_VARS (block); BLOCK_VARS (block) = copy; SET_DECL_VALUE_EXPR (copy, unshare_expr (value_expr)); DECL_HAS_VALUE_EXPR_P (copy) = 1; @@ -5392,7 +5392,7 @@ omp_firstprivatize_type_sizes (struct gimplify_omp_ctx *ctx, tree type) case QUAL_UNION_TYPE: { tree field; - for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) + for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field)) if (TREE_CODE (field) == FIELD_DECL) { omp_firstprivatize_variable (ctx, DECL_FIELD_OFFSET (field)); @@ -7532,7 +7532,7 @@ gimplify_type_sizes (tree type, gimple_seq *list_p) case RECORD_TYPE: case UNION_TYPE: case QUAL_UNION_TYPE: - for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field)) + for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field)) if (TREE_CODE (field) == FIELD_DECL) { gimplify_one_sizepos (&DECL_FIELD_OFFSET (field), list_p); @@ -7691,7 +7691,7 @@ gimplify_body (tree *body_p, tree fndecl, bool do_parms) gimple_bind_set_body (outer_bind, parm_stmts); for (parm = DECL_ARGUMENTS (current_function_decl); - parm; parm = TREE_CHAIN (parm)) + parm; parm = DECL_CHAIN (parm)) if (DECL_HAS_VALUE_EXPR_P (parm)) { DECL_HAS_VALUE_EXPR_P (parm) = 0; @@ -7741,7 +7741,7 @@ gimplify_function_tree (tree fndecl) else push_struct_function (fndecl); - for (parm = DECL_ARGUMENTS (fndecl); parm ; parm = TREE_CHAIN (parm)) + for (parm = DECL_ARGUMENTS (fndecl); parm ; parm = DECL_CHAIN (parm)) { /* Preliminarily mark non-addressed complex variables as eligible for promotion to gimple registers. We'll transform their uses @@ -8037,7 +8037,7 @@ force_gimple_operand (tree expr, gimple_seq *stmts, bool simple, tree var) } if (gimple_referenced_vars (cfun)) - for (t = gimplify_ctxp->temps; t ; t = TREE_CHAIN (t)) + for (t = gimplify_ctxp->temps; t ; t = DECL_CHAIN (t)) add_referenced_var (t); pop_gimplify_context (NULL); -- cgit v1.2.1