Commit 17aa6ab6 by Mikael Morin

trans-array.h (gfc_conv_descriptor_rank): New prototype.

	* 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.

From-SVN: r190095
parent d357d991
2012-08-02 Mikael Morin <mikael@gcc.gnu.org> 2012-08-02 Mikael Morin <mikael@gcc.gnu.org>
* 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 <mikael@gcc.gnu.org>
* iresolve.c (resolve_bound, gfc_resolve_shape): * iresolve.c (resolve_bound, gfc_resolve_shape):
Don't set the shape for assumed rank arrays. Don't set the shape for assumed rank arrays.
* simplify.c (gfc_simplify_shape): Don't try to simplify if the * simplify.c (gfc_simplify_shape): Don't try to simplify if the
......
...@@ -249,6 +249,20 @@ gfc_conv_descriptor_dtype (tree desc) ...@@ -249,6 +249,20 @@ gfc_conv_descriptor_dtype (tree desc)
tree 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) gfc_get_descriptor_dimension (tree desc)
{ {
tree type, field; tree type, field;
......
...@@ -154,6 +154,7 @@ tree gfc_conv_descriptor_data_get (tree); ...@@ -154,6 +154,7 @@ tree gfc_conv_descriptor_data_get (tree);
tree gfc_conv_descriptor_data_addr (tree); tree gfc_conv_descriptor_data_addr (tree);
tree gfc_conv_descriptor_offset_get (tree); tree gfc_conv_descriptor_offset_get (tree);
tree gfc_conv_descriptor_dtype (tree); tree gfc_conv_descriptor_dtype (tree);
tree gfc_conv_descriptor_rank (tree);
tree gfc_get_descriptor_dimension (tree); tree gfc_get_descriptor_dimension (tree);
tree gfc_conv_descriptor_stride_get (tree, tree); tree gfc_conv_descriptor_stride_get (tree, tree);
tree gfc_conv_descriptor_lbound_get (tree, tree); tree gfc_conv_descriptor_lbound_get (tree, tree);
......
...@@ -1315,20 +1315,6 @@ trans_num_images (gfc_se * se) ...@@ -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 static void
gfc_conv_intrinsic_rank (gfc_se *se, gfc_expr *expr) gfc_conv_intrinsic_rank (gfc_se *se, gfc_expr *expr)
{ {
...@@ -1345,7 +1331,7 @@ 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->pre, &argse.pre);
gfc_add_block_to_block (&se->post, &argse.post); 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) ...@@ -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, cond = fold_build2_loc (input_location, LT_EXPR, boolean_type_node,
bound, build_int_cst (TREE_TYPE (bound), 0)); bound, build_int_cst (TREE_TYPE (bound), 0));
if (as && as->type == AS_ASSUMED_RANK) if (as && as->type == AS_ASSUMED_RANK)
tmp = get_rank_from_desc (desc); tmp = gfc_conv_descriptor_rank (desc);
else else
tmp = gfc_rank_cst[GFC_TYPE_ARRAY_RANK (TREE_TYPE (desc))]; tmp = gfc_rank_cst[GFC_TYPE_ARRAY_RANK (TREE_TYPE (desc))];
tmp = fold_build2_loc (input_location, GE_EXPR, boolean_type_node, tmp = fold_build2_loc (input_location, GE_EXPR, boolean_type_node,
...@@ -5895,7 +5881,7 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr) ...@@ -5895,7 +5881,7 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr)
gfc_conv_expr_lhs (&arg1se, arg1->expr); gfc_conv_expr_lhs (&arg1se, arg1->expr);
if (arg1->expr->rank == -1) 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, tmp = fold_build2_loc (input_location, MINUS_EXPR,
TREE_TYPE (tmp), tmp, gfc_index_one_node); TREE_TYPE (tmp), tmp, gfc_index_one_node);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment