From edc4866fa9303029e1c0924a73f6c57f09d63d1c Mon Sep 17 00:00:00 2001 From: mikael Date: Thu, 2 Aug 2012 19:20:43 +0000 Subject: [PATCH] * trans-array.h (gfc_conv_descriptor_rank): New prototype. * trans-array.c (gfc_conv_descriptor_rank): New function moved and renamed ... * trans-intrinsic.c (get_rank_from_desc): ... from this one. (gfc_conv_intrinsic_rank, gfc_conv_intrinsic_bound, gfc_conv_associated): Also rename function calls. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@190095 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/fortran/ChangeLog | 9 +++++++++ gcc/fortran/trans-array.c | 14 ++++++++++++++ gcc/fortran/trans-array.h | 1 + gcc/fortran/trans-intrinsic.c | 20 +++----------------- 4 files changed, 27 insertions(+), 17 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 94bb958aa5f..036e973bcf1 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,5 +1,14 @@ 2012-08-02 Mikael Morin + * trans-array.h (gfc_conv_descriptor_rank): New prototype. + * trans-array.c (gfc_conv_descriptor_rank): New function moved and + renamed ... + * trans-intrinsic.c (get_rank_from_desc): ... from this one. + (gfc_conv_intrinsic_rank, gfc_conv_intrinsic_bound, + gfc_conv_associated): Also rename function calls. + +2012-08-02 Mikael Morin + * iresolve.c (resolve_bound, gfc_resolve_shape): Don't set the shape for assumed rank arrays. * simplify.c (gfc_simplify_shape): Don't try to simplify if the diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 555d69696bb..abdb9eabd4f 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -249,6 +249,20 @@ gfc_conv_descriptor_dtype (tree desc) tree +gfc_conv_descriptor_rank (tree desc) +{ + tree tmp; + tree dtype; + + dtype = gfc_conv_descriptor_dtype (desc); + tmp = build_int_cst (TREE_TYPE (dtype), GFC_DTYPE_RANK_MASK); + tmp = fold_build2_loc (input_location, BIT_AND_EXPR, TREE_TYPE (dtype), + dtype, tmp); + return fold_convert (gfc_get_int_type (gfc_default_integer_kind), tmp); +} + + +tree gfc_get_descriptor_dimension (tree desc) { tree type, field; diff --git a/gcc/fortran/trans-array.h b/gcc/fortran/trans-array.h index b7ab806fd18..5ad794ad752 100644 --- a/gcc/fortran/trans-array.h +++ b/gcc/fortran/trans-array.h @@ -154,6 +154,7 @@ tree gfc_conv_descriptor_data_get (tree); tree gfc_conv_descriptor_data_addr (tree); tree gfc_conv_descriptor_offset_get (tree); tree gfc_conv_descriptor_dtype (tree); +tree gfc_conv_descriptor_rank (tree); tree gfc_get_descriptor_dimension (tree); tree gfc_conv_descriptor_stride_get (tree, tree); tree gfc_conv_descriptor_lbound_get (tree, tree); diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 7bcfda9301d..fac29c7f5f6 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -1315,20 +1315,6 @@ trans_num_images (gfc_se * se) } -static tree -get_rank_from_desc (tree desc) -{ - tree tmp; - tree dtype; - - dtype = gfc_conv_descriptor_dtype (desc); - tmp = build_int_cst (TREE_TYPE (dtype), GFC_DTYPE_RANK_MASK); - tmp = fold_build2_loc (input_location, BIT_AND_EXPR, TREE_TYPE (dtype), - dtype, tmp); - return fold_convert (gfc_get_int_type (gfc_default_integer_kind), tmp); -} - - static void gfc_conv_intrinsic_rank (gfc_se *se, gfc_expr *expr) { @@ -1345,7 +1331,7 @@ gfc_conv_intrinsic_rank (gfc_se *se, gfc_expr *expr) gfc_add_block_to_block (&se->pre, &argse.pre); gfc_add_block_to_block (&se->post, &argse.post); - se->expr = get_rank_from_desc (argse.expr); + se->expr = gfc_conv_descriptor_rank (argse.expr); } @@ -1434,7 +1420,7 @@ gfc_conv_intrinsic_bound (gfc_se * se, gfc_expr * expr, int upper) cond = fold_build2_loc (input_location, LT_EXPR, boolean_type_node, bound, build_int_cst (TREE_TYPE (bound), 0)); if (as && as->type == AS_ASSUMED_RANK) - tmp = get_rank_from_desc (desc); + tmp = gfc_conv_descriptor_rank (desc); else tmp = gfc_rank_cst[GFC_TYPE_ARRAY_RANK (TREE_TYPE (desc))]; tmp = fold_build2_loc (input_location, GE_EXPR, boolean_type_node, @@ -5895,7 +5881,7 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr) gfc_conv_expr_lhs (&arg1se, arg1->expr); if (arg1->expr->rank == -1) { - tmp = get_rank_from_desc (arg1se.expr); + tmp = gfc_conv_descriptor_rank (arg1se.expr); tmp = fold_build2_loc (input_location, MINUS_EXPR, TREE_TYPE (tmp), tmp, gfc_index_one_node); } -- 2.11.4.GIT