From 97dc04b39a0435315f95512f5214d22cabe67e16 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Tue, 24 Aug 2004 08:46:38 -0700 Subject: [PATCH] gimplify.c (gimplify_array_ref_to_plus): Delete. 2004-08-24 Richard Henderson Andrew Pinski * gimplify.c (gimplify_array_ref_to_plus): Delete. (gimplify_addr_expr): Do not call gimplify_array_ref_to_plus for ARRAY_REF. * config/rs6000/rs6000.c (altivec_expand_builtin): Go passed ARRAY_REF also to get to the STRING_CST. Co-Authored-By: Andrew Pinski From-SVN: r86487 --- gcc/ChangeLog | 10 ++++++ gcc/config/rs6000/rs6000.c | 3 +- gcc/gimplify.c | 62 -------------------------------------- 3 files changed, 12 insertions(+), 63 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f6bb1b91c04..7d711fa5273 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2004-08-24 Richard Henderson + Andrew Pinski + + * gimplify.c (gimplify_array_ref_to_plus): Delete. + (gimplify_addr_expr): Do not call gimplify_array_ref_to_plus + for ARRAY_REF. + + * config/rs6000/rs6000.c (altivec_expand_builtin): Go passed + ARRAY_REF also to get to the STRING_CST. + 2004-08-24 Paul Brook * config/arm/arm.c (arm_override_options): Update error message. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 9da6d2636ae..c6198cf6392 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -6784,7 +6784,8 @@ altivec_expand_builtin (tree exp, rtx target, bool *expandedp) case ALTIVEC_BUILTIN_COMPILETIME_ERROR: arg0 = TREE_VALUE (arglist); - while (TREE_CODE (arg0) == NOP_EXPR || TREE_CODE (arg0) == ADDR_EXPR) + while (TREE_CODE (arg0) == NOP_EXPR || TREE_CODE (arg0) == ADDR_EXPR + || TREE_CODE (arg0) == ARRAY_REF) arg0 = TREE_OPERAND (arg0, 0); error ("invalid parameter combination for `%s' AltiVec intrinsic", TREE_STRING_POINTER (arg0)); diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 3c9ff202dc4..b008a17375c 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -1426,59 +1426,6 @@ gimplify_conversion (tree *expr_p) return GS_OK; } -/* Subroutine of gimplify_compound_lval. - Converts an ARRAY_REF to the equivalent *(&array + offset) form. */ - -static enum gimplify_status -gimplify_array_ref_to_plus (tree *expr_p, tree *pre_p, tree *post_p) -{ - tree array = TREE_OPERAND (*expr_p, 0); - tree arrtype = TREE_TYPE (array); - tree elttype = TREE_TYPE (arrtype); - tree size = array_ref_element_size (*expr_p); - tree ptrtype = build_pointer_type (elttype); - enum tree_code add_code = PLUS_EXPR; - tree idx = TREE_OPERAND (*expr_p, 1); - tree minidx = unshare_expr (array_ref_low_bound (*expr_p)); - tree offset, addr, result; - enum gimplify_status ret; - - /* If the array domain does not start at zero, apply the offset. */ - if (!integer_zerop (minidx)) - { - idx = convert (TREE_TYPE (minidx), idx); - idx = fold (build (MINUS_EXPR, TREE_TYPE (minidx), idx, minidx)); - } - - /* If the index is negative -- a technically invalid situation now - that we've biased the index back to zero -- then casting it to - unsigned has ill effects. In particular, -1*4U/4U != -1. - Represent this as a subtraction of a positive rather than addition - of a negative. This will prevent any conversion back to ARRAY_REF - from getting the wrong results from the division. */ - if (TREE_CODE (idx) == INTEGER_CST && tree_int_cst_sgn (idx) < 0) - { - idx = fold (build1 (NEGATE_EXPR, TREE_TYPE (idx), idx)); - add_code = MINUS_EXPR; - } - - /* Pointer arithmetic must be done in sizetype. */ - idx = fold_convert (sizetype, idx); - - /* Convert the index to a byte offset. */ - offset = size_binop (MULT_EXPR, size, idx); - - ret = gimplify_expr (&array, pre_p, post_p, is_gimple_min_lval, fb_lvalue); - if (ret == GS_ERROR) - return ret; - - addr = build_fold_addr_expr_with_type (array, ptrtype); - result = fold (build (add_code, ptrtype, addr, offset)); - *expr_p = build1 (INDIRECT_REF, elttype, result); - - return GS_OK; -} - /* Gimplify the COMPONENT_REF, ARRAY_REF, REALPART_EXPR or IMAGPART_EXPR node pointed by EXPR_P. @@ -3124,15 +3071,6 @@ gimplify_addr_expr (tree *expr_p, tree *pre_p, tree *post_p) ret = GS_OK; break; - case ARRAY_REF: - /* Fold &a[6] to (&a + 6). */ - ret = gimplify_array_ref_to_plus (&TREE_OPERAND (expr, 0), - pre_p, post_p); - - /* This added an INDIRECT_REF. Fold it away. */ - *expr_p = TREE_OPERAND (TREE_OPERAND (expr, 0), 0); - break; - case VIEW_CONVERT_EXPR: /* Take the address of our operand and then convert it to the type of this ADDR_EXPR. -- 2.30.2