diff options
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 89 | ||||
-rw-r--r-- | gcc/fortran/Make-lang.in | 5 | ||||
-rw-r--r-- | gcc/fortran/f95-lang.c | 4 | ||||
-rw-r--r-- | gcc/fortran/trans-array.c | 122 | ||||
-rw-r--r-- | gcc/fortran/trans-array.h | 6 | ||||
-rw-r--r-- | gcc/fortran/trans-decl.c | 8 | ||||
-rw-r--r-- | gcc/fortran/trans-expr.c | 60 | ||||
-rw-r--r-- | gcc/fortran/trans-intrinsic.c | 70 | ||||
-rw-r--r-- | gcc/fortran/trans-io.c | 30 | ||||
-rw-r--r-- | gcc/fortran/trans-openmp.c | 55 | ||||
-rw-r--r-- | gcc/fortran/trans-stmt.c | 132 | ||||
-rw-r--r-- | gcc/fortran/trans.c | 37 | ||||
-rw-r--r-- | gcc/fortran/trans.h | 8 |
13 files changed, 351 insertions, 275 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index fd3cff552d3..cfcfa12530a 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,92 @@ +2008-07-28 Richard Guenther <rguenther@suse.de> + + Merge from gimple-tuples-branch. + + 2008-07-18 Aldy Hernandez <aldyh@redhat.com> + + * trans-expr.c: Include gimple.h instead of tree-gimple.h. + * trans-array.c: Same. + * trans-openmp.c: Same. + * trans-stmt.c: Same. + * f95-lang.c: Same. + * trans-io.c: Same. + * trans-decl.c: Same. + * trans-intrinsic.c: Same. + * trans.c: Same. Include tree-iterator.h. + * Make-lang.in (trans.o): Depend on tree-iterator.h + + 2008-07-14 Aldy Hernandez <aldyh@redhat.com> + + * trans-array.h (gfc_conv_descriptor_data_set_internal): + Rename to gfc_conv_descriptor_data_set. + (gfc_conv_descriptor_data_set_tuples): Remove. + * trans-array.c (gfc_conv_descriptor_data_get): Rename + from gfc_conv_descriptor_data_set_internal. + Remove last argument to gfc_add_modify. + (gfc_trans_allocate_array_storage): Rename gfc_add_modify_expr to + gfc_add_modify. + (gfc_trans_create_temp_array): Same. + (gfc_conv_array_transpose): Same. + (gfc_grow_array): Same. + (gfc_put_offset_into_var): Same. + (gfc_trans_array_ctor_element): Same. + (gfc_trans_array_constructor_subarray): Same. + (gfc_trans_array_constructor_value): Same. + (gfc_trans_scalarized_loop_end): Same. + (gfc_array_init_size): Same. + (gfc_array_allocate): Same. + (gfc_trans_array_bounds): Same. + (gfc_trans_auto_array_allocation): Same. + (gfc_trans_g77_array): Same. + (gfc_trans_dummy_array_bias): Same. + (gfc_conv_expr_descriptor): Same. + (structure_alloc_comps): Same. + * trans-expr.c: Same. + * trans-openmp.c (gfc_omp_clause_default_ctor): Same. + Rename gfc_conv_descriptor_data_set_tuples to + gfc_conv_descriptor_data_set. + (gfc_omp_clause_copy_ctor): Change build_gimple_modify_stmt to + build2_v. + (gfc_omp_clause_assign_op): Same. + (gfc_trans_omp_array_reduction): Rename gfc_add_modify_expr to + gfc_add_modify. + (gfc_trans_omp_atomic): Same. + (gfc_trans_omp_do): Same. Change GIMPLE_MODIFY_STMT to MODIFY_EXPR. + Rename gfc_add_modify_stmt to gfc_add_modify. + * trans-stmt.c: Rename gfc_add_modify_expr to + gfc_add_modify. + * trans.c: Rename gfc_add_modify_expr to + gfc_add_modify. + (gfc_add_modify): Remove last argument. + Rename GIMPLE_MODIFY_STMT to MODIFY_EXPR. + * trans.h: Remove gfc_add_modify_expr, gfc_add_modify_stmt. + Add prototype for gfc_add_modify. + * f95-lang.c (union lang_tree_node): Rename GENERIC_NEXT to TREE_CHAIN. + * trans-decl.c: Rename gfc_add_modify_stmt to gfc_add_modify. + * trans-io.c: Same. + * trans-intrinsic.c: Same. + + 2008-02-25 Aldy Hernandez <aldyh@redhat.com> + + * Make-lang.in (fortran-warn): Add -Wno-format. + + 2008-02-19 Diego Novillo <dnovillo@google.com> + + http://gcc.gnu.org/ml/gcc-patches/2008-02/msg00804.html + + * fortran/Make-lang.in (fortran-warn): Remove. + + 2007-11-22 Aldy Hernandez <aldyh@redhat.com> + + * trans-expr.c (gfc_trans_string_copy): Use "void *" when building a + memset. + + 2007-11-10 Aldy Hernandez <aldyh@redhat.com> + + * Make-lang.in (fortran-warn): Set to -Wno-format. + * trans.c (gfc_trans_code): Update comment to say GENERIC. + Call tree_annotate_all_with_locus instead of annotate_all_with_locus. + 2008-07-27 Tobias Burnus <burnus@net-b.de> PR fortran/36132 diff --git a/gcc/fortran/Make-lang.in b/gcc/fortran/Make-lang.in index b0944c94308..77ddb6ae5e0 100644 --- a/gcc/fortran/Make-lang.in +++ b/gcc/fortran/Make-lang.in @@ -47,6 +47,7 @@ GFORTRAN_TARGET_INSTALL_NAME := $(target_noncanonical)-$(shell echo gfortran|sed # Use strict warnings for this front end. fortran-warn = $(STRICT_WARN) +fortran-warn += -Wno-format -Wno-missing-format-attribute -Wno-uninitialized # FIXME tuples: Do not merge. # These are the groups of object files we have. The F95_PARSER_OBJS are # all the front end files, the F95_OBJS are the files for the translation @@ -311,9 +312,9 @@ fortran/f95-lang.o: $(GFORTRAN_TRANS_DEPS) fortran/mathbuiltins.def \ $(BUILTINS_DEF) fortran/types.def fortran/scanner.o: toplev.h fortran/cpp.h fortran/convert.o: $(GFORTRAN_TRANS_DEPS) -fortran/trans.o: $(GFORTRAN_TRANS_DEPS) +fortran/trans.o: $(GFORTRAN_TRANS_DEPS) tree-iterator.h fortran/trans-decl.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-decl.h \ - $(CGRAPH_H) $(TARGET_H) $(FUNCTION_H) $(FLAGS_H) $(RTL_H) $(TREE_GIMPLE_H) \ + $(CGRAPH_H) $(TARGET_H) $(FUNCTION_H) $(FLAGS_H) $(RTL_H) $(GIMPLE_H) \ $(TREE_DUMP_H) fortran/trans-types.o: $(GFORTRAN_TRANS_DEPS) gt-fortran-trans-types.h \ $(REAL_H) toplev.h $(TARGET_H) $(FLAGS_H) dwarf2out.h diff --git a/gcc/fortran/f95-lang.c b/gcc/fortran/f95-lang.c index 941f7cd47d2..d2768b112dd 100644 --- a/gcc/fortran/f95-lang.c +++ b/gcc/fortran/f95-lang.c @@ -29,7 +29,7 @@ along with GCC; see the file COPYING3. If not see #include "system.h" #include "coretypes.h" #include "tree.h" -#include "tree-gimple.h" +#include "gimple.h" #include "flags.h" #include "langhooks.h" #include "langhooks-def.h" @@ -62,7 +62,7 @@ GTY(()) union lang_tree_node GTY((desc ("TREE_CODE (&%h.generic) == IDENTIFIER_NODE"), - chain_next ("(union lang_tree_node *)GENERIC_NEXT (&%h.generic)"))) + chain_next ("(union lang_tree_node *)TREE_CHAIN (&%h.generic)"))) { union tree_node GTY((tag ("0"), diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 14bab8ead53..fe6b63de90b 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -80,7 +80,7 @@ along with GCC; see the file COPYING3. If not see #include "system.h" #include "coretypes.h" #include "tree.h" -#include "tree-gimple.h" +#include "gimple.h" #include "ggc.h" #include "toplev.h" #include "real.h" @@ -161,12 +161,10 @@ gfc_conv_descriptor_data_get (tree desc) This function gets called through the following macros: gfc_conv_descriptor_data_set - gfc_conv_descriptor_data_set_tuples. */ + gfc_conv_descriptor_data_set. */ void -gfc_conv_descriptor_data_set_internal (stmtblock_t *block, - tree desc, tree value, - bool tuples_p) +gfc_conv_descriptor_data_set (stmtblock_t *block, tree desc, tree value) { tree field, type, t; @@ -177,7 +175,7 @@ gfc_conv_descriptor_data_set_internal (stmtblock_t *block, gcc_assert (DATA_FIELD == 0); t = fold_build3 (COMPONENT_REF, TREE_TYPE (field), desc, field, NULL_TREE); - gfc_add_modify (block, t, fold_convert (TREE_TYPE (field), value), tuples_p); + gfc_add_modify (block, t, fold_convert (TREE_TYPE (field), value)); } @@ -547,7 +545,7 @@ gfc_trans_allocate_array_storage (stmtblock_t * pre, stmtblock_t * post, /* The offset is zero because we create temporaries with a zero lower bound. */ tmp = gfc_conv_descriptor_offset (desc); - gfc_add_modify_expr (pre, tmp, gfc_index_zero_node); + gfc_add_modify (pre, tmp, gfc_index_zero_node); if (dealloc && !onstack) { @@ -627,7 +625,7 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post, /* Fill in the array dtype. */ tmp = gfc_conv_descriptor_dtype (desc); - gfc_add_modify_expr (pre, tmp, gfc_get_dtype (TREE_TYPE (desc))); + gfc_add_modify (pre, tmp, gfc_get_dtype (TREE_TYPE (desc))); /* Fill in the bounds and stride. This is a packed array, so: @@ -661,13 +659,13 @@ gfc_trans_create_temp_array (stmtblock_t * pre, stmtblock_t * post, /* Store the stride and bound components in the descriptor. */ tmp = gfc_conv_descriptor_stride (desc, gfc_rank_cst[n]); - gfc_add_modify_expr (pre, tmp, size); + gfc_add_modify (pre, tmp, size); tmp = gfc_conv_descriptor_lbound (desc, gfc_rank_cst[n]); - gfc_add_modify_expr (pre, tmp, gfc_index_zero_node); + gfc_add_modify (pre, tmp, gfc_index_zero_node); tmp = gfc_conv_descriptor_ubound (desc, gfc_rank_cst[n]); - gfc_add_modify_expr (pre, tmp, loop->to[n]); + gfc_add_modify (pre, tmp, loop->to[n]); tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, loop->to[n], gfc_index_one_node); @@ -752,7 +750,7 @@ gfc_conv_array_transpose (gfc_se * se, gfc_expr * expr) se->expr = dest; /* Copy across the dtype field. */ - gfc_add_modify_expr (&se->pre, + gfc_add_modify (&se->pre, gfc_conv_descriptor_dtype (dest), gfc_conv_descriptor_dtype (src)); @@ -769,15 +767,15 @@ gfc_conv_array_transpose (gfc_se * se, gfc_expr * expr) dest_index = gfc_rank_cst[n]; src_index = gfc_rank_cst[1 - n]; - gfc_add_modify_expr (&se->pre, + gfc_add_modify (&se->pre, gfc_conv_descriptor_stride (dest, dest_index), gfc_conv_descriptor_stride (src, src_index)); - gfc_add_modify_expr (&se->pre, + gfc_add_modify (&se->pre, gfc_conv_descriptor_lbound (dest, dest_index), gfc_conv_descriptor_lbound (src, src_index)); - gfc_add_modify_expr (&se->pre, + gfc_add_modify (&se->pre, gfc_conv_descriptor_ubound (dest, dest_index), gfc_conv_descriptor_ubound (src, src_index)); @@ -803,7 +801,7 @@ gfc_conv_array_transpose (gfc_se * se, gfc_expr * expr) else dest_info->offset = gfc_index_zero_node; - gfc_add_modify_expr (&se->pre, + gfc_add_modify (&se->pre, gfc_conv_descriptor_offset (dest), dest_info->offset); @@ -847,7 +845,7 @@ gfc_grow_array (stmtblock_t * pblock, tree desc, tree extra) /* Add EXTRA to the upper bound. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, ubound, extra); - gfc_add_modify_expr (pblock, ubound, tmp); + gfc_add_modify (pblock, ubound, tmp); /* Get the value of the current data pointer. */ arg0 = gfc_conv_descriptor_data_get (desc); @@ -957,7 +955,7 @@ gfc_put_offset_into_var (stmtblock_t * pblock, tree * poffset, /* We should have already created the offset variable. We cannot create it here because we may be in an inner scope. */ gcc_assert (*offsetvar != NULL_TREE); - gfc_add_modify_expr (pblock, *offsetvar, *poffset); + gfc_add_modify (pblock, *offsetvar, *poffset); *poffset = *offsetvar; TREE_USED (*offsetvar) = 1; } @@ -996,7 +994,7 @@ gfc_trans_array_ctor_element (stmtblock_t * pblock, tree desc, { /* The temporary is an array of pointers. */ se->expr = fold_convert (TREE_TYPE (tmp), se->expr); - gfc_add_modify_expr (&se->pre, tmp, se->expr); + gfc_add_modify (&se->pre, tmp, se->expr); } else { @@ -1011,7 +1009,7 @@ gfc_trans_array_ctor_element (stmtblock_t * pblock, tree desc, { if (first_len) { - gfc_add_modify_expr (&se->pre, first_len_val, + gfc_add_modify (&se->pre, first_len_val, se->string_length); first_len = false; } @@ -1033,7 +1031,7 @@ gfc_trans_array_ctor_element (stmtblock_t * pblock, tree desc, { /* TODO: Should the frontend already have done this conversion? */ se->expr = fold_convert (TREE_TYPE (tmp), se->expr); - gfc_add_modify_expr (&se->pre, tmp, se->expr); + gfc_add_modify (&se->pre, tmp, se->expr); } gfc_add_block_to_block (pblock, &se->pre); @@ -1104,7 +1102,7 @@ gfc_trans_array_constructor_subarray (stmtblock_t * pblock, /* Increment the offset. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, *poffset, gfc_index_one_node); - gfc_add_modify_expr (&body, *poffset, tmp); + gfc_add_modify (&body, *poffset, tmp); /* Finish the loop. */ gfc_trans_scalarizing_loops (&loop, &body); @@ -1243,7 +1241,7 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type, } if (!INTEGER_CST_P (*poffset)) { - gfc_add_modify_expr (&body, *offsetvar, *poffset); + gfc_add_modify (&body, *offsetvar, *poffset); *poffset = *offsetvar; } } @@ -1289,13 +1287,13 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type, /* Make a temporary, store the current value in that and return it, once the loop is done. */ tmp_loopvar = gfc_create_var (TREE_TYPE (loopvar), "loopvar"); - gfc_add_modify_expr (pblock, tmp_loopvar, loopvar); + gfc_add_modify (pblock, tmp_loopvar, loopvar); /* Initialize the loop. */ gfc_init_se (&se, NULL); gfc_conv_expr_val (&se, c->iterator->start); gfc_add_block_to_block (pblock, &se.pre); - gfc_add_modify_expr (pblock, loopvar, se.expr); + gfc_add_modify (pblock, loopvar, se.expr); gfc_init_se (&se, NULL); gfc_conv_expr_val (&se, c->iterator->end); @@ -1348,7 +1346,7 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type, /* Increase loop variable by step. */ tmp = fold_build2 (PLUS_EXPR, TREE_TYPE (loopvar), loopvar, step); - gfc_add_modify_expr (&body, loopvar, tmp); + gfc_add_modify (&body, loopvar, tmp); /* Finish the loop. */ tmp = gfc_finish_block (&body); @@ -1360,7 +1358,7 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type, gfc_add_expr_to_block (pblock, tmp); /* Restore the original value of the loop counter. */ - gfc_add_modify_expr (pblock, loopvar, tmp_loopvar); + gfc_add_modify (pblock, loopvar, tmp_loopvar); } } mpz_clear (size); @@ -2640,7 +2638,7 @@ gfc_trans_scalarized_loop_end (gfc_loopinfo * loop, int n, loopbody = gfc_finish_block (pbody); /* Initialize the loopvar. */ - gfc_add_modify_expr (&loop->code[n], loop->loopvar[n], loop->from[n]); + gfc_add_modify (&loop->code[n], loop->loopvar[n], loop->from[n]); exit_label = gfc_build_label_decl (NULL_TREE); @@ -2661,7 +2659,7 @@ gfc_trans_scalarized_loop_end (gfc_loopinfo * loop, int n, /* Increment the loopvar. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, loop->loopvar[n], gfc_index_one_node); - gfc_add_modify_expr (&block, loop->loopvar[n], tmp); + gfc_add_modify (&block, loop->loopvar[n], tmp); /* Build the loop. */ tmp = gfc_finish_block (&block); @@ -3621,7 +3619,7 @@ gfc_array_init_size (tree descriptor, int rank, tree * poffset, /* Set the dtype. */ tmp = gfc_conv_descriptor_dtype (descriptor); - gfc_add_modify_expr (pblock, tmp, gfc_get_dtype (TREE_TYPE (descriptor))); + gfc_add_modify (pblock, tmp, gfc_get_dtype (TREE_TYPE (descriptor))); or_expr = NULL_TREE; @@ -3652,7 +3650,7 @@ gfc_array_init_size (tree descriptor, int rank, tree * poffset, } } tmp = gfc_conv_descriptor_lbound (descriptor, gfc_rank_cst[n]); - gfc_add_modify_expr (pblock, tmp, se.expr); + gfc_add_modify (pblock, tmp, se.expr); /* Work out the offset for this component. */ tmp = fold_build2 (MULT_EXPR, gfc_array_index_type, se.expr, stride); @@ -3669,11 +3667,11 @@ gfc_array_init_size (tree descriptor, int rank, tree * poffset, gfc_add_block_to_block (pblock, &se.pre); tmp = gfc_conv_descriptor_ubound (descriptor, gfc_rank_cst[n]); - gfc_add_modify_expr (pblock, tmp, se.expr); + gfc_add_modify (pblock, tmp, se.expr); /* Store the stride. */ tmp = gfc_conv_descriptor_stride (descriptor, gfc_rank_cst[n]); - gfc_add_modify_expr (pblock, tmp, stride); + gfc_add_modify (pblock, tmp, stride); /* Calculate the size of this dimension. */ size = fold_build2 (PLUS_EXPR, gfc_array_index_type, se.expr, size); @@ -3713,11 +3711,11 @@ gfc_array_init_size (tree descriptor, int rank, tree * poffset, var = gfc_create_var (TREE_TYPE (size), "size"); gfc_start_block (&thenblock); - gfc_add_modify_expr (&thenblock, var, gfc_index_zero_node); + gfc_add_modify (&thenblock, var, gfc_index_zero_node); thencase = gfc_finish_block (&thenblock); gfc_start_block (&elseblock); - gfc_add_modify_expr (&elseblock, var, size); + gfc_add_modify (&elseblock, var, size); elsecase = gfc_finish_block (&elseblock); tmp = gfc_evaluate_now (or_expr, pblock); @@ -3803,7 +3801,7 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree pstat) gfc_add_expr_to_block (&se->pre, tmp); tmp = gfc_conv_descriptor_offset (se->expr); - gfc_add_modify_expr (&se->pre, tmp, offset); + gfc_add_modify (&se->pre, tmp, offset); if (expr->ts.type == BT_DERIVED && expr->ts.derived->attr.alloc_comp) @@ -4001,7 +3999,7 @@ gfc_trans_array_bounds (tree type, gfc_symbol * sym, tree * poffset, gfc_init_se (&se, NULL); gfc_conv_expr_type (&se, as->lower[dim], gfc_array_index_type); gfc_add_block_to_block (pblock, &se.pre); - gfc_add_modify_expr (pblock, lbound, se.expr); + gfc_add_modify (pblock, lbound, se.expr); } ubound = GFC_TYPE_ARRAY_UBOUND (type, dim); if (as->upper[dim] && !INTEGER_CST_P (ubound)) @@ -4009,7 +4007,7 @@ gfc_trans_array_bounds (tree type, gfc_symbol * sym, tree * poffset, gfc_init_se (&se, NULL); gfc_conv_expr_type (&se, as->upper[dim], gfc_array_index_type); gfc_add_block_to_block (pblock, &se.pre); - gfc_add_modify_expr (pblock, ubound, se.expr); + gfc_add_modify (pblock, ubound, se.expr); } /* The offset of this dimension. offset = offset - lbound * stride. */ tmp = fold_build2 (MULT_EXPR, gfc_array_index_type, lbound, size); @@ -4029,7 +4027,7 @@ gfc_trans_array_bounds (tree type, gfc_symbol * sym, tree * poffset, tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, ubound, tmp); tmp = fold_build2 (MULT_EXPR, gfc_array_index_type, size, tmp); if (stride) - gfc_add_modify_expr (pblock, stride, tmp); + gfc_add_modify (pblock, stride, tmp); else stride = gfc_evaluate_now (tmp, pblock); @@ -4039,7 +4037,7 @@ gfc_trans_array_bounds (tree type, gfc_symbol * sym, tree * poffset, stride, gfc_index_zero_node); tmp = fold_build3 (COND_EXPR, gfc_array_index_type, tmp, stride, gfc_index_zero_node); - gfc_add_modify_expr (pblock, stride, tmp); + gfc_add_modify (pblock, stride, tmp); } size = stride; @@ -4112,7 +4110,7 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, tree fnbody) if (sym->attr.cray_pointee) { if (TREE_CODE (GFC_TYPE_ARRAY_OFFSET (type)) == VAR_DECL) - gfc_add_modify_expr (&block, GFC_TYPE_ARRAY_OFFSET (type), offset); + gfc_add_modify (&block, GFC_TYPE_ARRAY_OFFSET (type), offset); gfc_add_expr_to_block (&block, fnbody); return gfc_finish_block (&block); } @@ -4125,11 +4123,11 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, tree fnbody) /* Allocate memory to hold the data. */ tmp = gfc_call_malloc (&block, TREE_TYPE (decl), size); - gfc_add_modify_expr (&block, decl, tmp); + gfc_add_modify (&block, decl, tmp); /* Set offset of the array. */ if (TREE_CODE (GFC_TYPE_ARRAY_OFFSET (type)) == VAR_DECL) - gfc_add_modify_expr (&block, GFC_TYPE_ARRAY_OFFSET (type), offset); + gfc_add_modify (&block, GFC_TYPE_ARRAY_OFFSET (type), offset); /* Automatic arrays should not have initializers. */ @@ -4177,13 +4175,13 @@ gfc_trans_g77_array (gfc_symbol * sym, tree body) /* Set the offset. */ if (TREE_CODE (GFC_TYPE_ARRAY_OFFSET (type)) == VAR_DECL) - gfc_add_modify_expr (&block, GFC_TYPE_ARRAY_OFFSET (type), offset); + gfc_add_modify (&block, GFC_TYPE_ARRAY_OFFSET (type), offset); /* Set the pointer itself if we aren't using the parameter directly. */ if (TREE_CODE (parm) != PARM_DECL) { tmp = convert (TREE_TYPE (parm), GFC_DECL_SAVED_DESCRIPTOR (parm)); - gfc_add_modify_expr (&block, parm, tmp); + gfc_add_modify (&block, parm, tmp); } stmt = gfc_finish_block (&block); @@ -4278,7 +4276,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) TREE_USED (partial) = 1; tmp = gfc_conv_descriptor_stride (dumdesc, gfc_rank_cst[0]); tmp = fold_build2 (EQ_EXPR, boolean_type_node, tmp, gfc_index_one_node); - gfc_add_modify_expr (&block, partial, tmp); + gfc_add_modify (&block, partial, tmp); } else { @@ -4298,7 +4296,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) tmp = fold_build3 (COND_EXPR, gfc_array_index_type, tmp, gfc_index_one_node, stride); stride = GFC_TYPE_ARRAY_STRIDE (type, 0); - gfc_add_modify_expr (&block, stride, tmp); + gfc_add_modify (&block, stride, tmp); /* Allow the user to disable array repacking. */ stmt_unpacked = NULL_TREE; @@ -4332,7 +4330,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) } else tmp = stmt_packed != NULL_TREE ? stmt_packed : stmt_unpacked; - gfc_add_modify_expr (&block, tmpdesc, fold_convert (type, tmp)); + gfc_add_modify (&block, tmpdesc, fold_convert (type, tmp)); offset = gfc_index_zero_node; size = gfc_index_one_node; @@ -4359,7 +4357,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) gfc_conv_expr_type (&se, sym->as->lower[n], gfc_array_index_type); gfc_add_block_to_block (&block, &se.pre); - gfc_add_modify_expr (&block, lbound, se.expr); + gfc_add_modify (&block, lbound, se.expr); } ubound = GFC_TYPE_ARRAY_UBOUND (type, n); @@ -4373,7 +4371,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) gfc_conv_expr_type (&se, sym->as->upper[n], gfc_array_index_type); gfc_add_block_to_block (&block, &se.pre); - gfc_add_modify_expr (&block, ubound, se.expr); + gfc_add_modify (&block, ubound, se.expr); } /* Check the sizes match. */ @@ -4400,7 +4398,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type, dubound, dlbound); tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, tmp, lbound); - gfc_add_modify_expr (&block, ubound, tmp); + gfc_add_modify (&block, ubound, tmp); } /* The offset of this dimension. offset = offset - lbound * stride. */ tmp = fold_build2 (MULT_EXPR, gfc_array_index_type, lbound, stride); @@ -4440,7 +4438,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) stmt_unpacked, stmt_packed); else tmp = (stmt_packed != NULL_TREE) ? stmt_packed : stmt_unpacked; - gfc_add_modify_expr (&block, stride, tmp); + gfc_add_modify (&block, stride, tmp); } } else @@ -4456,14 +4454,14 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) ubound, tmp); tmp = fold_build2 (MULT_EXPR, gfc_array_index_type, GFC_TYPE_ARRAY_STRIDE (type, n), tmp); - gfc_add_modify_expr (&block, stride, tmp); + gfc_add_modify (&block, stride, tmp); } } } /* Set the offset. */ if (TREE_CODE (GFC_TYPE_ARRAY_OFFSET (type)) == VAR_DECL) - gfc_add_modify_expr (&block, GFC_TYPE_ARRAY_OFFSET (type), offset); + gfc_add_modify (&block, GFC_TYPE_ARRAY_OFFSET (type), offset); gfc_trans_vla_type_sizes (sym, &block); @@ -4758,7 +4756,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) if (se->direct_byref) { /* Copy the descriptor for pointer assignments. */ - gfc_add_modify_expr (&se->pre, se->expr, desc); + gfc_add_modify (&se->pre, se->expr, desc); /* Add any offsets from subreferences. */ gfc_get_dataptr_offset (&se->pre, se->expr, desc, NULL_TREE, @@ -4991,7 +4989,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) /* Set the dtype. */ tmp = gfc_conv_descriptor_dtype (parm); - gfc_add_modify_expr (&loop.pre, tmp, gfc_get_dtype (parmtype)); + gfc_add_modify (&loop.pre, tmp, gfc_get_dtype (parmtype)); /* Set offset for assignments to pointer only to zero if it is not the full array. */ @@ -5060,11 +5058,11 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) from = gfc_index_one_node; } tmp = gfc_conv_descriptor_lbound (parm, gfc_rank_cst[dim]); - gfc_add_modify_expr (&loop.pre, tmp, from); + gfc_add_modify (&loop.pre, tmp, from); /* Set the new upper bound. */ tmp = gfc_conv_descriptor_ubound (parm, gfc_rank_cst[dim]); - gfc_add_modify_expr (&loop.pre, tmp, to); + gfc_add_modify (&loop.pre, tmp, to); /* Multiply the stride by the section stride to get the total stride. */ @@ -5089,7 +5087,7 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) /* Store the new stride. */ tmp = gfc_conv_descriptor_stride (parm, gfc_rank_cst[dim]); - gfc_add_modify_expr (&loop.pre, tmp, stride); + gfc_add_modify (&loop.pre, tmp, stride); dim++; } @@ -5106,14 +5104,14 @@ gfc_conv_expr_descriptor (gfc_se * se, gfc_expr * expr, gfc_ss * ss) { /* Set the offset. */ tmp = gfc_conv_descriptor_offset (parm); - gfc_add_modify_expr (&loop.pre, tmp, base); + gfc_add_modify (&loop.pre, tmp, base); } else { /* Only the callee knows what the correct offset it, so just set it to zero here. */ tmp = gfc_conv_descriptor_offset (parm); - gfc_add_modify_expr (&loop.pre, tmp, gfc_index_zero_node); + gfc_add_modify (&loop.pre, tmp, gfc_index_zero_node); } desc = parm; } @@ -5588,7 +5586,7 @@ structure_alloc_comps (gfc_symbol * der_type, tree decl, { rank = c->as ? c->as->rank : 0; tmp = fold_convert (TREE_TYPE (dcmp), comp); - gfc_add_modify_expr (&fnblock, dcmp, tmp); + gfc_add_modify (&fnblock, dcmp, tmp); tmp = structure_alloc_comps (c->ts.derived, comp, dcmp, rank, purpose); gfc_add_expr_to_block (&fnblock, tmp); diff --git a/gcc/fortran/trans-array.h b/gcc/fortran/trans-array.h index 145f4a82565..18de51c8437 100644 --- a/gcc/fortran/trans-array.h +++ b/gcc/fortran/trans-array.h @@ -120,11 +120,7 @@ tree gfc_conv_array_ubound (tree, int); /* Build expressions for accessing components of an array descriptor. */ tree gfc_conv_descriptor_data_get (tree); -void gfc_conv_descriptor_data_set_internal (stmtblock_t *, tree, tree, bool); -#define gfc_conv_descriptor_data_set(BLOCK, T1, T2) \ - gfc_conv_descriptor_data_set_internal ((BLOCK), (T1), (T2), false) -#define gfc_conv_descriptor_data_set_tuples(BLOCK, T1, T2) \ - gfc_conv_descriptor_data_set_internal ((BLOCK), (T1), (T2), true) +void gfc_conv_descriptor_data_set (stmtblock_t *, tree, tree); tree gfc_conv_descriptor_data_addr (tree); tree gfc_conv_descriptor_offset (tree); tree gfc_conv_descriptor_dtype (tree); diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index d2cb6a319c7..1dfa05cc46f 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -26,7 +26,7 @@ along with GCC; see the file COPYING3. If not see #include "coretypes.h" #include "tree.h" #include "tree-dump.h" -#include "tree-gimple.h" +#include "gimple.h" #include "ggc.h" #include "toplev.h" #include "tm.h" @@ -2576,7 +2576,7 @@ gfc_trans_assign_aux_var (gfc_symbol * sym, tree fnbody) /* Set the initial value to length. See the comments in function gfc_add_assign_aux_vars in this file. */ - gfc_add_modify_expr (&body, GFC_DECL_STRING_LEN (sym->backend_decl), + gfc_add_modify (&body, GFC_DECL_STRING_LEN (sym->backend_decl), build_int_cst (NULL_TREE, -2)); gfc_add_expr_to_block (&body, fnbody); @@ -2607,7 +2607,7 @@ gfc_trans_vla_one_sizepos (tree *tp, stmtblock_t *body) var = gfc_create_var_np (TREE_TYPE (t), NULL); gfc_add_decl_to_function (var); - gfc_add_modify_expr (body, var, val); + gfc_add_modify (body, var, val); if (TREE_CODE (t) == SAVE_EXPR) TREE_OPERAND (t, 0) = var; *tp = var; @@ -3412,7 +3412,7 @@ gfc_generate_function_code (gfc_namespace * ns) { tree alternate_return; alternate_return = gfc_get_fake_result_decl (sym, 0); - gfc_add_modify_expr (&body, alternate_return, integer_zero_node); + gfc_add_modify (&body, alternate_return, integer_zero_node); } if (ns->entries) diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index e145c0ca01c..05ee3902e34 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -30,7 +30,7 @@ along with GCC; see the file COPYING3. If not see #include "ggc.h" #include "toplev.h" #include "real.h" -#include "tree-gimple.h" +#include "gimple.h" #include "langhooks.h" #include "flags.h" #include "gfortran.h" @@ -115,7 +115,7 @@ gfc_make_safe_expr (gfc_se * se) /* We need a temporary for this result. */ var = gfc_create_var (TREE_TYPE (se->expr), NULL); - gfc_add_modify_expr (&se->pre, var, se->expr); + gfc_add_modify (&se->pre, var, se->expr); se->expr = var; } @@ -257,7 +257,7 @@ gfc_conv_string_length (gfc_charlen * cl, stmtblock_t * pblock) gfc_add_block_to_block (pblock, &se.pre); if (cl->backend_decl) - gfc_add_modify_expr (pblock, cl->backend_decl, se.expr); + gfc_add_modify (pblock, cl->backend_decl, se.expr); else cl->backend_decl = gfc_evaluate_now (se.expr, pblock); } @@ -993,7 +993,7 @@ gfc_conv_string_tmp (gfc_se * se, tree type, tree len) fold_build2 (MULT_EXPR, TREE_TYPE (len), len, fold_convert (TREE_TYPE (len), TYPE_SIZE (type)))); - gfc_add_modify_expr (&se->pre, var, tmp); + gfc_add_modify (&se->pre, var, tmp); /* Free the temporary afterwards. */ tmp = gfc_call_free (convert (pvoid_type_node, var)); @@ -1509,7 +1509,7 @@ gfc_get_interface_mapping_array (stmtblock_t * block, gfc_symbol * sym, type = gfc_get_nodesc_array_type (type, sym->as, packed); var = gfc_create_var (type, "ifm"); - gfc_add_modify_expr (block, var, fold_convert (type, data)); + gfc_add_modify (block, var, fold_convert (type, data)); return var; } @@ -2165,7 +2165,7 @@ gfc_conv_subref_array_arg (gfc_se * parmse, gfc_expr * expr, tmp_index = fold_build2 (MINUS_EXPR, gfc_array_index_type, tmp_index, rse.loop->from[0]); - gfc_add_modify_expr (&rse.loop->code[0], offset, tmp_index); + gfc_add_modify (&rse.loop->code[0], offset, tmp_index); tmp_index = fold_build2 (PLUS_EXPR, gfc_array_index_type, rse.loop->loopvar[0], offset); @@ -2895,9 +2895,9 @@ fill_with_spaces (tree start, tree type, tree size) /* Initialize variables. */ gfc_init_block (&block); i = gfc_create_var (sizetype, "i"); - gfc_add_modify_expr (&block, i, fold_convert (sizetype, size)); + gfc_add_modify (&block, i, fold_convert (sizetype, size)); el = gfc_create_var (build_pointer_type (type), "el"); - gfc_add_modify_expr (&block, el, fold_convert (TREE_TYPE (el), start)); + gfc_add_modify (&block, el, fold_convert (TREE_TYPE (el), start)); exit_label = gfc_build_label_decl (NULL_TREE); TREE_USED (exit_label) = 1; @@ -2913,14 +2913,14 @@ fill_with_spaces (tree start, tree type, tree size) gfc_add_expr_to_block (&loop, tmp); /* Assignment. */ - gfc_add_modify_expr (&loop, fold_build1 (INDIRECT_REF, type, el), + gfc_add_modify (&loop, fold_build1 (INDIRECT_REF, type, el), build_int_cst (type, lang_hooks.to_target_charset (' '))); /* Increment loop variables. */ - gfc_add_modify_expr (&loop, i, fold_build2 (MINUS_EXPR, sizetype, i, + gfc_add_modify (&loop, i, fold_build2 (MINUS_EXPR, sizetype, i, TYPE_SIZE_UNIT (type))); - gfc_add_modify_expr (&loop, el, fold_build2 (POINTER_PLUS_EXPR, + gfc_add_modify (&loop, el, fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (el), el, TYPE_SIZE_UNIT (type))); @@ -2989,7 +2989,7 @@ gfc_trans_string_copy (stmtblock_t * block, tree dlength, tree dest, if (dsc != NULL_TREE && ssc != NULL_TREE && TREE_TYPE (dsc) == TREE_TYPE (ssc)) { - gfc_add_modify_expr (block, dsc, ssc); + gfc_add_modify (block, dsc, ssc); return; } @@ -3135,7 +3135,7 @@ gfc_conv_statement_function (gfc_se * se, gfc_expr * expr) gfc_conv_expr (&lse, args->expr); gfc_add_block_to_block (&se->pre, &lse.pre); - gfc_add_modify_expr (&se->pre, temp_vars[n], lse.expr); + gfc_add_modify (&se->pre, temp_vars[n], lse.expr); gfc_add_block_to_block (&se->pre, &lse.post); } @@ -3420,7 +3420,7 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr) se.want_pointer = 1; gfc_conv_expr (&se, expr); gfc_add_block_to_block (&block, &se.pre); - gfc_add_modify_expr (&block, dest, + gfc_add_modify (&block, dest, fold_convert (TREE_TYPE (dest), se.expr)); gfc_add_block_to_block (&block, &se.post); } @@ -3441,7 +3441,7 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr) gfc_add_block_to_block (&block, &se.pre); tmp = fold_convert (TREE_TYPE (dest), se.expr); - gfc_add_modify_expr (&block, dest, tmp); + gfc_add_modify (&block, dest, tmp); if (cm->ts.type == BT_DERIVED && cm->ts.derived->attr.alloc_comp) tmp = gfc_copy_alloc_comp (cm->ts.derived, se.expr, dest, @@ -3459,7 +3459,7 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr) /* Shift the lbound and ubound of temporaries to being unity, rather than zero, based. Calculate the offset for all cases. */ offset = gfc_conv_descriptor_offset (dest); - gfc_add_modify_expr (&block, offset, gfc_index_zero_node); + gfc_add_modify (&block, offset, gfc_index_zero_node); tmp2 =gfc_create_var (gfc_array_index_type, NULL); for (n = 0; n < expr->rank; n++) { @@ -3470,21 +3470,21 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr) tmp = gfc_conv_descriptor_ubound (dest, gfc_rank_cst[n]); span = fold_build2 (MINUS_EXPR, gfc_array_index_type, tmp, gfc_conv_descriptor_lbound (dest, gfc_rank_cst[n])); - gfc_add_modify_expr (&block, tmp, + gfc_add_modify (&block, tmp, fold_build2 (PLUS_EXPR, gfc_array_index_type, span, gfc_index_one_node)); tmp = gfc_conv_descriptor_lbound (dest, gfc_rank_cst[n]); - gfc_add_modify_expr (&block, tmp, gfc_index_one_node); + gfc_add_modify (&block, tmp, gfc_index_one_node); } tmp = fold_build2 (MULT_EXPR, gfc_array_index_type, gfc_conv_descriptor_lbound (dest, gfc_rank_cst[n]), gfc_conv_descriptor_stride (dest, gfc_rank_cst[n])); - gfc_add_modify_expr (&block, tmp2, tmp); + gfc_add_modify (&block, tmp2, tmp); tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type, offset, tmp2); - gfc_add_modify_expr (&block, offset, tmp); + gfc_add_modify (&block, offset, tmp); } } else @@ -3499,7 +3499,7 @@ gfc_trans_subcomponent_assign (tree dest, gfc_component * cm, gfc_expr * expr) { gfc_init_se (&se, NULL); gfc_conv_expr (&se, expr); - gfc_add_modify_expr (&block, dest, + gfc_add_modify (&block, dest, fold_convert (TREE_TYPE (dest), se.expr)); } else @@ -3745,7 +3745,7 @@ gfc_conv_expr_val (gfc_se * se, gfc_expr * expr) if (se->post.head) { val = gfc_create_var (TREE_TYPE (se->expr), NULL); - gfc_add_modify_expr (&se->pre, val, se->expr); + gfc_add_modify (&se->pre, val, se->expr); se->expr = val; gfc_add_block_to_block (&se->pre, &se->post); } @@ -3791,7 +3791,7 @@ gfc_conv_expr_reference (gfc_se * se, gfc_expr * expr) if (se->post.head) { var = gfc_create_var (TREE_TYPE (se->expr), NULL); - gfc_add_modify_expr (&se->pre, var, se->expr); + gfc_add_modify (&se->pre, var, se->expr); gfc_add_block_to_block (&se->pre, &se->post); se->expr = var; } @@ -3805,7 +3805,7 @@ gfc_conv_expr_reference (gfc_se * se, gfc_expr * expr) se->want_pointer = 1; gfc_conv_expr (se, expr); var = gfc_create_var (TREE_TYPE (se->expr), NULL); - gfc_add_modify_expr (&se->pre, var, se->expr); + gfc_add_modify (&se->pre, var, se->expr); se->expr = var; return; } @@ -3826,7 +3826,7 @@ gfc_conv_expr_reference (gfc_se * se, gfc_expr * expr) else { var = gfc_create_var (TREE_TYPE (se->expr), NULL); - gfc_add_modify_expr (&se->pre, var, se->expr); + gfc_add_modify (&se->pre, var, se->expr); } gfc_add_block_to_block (&se->pre, &se->post); @@ -3879,7 +3879,7 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr * expr2) gfc_add_block_to_block (&block, &lse.pre); gfc_add_block_to_block (&block, &rse.pre); - gfc_add_modify_expr (&block, lse.expr, + gfc_add_modify (&block, lse.expr, fold_convert (TREE_TYPE (lse.expr), rse.expr)); gfc_add_block_to_block (&block, &rse.post); gfc_add_block_to_block (&block, &lse.post); @@ -3912,7 +3912,7 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr * expr2) tmp = fold_convert (gfc_array_index_type, size_in_bytes (tmp)); if (!INTEGER_CST_P (tmp)) gfc_add_block_to_block (&lse.post, &rse.pre); - gfc_add_modify_expr (&lse.post, GFC_DECL_SPAN(decl), tmp); + gfc_add_modify (&lse.post, GFC_DECL_SPAN(decl), tmp); } break; @@ -3926,7 +3926,7 @@ gfc_trans_pointer_assignment (gfc_expr * expr1, gfc_expr * expr2) lse.expr = tmp; lse.direct_byref = 1; gfc_conv_expr_descriptor (&lse, expr2, rss); - gfc_add_modify_expr (&lse.pre, desc, tmp); + gfc_add_modify (&lse.pre, desc, tmp); break; } gfc_add_block_to_block (&block, &lse.pre); @@ -4038,7 +4038,7 @@ gfc_trans_scalar_assign (gfc_se * lse, gfc_se * rse, gfc_typespec ts, gfc_add_block_to_block (&block, &rse->pre); gfc_add_block_to_block (&block, &lse->pre); - gfc_add_modify_expr (&block, lse->expr, + gfc_add_modify (&block, lse->expr, fold_convert (TREE_TYPE (lse->expr), rse->expr)); /* Do a deep copy if the rhs is a variable, if it is not the @@ -4055,7 +4055,7 @@ gfc_trans_scalar_assign (gfc_se * lse, gfc_se * rse, gfc_typespec ts, gfc_add_block_to_block (&block, &lse->pre); gfc_add_block_to_block (&block, &rse->pre); - gfc_add_modify_expr (&block, lse->expr, + gfc_add_modify (&block, lse->expr, fold_convert (TREE_TYPE (lse->expr), rse->expr)); } diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 2dc2d4f7a98..a56f4c1fabb 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -30,7 +30,7 @@ along with GCC; see the file COPYING3. If not see #include "ggc.h" #include "toplev.h" #include "real.h" -#include "tree-gimple.h" +#include "gimple.h" #include "flags.h" #include "gfortran.h" #include "arith.h" @@ -1316,7 +1316,7 @@ gfc_conv_intrinsic_char (gfc_se * se, gfc_expr * expr) var = gfc_create_var (type, "char"); arg[0] = fold_build1 (NOP_EXPR, type, arg[0]); - gfc_add_modify_expr (&se->pre, var, arg[0]); + gfc_add_modify (&se->pre, var, arg[0]); se->expr = gfc_build_addr_expr (build_pointer_type (type), var); se->string_length = integer_one_node; } @@ -1479,7 +1479,7 @@ gfc_conv_intrinsic_minmax (gfc_se * se, gfc_expr * expr, int op) args[0] = gfc_evaluate_now (args[0], &se->pre); mvar = gfc_create_var (type, "M"); - gfc_add_modify_expr (&se->pre, mvar, args[0]); + gfc_add_modify (&se->pre, mvar, args[0]); for (i = 1, argexpr = argexpr->next; i < nargs; i++) { tree cond, isnan; @@ -1718,7 +1718,7 @@ gfc_conv_intrinsic_anyall (gfc_se * se, gfc_expr * expr, int op) tmp = convert (type, boolean_true_node); else tmp = convert (type, boolean_false_node); - gfc_add_modify_expr (&se->pre, resvar, tmp); + gfc_add_modify (&se->pre, resvar, tmp); /* Walk the arguments. */ arrayss = gfc_walk_expr (actual->expr); @@ -1744,7 +1744,7 @@ gfc_conv_intrinsic_anyall (gfc_se * se, gfc_expr * expr, int op) tmp = convert (type, boolean_false_node); else tmp = convert (type, boolean_true_node); - gfc_add_modify_expr (&block, resvar, tmp); + gfc_add_modify (&block, resvar, tmp); /* And break out of the loop. */ tmp = build1_v (GOTO_EXPR, exit_label); @@ -1802,7 +1802,7 @@ gfc_conv_intrinsic_count (gfc_se * se, gfc_expr * expr) type = gfc_typenode_for_spec (&expr->ts); /* Initialize the result. */ resvar = gfc_create_var (type, "count"); - gfc_add_modify_expr (&se->pre, resvar, build_int_cst (type, 0)); + gfc_add_modify (&se->pre, resvar, build_int_cst (type, 0)); /* Walk the arguments. */ arrayss = gfc_walk_expr (actual->expr); @@ -1875,7 +1875,7 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, int op) else tmp = gfc_build_const (type, integer_one_node); - gfc_add_modify_expr (&se->pre, resvar, tmp); + gfc_add_modify (&se->pre, resvar, tmp); /* Walk the arguments. */ actual = expr->value.function.actual; @@ -1932,7 +1932,7 @@ gfc_conv_intrinsic_arith (gfc_se * se, gfc_expr * expr, int op) gfc_add_block_to_block (&block, &arrayse.pre); tmp = fold_build2 (op, type, resvar, arrayse.expr); - gfc_add_modify_expr (&block, resvar, tmp); + gfc_add_modify (&block, resvar, tmp); gfc_add_block_to_block (&block, &arrayse.post); if (maskss) @@ -1999,7 +1999,7 @@ gfc_conv_intrinsic_dot_product (gfc_se * se, gfc_expr * expr) else tmp = gfc_build_const (type, integer_zero_node); - gfc_add_modify_expr (&se->pre, resvar, tmp); + gfc_add_modify (&se->pre, resvar, tmp); /* Walk argument #1. */ actual = expr->value.function.actual; @@ -2056,7 +2056,7 @@ gfc_conv_intrinsic_dot_product (gfc_se * se, gfc_expr * expr) tmp = fold_build2 (MULT_EXPR, type, arrayse1.expr, arrayse2.expr); tmp = fold_build2 (PLUS_EXPR, type, resvar, tmp); } - gfc_add_modify_expr (&block, resvar, tmp); + gfc_add_modify (&block, resvar, tmp); /* Finish up the loop block and the loop. */ tmp = gfc_finish_block (&block); @@ -2146,7 +2146,7 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, int op) possible value is HUGE in both cases. */ if (op == GT_EXPR) tmp = fold_build1 (NEGATE_EXPR, TREE_TYPE (tmp), tmp); - gfc_add_modify_expr (&se->pre, limit, tmp); + gfc_add_modify (&se->pre, limit, tmp); if (op == GT_EXPR && expr->ts.type == BT_INTEGER) tmp = fold_build2 (MINUS_EXPR, TREE_TYPE (tmp), tmp, @@ -2167,7 +2167,7 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, int op) /* Initialize the position to zero, following Fortran 2003. We are free to do this because Fortran 95 allows the result of an entirely false mask to be processor dependent. */ - gfc_add_modify_expr (&loop.pre, pos, gfc_index_zero_node); + gfc_add_modify (&loop.pre, pos, gfc_index_zero_node); gfc_mark_ss_chain_used (arrayss, 1); if (maskss) @@ -2200,7 +2200,7 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, int op) gfc_start_block (&ifblock); /* Assign the value to the limit... */ - gfc_add_modify_expr (&ifblock, limit, arrayse.expr); + gfc_add_modify (&ifblock, limit, arrayse.expr); /* Remember where we are. An offset must be added to the loop counter to obtain the required position. */ @@ -2210,11 +2210,11 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, int op) else tmp = build_int_cst (gfc_array_index_type, 1); - gfc_add_modify_expr (&block, offset, tmp); + gfc_add_modify (&block, offset, tmp); tmp = fold_build2 (PLUS_EXPR, TREE_TYPE (pos), loop.loopvar[0], offset); - gfc_add_modify_expr (&ifblock, pos, tmp); + gfc_add_modify (&ifblock, pos, tmp); ifbody = gfc_finish_block (&ifblock); @@ -2258,7 +2258,7 @@ gfc_conv_intrinsic_minmaxloc (gfc_se * se, gfc_expr * expr, int op) the pos variable the same way as above. */ gfc_init_block (&elseblock); - gfc_add_modify_expr (&elseblock, pos, gfc_index_zero_node); + gfc_add_modify (&elseblock, pos, gfc_index_zero_node); elsetmp = gfc_finish_block (&elseblock); tmp = build3_v (COND_EXPR, maskse.expr, tmp, elsetmp); @@ -2329,7 +2329,7 @@ gfc_conv_intrinsic_minmaxval (gfc_se * se, gfc_expr * expr, int op) tmp = fold_build2 (MINUS_EXPR, TREE_TYPE (tmp), tmp, build_int_cst (type, 1)); - gfc_add_modify_expr (&se->pre, limit, tmp); + gfc_add_modify (&se->pre, limit, tmp); /* Walk the arguments. */ actual = expr->value.function.actual; @@ -3003,12 +3003,12 @@ gfc_conv_intrinsic_spacing (gfc_se * se, gfc_expr * expr) gfc_add_expr_to_block (&block, tmp); tmp = fold_build2 (MINUS_EXPR, integer_type_node, e, prec); - gfc_add_modify_expr (&block, e, fold_build2 (MAX_EXPR, integer_type_node, + gfc_add_modify (&block, e, fold_build2 (MAX_EXPR, integer_type_node, tmp, emin)); tmp = build_call_expr (built_in_decls[scalbn], 2, build_real_from_int_cst (type, integer_one_node), e); - gfc_add_modify_expr (&block, res, tmp); + gfc_add_modify (&block, res, tmp); /* Finish by building the IF statement. */ cond = fold_build2 (EQ_EXPR, boolean_type_node, arg, @@ -3071,7 +3071,7 @@ gfc_conv_intrinsic_rrspacing (gfc_se * se, gfc_expr * expr) e = gfc_create_var (integer_type_node, NULL); x = gfc_create_var (type, NULL); - gfc_add_modify_expr (&se->pre, x, + gfc_add_modify (&se->pre, x, build_call_expr (built_in_decls[fabs], 1, arg)); @@ -3083,7 +3083,7 @@ gfc_conv_intrinsic_rrspacing (gfc_se * se, gfc_expr * expr) tmp = fold_build2 (MINUS_EXPR, integer_type_node, build_int_cst (NULL_TREE, prec), e); tmp = build_call_expr (built_in_decls[scalbn], 2, x, tmp); - gfc_add_modify_expr (&block, x, tmp); + gfc_add_modify (&block, x, tmp); stmt = gfc_finish_block (&block); cond = fold_build2 (NE_EXPR, boolean_type_node, x, @@ -3300,7 +3300,7 @@ gfc_conv_intrinsic_sizeof (gfc_se *se, gfc_expr *expr) else tmp = fold_convert (gfc_array_index_type, size_in_bytes (type)); - gfc_add_modify_expr (&argse.pre, source_bytes, tmp); + gfc_add_modify (&argse.pre, source_bytes, tmp); /* Obtain the size of the array in bytes. */ for (n = 0; n < arg->rank; n++) @@ -3315,7 +3315,7 @@ gfc_conv_intrinsic_sizeof (gfc_se *se, gfc_expr *expr) tmp, gfc_index_one_node); tmp = fold_build2 (MULT_EXPR, gfc_array_index_type, tmp, source_bytes); - gfc_add_modify_expr (&argse.pre, source_bytes, tmp); + gfc_add_modify (&argse.pre, source_bytes, tmp); } se->expr = source_bytes; } @@ -3473,13 +3473,13 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr) { tree idx; idx = gfc_rank_cst[n]; - gfc_add_modify_expr (&argse.pre, source_bytes, tmp); + gfc_add_modify (&argse.pre, source_bytes, tmp); stride = gfc_conv_descriptor_stride (argse.expr, idx); lower = gfc_conv_descriptor_lbound (argse.expr, idx); upper = gfc_conv_descriptor_ubound (argse.expr, idx); tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type, upper, lower); - gfc_add_modify_expr (&argse.pre, extent, tmp); + gfc_add_modify (&argse.pre, extent, tmp); tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, extent, gfc_index_one_node); tmp = fold_build2 (MULT_EXPR, gfc_array_index_type, @@ -3487,7 +3487,7 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr) } } - gfc_add_modify_expr (&argse.pre, source_bytes, tmp); + gfc_add_modify (&argse.pre, source_bytes, tmp); gfc_add_block_to_block (&se->pre, &argse.pre); gfc_add_block_to_block (&se->post, &argse.post); @@ -3522,7 +3522,7 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr) size_in_bytes (mold_type)); dest_word_len = gfc_create_var (gfc_array_index_type, NULL); - gfc_add_modify_expr (&se->pre, dest_word_len, tmp); + gfc_add_modify (&se->pre, dest_word_len, tmp); /* Finally convert SIZE, if it is present. */ arg = arg->next; @@ -3551,8 +3551,8 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr) else tmp = source_bytes; - gfc_add_modify_expr (&se->pre, size_bytes, tmp); - gfc_add_modify_expr (&se->pre, size_words, + gfc_add_modify (&se->pre, size_bytes, tmp); + gfc_add_modify (&se->pre, size_words, fold_build2 (CEIL_DIV_EXPR, gfc_array_index_type, size_bytes, dest_word_len)); @@ -3569,8 +3569,8 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr) tmp, gfc_index_one_node); tmp = fold_build2 (MIN_EXPR, gfc_array_index_type, tmp, size_words); - gfc_add_modify_expr (&se->pre, size_words, tmp); - gfc_add_modify_expr (&se->pre, size_bytes, + gfc_add_modify (&se->pre, size_words, tmp); + gfc_add_modify (&se->pre, size_bytes, fold_build2 (MULT_EXPR, gfc_array_index_type, size_words, dest_word_len)); upper = fold_build2 (PLUS_EXPR, gfc_array_index_type, @@ -3971,7 +3971,7 @@ gfc_conv_intrinsic_repeat (gfc_se * se, gfc_expr * expr) build_int_cst (size_type_node, 0)); tmp = fold_build3 (COND_EXPR, ncopies_type, cond, build_int_cst (ncopies_type, 0), ncopies); - gfc_add_modify_expr (&se->pre, n, tmp); + gfc_add_modify (&se->pre, n, tmp); ncopies = n; /* Check that ncopies is not too large: ncopies should be less than @@ -4006,7 +4006,7 @@ gfc_conv_intrinsic_repeat (gfc_se * se, gfc_expr * expr) memmove (dest + (i * slen * size), src, slen*size); */ gfc_start_block (&block); count = gfc_create_var (ncopies_type, "count"); - gfc_add_modify_expr (&block, count, build_int_cst (ncopies_type, 0)); + gfc_add_modify (&block, count, build_int_cst (ncopies_type, 0)); exit_label = gfc_build_label_decl (NULL_TREE); /* Start the loop body. */ @@ -4037,7 +4037,7 @@ gfc_conv_intrinsic_repeat (gfc_se * se, gfc_expr * expr) /* Increment count. */ tmp = fold_build2 (PLUS_EXPR, ncopies_type, count, build_int_cst (TREE_TYPE (count), 1)); - gfc_add_modify_expr (&body, count, tmp); + gfc_add_modify (&body, count, tmp); /* Build the loop. */ tmp = build1_v (LOOP_EXPR, gfc_finish_block (&body)); @@ -4101,7 +4101,7 @@ gfc_conv_intrinsic_loc (gfc_se * se, gfc_expr * expr) /* Create a temporary variable for loc return value. Without this, we get an error an ICE in gcc/expr.c(expand_expr_addr_expr_1). */ temp_var = gfc_create_var (gfc_get_int_type (gfc_index_integer_kind), NULL); - gfc_add_modify_expr (&se->pre, temp_var, se->expr); + gfc_add_modify (&se->pre, temp_var, se->expr); se->expr = temp_var; } diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index 3d17a4c77da..e304d1687bf 100644 --- a/gcc/fortran/trans-io.c +++ b/gcc/fortran/trans-io.c @@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see #include "system.h" #include "coretypes.h" #include "tree.h" -#include "tree-gimple.h" +#include "gimple.h" #include "ggc.h" #include "toplev.h" #include "real.h" @@ -450,7 +450,7 @@ set_parameter_const (stmtblock_t *block, tree var, enum iofield type, var, TYPE_FIELDS (TREE_TYPE (var)), NULL_TREE); tmp = fold_build3 (COMPONENT_REF, TREE_TYPE (p->field), var, p->field, NULL_TREE); - gfc_add_modify_expr (block, tmp, build_int_cst (TREE_TYPE (p->field), val)); + gfc_add_modify (block, tmp, build_int_cst (TREE_TYPE (p->field), val)); return p->mask; } @@ -505,7 +505,7 @@ set_parameter_value (stmtblock_t *block, tree var, enum iofield type, var, TYPE_FIELDS (TREE_TYPE (var)), NULL_TREE); tmp = fold_build3 (COMPONENT_REF, dest_type, var, p->field, NULL_TREE); - gfc_add_modify_expr (block, tmp, se.expr); + gfc_add_modify (block, tmp, se.expr); return p->mask; } @@ -535,7 +535,7 @@ set_parameter_ref (stmtblock_t *block, stmtblock_t *postblock, /* If this is for the iostat variable initialize the user variable to LIBERROR_OK which is zero. */ if (type == IOPARM_common_iostat) - gfc_add_modify_expr (block, se.expr, + gfc_add_modify (block, se.expr, build_int_cst (TREE_TYPE (se.expr), LIBERROR_OK)); } else @@ -549,13 +549,13 @@ set_parameter_ref (stmtblock_t *block, stmtblock_t *postblock, /* If this is for the iostat variable, initialize the user variable to LIBERROR_OK which is zero. */ if (type == IOPARM_common_iostat) - gfc_add_modify_expr (block, tmpvar, + gfc_add_modify (block, tmpvar, build_int_cst (TREE_TYPE (tmpvar), LIBERROR_OK)); addr = build_fold_addr_expr (tmpvar); /* After the I/O operation, we set the variable from the temporary. */ tmp = convert (TREE_TYPE (se.expr), tmpvar); - gfc_add_modify_expr (postblock, se.expr, tmp); + gfc_add_modify (postblock, se.expr, tmp); } if (p->param_type == IOPARM_ptype_common) @@ -563,7 +563,7 @@ set_parameter_ref (stmtblock_t *block, stmtblock_t *postblock, var, TYPE_FIELDS (TREE_TYPE (var)), NULL_TREE); tmp = fold_build3 (COMPONENT_REF, TREE_TYPE (p->field), var, p->field, NULL_TREE); - gfc_add_modify_expr (block, tmp, addr); + gfc_add_modify (block, tmp, addr); return p->mask; } @@ -672,9 +672,9 @@ set_string (stmtblock_t * block, stmtblock_t * postblock, tree var, fold_convert (long_integer_type_node, tmp)); gfc_free (msg); - gfc_add_modify_expr (&se.pre, io, + gfc_add_modify (&se.pre, io, fold_convert (TREE_TYPE (io), GFC_DECL_ASSIGN_ADDR (se.expr))); - gfc_add_modify_expr (&se.pre, len, GFC_DECL_STRING_LEN (se.expr)); + gfc_add_modify (&se.pre, len, GFC_DECL_STRING_LEN (se.expr)); } else { @@ -688,8 +688,8 @@ set_string (stmtblock_t * block, stmtblock_t * postblock, tree var, gcc_unreachable (); gfc_conv_string_parameter (&se); - gfc_add_modify_expr (&se.pre, io, fold_convert (TREE_TYPE (io), se.expr)); - gfc_add_modify_expr (&se.pre, len, se.string_length); + gfc_add_modify (&se.pre, io, fold_convert (TREE_TYPE (io), se.expr)); + gfc_add_modify (&se.pre, len, se.string_length); } gfc_add_block_to_block (block, &se.pre); @@ -764,10 +764,10 @@ set_internal_unit (stmtblock_t * block, stmtblock_t * post_block, /* The cast is needed for character substrings and the descriptor data. */ - gfc_add_modify_expr (&se.pre, io, fold_convert (TREE_TYPE (io), tmp)); - gfc_add_modify_expr (&se.pre, len, + gfc_add_modify (&se.pre, io, fold_convert (TREE_TYPE (io), tmp)); + gfc_add_modify (&se.pre, len, fold_convert (TREE_TYPE (len), se.string_length)); - gfc_add_modify_expr (&se.pre, desc, se.expr); + gfc_add_modify (&se.pre, desc, se.expr); gfc_add_block_to_block (block, &se.pre); gfc_add_block_to_block (post_block, &se.post); @@ -865,7 +865,7 @@ set_error_locus (stmtblock_t * block, tree var, locus * where) str = gfc_build_cstring_const (f->filename); str = gfc_build_addr_expr (pchar_type_node, str); - gfc_add_modify_expr (block, locus_file, str); + gfc_add_modify (block, locus_file, str); line = LOCATION_LINE (where->lb->location); set_parameter_const (block, var, IOPARM_common_line, line); diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index 06329a98554..49fd1f6152f 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -23,7 +23,7 @@ along with GCC; see the file COPYING3. If not see #include "system.h" #include "coretypes.h" #include "tree.h" -#include "tree-gimple.h" +#include "gimple.h" #include "ggc.h" #include "toplev.h" #include "real.h" @@ -147,7 +147,7 @@ gfc_omp_clause_default_ctor (tree clause, tree decl, tree outer) gfc_init_block (&cond_block); - gfc_add_modify_expr (&cond_block, decl, outer); + gfc_add_modify (&cond_block, decl, outer); rank = gfc_rank_cst[GFC_TYPE_ARRAY_RANK (type) - 1]; size = gfc_conv_descriptor_ubound (decl, rank); size = fold_build2 (MINUS_EXPR, gfc_array_index_type, size, @@ -164,11 +164,11 @@ gfc_omp_clause_default_ctor (tree clause, tree decl, tree outer) ptr = gfc_allocate_array_with_status (&cond_block, build_int_cst (pvoid_type_node, 0), size, NULL); - gfc_conv_descriptor_data_set_tuples (&cond_block, decl, ptr); + gfc_conv_descriptor_data_set (&cond_block, decl, ptr); then_b = gfc_finish_block (&cond_block); gfc_init_block (&cond_block); - gfc_conv_descriptor_data_set_tuples (&cond_block, decl, null_pointer_node); + gfc_conv_descriptor_data_set (&cond_block, decl, null_pointer_node); else_b = gfc_finish_block (&cond_block); cond = fold_build2 (NE_EXPR, boolean_type_node, @@ -191,7 +191,7 @@ gfc_omp_clause_copy_ctor (tree clause, tree dest, tree src) if (! GFC_DESCRIPTOR_TYPE_P (type) || GFC_TYPE_ARRAY_AKIND (type) != GFC_ARRAY_ALLOCATABLE) - return build_gimple_modify_stmt (dest, src); + return build2_v (MODIFY_EXPR, dest, src); gcc_assert (OMP_CLAUSE_CODE (clause) == OMP_CLAUSE_FIRSTPRIVATE); @@ -199,7 +199,7 @@ gfc_omp_clause_copy_ctor (tree clause, tree dest, tree src) and copied from SRC. */ gfc_start_block (&block); - gfc_add_modify_expr (&block, dest, src); + gfc_add_modify (&block, dest, src); rank = gfc_rank_cst[GFC_TYPE_ARRAY_RANK (type) - 1]; size = gfc_conv_descriptor_ubound (dest, rank); size = fold_build2 (MINUS_EXPR, gfc_array_index_type, size, @@ -216,7 +216,7 @@ gfc_omp_clause_copy_ctor (tree clause, tree dest, tree src) ptr = gfc_allocate_array_with_status (&block, build_int_cst (pvoid_type_node, 0), size, NULL); - gfc_conv_descriptor_data_set_tuples (&block, dest, ptr); + gfc_conv_descriptor_data_set (&block, dest, ptr); call = build_call_expr (built_in_decls[BUILT_IN_MEMCPY], 3, ptr, fold_convert (pvoid_type_node, gfc_conv_descriptor_data_get (src)), @@ -236,7 +236,7 @@ gfc_omp_clause_assign_op (tree clause ATTRIBUTE_UNUSED, tree dest, tree src) if (! GFC_DESCRIPTOR_TYPE_P (type) || GFC_TYPE_ARRAY_AKIND (type) != GFC_ARRAY_ALLOCATABLE) - return build_gimple_modify_stmt (dest, src); + return build2_v (MODIFY_EXPR, dest, src); /* Handle copying allocatable arrays. */ gfc_start_block (&block); @@ -602,7 +602,7 @@ gfc_trans_omp_array_reduction (tree c, gfc_symbol *sym, locus where) gfc_start_block (&block); - gfc_add_modify_expr (&block, decl, outer_sym.backend_decl); + gfc_add_modify (&block, decl, outer_sym.backend_decl); rank = gfc_rank_cst[GFC_TYPE_ARRAY_RANK (type) - 1]; size = gfc_conv_descriptor_ubound (decl, rank); size = fold_build2 (MINUS_EXPR, gfc_array_index_type, size, @@ -619,7 +619,7 @@ gfc_trans_omp_array_reduction (tree c, gfc_symbol *sym, locus where) ptr = gfc_allocate_array_with_status (&block, build_int_cst (pvoid_type_node, 0), size, NULL); - gfc_conv_descriptor_data_set_tuples (&block, decl, ptr); + gfc_conv_descriptor_data_set (&block, decl, ptr); gfc_add_expr_to_block (&block, gfc_trans_assignment (e1, e2, false)); stmt = gfc_finish_block (&block); } @@ -1062,7 +1062,7 @@ gfc_trans_omp_atomic (gfc_code *code) tree accum = gfc_create_var (TREE_TYPE (rse.expr), NULL); gfc_actual_arglist *arg; - gfc_add_modify_stmt (&block, accum, rse.expr); + gfc_add_modify (&block, accum, rse.expr); for (arg = expr2->value.function.actual->next->next; arg; arg = arg->next) { @@ -1070,7 +1070,7 @@ gfc_trans_omp_atomic (gfc_code *code) gfc_conv_expr (&rse, arg->expr); gfc_add_block_to_block (&block, &rse.pre); x = fold_build2 (op, TREE_TYPE (accum), accum, rse.expr); - gfc_add_modify_stmt (&block, accum, x); + gfc_add_modify (&block, accum, x); } rse.expr = accum; @@ -1204,11 +1204,11 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock, /* Loop body. */ if (simple) { - TREE_VEC_ELT (init, i) = build2_v (GIMPLE_MODIFY_STMT, dovar, from); + TREE_VEC_ELT (init, i) = build2_v (MODIFY_EXPR, dovar, from); TREE_VEC_ELT (cond, i) = fold_build2 (simple > 0 ? LE_EXPR : GE_EXPR, boolean_type_node, dovar, to); TREE_VEC_ELT (incr, i) = fold_build2 (PLUS_EXPR, type, dovar, step); - TREE_VEC_ELT (incr, i) = fold_build2 (GIMPLE_MODIFY_STMT, type, dovar, + TREE_VEC_ELT (incr, i) = fold_build2 (MODIFY_EXPR, type, dovar, TREE_VEC_ELT (incr, i)); } else @@ -1225,13 +1225,13 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock, tmp = fold_build2 (TRUNC_DIV_EXPR, type, tmp, step); tmp = gfc_evaluate_now (tmp, pblock); count = gfc_create_var (type, "count"); - TREE_VEC_ELT (init, i) = build2_v (GIMPLE_MODIFY_STMT, count, + TREE_VEC_ELT (init, i) = build2_v (MODIFY_EXPR, count, build_int_cst (type, 0)); TREE_VEC_ELT (cond, i) = fold_build2 (LT_EXPR, boolean_type_node, count, tmp); TREE_VEC_ELT (incr, i) = fold_build2 (PLUS_EXPR, type, count, build_int_cst (type, 1)); - TREE_VEC_ELT (incr, i) = fold_build2 (GIMPLE_MODIFY_STMT, type, + TREE_VEC_ELT (incr, i) = fold_build2 (MODIFY_EXPR, type, count, TREE_VEC_ELT (incr, i)); /* Initialize DOVAR. */ @@ -1260,7 +1260,7 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock, than value after iterator increment. */ tmp = gfc_evaluate_now (step, pblock); tmp = fold_build2 (PLUS_EXPR, type, dovar, tmp); - tmp = fold_build2 (GIMPLE_MODIFY_STMT, type, dovar, tmp); + tmp = fold_build2 (MODIFY_EXPR, type, dovar, tmp); for (c = omp_clauses; c ; c = OMP_CLAUSE_CHAIN (c)) if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_LASTPRIVATE && OMP_CLAUSE_DECL (c) == dovar) @@ -1308,7 +1308,7 @@ gfc_trans_omp_do (gfc_code *code, stmtblock_t *pblock, dovar_init = nreverse (dovar_init); while (dovar_init) { - gfc_add_modify_stmt (&body, TREE_PURPOSE (dovar_init), + gfc_add_modify (&body, TREE_PURPOSE (dovar_init), TREE_VALUE (dovar_init)); dovar_init = TREE_CHAIN (dovar_init); } @@ -1381,7 +1381,7 @@ gfc_trans_omp_parallel (gfc_code *code) omp_clauses = gfc_trans_omp_clauses (&block, code->ext.omp_clauses, code->loc); stmt = gfc_trans_omp_code (code->block->next, true); - stmt = build4_v (OMP_PARALLEL, stmt, omp_clauses, NULL, NULL); + stmt = build2 (OMP_PARALLEL, void_type_node, stmt, omp_clauses); gfc_add_expr_to_block (&block, stmt); return gfc_finish_block (&block); } @@ -1421,7 +1421,7 @@ gfc_trans_omp_parallel_do (gfc_code *code) stmt = build3_v (BIND_EXPR, NULL, stmt, poplevel (1, 0, 0)); else poplevel (0, 0, 0); - stmt = build4_v (OMP_PARALLEL, stmt, omp_clauses, NULL, NULL); + stmt = build2 (OMP_PARALLEL, void_type_node, stmt, omp_clauses); OMP_PARALLEL_COMBINED (stmt) = 1; gfc_add_expr_to_block (&block, stmt); return gfc_finish_block (&block); @@ -1446,7 +1446,7 @@ gfc_trans_omp_parallel_sections (gfc_code *code) stmt = build3_v (BIND_EXPR, NULL, stmt, poplevel (1, 0, 0)); else poplevel (0, 0, 0); - stmt = build4_v (OMP_PARALLEL, stmt, omp_clauses, NULL, NULL); + stmt = build2 (OMP_PARALLEL, void_type_node, stmt, omp_clauses); OMP_PARALLEL_COMBINED (stmt) = 1; gfc_add_expr_to_block (&block, stmt); return gfc_finish_block (&block); @@ -1471,7 +1471,7 @@ gfc_trans_omp_parallel_workshare (gfc_code *code) stmt = build3_v (BIND_EXPR, NULL, stmt, poplevel (1, 0, 0)); else poplevel (0, 0, 0); - stmt = build4_v (OMP_PARALLEL, stmt, omp_clauses, NULL, NULL); + stmt = build2 (OMP_PARALLEL, void_type_node, stmt, omp_clauses); OMP_PARALLEL_COMBINED (stmt) = 1; gfc_add_expr_to_block (&block, stmt); return gfc_finish_block (&block); @@ -1503,7 +1503,7 @@ gfc_trans_omp_sections (gfc_code *code, gfc_omp_clauses *clauses) } stmt = gfc_finish_block (&body); - stmt = build3_v (OMP_SECTIONS, stmt, omp_clauses, NULL_TREE); + stmt = build2 (OMP_SECTIONS, void_type_node, stmt, omp_clauses); gfc_add_expr_to_block (&block, stmt); return gfc_finish_block (&block); @@ -1522,16 +1522,13 @@ static tree gfc_trans_omp_task (gfc_code *code) { stmtblock_t block; - tree stmt, body_stmt, omp_clauses; + tree stmt, omp_clauses; gfc_start_block (&block); omp_clauses = gfc_trans_omp_clauses (&block, code->ext.omp_clauses, code->loc); - body_stmt = gfc_trans_omp_code (code->block->next, true); - stmt = make_node (OMP_TASK); - TREE_TYPE (stmt) = void_type_node; - OMP_TASK_CLAUSES (stmt) = omp_clauses; - OMP_TASK_BODY (stmt) = body_stmt; + stmt = gfc_trans_omp_code (code->block->next, true); + stmt = build2 (OMP_TASK, void_type_node, stmt, omp_clauses); gfc_add_expr_to_block (&block, stmt); return gfc_finish_block (&block); } diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index 79a1446ebf1..bf4305ba9c3 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -25,7 +25,7 @@ along with GCC; see the file COPYING3. If not see #include "system.h" #include "coretypes.h" #include "tree.h" -#include "tree-gimple.h" +#include "gimple.h" #include "ggc.h" #include "toplev.h" #include "real.h" @@ -127,8 +127,8 @@ gfc_trans_label_assign (gfc_code * code) label_tree = gfc_build_addr_expr (pvoid_type_node, label_tree); } - gfc_add_modify_expr (&se.pre, len, len_tree); - gfc_add_modify_expr (&se.pre, addr, label_tree); + gfc_add_modify (&se.pre, len, len_tree); + gfc_add_modify (&se.pre, addr, label_tree); return gfc_finish_block (&se.pre); } @@ -271,9 +271,9 @@ gfc_conv_elemental_dependencies (gfc_se * se, gfc_se * loopse, &tmp_loop, info, tmp, false, true, false, & arg->expr->where); - gfc_add_modify_expr (&se->pre, size, tmp); + gfc_add_modify (&se->pre, size, tmp); tmp = fold_convert (pvoid_type_node, info->data); - gfc_add_modify_expr (&se->pre, data, tmp); + gfc_add_modify (&se->pre, data, tmp); gfc_merge_block_scope (&block); /* Obtain the argument descriptor for unpacking. */ @@ -294,7 +294,7 @@ gfc_conv_elemental_dependencies (gfc_se * se, gfc_se * loopse, offset, tmp); } info->offset = gfc_create_var (gfc_array_index_type, NULL); - gfc_add_modify_expr (&se->pre, info->offset, offset); + gfc_add_modify (&se->pre, info->offset, offset); /* Copy the result back using unpack. */ tmp = build_call_expr (gfor_fndecl_in_unpack, 2, parmse.expr, data); @@ -349,7 +349,7 @@ gfc_trans_call (gfc_code * code, bool dependency_check) se.expr = convert (gfc_typenode_for_spec (&sym->ts), se.expr); if (sym->backend_decl == NULL) sym->backend_decl = gfc_get_symbol_decl (sym); - gfc_add_modify_expr (&se.pre, sym->backend_decl, se.expr); + gfc_add_modify (&se.pre, sym->backend_decl, se.expr); } else gfc_add_expr_to_block (&se.pre, se.expr); @@ -734,7 +734,7 @@ gfc_trans_simple_do (gfc_code * code, stmtblock_t *pblock, tree dovar, type = TREE_TYPE (dovar); /* Initialize the DO variable: dovar = from. */ - gfc_add_modify_expr (pblock, dovar, from); + gfc_add_modify (pblock, dovar, from); /* Cycle and exit statements are implemented with gotos. */ cycle_label = gfc_build_label_decl (NULL_TREE); @@ -763,7 +763,7 @@ gfc_trans_simple_do (gfc_code * code, stmtblock_t *pblock, tree dovar, /* Increment the loop variable. */ tmp = fold_build2 (PLUS_EXPR, type, dovar, step); - gfc_add_modify_expr (&body, dovar, tmp); + gfc_add_modify (&body, dovar, tmp); /* The loop exit. */ tmp = build1_v (GOTO_EXPR, exit_label); @@ -911,7 +911,7 @@ gfc_trans_do (gfc_code * code) tmp = fold_build1 (FIX_TRUNC_EXPR, utype, tmp); } countm1 = gfc_create_var (utype, "countm1"); - gfc_add_modify_expr (&block, countm1, tmp); + gfc_add_modify (&block, countm1, tmp); /* Cycle and exit statements are implemented with gotos. */ cycle_label = gfc_build_label_decl (NULL_TREE); @@ -919,7 +919,7 @@ gfc_trans_do (gfc_code * code) TREE_USED (exit_label) = 1; /* Initialize the DO variable: dovar = from. */ - gfc_add_modify_expr (&block, dovar, from); + gfc_add_modify (&block, dovar, from); /* If the loop is empty, go directly to the exit label. */ tmp = fold_build3 (COND_EXPR, void_type_node, empty, @@ -949,7 +949,7 @@ gfc_trans_do (gfc_code * code) /* Increment the loop variable. */ tmp = fold_build2 (PLUS_EXPR, type, dovar, step); - gfc_add_modify_expr (&body, dovar, tmp); + gfc_add_modify (&body, dovar, tmp); /* End with the loop condition. Loop until countm1 == 0. */ cond = fold_build2 (EQ_EXPR, boolean_type_node, countm1, @@ -961,7 +961,7 @@ gfc_trans_do (gfc_code * code) /* Decrement the loop count. */ tmp = fold_build2 (MINUS_EXPR, utype, countm1, build_int_cst (utype, 1)); - gfc_add_modify_expr (&body, countm1, tmp); + gfc_add_modify (&body, countm1, tmp); /* End of loop body. */ tmp = gfc_finish_block (&body); @@ -1479,7 +1479,7 @@ gfc_trans_character_select (gfc_code *code) tmp = build_call_expr (fndecl, 4, init, build_int_cst (NULL_TREE, n), se.expr, se.string_length); case_num = gfc_create_var (integer_type_node, "case_num"); - gfc_add_modify_expr (&block, case_num, tmp); + gfc_add_modify (&block, case_num, tmp); gfc_add_block_to_block (&block, &se.post); @@ -1609,7 +1609,7 @@ forall_make_variable_temp (gfc_code *c, stmtblock_t *pre, stmtblock_t *post) { /* Use the variable offset for the temporary. */ tmp = gfc_conv_descriptor_offset (tse.expr); - gfc_add_modify_expr (pre, tmp, + gfc_add_modify (pre, tmp, gfc_conv_array_offset (old_sym->backend_decl)); } } @@ -1765,7 +1765,7 @@ gfc_trans_forall_loop (forall_info *forall_tmp, tree body, /* Initialize the mask index outside the FORALL nest. */ if (mask_flag && forall_tmp->mask) - gfc_add_modify_expr (outer, forall_tmp->maskindex, gfc_index_zero_node); + gfc_add_modify (outer, forall_tmp->maskindex, gfc_index_zero_node); iter = forall_tmp->this_loop; nvar = forall_tmp->nvar; @@ -1798,7 +1798,7 @@ gfc_trans_forall_loop (forall_info *forall_tmp, tree body, /* Increment the loop variable. */ tmp = fold_build2 (PLUS_EXPR, TREE_TYPE (var), var, step); - gfc_add_modify_expr (&block, var, tmp); + gfc_add_modify (&block, var, tmp); /* Advance to the next mask element. Only do this for the innermost loop. */ @@ -1807,26 +1807,26 @@ gfc_trans_forall_loop (forall_info *forall_tmp, tree body, tree maskindex = forall_tmp->maskindex; tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, maskindex, gfc_index_one_node); - gfc_add_modify_expr (&block, maskindex, tmp); + gfc_add_modify (&block, maskindex, tmp); } /* Decrement the loop counter. */ tmp = fold_build2 (MINUS_EXPR, TREE_TYPE (var), count, build_int_cst (TREE_TYPE (var), 1)); - gfc_add_modify_expr (&block, count, tmp); + gfc_add_modify (&block, count, tmp); body = gfc_finish_block (&block); /* Loop var initialization. */ gfc_init_block (&block); - gfc_add_modify_expr (&block, var, start); + gfc_add_modify (&block, var, start); /* Initialize the loop counter. */ tmp = fold_build2 (MINUS_EXPR, TREE_TYPE (var), step, start); tmp = fold_build2 (PLUS_EXPR, TREE_TYPE (var), end, tmp); tmp = fold_build2 (TRUNC_DIV_EXPR, TREE_TYPE (var), tmp, step); - gfc_add_modify_expr (&block, count, tmp); + gfc_add_modify (&block, count, tmp); /* The loop expression. */ tmp = build1_v (LOOP_EXPR, body); @@ -1918,7 +1918,7 @@ gfc_do_allocate (tree bytesize, tree size, tree * pdata, stmtblock_t * pblock, *pdata = convert (pvoid_type_node, tmpvar); tmp = gfc_call_malloc (pblock, TREE_TYPE (tmpvar), bytesize); - gfc_add_modify_expr (pblock, tmpvar, tmp); + gfc_add_modify (pblock, tmpvar, tmp); } return tmpvar; } @@ -1954,13 +1954,13 @@ generate_loop_for_temp_to_lhs (gfc_expr *expr, tree tmp1, tree count3, /* Use the scalar assignment as is. */ gfc_add_block_to_block (&block, &lse.pre); - gfc_add_modify_expr (&block, lse.expr, tmp); + gfc_add_modify (&block, lse.expr, tmp); gfc_add_block_to_block (&block, &lse.post); /* Increment the count1. */ tmp = fold_build2 (PLUS_EXPR, TREE_TYPE (count1), count1, gfc_index_one_node); - gfc_add_modify_expr (&block, count1, tmp); + gfc_add_modify (&block, count1, tmp); tmp = gfc_finish_block (&block); } @@ -2016,14 +2016,14 @@ generate_loop_for_temp_to_lhs (gfc_expr *expr, tree tmp1, tree count3, /* Increment count1. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, count1, gfc_index_one_node); - gfc_add_modify_expr (&body, count1, tmp); + gfc_add_modify (&body, count1, tmp); /* Increment count3. */ if (count3) { tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, count3, gfc_index_one_node); - gfc_add_modify_expr (&body, count3, tmp); + gfc_add_modify (&body, count3, tmp); } /* Generate the copying loops. */ @@ -2117,21 +2117,21 @@ generate_loop_for_rhs_to_temp (gfc_expr *expr2, tree tmp1, tree count3, /* Increment count1. */ tmp = fold_build2 (PLUS_EXPR, TREE_TYPE (count1), count1, gfc_index_one_node); - gfc_add_modify_expr (&block, count1, tmp); + gfc_add_modify (&block, count1, tmp); } else { /* Increment count1. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, count1, gfc_index_one_node); - gfc_add_modify_expr (&body1, count1, tmp); + gfc_add_modify (&body1, count1, tmp); /* Increment count3. */ if (count3) { tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, count3, gfc_index_one_node); - gfc_add_modify_expr (&body1, count3, tmp); + gfc_add_modify (&body1, count3, tmp); } /* Generate the copying loops. */ @@ -2257,7 +2257,7 @@ compute_overall_iter_number (forall_info *nested_forall_info, tree inner_size, /* Otherwise, create a temporary variable to compute the result. */ number = gfc_create_var (gfc_array_index_type, "num"); - gfc_add_modify_expr (block, number, gfc_index_zero_node); + gfc_add_modify (block, number, gfc_index_zero_node); gfc_start_block (&body); if (inner_size_body) @@ -2267,7 +2267,7 @@ compute_overall_iter_number (forall_info *nested_forall_info, tree inner_size, number, inner_size); else tmp = inner_size; - gfc_add_modify_expr (&body, number, tmp); + gfc_add_modify (&body, number, tmp); tmp = gfc_finish_block (&body); /* Generate loops. */ @@ -2378,13 +2378,13 @@ gfc_trans_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2, if (wheremask) { count = gfc_create_var (gfc_array_index_type, "count"); - gfc_add_modify_expr (block, count, gfc_index_zero_node); + gfc_add_modify (block, count, gfc_index_zero_node); } else count = NULL; /* Initialize count1. */ - gfc_add_modify_expr (block, count1, gfc_index_zero_node); + gfc_add_modify (block, count1, gfc_index_zero_node); /* Calculate the size of temporary needed in the assignment. Return loop, lss and rss which are used in function generate_loop_for_rhs_to_temp(). */ @@ -2423,11 +2423,11 @@ gfc_trans_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2, gfc_add_expr_to_block (block, tmp); /* Reset count1. */ - gfc_add_modify_expr (block, count1, gfc_index_zero_node); + gfc_add_modify (block, count1, gfc_index_zero_node); /* Reset count. */ if (wheremask) - gfc_add_modify_expr (block, count, gfc_index_zero_node); + gfc_add_modify (block, count, gfc_index_zero_node); /* Generate codes to copy the temporary to lhs. */ tmp = generate_loop_for_temp_to_lhs (expr1, tmp1, count, count1, @@ -2469,7 +2469,7 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2, tree tmp, tmp1, ptemp1; count = gfc_create_var (gfc_array_index_type, "count"); - gfc_add_modify_expr (block, count, gfc_index_zero_node); + gfc_add_modify (block, count, gfc_index_zero_node); inner_size = integer_one_node; lss = gfc_walk_expr (expr1); @@ -2490,14 +2490,14 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2, rse.want_pointer = 1; gfc_conv_expr (&rse, expr2); gfc_add_block_to_block (&body, &rse.pre); - gfc_add_modify_expr (&body, lse.expr, + gfc_add_modify (&body, lse.expr, fold_convert (TREE_TYPE (lse.expr), rse.expr)); gfc_add_block_to_block (&body, &rse.post); /* Increment count. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, count, gfc_index_one_node); - gfc_add_modify_expr (&body, count, tmp); + gfc_add_modify (&body, count, tmp); tmp = gfc_finish_block (&body); @@ -2507,7 +2507,7 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2, gfc_add_expr_to_block (block, tmp); /* Reset count. */ - gfc_add_modify_expr (block, count, gfc_index_zero_node); + gfc_add_modify (block, count, gfc_index_zero_node); gfc_start_block (&body); gfc_init_se (&lse, NULL); @@ -2516,12 +2516,12 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2, lse.want_pointer = 1; gfc_conv_expr (&lse, expr1); gfc_add_block_to_block (&body, &lse.pre); - gfc_add_modify_expr (&body, lse.expr, rse.expr); + gfc_add_modify (&body, lse.expr, rse.expr); gfc_add_block_to_block (&body, &lse.post); /* Increment count. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, count, gfc_index_one_node); - gfc_add_modify_expr (&body, count, tmp); + gfc_add_modify (&body, count, tmp); tmp = gfc_finish_block (&body); /* Generate body and loops according to the information in @@ -2566,7 +2566,7 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2, /* Increment count. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, count, gfc_index_one_node); - gfc_add_modify_expr (&body, count, tmp); + gfc_add_modify (&body, count, tmp); tmp = gfc_finish_block (&body); @@ -2576,13 +2576,13 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2, gfc_add_expr_to_block (block, tmp); /* Reset count. */ - gfc_add_modify_expr (block, count, gfc_index_zero_node); + gfc_add_modify (block, count, gfc_index_zero_node); parm = gfc_build_array_ref (tmp1, count, NULL); lss = gfc_walk_expr (expr1); gfc_init_se (&lse, NULL); gfc_conv_expr_descriptor (&lse, expr1, lss); - gfc_add_modify_expr (&lse.pre, lse.expr, parm); + gfc_add_modify (&lse.pre, lse.expr, parm); gfc_start_block (&body); gfc_add_block_to_block (&body, &lse.pre); gfc_add_block_to_block (&body, &lse.post); @@ -2590,7 +2590,7 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2, /* Increment count. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, count, gfc_index_one_node); - gfc_add_modify_expr (&body, count, tmp); + gfc_add_modify (&body, count, tmp); tmp = gfc_finish_block (&body); @@ -2822,7 +2822,7 @@ gfc_trans_forall_1 (gfc_code * code, forall_info * nested_forall_info) /* As the mask array can be very big, prefer compact boolean types. */ tree mask_type = gfc_get_logical_type (gfc_logical_kinds[0].kind); - gfc_add_modify_expr (&block, maskindex, gfc_index_zero_node); + gfc_add_modify (&block, maskindex, gfc_index_zero_node); /* Start of mask assignment loop body. */ gfc_start_block (&body); @@ -2836,12 +2836,12 @@ gfc_trans_forall_1 (gfc_code * code, forall_info * nested_forall_info) se.expr = convert (mask_type, se.expr); tmp = gfc_build_array_ref (mask, maskindex, NULL); - gfc_add_modify_expr (&body, tmp, se.expr); + gfc_add_modify (&body, tmp, se.expr); /* Advance to the next mask element. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, maskindex, gfc_index_one_node); - gfc_add_modify_expr (&body, maskindex, tmp); + gfc_add_modify (&body, maskindex, tmp); /* Generate the loops. */ tmp = gfc_finish_block (&body); @@ -2999,7 +2999,7 @@ gfc_evaluate_where_mask (gfc_expr * me, forall_info * nested_forall_info, /* Variable to index the temporary. */ count = gfc_create_var (gfc_array_index_type, "count"); /* Initialize count. */ - gfc_add_modify_expr (block, count, gfc_index_zero_node); + gfc_add_modify (block, count, gfc_index_zero_node); gfc_start_block (&body); @@ -3041,14 +3041,14 @@ gfc_evaluate_where_mask (gfc_expr * me, forall_info * nested_forall_info, gfc_add_block_to_block (&body1, &lse.pre); gfc_add_block_to_block (&body1, &rse.pre); - gfc_add_modify_expr (&body1, cond, fold_convert (mask_type, rse.expr)); + gfc_add_modify (&body1, cond, fold_convert (mask_type, rse.expr)); if (mask && (cmask || pmask)) { tmp = gfc_build_array_ref (mask, count, NULL); if (invert) tmp = fold_build1 (TRUTH_NOT_EXPR, mask_type, tmp); - gfc_add_modify_expr (&body1, mtmp, tmp); + gfc_add_modify (&body1, mtmp, tmp); } if (cmask) @@ -3057,7 +3057,7 @@ gfc_evaluate_where_mask (gfc_expr * me, forall_info * nested_forall_info, tmp = cond; if (mask) tmp = fold_build2 (TRUTH_AND_EXPR, mask_type, mtmp, tmp); - gfc_add_modify_expr (&body1, tmp1, tmp); + gfc_add_modify (&body1, tmp1, tmp); } if (pmask) @@ -3066,7 +3066,7 @@ gfc_evaluate_where_mask (gfc_expr * me, forall_info * nested_forall_info, tmp = fold_build1 (TRUTH_NOT_EXPR, mask_type, cond); if (mask) tmp = fold_build2 (TRUTH_AND_EXPR, mask_type, mtmp, tmp); - gfc_add_modify_expr (&body1, tmp1, tmp); + gfc_add_modify (&body1, tmp1, tmp); } gfc_add_block_to_block (&body1, &lse.post); @@ -3081,7 +3081,7 @@ gfc_evaluate_where_mask (gfc_expr * me, forall_info * nested_forall_info, /* Increment count. */ tmp1 = fold_build2 (PLUS_EXPR, gfc_array_index_type, count, gfc_index_one_node); - gfc_add_modify_expr (&body1, count, tmp1); + gfc_add_modify (&body1, count, tmp1); /* Generate the copying loops. */ gfc_trans_scalarizing_loops (&loop, &body1); @@ -3242,7 +3242,7 @@ gfc_trans_where_assign (gfc_expr *expr1, gfc_expr *expr2, /* Increment count1. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, count1, gfc_index_one_node); - gfc_add_modify_expr (&body, count1, tmp); + gfc_add_modify (&body, count1, tmp); /* Use the scalar assignment as is. */ gfc_add_block_to_block (&block, &body); @@ -3258,7 +3258,7 @@ gfc_trans_where_assign (gfc_expr *expr1, gfc_expr *expr2, expression. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, count1, gfc_index_one_node); - gfc_add_modify_expr (&body, count1, tmp); + gfc_add_modify (&body, count1, tmp); gfc_trans_scalarized_loop_boundary (&loop, &body); /* We need to copy the temporary to the actual lhs. */ @@ -3292,14 +3292,14 @@ gfc_trans_where_assign (gfc_expr *expr1, gfc_expr *expr2, /* Increment count2. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, count2, gfc_index_one_node); - gfc_add_modify_expr (&body, count2, tmp); + gfc_add_modify (&body, count2, tmp); } else { /* Increment count1. */ tmp = fold_build2 (PLUS_EXPR, gfc_array_index_type, count1, gfc_index_one_node); - gfc_add_modify_expr (&body, count1, tmp); + gfc_add_modify (&body, count1, tmp); } /* Generate the copying loops. */ @@ -3492,8 +3492,8 @@ gfc_trans_where_2 (gfc_code * code, tree mask, bool invert, /* Variables to control maskexpr. */ count1 = gfc_create_var (gfc_array_index_type, "count1"); count2 = gfc_create_var (gfc_array_index_type, "count2"); - gfc_add_modify_expr (block, count1, gfc_index_zero_node); - gfc_add_modify_expr (block, count2, gfc_index_zero_node); + gfc_add_modify (block, count1, gfc_index_zero_node); + gfc_add_modify (block, count2, gfc_index_zero_node); tmp = gfc_trans_where_assign (expr1, expr2, cmask, invert, @@ -3510,8 +3510,8 @@ gfc_trans_where_2 (gfc_code * code, tree mask, bool invert, /* Variables to control maskexpr. */ count1 = gfc_create_var (gfc_array_index_type, "count1"); count2 = gfc_create_var (gfc_array_index_type, "count2"); - gfc_add_modify_expr (block, count1, gfc_index_zero_node); - gfc_add_modify_expr (block, count2, gfc_index_zero_node); + gfc_add_modify (block, count1, gfc_index_zero_node); + gfc_add_modify (block, count2, gfc_index_zero_node); tmp = gfc_trans_where_assign (expr1, expr2, cmask, invert, @@ -3893,7 +3893,7 @@ gfc_trans_allocate (gfc_code * code) gfc_init_se (&se, NULL); gfc_conv_expr_lhs (&se, code->expr); tmp = convert (TREE_TYPE (se.expr), stat); - gfc_add_modify_expr (&block, se.expr, tmp); + gfc_add_modify (&block, se.expr, tmp); } return gfc_finish_block (&block); @@ -3942,7 +3942,7 @@ gfc_trans_deallocate (gfc_code * code) apstat = build_fold_addr_expr (astat); /* Initialize astat to 0. */ - gfc_add_modify_expr (&block, astat, build_int_cst (TREE_TYPE (astat), 0)); + gfc_add_modify (&block, astat, build_int_cst (TREE_TYPE (astat), 0)); } else pstat = apstat = stat = astat = NULL_TREE; @@ -3997,7 +3997,7 @@ gfc_trans_deallocate (gfc_code * code) if (code->expr) { apstat = fold_build2 (PLUS_EXPR, TREE_TYPE (stat), astat, stat); - gfc_add_modify_expr (&se.pre, astat, apstat); + gfc_add_modify (&se.pre, astat, apstat); } tmp = gfc_finish_block (&se.pre); @@ -4011,7 +4011,7 @@ gfc_trans_deallocate (gfc_code * code) gfc_init_se (&se, NULL); gfc_conv_expr_lhs (&se, code->expr); tmp = convert (TREE_TYPE (se.expr), astat); - gfc_add_modify_expr (&block, se.expr, tmp); + gfc_add_modify (&block, se.expr, tmp); } return gfc_finish_block (&block); diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index d6aef8769e7..911e379001a 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -23,7 +23,8 @@ along with GCC; see the file COPYING3. If not see #include "system.h" #include "coretypes.h" #include "tree.h" -#include "tree-gimple.h" +#include "gimple.h" +#include "tree-iterator.h" #include "ggc.h" #include "toplev.h" #include "defaults.h" @@ -142,19 +143,18 @@ gfc_evaluate_now (tree expr, stmtblock_t * pblock) return expr; var = gfc_create_var (TREE_TYPE (expr), NULL); - gfc_add_modify_expr (pblock, var, expr); + gfc_add_modify (pblock, var, expr); return var; } -/* Build a MODIFY_EXPR (or GIMPLE_MODIFY_STMT) node and add it to a - given statement block PBLOCK. A MODIFY_EXPR is an assignment: +/* Build a MODIFY_EXPR node and add it to a given statement block PBLOCK. + A MODIFY_EXPR is an assignment: LHS <- RHS. */ void -gfc_add_modify (stmtblock_t * pblock, tree lhs, tree rhs, - bool tuples_p) +gfc_add_modify (stmtblock_t * pblock, tree lhs, tree rhs) { tree tmp; @@ -167,8 +167,7 @@ gfc_add_modify (stmtblock_t * pblock, tree lhs, tree rhs, || AGGREGATE_TYPE_P (TREE_TYPE (lhs))); #endif - tmp = fold_build2 (tuples_p ? GIMPLE_MODIFY_STMT : MODIFY_EXPR, - void_type_node, lhs, rhs); + tmp = fold_build2 (MODIFY_EXPR, void_type_node, lhs, rhs); gfc_add_expr_to_block (pblock, tmp); } @@ -434,7 +433,7 @@ gfc_trans_runtime_check (bool error, bool once, tree cond, stmtblock_t * pblock, gfc_add_expr_to_block (&block, tmp); if (once) - gfc_add_modify_expr (&block, tmpvar, boolean_false_node); + gfc_add_modify (&block, tmpvar, boolean_false_node); body = gfc_finish_block (&block); @@ -495,7 +494,7 @@ gfc_call_malloc (stmtblock_t * block, tree type, tree size) size = fold_build2 (MAX_EXPR, size_type_node, size, build_int_cst (size_type_node, 1)); - gfc_add_modify_expr (&block2, res, + gfc_add_modify (&block2, res, build_call_expr (built_in_decls[BUILT_IN_MALLOC], 1, size)); null_result = fold_build2 (EQ_EXPR, boolean_type_node, res, @@ -593,10 +592,10 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status) stmtblock_t set_status_block; gfc_start_block (&set_status_block); - gfc_add_modify_expr (&set_status_block, + gfc_add_modify (&set_status_block, fold_build1 (INDIRECT_REF, status_type, status), build_int_cst (status_type, LIBERROR_ALLOCATION)); - gfc_add_modify_expr (&set_status_block, res, + gfc_add_modify (&set_status_block, res, build_int_cst (pvoid_type_node, 0)); tmp = fold_build2 (EQ_EXPR, boolean_type_node, status, @@ -607,7 +606,7 @@ gfc_allocate_with_status (stmtblock_t * block, tree size, tree status) /* The allocation itself. */ gfc_start_block (&alloc_block); - gfc_add_modify_expr (&alloc_block, res, + gfc_add_modify (&alloc_block, res, build_call_expr (built_in_decls[BUILT_IN_MALLOC], 1, fold_build2 (MAX_EXPR, size_type_node, size, @@ -689,7 +688,7 @@ gfc_allocate_array_with_status (stmtblock_t * block, tree mem, tree size, /* If mem is NULL, we call gfc_allocate_with_status. */ gfc_start_block (&alloc_block); tmp = gfc_allocate_with_status (&alloc_block, size, status); - gfc_add_modify_expr (&alloc_block, res, fold_convert (type, tmp)); + gfc_add_modify (&alloc_block, res, fold_convert (type, tmp)); alloc = gfc_finish_block (&alloc_block); /* Otherwise, we issue a runtime error or set the status variable. */ @@ -708,9 +707,9 @@ gfc_allocate_array_with_status (stmtblock_t * block, tree mem, tree size, gfc_add_expr_to_block (&set_status_block, tmp); tmp = gfc_allocate_with_status (&set_status_block, size, status); - gfc_add_modify_expr (&set_status_block, res, fold_convert (type, tmp)); + gfc_add_modify (&set_status_block, res, fold_convert (type, tmp)); - gfc_add_modify_expr (&set_status_block, + gfc_add_modify (&set_status_block, fold_build1 (INDIRECT_REF, status_type, status), build_int_cst (status_type, LIBERROR_ALLOCATION)); @@ -885,7 +884,7 @@ gfc_call_realloc (stmtblock_t * block, tree mem, tree size) /* Call realloc and check the result. */ tmp = build_call_expr (built_in_decls[BUILT_IN_REALLOC], 2, fold_convert (pvoid_type_node, mem), size); - gfc_add_modify_expr (block, res, fold_convert (type, tmp)); + gfc_add_modify (block, res, fold_convert (type, tmp)); null_result = fold_build2 (EQ_EXPR, boolean_type_node, res, build_int_cst (pvoid_type_node, 0)); nonzero = fold_build2 (NE_EXPR, boolean_type_node, size, @@ -985,7 +984,7 @@ gfc_trans_code (gfc_code * code) gfc_start_block (&block); - /* Translate statements one by one to GIMPLE trees until we reach + /* Translate statements one by one into GENERIC trees until we reach the end of this gfc_code branch. */ for (; code; code = code->next) { @@ -1173,7 +1172,7 @@ gfc_trans_code (gfc_code * code) if (res != NULL_TREE && ! IS_EMPTY_STMT (res)) { if (TREE_CODE (res) == STATEMENT_LIST) - annotate_all_with_locus (&res, input_location); + tree_annotate_all_with_location (&res, input_location); else SET_EXPR_LOCATION (res, input_location); diff --git a/gcc/fortran/trans.h b/gcc/fortran/trans.h index 7704748d305..6e09f24ac95 100644 --- a/gcc/fortran/trans.h +++ b/gcc/fortran/trans.h @@ -348,12 +348,8 @@ void gfc_trans_vla_type_sizes (gfc_symbol *, stmtblock_t *); void gfc_add_expr_to_block (stmtblock_t *, tree); /* Add a block to the end of a block. */ void gfc_add_block_to_block (stmtblock_t *, stmtblock_t *); -/* Add a MODIFY_EXPR or a GIMPLE_MODIFY_STMT to a block. */ -void gfc_add_modify (stmtblock_t *, tree, tree, bool); -#define gfc_add_modify_expr(BLOCK, LHS, RHS) \ - gfc_add_modify ((BLOCK), (LHS), (RHS), false) -#define gfc_add_modify_stmt(BLOCK, LHS, RHS) \ - gfc_add_modify ((BLOCK), (LHS), (RHS), true) +/* Add a MODIFY_EXPR to a block. */ +void gfc_add_modify (stmtblock_t *, tree, tree); /* Initialize a statement block. */ void gfc_init_block (stmtblock_t *); |