diff options
Diffstat (limited to 'gcc/fortran/trans-array.c')
-rw-r--r-- | gcc/fortran/trans-array.c | 90 |
1 files changed, 27 insertions, 63 deletions
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); |