diff options
author | Mikael Morin <mikael@gcc.gnu.org> | 2011-11-03 22:40:55 +0000 |
---|---|---|
committer | Mikael Morin <mikael@gcc.gnu.org> | 2011-11-03 22:40:55 +0000 |
commit | 1d9370e9096e97e380a593039e755523345e530d (patch) | |
tree | f73ff2e0f23b7d995b910b50c4f60d42beafe945 | |
parent | a9e88ec6fe9438c79b19601f9c20ef77bea4ef9e (diff) | |
download | gcc-1d9370e9096e97e380a593039e755523345e530d.zip gcc-1d9370e9096e97e380a593039e755523345e530d.tar.gz gcc-1d9370e9096e97e380a593039e755523345e530d.tar.bz2 |
trans-array.c (set_loop_bounds): Separate the beginning of gfc_conv_loop_setup into a function of its own.
* trans-array.c (set_loop_bounds): Separate the beginning of
gfc_conv_loop_setup into a function of its own.
(set_delta): Separate the end of gfc_conv_loop_setup into a function
of its own.
(gfc_conv_loop_setup): Call set_loop_bounds and set delta.
(set_loop_bounds, set_delta, gfc_conv_loop_setup): Make loopspec a
pointer to the specloop field from the loop struct.
From-SVN: r180880
-rw-r--r-- | gcc/fortran/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/fortran/trans-array.c | 60 |
2 files changed, 58 insertions, 12 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index ac6e29b..0d0e730 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,13 @@ +2011-11-03 Mikael Morin <mikael@gcc.gnu.org> + + * trans-array.c (set_loop_bounds): Separate the beginning of + gfc_conv_loop_setup into a function of its own. + (set_delta): Separate the end of gfc_conv_loop_setup into a function + of its own. + (gfc_conv_loop_setup): Call set_loop_bounds and set delta. + (set_loop_bounds, set_delta, gfc_conv_loop_setup): Make loopspec a + pointer to the specloop field from the loop struct. + 2011-11-03 Tobias Burnus <burnus@net-b.de> PR fortran/50933 diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 045c426..302f937 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -3919,25 +3919,25 @@ temporary: } -/* Initialize the scalarization loop. Creates the loop variables. Determines - the range of the loop variables. Creates a temporary if required. - Calculates how to transform from loop variables to array indices for each - expression. Also generates code for scalar expressions which have been - moved outside the loop. */ +/* Browse through each array's information from the scalarizer and set the loop + bounds according to the "best" one (per dimension), i.e. the one which + provides the most information (constant bounds, shape, etc). */ -void -gfc_conv_loop_setup (gfc_loopinfo * loop, locus * where) +static void +set_loop_bounds (gfc_loopinfo *loop) { int n, dim, spec_dim; gfc_array_info *info; gfc_array_info *specinfo; - gfc_ss *ss, *tmp_ss; + gfc_ss *ss; tree tmp; - gfc_ss *loopspec[GFC_MAX_DIMENSIONS]; + gfc_ss **loopspec; bool dynamic[GFC_MAX_DIMENSIONS]; mpz_t *cshape; mpz_t i; + loopspec = loop->specloop; + mpz_init (i); for (n = 0; n < loop->dimen; n++) { @@ -4119,6 +4119,26 @@ gfc_conv_loop_setup (gfc_loopinfo * loop, locus * where) loop->from[n] = gfc_index_zero_node; } } + mpz_clear (i); +} + + +static void set_delta (gfc_loopinfo *loop); + + +/* Initialize the scalarization loop. Creates the loop variables. Determines + the range of the loop variables. Creates a temporary if required. + Also generates code for scalar expressions which have been + moved outside the loop. */ + +void +gfc_conv_loop_setup (gfc_loopinfo * loop, locus * where) +{ + gfc_ss *tmp_ss; + tree tmp; + int n; + + set_loop_bounds (loop); /* Add all the scalar code that can be taken out of the loops. This may include calculating the loop bounds, so do it before @@ -4153,15 +4173,31 @@ gfc_conv_loop_setup (gfc_loopinfo * loop, locus * where) } for (n = 0; n < loop->temp_dim; n++) - loopspec[loop->order[n]] = NULL; - - mpz_clear (i); + loop->specloop[loop->order[n]] = NULL; /* For array parameters we don't have loop variables, so don't calculate the translations. */ if (loop->array_parameter) return; + set_delta (loop); +} + + +/* Calculates how to transform from loop variables to array indices for each + array: once loop bounds are chosen, sets the difference (DELTA field) between + loop bounds and array reference bounds, for each array info. */ + +static void +set_delta (gfc_loopinfo *loop) +{ + gfc_ss *ss, **loopspec; + gfc_array_info *info; + tree tmp; + int n, dim; + + loopspec = loop->specloop; + /* Calculate the translation from loop variables to array indices. */ for (ss = loop->ss; ss != gfc_ss_terminator; ss = ss->loop_chain) { |