diff options
Diffstat (limited to 'gcc/fortran')
-rw-r--r-- | gcc/fortran/ChangeLog | 65 | ||||
-rw-r--r-- | gcc/fortran/trans-array.c | 90 | ||||
-rw-r--r-- | gcc/fortran/trans-decl.c | 74 | ||||
-rw-r--r-- | gcc/fortran/trans-expr.c | 84 | ||||
-rw-r--r-- | gcc/fortran/trans-intrinsic.c | 68 | ||||
-rw-r--r-- | gcc/fortran/trans-io.c | 66 | ||||
-rw-r--r-- | gcc/fortran/trans-openmp.c | 4 | ||||
-rw-r--r-- | gcc/fortran/trans-stmt.c | 73 | ||||
-rw-r--r-- | gcc/fortran/trans.c | 12 |
9 files changed, 223 insertions, 313 deletions
diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index bf9fe04..796c8b9 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,68 @@ +2007-02-15 Sandra Loosemore <sandra@codesourcery.com> + Brooks Moses <brooks.moses@codesourcery.com> + Lee Millward <lee.millward@codesourcery.com> + + * trans-expr.c (gfc_conv_power_op): Use build_call_expr. + (gfc_conv_string_tmp): Likewise. + (gfc_conv_concat_op): Likewise. + (gfc_build_compare_string): Likewise. + (gfc_conv_function_call): Use build_call_list instead of build3. + + * trans-array.c (gfc_trans_allocate_array_storage): Use + build_call_expr. + (gfc_grow_array): Likewise. + (gfc_trans_array_ctor_element): Likewise. + (gfc_trans_array_constructor_value): Likewise. + (gfc_array_allocate): Likewise. + (gfc_array_deallocate): Likewise. + (gfc_trans_auto_array_allocation): Likewise. + (gfc_trans_dummy_array_bias): Likewise. + (gfc_conv_array_parameter): Likewise. + (gfc_trans_dealloc_allocated): Likewise. + (gfc_duplicate_allocatable): Likewise. + + * trans-openmp.c (gfc_trans_omp_barrier): Use build_call_expr. + (gfc_trans_omp_flush): Likewise. + + * trans-stmt.c (gfc_conv_elementel_dependencies): Use build_call_expr. + (gfc_trans_pause): Likewise. + (gfc_trans_stop): Likewise. + (gfc_trans_character_select): Likewise. + (gfc_do_allocate): Likewise. + (gfc_trans_assign_need_temp): Likewise. + (gfc_trans_pointer_assign_need_temp): Likewise. + (gfc_trans_forall_1): Likewise. + (gfc_trans_where_2): Likewise. + (gfc_trans_allocate): Likewise. + (gfc_trans_deallocate): Likewise. + + * trans.c (gfc_trans_runtime_check): Use build_call_expr. + + * trans-io.c (gfc_trans_open): Use build_call_expr. + (gfc_trans_close): Likewise. + (build_filepos): Likewise. + (gfc_trans_inquire): Likewise. + (NML_FIRST_ARG): Delete. + (NML_ADD_ARG): Delete. + (transfer_namelist_element): Use build_call_expr. + (build_dt): Likewise. + (gfc_trans_dt_end): Likewise. + (transfer_expr): Likewise. + (transfer_array-desc): Likewise. + + * trans-decl.c (gfc_generate_function_code): Use build_call_expr. + (gfc_generate_constructors): Likewise. + + * trans-intrinsic.c (gfc_conv_intrinsic_ctime): Use build_call_expr. + (gfc_conv_intrinsic_fdate): Likewise. + (gfc_conv_intrinsic_ttynam): Likewise. + (gfc_conv_intrinsic_array_transfer): Likewise. + (gfc_conv_associated): Likewise. + (gfc_conv_intrinsic_si_kind): Likewise. + (gfc_conv_intrinsic_trim): Likewise. + (gfc_conv_intrinsic_repeat: Likewise. + (gfc_conv_intrinsic_iargc): Likewise. + 2007-02-14 Jerry DeLisle <jvdelisle@gcc.gnu.org> PR fortran/30779 diff --git a/gcc/fortran/trans-array.c b/gcc/fortran/trans-array.c index 1c89975..64ea9d6 100644 --- a/gcc/fortran/trans-array.c +++ b/gcc/fortran/trans-array.c @@ -501,7 +501,6 @@ gfc_trans_allocate_array_storage (stmtblock_t * pre, stmtblock_t * post, bool dynamic, bool dealloc) { tree tmp; - tree args; tree desc; bool onstack; @@ -534,15 +533,13 @@ gfc_trans_allocate_array_storage (stmtblock_t * pre, stmtblock_t * post, else { /* Allocate memory to hold the data. */ - args = gfc_chainon_list (NULL_TREE, size); - if (gfc_index_integer_kind == 4) tmp = gfor_fndecl_internal_malloc; else if (gfc_index_integer_kind == 8) tmp = gfor_fndecl_internal_malloc64; else gcc_unreachable (); - tmp = build_function_call_expr (tmp, args); + tmp = build_call_expr (tmp, 1, size); tmp = gfc_evaluate_now (tmp, pre); gfc_conv_descriptor_data_set (pre, desc, tmp); } @@ -559,8 +556,7 @@ gfc_trans_allocate_array_storage (stmtblock_t * pre, stmtblock_t * post, /* Free the temporary. */ tmp = gfc_conv_descriptor_data_get (desc); tmp = fold_convert (pvoid_type_node, tmp); - tmp = gfc_chainon_list (NULL_TREE, tmp); - tmp = build_function_call_expr (gfor_fndecl_internal_free, tmp); + tmp = build_call_expr (gfor_fndecl_internal_free, 1, tmp); gfc_add_expr_to_block (post, tmp); } } @@ -829,7 +825,7 @@ gfc_get_iteration_count (tree start, tree end, tree step) static void gfc_grow_array (stmtblock_t * pblock, tree desc, tree extra) { - tree args; + tree arg0, arg1; tree tmp; tree size; tree ubound; @@ -844,14 +840,12 @@ gfc_grow_array (stmtblock_t * pblock, tree desc, tree extra) gfc_add_modify_expr (pblock, ubound, tmp); /* Get the value of the current data pointer. */ - tmp = gfc_conv_descriptor_data_get (desc); - args = gfc_chainon_list (NULL_TREE, tmp); + arg0 = gfc_conv_descriptor_data_get (desc); /* Calculate the new array size. */ size = TYPE_SIZE_UNIT (gfc_get_element_type (TREE_TYPE (desc))); tmp = build2 (PLUS_EXPR, gfc_array_index_type, ubound, gfc_index_one_node); - tmp = build2 (MULT_EXPR, gfc_array_index_type, tmp, size); - args = gfc_chainon_list (args, tmp); + arg1 = build2 (MULT_EXPR, gfc_array_index_type, tmp, size); /* Pick the appropriate realloc function. */ if (gfc_index_integer_kind == 4) @@ -862,7 +856,7 @@ gfc_grow_array (stmtblock_t * pblock, tree desc, tree extra) gcc_unreachable (); /* Set the new data pointer. */ - tmp = build_function_call_expr (tmp, args); + tmp = build_call_expr (tmp, 2, arg0, arg1); gfc_conv_descriptor_data_set (pblock, desc, tmp); } @@ -971,7 +965,6 @@ gfc_trans_array_ctor_element (stmtblock_t * pblock, tree desc, tree offset, gfc_se * se, gfc_expr * expr) { tree tmp; - tree args; gfc_conv_expr (se, expr); @@ -993,11 +986,8 @@ gfc_trans_array_ctor_element (stmtblock_t * pblock, tree desc, tmp = gfc_build_addr_expr (pchar_type_node, tmp); /* We know the temporary and the value will be the same length, so can use memcpy. */ - args = gfc_chainon_list (NULL_TREE, tmp); - args = gfc_chainon_list (args, se->expr); - args = gfc_chainon_list (args, se->string_length); - tmp = built_in_decls[BUILT_IN_MEMCPY]; - tmp = build_function_call_expr (tmp, args); + tmp = build_call_expr (built_in_decls[BUILT_IN_MEMCPY], 3, + tmp, se->expr, se->string_length); gfc_add_expr_to_block (&se->pre, tmp); } } @@ -1206,11 +1196,8 @@ gfc_trans_array_constructor_value (stmtblock_t * pblock, tree type, size = TREE_INT_CST_LOW (TYPE_SIZE_UNIT (type)); bound = build_int_cst (NULL_TREE, n * size); - tmp = gfc_chainon_list (NULL_TREE, tmp); - tmp = gfc_chainon_list (tmp, init); - tmp = gfc_chainon_list (tmp, bound); - tmp = build_function_call_expr (built_in_decls[BUILT_IN_MEMCPY], - tmp); + tmp = build_call_expr (built_in_decls[BUILT_IN_MEMCPY], 3, + tmp, init, bound); gfc_add_expr_to_block (&body, tmp); *poffset = fold_build2 (PLUS_EXPR, gfc_array_index_type, @@ -3491,13 +3478,11 @@ gfc_array_allocate (gfc_se * se, gfc_expr * expr, tree pstat) else gcc_unreachable (); - tmp = NULL_TREE; /* The allocate_array variants take the old pointer as first argument. */ if (allocatable_array) - tmp = gfc_chainon_list (tmp, pointer); - tmp = gfc_chainon_list (tmp, size); - tmp = gfc_chainon_list (tmp, pstat); - tmp = build_function_call_expr (allocate, tmp); + tmp = build_call_expr (allocate, 3, pointer, size, pstat); + else + tmp = build_call_expr (allocate, 2, size, pstat); tmp = build2 (MODIFY_EXPR, void_type_node, pointer, tmp); gfc_add_expr_to_block (&se->pre, tmp); @@ -3533,9 +3518,7 @@ gfc_array_deallocate (tree descriptor, tree pstat) STRIP_NOPS (var); /* Parameter is the address of the data component. */ - tmp = gfc_chainon_list (NULL_TREE, var); - tmp = gfc_chainon_list (tmp, pstat); - tmp = build_function_call_expr (gfor_fndecl_deallocate, tmp); + tmp = build_call_expr (gfor_fndecl_deallocate, 2, var, pstat); gfc_add_expr_to_block (&block, tmp); /* Zero the data pointer. */ @@ -3826,15 +3809,13 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, tree fnbody) size = fold_build2 (MULT_EXPR, gfc_array_index_type, size, tmp); /* Allocate memory to hold the data. */ - tmp = gfc_chainon_list (NULL_TREE, size); - if (gfc_index_integer_kind == 4) fndecl = gfor_fndecl_internal_malloc; else if (gfc_index_integer_kind == 8) fndecl = gfor_fndecl_internal_malloc64; else gcc_unreachable (); - tmp = build_function_call_expr (fndecl, tmp); + tmp = build_call_expr (fndecl, 1, size); tmp = fold (convert (TREE_TYPE (decl), tmp)); gfc_add_modify_expr (&block, decl, tmp); @@ -3850,8 +3831,7 @@ gfc_trans_auto_array_allocation (tree decl, gfc_symbol * sym, tree fnbody) /* Free the temporary. */ tmp = convert (pvoid_type_node, decl); - tmp = gfc_chainon_list (NULL_TREE, tmp); - tmp = build_function_call_expr (gfor_fndecl_internal_free, tmp); + tmp = build_call_expr (gfor_fndecl_internal_free, 1, tmp); gfc_add_expr_to_block (&block, tmp); return gfc_finish_block (&block); @@ -4020,8 +4000,7 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) gcc_assert (integer_onep (GFC_TYPE_ARRAY_STRIDE (type, 0))); /* A library call to repack the array if necessary. */ tmp = GFC_DECL_SAVED_DESCRIPTOR (tmpdesc); - tmp = gfc_chainon_list (NULL_TREE, tmp); - stmt_unpacked = build_function_call_expr (gfor_fndecl_in_pack, tmp); + stmt_unpacked = build_call_expr (gfor_fndecl_in_pack, 1, tmp); stride = gfc_index_one_node; } @@ -4203,15 +4182,12 @@ gfc_trans_dummy_array_bias (gfc_symbol * sym, tree tmpdesc, tree body) if (sym->attr.intent != INTENT_IN) { /* Copy the data back. */ - tmp = gfc_chainon_list (NULL_TREE, dumdesc); - tmp = gfc_chainon_list (tmp, tmpdesc); - tmp = build_function_call_expr (gfor_fndecl_in_unpack, tmp); + tmp = build_call_expr (gfor_fndecl_in_unpack, 2, dumdesc, tmpdesc); gfc_add_expr_to_block (&cleanup, tmp); } /* Free the temporary. */ - tmp = gfc_chainon_list (NULL_TREE, tmpdesc); - tmp = build_function_call_expr (gfor_fndecl_internal_free, tmp); + tmp = build_call_expr (gfor_fndecl_internal_free, 1, tmpdesc); gfc_add_expr_to_block (&cleanup, tmp); stmt = gfc_finish_block (&cleanup); @@ -4778,23 +4754,19 @@ gfc_conv_array_parameter (gfc_se * se, gfc_expr * expr, gfc_ss * ss, int g77) { desc = se->expr; /* Repack the array. */ - tmp = gfc_chainon_list (NULL_TREE, desc); - ptr = build_function_call_expr (gfor_fndecl_in_pack, tmp); + ptr = build_call_expr (gfor_fndecl_in_pack, 1, desc); ptr = gfc_evaluate_now (ptr, &se->pre); se->expr = ptr; gfc_start_block (&block); /* Copy the data back. */ - tmp = gfc_chainon_list (NULL_TREE, desc); - tmp = gfc_chainon_list (tmp, ptr); - tmp = build_function_call_expr (gfor_fndecl_in_unpack, tmp); + tmp = build_call_expr (gfor_fndecl_in_unpack, 2, desc, ptr); gfc_add_expr_to_block (&block, tmp); /* Free the temporary. */ tmp = convert (pvoid_type_node, ptr); - tmp = gfc_chainon_list (NULL_TREE, tmp); - tmp = build_function_call_expr (gfor_fndecl_internal_free, tmp); + tmp = build_call_expr (gfor_fndecl_internal_free, 1, tmp); gfc_add_expr_to_block (&block, tmp); stmt = gfc_finish_block (&block); @@ -4836,9 +4808,7 @@ gfc_trans_dealloc_allocated (tree descriptor) /* Call array_deallocate with an int* present in the second argument. Although it is ignored here, it's presence ensures that arrays that are already deallocated are ignored. */ - tmp = gfc_chainon_list (NULL_TREE, var); - tmp = gfc_chainon_list (tmp, ptr); - tmp = build_function_call_expr (gfor_fndecl_deallocate, tmp); + tmp = build_call_expr (gfor_fndecl_deallocate, 2, var, ptr); gfc_add_expr_to_block (&block, tmp); /* Zero the data pointer. */ @@ -4880,7 +4850,6 @@ gfc_duplicate_allocatable(tree dest, tree src, tree type, int rank) tree tmp; tree size; tree nelems; - tree args; tree null_cond; tree null_data; stmtblock_t block; @@ -4897,11 +4866,10 @@ gfc_duplicate_allocatable(tree dest, tree src, tree type, int rank) TYPE_SIZE_UNIT (gfc_get_element_type (type))); /* Allocate memory to the destination. */ - tmp = gfc_chainon_list (NULL_TREE, size); if (gfc_index_integer_kind == 4) - tmp = build_function_call_expr (gfor_fndecl_internal_malloc, tmp); + tmp = build_call_expr (gfor_fndecl_internal_malloc, 1, size); else if (gfc_index_integer_kind == 8) - tmp = build_function_call_expr (gfor_fndecl_internal_malloc64, tmp); + tmp = build_call_expr (gfor_fndecl_internal_malloc64, 1, size); else gcc_unreachable (); tmp = fold (convert (TREE_TYPE (gfc_conv_descriptor_data_get (src)), @@ -4910,13 +4878,9 @@ gfc_duplicate_allocatable(tree dest, tree src, tree type, int rank) /* We know the temporary and the value will be the same length, so can use memcpy. */ - tmp = gfc_conv_descriptor_data_get (dest); - args = gfc_chainon_list (NULL_TREE, tmp); - tmp = gfc_conv_descriptor_data_get (src); - args = gfc_chainon_list (args, tmp); - args = gfc_chainon_list (args, size); tmp = built_in_decls[BUILT_IN_MEMCPY]; - tmp = build_function_call_expr (tmp, args); + tmp = build_call_expr (tmp, 3, gfc_conv_descriptor_data_get (dest), + gfc_conv_descriptor_data_get (src), size); gfc_add_expr_to_block (&block, tmp); tmp = gfc_finish_block (&block); diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index 1bf11e3..d001ad9 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -3135,23 +3135,16 @@ gfc_generate_function_code (gfc_namespace * ns) if (sym->attr.is_main_program) { - tree arglist, gfc_int4_type_node; - - gfc_int4_type_node = gfc_get_int_type (4); - arglist = gfc_chainon_list (NULL_TREE, - build_int_cst (gfc_int4_type_node, - gfc_option.warn_std)); - arglist = gfc_chainon_list (arglist, - build_int_cst (gfc_int4_type_node, - gfc_option.allow_std)); - arglist = gfc_chainon_list (arglist, - build_int_cst (gfc_int4_type_node, - pedantic)); - arglist = gfc_chainon_list (arglist, - build_int_cst (gfc_int4_type_node, - gfc_option.flag_dump_core)); - - tmp = build_function_call_expr (gfor_fndecl_set_std, arglist); + tree gfc_int4_type_node = gfc_get_int_type (4); + tmp = build_call_expr (gfor_fndecl_set_std, 3, + build_int_cst (gfc_int4_type_node, + gfc_option.warn_std), + build_int_cst (gfc_int4_type_node, + gfc_option.allow_std), + build_int_cst (gfc_int4_type_node, + pedantic), + build_int_cst (gfc_int4_type_node, + gfc_option.flag_dump_core)); gfc_add_expr_to_block (&body, tmp); } @@ -3160,13 +3153,10 @@ gfc_generate_function_code (gfc_namespace * ns) needed. */ if (sym->attr.is_main_program && gfc_option.fpe != 0) { - tree arglist, gfc_c_int_type_node; - - gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind); - arglist = gfc_chainon_list (NULL_TREE, - build_int_cst (gfc_c_int_type_node, - gfc_option.fpe)); - tmp = build_function_call_expr (gfor_fndecl_set_fpe, arglist); + tree gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind); + tmp = build_call_expr (gfor_fndecl_set_fpe, 1, + build_int_cst (gfc_c_int_type_node, + gfc_option.fpe)); gfc_add_expr_to_block (&body, tmp); } @@ -3175,13 +3165,10 @@ gfc_generate_function_code (gfc_namespace * ns) if (sym->attr.is_main_program && gfc_option.convert != CONVERT_NATIVE) { - tree arglist, gfc_c_int_type_node; - - gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind); - arglist = gfc_chainon_list (NULL_TREE, - build_int_cst (gfc_c_int_type_node, - gfc_option.convert)); - tmp = build_function_call_expr (gfor_fndecl_set_convert, arglist); + tree gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind); + tmp = build_call_expr (gfor_fndecl_set_convert, 1, + build_int_cst (gfc_c_int_type_node, + gfc_option.convert)); gfc_add_expr_to_block (&body, tmp); } @@ -3190,26 +3177,22 @@ gfc_generate_function_code (gfc_namespace * ns) if (sym->attr.is_main_program && gfc_option.record_marker != 0) { - tree arglist, gfc_c_int_type_node; - - gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind); - arglist = gfc_chainon_list (NULL_TREE, - build_int_cst (gfc_c_int_type_node, - gfc_option.record_marker)); - tmp = build_function_call_expr (gfor_fndecl_set_record_marker, arglist); + tree gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind); + tmp = build_call_expr (gfor_fndecl_set_record_marker, 1, + build_int_cst (gfc_c_int_type_node, + gfc_option.record_marker)); gfc_add_expr_to_block (&body, tmp); - } if (sym->attr.is_main_program && gfc_option.max_subrecord_length != 0) { - tree arglist, gfc_c_int_type_node; + tree gfc_c_int_type_node; gfc_c_int_type_node = gfc_get_int_type (gfc_c_int_kind); - arglist = gfc_chainon_list (NULL_TREE, - build_int_cst (gfc_c_int_type_node, - gfc_option.max_subrecord_length)); - tmp = build_function_call_expr (gfor_fndecl_set_max_subrecord_length, arglist); + tmp = build_call_expr (gfor_fndecl_set_max_subrecord_length, + 1, + build_int_cst (gfc_c_int_type_node, + gfc_option.max_subrecord_length)); gfc_add_expr_to_block (&body, tmp); } @@ -3374,8 +3357,7 @@ gfc_generate_constructors (void) for (; gfc_static_ctors; gfc_static_ctors = TREE_CHAIN (gfc_static_ctors)) { - tmp = - build_function_call_expr (TREE_VALUE (gfc_static_ctors), NULL_TREE); + tmp = build_call_expr (TREE_VALUE (gfc_static_ctors), 0); DECL_SAVED_TREE (fndecl) = build_stmt (EXPR_STMT, tmp); } diff --git a/gcc/fortran/trans-expr.c b/gcc/fortran/trans-expr.c index 1a97e31..839d768 100644 --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -748,7 +748,6 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr) gfc_se lse; gfc_se rse; tree fndecl; - tree tmp; gfc_init_se (&lse, se); gfc_conv_expr_val (&lse, expr->value.op.op1); @@ -887,9 +886,7 @@ gfc_conv_power_op (gfc_se * se, gfc_expr * expr) break; } - tmp = gfc_chainon_list (NULL_TREE, lse.expr); - tmp = gfc_chainon_list (tmp, rse.expr); - se->expr = build_function_call_expr (fndecl, tmp); + se->expr = build_call_expr (fndecl, 2, lse.expr, rse.expr); } @@ -900,7 +897,6 @@ gfc_conv_string_tmp (gfc_se * se, tree type, tree len) { tree var; tree tmp; - tree args; gcc_assert (TREE_TYPE (len) == gfc_charlen_type_node); @@ -918,15 +914,13 @@ gfc_conv_string_tmp (gfc_se * se, tree type, tree len) { /* Allocate a temporary to hold the result. */ var = gfc_create_var (type, "pstr"); - args = gfc_chainon_list (NULL_TREE, len); - tmp = build_function_call_expr (gfor_fndecl_internal_malloc, args); + tmp = build_call_expr (gfor_fndecl_internal_malloc, 1, len); tmp = convert (type, tmp); gfc_add_modify_expr (&se->pre, var, tmp); /* Free the temporary afterwards. */ tmp = convert (pvoid_type_node, var); - args = gfc_chainon_list (NULL_TREE, tmp); - tmp = build_function_call_expr (gfor_fndecl_internal_free, args); + tmp = build_call_expr (gfor_fndecl_internal_free, 1, tmp); gfc_add_expr_to_block (&se->post, tmp); } @@ -945,7 +939,6 @@ gfc_conv_concat_op (gfc_se * se, gfc_expr * expr) tree len; tree type; tree var; - tree args; tree tmp; gcc_assert (expr->value.op.op1->ts.type == BT_CHARACTER @@ -974,14 +967,10 @@ gfc_conv_concat_op (gfc_se * se, gfc_expr * expr) var = gfc_conv_string_tmp (se, type, len); /* Do the actual concatenation. */ - args = NULL_TREE; - args = gfc_chainon_list (args, len); - args = gfc_chainon_list (args, var); - args = gfc_chainon_list (args, lse.string_length); - args = gfc_chainon_list (args, lse.expr); - args = gfc_chainon_list (args, rse.string_length); - args = gfc_chainon_list (args, rse.expr); - tmp = build_function_call_expr (gfor_fndecl_concat_string, args); + tmp = build_call_expr (gfor_fndecl_concat_string, 6, + len, var, + lse.string_length, lse.expr, + rse.string_length, rse.expr); gfc_add_expr_to_block (&se->pre, tmp); /* Add the cleanup for the operands. */ @@ -1205,17 +1194,9 @@ gfc_build_compare_string (tree len1, tree str1, tree len2, tree str2) tmp = fold_build2 (MINUS_EXPR, type, sc1, sc2); } else - { - tmp = NULL_TREE; - tmp = gfc_chainon_list (tmp, len1); - tmp = gfc_chainon_list (tmp, str1); - tmp = gfc_chainon_list (tmp, len2); - tmp = gfc_chainon_list (tmp, str2); - - /* Build a call for the comparison. */ - tmp = build_function_call_expr (gfor_fndecl_compare_string, tmp); - } - + /* Build a call for the comparison. */ + tmp = build_call_expr (gfor_fndecl_compare_string, 4, + len1, str1, len2, str2); return tmp; } @@ -1281,7 +1262,7 @@ gfc_conv_operator_assign (gfc_se *lse, gfc_se *rse, gfc_symbol *sym) gfc_init_se (&se, NULL); gfc_conv_function_val (&se, sym); tmp = TREE_TYPE (TREE_TYPE (TREE_TYPE (se.expr))); - tmp = build3 (CALL_EXPR, tmp, se.expr, args, NULL_TREE); + tmp = build_call_list (tmp, se.expr, args); gfc_add_expr_to_block (&block, tmp); gfc_add_block_to_block (&block, &lse->post); @@ -2407,8 +2388,7 @@ gfc_conv_function_call (gfc_se * se, gfc_symbol * sym, } fntype = TREE_TYPE (TREE_TYPE (se->expr)); - se->expr = build3 (CALL_EXPR, TREE_TYPE (fntype), se->expr, - arglist, NULL_TREE); + se->expr = build_call_list (TREE_TYPE (fntype), se->expr, arglist); /* If we have a pointer function, but we don't want a pointer, e.g. something like @@ -2542,26 +2522,21 @@ gfc_trans_string_copy (stmtblock_t * block, tree dlength, tree dest, /* Truncate string if source is too long. */ cond2 = fold_build2 (GE_EXPR, boolean_type_node, slen, dlen); - tmp2 = gfc_chainon_list (NULL_TREE, dest); - tmp2 = gfc_chainon_list (tmp2, src); - tmp2 = gfc_chainon_list (tmp2, dlen); - tmp2 = build_function_call_expr (built_in_decls[BUILT_IN_MEMMOVE], tmp2); + tmp2 = build_call_expr (built_in_decls[BUILT_IN_MEMMOVE], + 3, dest, src, dlen); /* Else copy and pad with spaces. */ - tmp3 = gfc_chainon_list (NULL_TREE, dest); - tmp3 = gfc_chainon_list (tmp3, src); - tmp3 = gfc_chainon_list (tmp3, slen); - tmp3 = build_function_call_expr (built_in_decls[BUILT_IN_MEMMOVE], tmp3); + tmp3 = build_call_expr (built_in_decls[BUILT_IN_MEMMOVE], + 3, dest, src, slen); tmp4 = fold_build2 (PLUS_EXPR, pchar_type_node, dest, fold_convert (pchar_type_node, slen)); - tmp4 = gfc_chainon_list (NULL_TREE, tmp4); - tmp4 = gfc_chainon_list (tmp4, build_int_cst - (gfc_get_int_type (gfc_c_int_kind), - lang_hooks.to_target_charset (' '))); - tmp4 = gfc_chainon_list (tmp4, fold_build2 (MINUS_EXPR, TREE_TYPE(dlen), - dlen, slen)); - tmp4 = build_function_call_expr (built_in_decls[BUILT_IN_MEMSET], tmp4); + tmp4 = build_call_expr (built_in_decls[BUILT_IN_MEMSET], 3, + tmp4, + build_int_cst (gfc_get_int_type (gfc_c_int_kind), + lang_hooks.to_target_charset (' ')), + fold_build2 (MINUS_EXPR, TREE_TYPE(dlen), + dlen, slen)); gfc_init_block (&tempblock); gfc_add_expr_to_block (&tempblock, tmp3); @@ -3585,7 +3560,7 @@ static tree gfc_trans_zero_assign (gfc_expr * expr) { tree dest, len, type; - tree tmp, args; + tree tmp; gfc_symbol *sym; sym = expr->symtree->n.sym; @@ -3613,10 +3588,8 @@ gfc_trans_zero_assign (gfc_expr * expr) len = fold_convert (size_type_node, len); /* Construct call to __builtin_memset. */ - args = build_tree_list (NULL_TREE, len); - args = tree_cons (NULL_TREE, integer_zero_node, args); - args = tree_cons (NULL_TREE, dest, args); - tmp = build_function_call_expr (built_in_decls[BUILT_IN_MEMSET], args); + tmp = build_call_expr (built_in_decls[BUILT_IN_MEMSET], + 3, dest, integer_zero_node, len); return fold_convert (void_type_node, tmp); } @@ -3627,7 +3600,7 @@ gfc_trans_zero_assign (gfc_expr * expr) static tree gfc_build_memcpy_call (tree dst, tree src, tree len) { - tree tmp, args; + tree tmp; /* Convert arguments to the correct types. */ if (!POINTER_TYPE_P (TREE_TYPE (dst))) @@ -3643,10 +3616,7 @@ gfc_build_memcpy_call (tree dst, tree src, tree len) len = fold_convert (size_type_node, len); /* Construct call to __builtin_memcpy. */ - args = build_tree_list (NULL_TREE, len); - args = tree_cons (NULL_TREE, src, args); - args = tree_cons (NULL_TREE, dst, args); - tmp = build_function_call_expr (built_in_decls[BUILT_IN_MEMCPY], args); + tmp = build_call_expr (built_in_decls[BUILT_IN_MEMCPY], 3, dst, src, len); return fold_convert (void_type_node, tmp); } diff --git a/gcc/fortran/trans-intrinsic.c b/gcc/fortran/trans-intrinsic.c index 1bce128..e6bc46f 100644 --- a/gcc/fortran/trans-intrinsic.c +++ b/gcc/fortran/trans-intrinsic.c @@ -164,6 +164,8 @@ real_compnt_info; enum rounding_mode { RND_ROUND, RND_TRUNC, RND_CEIL, RND_FLOOR }; /* Evaluate the arguments to an intrinsic function. */ +/* FIXME: This function and its callers should be rewritten so that it's + not necessary to cons up a list to hold the arguments. */ static tree gfc_conv_intrinsic_function_args (gfc_se * se, gfc_expr * expr) @@ -1273,8 +1275,7 @@ gfc_conv_intrinsic_ctime (gfc_se * se, gfc_expr * expr) /* Free the temporary afterwards, if necessary. */ cond = build2 (GT_EXPR, boolean_type_node, len, build_int_cst (TREE_TYPE (len), 0)); - arglist = gfc_chainon_list (NULL_TREE, var); - tmp = build_function_call_expr (gfor_fndecl_internal_free, arglist); + tmp = build_call_expr (gfor_fndecl_internal_free, 1, var); tmp = build3_v (COND_EXPR, cond, tmp, build_empty_stmt ()); gfc_add_expr_to_block (&se->post, tmp); @@ -1309,8 +1310,7 @@ gfc_conv_intrinsic_fdate (gfc_se * se, gfc_expr * expr) /* Free the temporary afterwards, if necessary. */ cond = build2 (GT_EXPR, boolean_type_node, len, build_int_cst (TREE_TYPE (len), 0)); - arglist = gfc_chainon_list (NULL_TREE, var); - tmp = build_function_call_expr (gfor_fndecl_internal_free, arglist); + tmp = build_call_expr (gfor_fndecl_internal_free, 1, var); tmp = build3_v (COND_EXPR, cond, tmp, build_empty_stmt ()); gfc_add_expr_to_block (&se->post, tmp); @@ -1347,8 +1347,7 @@ gfc_conv_intrinsic_ttynam (gfc_se * se, gfc_expr * expr) /* Free the temporary afterwards, if necessary. */ cond = build2 (GT_EXPR, boolean_type_node, len, build_int_cst (TREE_TYPE (len), 0)); - arglist = gfc_chainon_list (NULL_TREE, var); - tmp = build_function_call_expr (gfor_fndecl_internal_free, arglist); + tmp = build_call_expr (gfor_fndecl_internal_free, 1, var); tmp = build3_v (COND_EXPR, cond, tmp, build_empty_stmt ()); gfc_add_expr_to_block (&se->post, tmp); @@ -2809,7 +2808,6 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr) tree lower; tree stride; tree stmt; - tree args; gfc_actual_arglist *arg; gfc_se argse; gfc_ss *ss; @@ -2850,15 +2848,13 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr) && arg->expr->ref->u.ar.type == AR_FULL)) { tmp = build_fold_addr_expr (argse.expr); - tmp = gfc_chainon_list (NULL_TREE, tmp); - source = build_function_call_expr (gfor_fndecl_in_pack, tmp); + source = build_call_expr (gfor_fndecl_in_pack, 1, tmp); source = gfc_evaluate_now (source, &argse.pre); /* Free the temporary. */ gfc_start_block (&block); tmp = convert (pvoid_type_node, source); - tmp = gfc_chainon_list (NULL_TREE, tmp); - tmp = build_function_call_expr (gfor_fndecl_internal_free, tmp); + tmp = build_call_expr (gfor_fndecl_internal_free, 1, tmp); gfc_add_expr_to_block (&block, tmp); stmt = gfc_finish_block (&block); @@ -2998,13 +2994,11 @@ gfc_conv_intrinsic_array_transfer (gfc_se * se, gfc_expr * expr) info, tmp, false, true, false); /* Use memcpy to do the transfer. */ - tmp = gfc_conv_descriptor_data_get (info->descriptor); - args = gfc_chainon_list (NULL_TREE, tmp); - tmp = fold_convert (pvoid_type_node, source); - args = gfc_chainon_list (args, source); - args = gfc_chainon_list (args, size_bytes); - tmp = built_in_decls[BUILT_IN_MEMCPY]; - tmp = build_function_call_expr (tmp, args); + tmp = build_call_expr (built_in_decls[BUILT_IN_MEMCPY], + 3, + gfc_conv_descriptor_data_get (info->descriptor), + fold_convert (pvoid_type_node, source), + size_bytes); gfc_add_expr_to_block (&se->pre, tmp); se->expr = info->descriptor; @@ -3024,7 +3018,7 @@ gfc_conv_intrinsic_transfer (gfc_se * se, gfc_expr * expr) tree type; tree ptr; gfc_ss *ss; - tree tmpdecl, tmp, args; + tree tmpdecl, tmp; /* Get a pointer to the source. */ arg = expr->value.function.actual; @@ -3059,13 +3053,10 @@ gfc_conv_intrinsic_transfer (gfc_se * se, gfc_expr * expr) /* Use memcpy to do the transfer. */ tmp = build1 (ADDR_EXPR, build_pointer_type (type), tmpdecl); - tmp = fold_convert (pvoid_type_node, tmp); - args = gfc_chainon_list (NULL_TREE, tmp); - tmp = fold_convert (pvoid_type_node, ptr); - args = gfc_chainon_list (args, tmp); - args = gfc_chainon_list (args, moldsize); - tmp = built_in_decls[BUILT_IN_MEMCPY]; - tmp = build_function_call_expr (tmp, args); + tmp = build_call_expr (built_in_decls[BUILT_IN_MEMCPY], 3, + fold_convert (pvoid_type_node, tmp), + fold_convert (pvoid_type_node, ptr), + moldsize); gfc_add_expr_to_block (&se->pre, tmp); se->expr = tmpdecl; @@ -3112,7 +3103,7 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr) gfc_se arg2se; tree tmp2; tree tmp; - tree args, fndecl; + tree fndecl; tree nonzero_charlen; tree nonzero_arraylen; gfc_ss *ss1, *ss2; @@ -3185,18 +3176,15 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr) /* A pointer to an array, call library function _gfor_associated. */ gcc_assert (ss2 != gfc_ss_terminator); - args = NULL_TREE; arg1se.want_pointer = 1; gfc_conv_expr_descriptor (&arg1se, arg1->expr, ss1); - args = gfc_chainon_list (args, arg1se.expr); arg2se.want_pointer = 1; gfc_conv_expr_descriptor (&arg2se, arg2->expr, ss2); gfc_add_block_to_block (&se->pre, &arg2se.pre); gfc_add_block_to_block (&se->post, &arg2se.post); - args = gfc_chainon_list (args, arg2se.expr); fndecl = gfor_fndecl_associated; - se->expr = build_function_call_expr (fndecl, args); + se->expr = build_call_expr (fndecl, 2, arg1se.expr, arg2se.expr); se->expr = build2 (TRUTH_AND_EXPR, boolean_type_node, se->expr, nonzero_arraylen); @@ -3287,8 +3275,7 @@ gfc_conv_intrinsic_si_kind (gfc_se * se, gfc_expr * expr) args = gfc_conv_intrinsic_function_args (se, expr); args = TREE_VALUE (args); args = build_fold_addr_expr (args); - args = tree_cons (NULL_TREE, args, NULL_TREE); - se->expr = build_function_call_expr (gfor_fndecl_si_kind, args); + se->expr = build_call_expr (gfor_fndecl_si_kind, 1, args); } /* Generate code for SELECTED_REAL_KIND (P, R) intrinsic function. */ @@ -3351,8 +3338,7 @@ gfc_conv_intrinsic_trim (gfc_se * se, gfc_expr * expr) /* Free the temporary afterwards, if necessary. */ cond = build2 (GT_EXPR, boolean_type_node, len, build_int_cst (TREE_TYPE (len), 0)); - arglist = gfc_chainon_list (NULL_TREE, var); - tmp = build_function_call_expr (gfor_fndecl_internal_free, arglist); + tmp = build_call_expr (gfor_fndecl_internal_free, 1, var); tmp = build3_v (COND_EXPR, cond, tmp, build_empty_stmt ()); gfc_add_expr_to_block (&se->post, tmp); @@ -3370,7 +3356,6 @@ gfc_conv_intrinsic_repeat (gfc_se * se, gfc_expr * expr) tree tmp; tree len; tree args; - tree arglist; tree ncopies; tree var; tree type; @@ -3395,12 +3380,9 @@ gfc_conv_intrinsic_repeat (gfc_se * se, gfc_expr * expr) var = gfc_conv_string_tmp (se, build_pointer_type (type), len); /* Create the argument list and generate the function call. */ - arglist = NULL_TREE; - arglist = gfc_chainon_list (arglist, var); - arglist = gfc_chainon_list (arglist, TREE_VALUE (args)); - arglist = gfc_chainon_list (arglist, TREE_VALUE (TREE_CHAIN (args))); - arglist = gfc_chainon_list (arglist, ncopies); - tmp = build_function_call_expr (gfor_fndecl_string_repeat, arglist); + tmp = build_call_expr (gfor_fndecl_string_repeat, 4, var, + TREE_VALUE (args), + TREE_VALUE (TREE_CHAIN (args)), ncopies); gfc_add_expr_to_block (&se->pre, tmp); se->expr = var; @@ -3419,7 +3401,7 @@ gfc_conv_intrinsic_iargc (gfc_se * se, gfc_expr * expr) /* Call the library function. This always returns an INTEGER(4). */ fndecl = gfor_fndecl_iargc; - tmp = build_function_call_expr (fndecl, NULL_TREE); + tmp = build_call_expr (fndecl, 0); /* Convert it to the required type. */ type = gfc_typenode_for_spec (&expr->ts); diff --git a/gcc/fortran/trans-io.c b/gcc/fortran/trans-io.c index 9865f44..951d465 100644 --- a/gcc/fortran/trans-io.c +++ b/gcc/fortran/trans-io.c @@ -835,8 +835,7 @@ gfc_trans_open (gfc_code * code) set_parameter_const (&block, var, IOPARM_common_flags, mask); tmp = build_fold_addr_expr (var); - tmp = gfc_chainon_list (NULL_TREE, tmp); - tmp = build_function_call_expr (iocall[IOCALL_OPEN], tmp); + tmp = build_call_expr (iocall[IOCALL_OPEN], 1, tmp); gfc_add_expr_to_block (&block, tmp); gfc_add_block_to_block (&block, &post_block); @@ -888,8 +887,7 @@ gfc_trans_close (gfc_code * code) set_parameter_const (&block, var, IOPARM_common_flags, mask); tmp = build_fold_addr_expr (var); - tmp = gfc_chainon_list (NULL_TREE, tmp); - tmp = build_function_call_expr (iocall[IOCALL_CLOSE], tmp); + tmp = build_call_expr (iocall[IOCALL_CLOSE], 1, tmp); gfc_add_expr_to_block (&block, tmp); gfc_add_block_to_block (&block, &post_block); @@ -939,8 +937,7 @@ build_filepos (tree function, gfc_code * code) set_parameter_const (&block, var, IOPARM_common_flags, mask); tmp = build_fold_addr_expr (var); - tmp = gfc_chainon_list (NULL_TREE, tmp); - tmp = build_function_call_expr (function, tmp); + tmp = build_call_expr (function, 1, tmp); gfc_add_expr_to_block (&block, tmp); gfc_add_block_to_block (&block, &post_block); @@ -1125,8 +1122,7 @@ gfc_trans_inquire (gfc_code * code) set_parameter_const (&block, var, IOPARM_common_flags, mask); tmp = build_fold_addr_expr (var); - tmp = gfc_chainon_list (NULL_TREE, tmp); - tmp = build_function_call_expr (iocall[IOCALL_INQUIRE], tmp); + tmp = build_call_expr (iocall[IOCALL_INQUIRE], 1, tmp); gfc_add_expr_to_block (&block, tmp); gfc_add_block_to_block (&block, &post_block); @@ -1248,8 +1244,6 @@ nml_get_addr_expr (gfc_symbol * sym, gfc_component * c, call to iocall[IOCALL_SET_NML_VAL]. For derived type variable, recursively generate calls to iocall[IOCALL_SET_NML_VAL] for each component. */ -#define NML_FIRST_ARG(a) args = gfc_chainon_list (NULL_TREE, a) -#define NML_ADD_ARG(a) args = gfc_chainon_list (args, a) #define IARG(i) build_int_cst (gfc_array_index_type, i) static void @@ -1263,7 +1257,6 @@ transfer_namelist_element (stmtblock_t * block, const char * var_name, tree dt = NULL; tree string; tree tmp; - tree args; tree dtype; tree dt_parm_addr; int n_dim; @@ -1329,18 +1322,14 @@ transfer_namelist_element (stmtblock_t * block, const char * var_name, (address, name, type, kind or string_length, dtype) */ dt_parm_addr = build_fold_addr_expr (dt_parm); - NML_FIRST_ARG (dt_parm_addr); - NML_ADD_ARG (addr_expr); - NML_ADD_ARG (string); - NML_ADD_ARG (IARG (ts->kind)); if (ts->type == BT_CHARACTER) - NML_ADD_ARG (ts->cl->backend_decl); + tmp = ts->cl->backend_decl; else - NML_ADD_ARG (build_int_cst (gfc_charlen_type_node, 0)); - - NML_ADD_ARG (dtype); - tmp = build_function_call_expr (iocall[IOCALL_SET_NML_VAL], args); + tmp = build_int_cst (gfc_charlen_type_node, 0); + tmp = build_call_expr (iocall[IOCALL_SET_NML_VAL], 6, + dt_parm_addr, addr_expr, string, + IARG (ts->kind), tmp, dtype); gfc_add_expr_to_block (block, tmp); /* If the object is an array, transfer rank times: @@ -1348,12 +1337,12 @@ transfer_namelist_element (stmtblock_t * block, const char * var_name, for ( n_dim = 0 ; n_dim < rank ; n_dim++ ) { - NML_FIRST_ARG (dt_parm_addr); - NML_ADD_ARG (IARG (n_dim)); - NML_ADD_ARG (GFC_TYPE_ARRAY_STRIDE (dt, n_dim)); - NML_ADD_ARG (GFC_TYPE_ARRAY_LBOUND (dt, n_dim)); - NML_ADD_ARG (GFC_TYPE_ARRAY_UBOUND (dt, n_dim)); - tmp = build_function_call_expr (iocall[IOCALL_SET_NML_VAL_DIM], args); + tmp = build_call_expr (iocall[IOCALL_SET_NML_VAL_DIM], 5, + dt_parm_addr, + IARG (n_dim), + GFC_TYPE_ARRAY_STRIDE (dt, n_dim), + GFC_TYPE_ARRAY_LBOUND (dt, n_dim), + GFC_TYPE_ARRAY_UBOUND (dt, n_dim)); gfc_add_expr_to_block (block, tmp); } @@ -1377,8 +1366,6 @@ transfer_namelist_element (stmtblock_t * block, const char * var_name, } #undef IARG -#undef NML_ADD_ARG -#undef NML_FIRST_ARG /* Create a data transfer statement. Not all of the fields are valid for both reading and writing, but improper use has been filtered @@ -1509,8 +1496,7 @@ build_dt (tree function, gfc_code * code) set_parameter_const (&block, var, IOPARM_common_flags, mask); tmp = build_fold_addr_expr (var); - tmp = gfc_chainon_list (NULL_TREE, tmp); - tmp = build_function_call_expr (function, tmp); + tmp = build_call_expr (function, 1, tmp); gfc_add_expr_to_block (&block, tmp); gfc_add_block_to_block (&block, &post_block); @@ -1590,8 +1576,7 @@ gfc_trans_dt_end (gfc_code * code) } tmp = build_fold_addr_expr (dt_parm); - tmp = gfc_chainon_list (NULL_TREE, tmp); - tmp = build_function_call_expr (function, tmp); + tmp = build_call_expr (function, 1, tmp); gfc_add_expr_to_block (&block, tmp); gfc_add_block_to_block (&block, dt_post_end_block); gfc_init_block (dt_post_end_block); @@ -1702,7 +1687,7 @@ transfer_array_component (tree expr, gfc_component * cm) static void transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr) { - tree args, tmp, function, arg2, field, expr; + tree tmp, function, arg2, field, expr; gfc_component *c; int kind; @@ -1777,11 +1762,7 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr) } tmp = build_fold_addr_expr (dt_parm); - args = gfc_chainon_list (NULL_TREE, tmp); - args = gfc_chainon_list (args, addr_expr); - args = gfc_chainon_list (args, arg2); - - tmp = build_function_call_expr (function, args); + tmp = build_call_expr (function, 3, tmp, addr_expr, arg2); gfc_add_expr_to_block (&se->pre, tmp); gfc_add_block_to_block (&se->pre, &se->post); @@ -1794,7 +1775,7 @@ transfer_expr (gfc_se * se, gfc_typespec * ts, tree addr_expr) static void transfer_array_desc (gfc_se * se, gfc_typespec * ts, tree addr_expr) { - tree args, tmp, charlen_arg, kind_arg; + tree tmp, charlen_arg, kind_arg; if (ts->type == BT_CHARACTER) charlen_arg = se->string_length; @@ -1804,11 +1785,8 @@ transfer_array_desc (gfc_se * se, gfc_typespec * ts, tree addr_expr) kind_arg = build_int_cst (NULL_TREE, ts->kind); tmp = build_fold_addr_expr (dt_parm); - args = gfc_chainon_list (NULL_TREE, tmp); - args = gfc_chainon_list (args, addr_expr); - args = gfc_chainon_list (args, kind_arg); - args = gfc_chainon_list (args, charlen_arg); - tmp = build_function_call_expr (iocall[IOCALL_X_ARRAY], args); + tmp = build_call_expr (iocall[IOCALL_X_ARRAY], 4, + tmp, addr_expr, kind_arg, charlen_arg); gfc_add_expr_to_block (&se->pre, tmp); gfc_add_block_to_block (&se->pre, &se->post); } diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index 8276316..49368661 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -875,7 +875,7 @@ static tree gfc_trans_omp_barrier (void) { tree decl = built_in_decls [BUILT_IN_GOMP_BARRIER]; - return build_function_call_expr (decl, NULL); + return build_call_expr (decl, 0); } static tree @@ -1054,7 +1054,7 @@ static tree gfc_trans_omp_flush (void) { tree decl = built_in_decls [BUILT_IN_SYNCHRONIZE]; - return build_function_call_expr (decl, NULL); + return build_call_expr (decl, 0); } static tree diff --git a/gcc/fortran/trans-stmt.c b/gcc/fortran/trans-stmt.c index 6b8a9a0..cdc8dc6 100644 --- a/gcc/fortran/trans-stmt.c +++ b/gcc/fortran/trans-stmt.c @@ -295,9 +295,7 @@ gfc_conv_elemental_dependencies (gfc_se * se, gfc_se * loopse, gfc_add_modify_expr (&se->pre, info->offset, offset); /* Copy the result back using unpack. */ - tmp = gfc_chainon_list (NULL_TREE, parmse.expr); - tmp = gfc_chainon_list (tmp, data); - tmp = build_function_call_expr (gfor_fndecl_in_unpack, tmp); + tmp = build_call_expr (gfor_fndecl_in_unpack, 2, parmse.expr, data); gfc_add_expr_to_block (&se->post, tmp); gfc_add_block_to_block (&se->post, &parmse.post); @@ -470,9 +468,7 @@ gfc_trans_pause (gfc_code * code) { tree gfc_int4_type_node = gfc_get_int_type (4); gfc_se se; - tree args; tree tmp; - tree fndecl; /* Start a new block for this statement. */ gfc_init_se (&se, NULL); @@ -482,18 +478,15 @@ gfc_trans_pause (gfc_code * code) if (code->expr == NULL) { tmp = build_int_cst (gfc_int4_type_node, code->ext.stop_code); - args = gfc_chainon_list (NULL_TREE, tmp); - fndecl = gfor_fndecl_pause_numeric; + tmp = build_call_expr (gfor_fndecl_pause_numeric, 1, tmp); } else { gfc_conv_expr_reference (&se, code->expr); - args = gfc_chainon_list (NULL_TREE, se.expr); - args = gfc_chainon_list (args, se.string_length); - fndecl = gfor_fndecl_pause_string; + tmp = build_call_expr (gfor_fndecl_pause_string, 2, + se.expr, se.string_length); } - tmp = build_function_call_expr (fndecl, args); gfc_add_expr_to_block (&se.pre, tmp); gfc_add_block_to_block (&se.pre, &se.post); @@ -510,9 +503,7 @@ gfc_trans_stop (gfc_code * code) { tree gfc_int4_type_node = gfc_get_int_type (4); gfc_se se; - tree args; tree tmp; - tree fndecl; /* Start a new block for this statement. */ gfc_init_se (&se, NULL); @@ -522,18 +513,15 @@ gfc_trans_stop (gfc_code * code) if (code->expr == NULL) { tmp = build_int_cst (gfc_int4_type_node, code->ext.stop_code); - args = gfc_chainon_list (NULL_TREE, tmp); - fndecl = gfor_fndecl_stop_numeric; + tmp = build_call_expr (gfor_fndecl_stop_numeric, 1, tmp); } else { gfc_conv_expr_reference (&se, code->expr); - args = gfc_chainon_list (NULL_TREE, se.expr); - args = gfc_chainon_list (args, se.string_length); - fndecl = gfor_fndecl_stop_string; + tmp = build_call_expr (gfor_fndecl_stop_string, 2, + se.expr, se.string_length); } - tmp = build_function_call_expr (fndecl, args); gfc_add_expr_to_block (&se.pre, tmp); gfc_add_block_to_block (&se.pre, &se.post); @@ -1308,7 +1296,7 @@ gfc_trans_logical_select (gfc_code * code) static tree gfc_trans_character_select (gfc_code *code) { - tree init, node, end_label, tmp, type, args, *labels; + tree init, node, end_label, tmp, type, *labels; tree case_label; stmtblock_t block, body; gfc_case *cp, *d; @@ -1449,25 +1437,19 @@ gfc_trans_character_select (gfc_code *code) DECL_INITIAL (tmp) = init; init = tmp; - /* Build an argument list for the library call */ + /* Build the library call */ init = gfc_build_addr_expr (pvoid_type_node, init); - args = gfc_chainon_list (NULL_TREE, init); - - tmp = build_int_cst (NULL_TREE, n); - args = gfc_chainon_list (args, tmp); - tmp = gfc_build_addr_expr (pvoid_type_node, end_label); - args = gfc_chainon_list (args, tmp); gfc_init_se (&se, NULL); gfc_conv_expr_reference (&se, code->expr); - args = gfc_chainon_list (args, se.expr); - args = gfc_chainon_list (args, se.string_length); - gfc_add_block_to_block (&block, &se.pre); - tmp = build_function_call_expr (gfor_fndecl_select_string, args); + tmp = build_call_expr (gfor_fndecl_select_string, 5, + init, build_int_cst (NULL_TREE, n), + tmp, se.expr, se.string_length); + case_label = gfc_create_var (TREE_TYPE (tmp), "case_label"); gfc_add_modify_expr (&block, case_label, tmp); @@ -1687,7 +1669,6 @@ gfc_do_allocate (tree bytesize, tree size, tree * pdata, stmtblock_t * pblock, tree tmpvar; tree type; tree tmp; - tree args; if (INTEGER_CST_P (size)) { @@ -1710,14 +1691,13 @@ gfc_do_allocate (tree bytesize, tree size, tree * pdata, stmtblock_t * pblock, tmpvar = gfc_create_var (build_pointer_type (type), "temp"); *pdata = convert (pvoid_type_node, tmpvar); - args = gfc_chainon_list (NULL_TREE, bytesize); if (gfc_index_integer_kind == 4) tmp = gfor_fndecl_internal_malloc; else if (gfc_index_integer_kind == 8) tmp = gfor_fndecl_internal_malloc64; else gcc_unreachable (); - tmp = build_function_call_expr (tmp, args); + tmp = build_call_expr (tmp, 1, bytesize); tmp = convert (TREE_TYPE (tmpvar), tmp); gfc_add_modify_expr (pblock, tmpvar, tmp); } @@ -2229,8 +2209,7 @@ gfc_trans_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2, if (ptemp1) { /* Free the temporary. */ - tmp = gfc_chainon_list (NULL_TREE, ptemp1); - tmp = build_function_call_expr (gfor_fndecl_internal_free, tmp); + tmp = build_call_expr (gfor_fndecl_internal_free, 1, ptemp1); gfc_add_expr_to_block (block, tmp); } } @@ -2388,8 +2367,7 @@ gfc_trans_pointer_assign_need_temp (gfc_expr * expr1, gfc_expr * expr2, /* Free the temporary. */ if (ptemp1) { - tmp = gfc_chainon_list (NULL_TREE, ptemp1); - tmp = build_function_call_expr (gfor_fndecl_internal_free, tmp); + tmp = build_call_expr (gfor_fndecl_internal_free, 1, ptemp1); gfc_add_expr_to_block (block, tmp); } } @@ -2724,8 +2702,7 @@ gfc_trans_forall_1 (gfc_code * code, forall_info * nested_forall_info) if (pmask) { /* Free the temporary for the mask. */ - tmp = gfc_chainon_list (NULL_TREE, pmask); - tmp = build_function_call_expr (gfor_fndecl_internal_free, tmp); + tmp = build_call_expr (gfor_fndecl_internal_free, 1, pmask); gfc_add_expr_to_block (&block, tmp); } if (maskindex) @@ -3322,16 +3299,14 @@ gfc_trans_where_2 (gfc_code * code, tree mask, bool invert, /* If we allocated a pending mask array, deallocate it now. */ if (ppmask) { - tree args = gfc_chainon_list (NULL_TREE, ppmask); - tmp = build_function_call_expr (gfor_fndecl_internal_free, args); + tmp = build_call_expr (gfor_fndecl_internal_free, 1, ppmask); gfc_add_expr_to_block (block, tmp); } /* If we allocated a current mask array, deallocate it now. */ if (pcmask) { - tree args = gfc_chainon_list (NULL_TREE, pcmask); - tmp = build_function_call_expr (gfor_fndecl_internal_free, args); + tmp = build_call_expr (gfor_fndecl_internal_free, 1, pcmask); gfc_add_expr_to_block (block, tmp); } } @@ -3617,9 +3592,7 @@ gfc_trans_allocate (gfc_code * code) if (expr->ts.type == BT_CHARACTER && tmp == NULL_TREE) tmp = se.string_length; - parm = gfc_chainon_list (NULL_TREE, tmp); - parm = gfc_chainon_list (parm, pstat); - tmp = build_function_call_expr (gfor_fndecl_allocate, parm); + tmp = build_call_expr (gfor_fndecl_allocate, 2, tmp, pstat); tmp = build2 (MODIFY_EXPR, void_type_node, se.expr, tmp); gfc_add_expr_to_block (&se.pre, tmp); @@ -3685,7 +3658,7 @@ gfc_trans_deallocate (gfc_code * code) gfc_se se; gfc_alloc *al; gfc_expr *expr; - tree apstat, astat, parm, pstat, stat, tmp; + tree apstat, astat, pstat, stat, tmp; stmtblock_t block; gfc_start_block (&block); @@ -3748,9 +3721,7 @@ gfc_trans_deallocate (gfc_code * code) tmp = gfc_array_deallocate (se.expr, pstat); else { - parm = gfc_chainon_list (NULL_TREE, se.expr); - parm = gfc_chainon_list (parm, pstat); - tmp = build_function_call_expr (gfor_fndecl_deallocate, parm); + tmp = build_call_expr (gfor_fndecl_deallocate, 2, se.expr, pstat); gfc_add_expr_to_block (&se.pre, tmp); tmp = build2 (MODIFY_EXPR, void_type_node, diff --git a/gcc/fortran/trans.c b/gcc/fortran/trans.c index d942ebd..59b2dec 100644 --- a/gcc/fortran/trans.c +++ b/gcc/fortran/trans.c @@ -318,7 +318,7 @@ gfc_trans_runtime_check (tree cond, const char * msgid, stmtblock_t * pblock, stmtblock_t block; tree body; tree tmp; - tree args; + tree arg; char * message; int line; @@ -342,11 +342,10 @@ gfc_trans_runtime_check (tree cond, const char * msgid, stmtblock_t * pblock, asprintf (&message, "%s (in file '%s', around line %d)", _(msgid), gfc_source_file, input_line + 1); - tmp = gfc_build_addr_expr (pchar_type_node, gfc_build_cstring_const(message)); + arg = gfc_build_addr_expr (pchar_type_node, gfc_build_cstring_const(message)); gfc_free(message); - args = gfc_chainon_list (NULL_TREE, tmp); - tmp = build_function_call_expr (gfor_fndecl_runtime_error, args); + tmp = build_call_expr (gfor_fndecl_runtime_error, 1, arg); gfc_add_expr_to_block (&block, tmp); body = gfc_finish_block (&block); @@ -359,9 +358,8 @@ gfc_trans_runtime_check (tree cond, const char * msgid, stmtblock_t * pblock, { /* Tell the compiler that this isn't likely. */ cond = fold_convert (long_integer_type_node, cond); - tmp = gfc_chainon_list (NULL_TREE, cond); - tmp = gfc_chainon_list (tmp, build_int_cst (long_integer_type_node, 0)); - cond = build_function_call_expr (built_in_decls[BUILT_IN_EXPECT], tmp); + tmp = build_int_cst (long_integer_type_node, 0); + cond = build_call_expr (built_in_decls[BUILT_IN_EXPECT], 2, cond, tmp); cond = fold_convert (boolean_type_node, cond); tmp = build3_v (COND_EXPR, cond, body, build_empty_stmt ()); |