From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13558 invoked by alias); 27 Oct 2011 23:30:17 -0000 Received: (qmail 13290 invoked by uid 22791); 27 Oct 2011 23:30:14 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp25.services.sfr.fr (HELO smtp25.services.sfr.fr) (93.17.128.120) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 27 Oct 2011 23:29:59 +0000 Received: from filter.sfr.fr (localhost [127.0.0.1]) by msfrf2512.sfr.fr (SMTP Server) with ESMTP id A6E49700004E; Fri, 28 Oct 2011 01:29:58 +0200 (CEST) Received: from gimli.local (145.15.72.86.rev.sfr.net [86.72.15.145]) by msfrf2512.sfr.fr (SMTP Server) with ESMTP id 4D4087000040; Fri, 28 Oct 2011 01:29:58 +0200 (CEST) X-SFR-UUID: 20111027232958316.4D4087000040@msfrf2512.sfr.fr Content-Type: multipart/mixed; boundary="===============2864966226397298103==" MIME-Version: 1.0 From: Mikael Morin To: gfortran , GCC patches Message-ID: <20111027232958.18581.39970@gimli.local> In-Reply-To: <20111027232947.18581.48982@gimli.local> References: <20111027232818.18581.901@gimli.local> <20111027232947.18581.48982@gimli.local> Subject: [Patch, fortran] [14/66] inline sum and product: Interfaces changes: gfc_trans_array_bound_check, gfc_conv_array_index_offset Date: Thu, 27 Oct 2011 23:31:00 -0000 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2011-10/txt/msg02529.txt.bz2 --===============2864966226397298103== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-length: 331 The next patch is going to need array expression (available through gf_ss) instead of just the array descriptor in gfc_trans_array_bound_check. This makes the gfc_ss struct available as argument. This requires an update of gfc_conv_array_index_offset too. Both functions are static, they lose their gfc_ prefix along the way. OK? --===============2864966226397298103== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pr43829-14.CL" Content-length: 520 2011-10-19 Mikael Morin * trans-array.c (gfc_trans_array_bound_check, trans_array_bound_check): Rename the former to the latter. Replace descriptor argument with ss argument. Get descriptor from ss. (gfc_conv_array_index_offset, conv_array_index_offset): Rename the former to the latter. Update call to trans_array_bound_check. Replace info argument with ss argument. Get info from ss. (gfc_conv_scalarized_array_ref): Update call to conv_array_index_offset. (add_array_offset): Ditto --===============2864966226397298103== Content-Type: text/x-diff; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pr43829-14.patch" Content-length: 3374 diff --git a/trans-array.c b/trans-array.c index c39fc9e..45bf683 100644 --- a/trans-array.c +++ b/trans-array.c @@ -2426,17 +2426,20 @@ gfc_conv_array_ubound (tree descriptor, int dim) /* Generate code to perform an array index bound check. */ static tree -gfc_trans_array_bound_check (gfc_se * se, tree descriptor, tree index, int n, - locus * where, bool check_upper) +trans_array_bound_check (gfc_se * se, gfc_ss *ss, tree index, int n, + locus * where, bool check_upper) { tree fault; tree tmp_lo, tmp_up; + tree descriptor; char *msg; const char * name = NULL; if (!(gfc_option.rtcheck & GFC_RTCHECK_BOUNDS)) return index; + descriptor = ss->data.info.descriptor; + index = gfc_evaluate_now (index, &se->pre); /* We find a name for the error message. */ @@ -2521,13 +2524,16 @@ gfc_trans_array_bound_check (gfc_se * se, tree descriptor, tree index, int n, DIM is the array dimension, I is the loop dimension. */ static tree -gfc_conv_array_index_offset (gfc_se * se, gfc_ss_info * info, int dim, int i, - gfc_array_ref * ar, tree stride) +conv_array_index_offset (gfc_se * se, gfc_ss * ss, int dim, int i, + gfc_array_ref * ar, tree stride) { + gfc_ss_info *info; tree index; tree desc; tree data; + info = &ss->data.info; + /* Get the index into the array for this dimension. */ if (ar) { @@ -2544,10 +2550,9 @@ gfc_conv_array_index_offset (gfc_se * se, gfc_ss_info * info, int dim, int i, /* We've already translated this value outside the loop. */ index = info->subscript[dim]->data.scalar.expr; - index = gfc_trans_array_bound_check (se, info->descriptor, - index, dim, &ar->where, - ar->as->type != AS_ASSUMED_SIZE - || dim < ar->dimen - 1); + index = trans_array_bound_check (se, ss, index, dim, &ar->where, + ar->as->type != AS_ASSUMED_SIZE + || dim < ar->dimen - 1); break; case DIMEN_VECTOR: @@ -2574,10 +2579,9 @@ gfc_conv_array_index_offset (gfc_se * se, gfc_ss_info * info, int dim, int i, index = fold_convert (gfc_array_index_type, index); /* Do any bounds checking on the final info->descriptor index. */ - index = gfc_trans_array_bound_check (se, info->descriptor, - index, dim, &ar->where, - ar->as->type != AS_ASSUMED_SIZE - || dim < ar->dimen - 1); + index = trans_array_bound_check (se, ss, index, dim, &ar->where, + ar->as->type != AS_ASSUMED_SIZE + || dim < ar->dimen - 1); break; case DIMEN_RANGE: @@ -2648,7 +2652,7 @@ gfc_conv_scalarized_array_ref (gfc_se * se, gfc_array_ref * ar) else n = 0; - index = gfc_conv_array_index_offset (se, info, info->dim[n], n, ar, + index = conv_array_index_offset (se, se->ss, info->dim[n], n, ar, info->stride0); /* Add the offset for this dimension to the stored offset for all other dimensions. */ @@ -2843,8 +2847,7 @@ add_array_offset (stmtblock_t *pblock, gfc_loopinfo *loop, gfc_ss *ss, se.loop = loop; se.expr = info->descriptor; stride = gfc_conv_array_stride (info->descriptor, array_dim); - index = gfc_conv_array_index_offset (&se, info, array_dim, loop_dim, ar, - stride); + index = conv_array_index_offset (&se, ss, array_dim, loop_dim, ar, stride); gfc_add_block_to_block (pblock, &se.pre); info->offset = fold_build2_loc (input_location, PLUS_EXPR, --===============2864966226397298103==--