diff options
Diffstat (limited to 'gcc/omp-low.c')
-rw-r--r-- | gcc/omp-low.c | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/gcc/omp-low.c b/gcc/omp-low.c index a59841384ca..54997072df4 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -551,12 +551,12 @@ workshare_safe_to_combine_p (basic_block ws_entry_bb) parallel+workshare call. WS_STMT is the workshare directive being expanded. */ -static VEC(tree,gc) * +static vec<tree, va_gc> * get_ws_args_for (gimple ws_stmt) { tree t; location_t loc = gimple_location (ws_stmt); - VEC(tree,gc) *ws_args; + vec<tree, va_gc> *ws_args; if (gimple_code (ws_stmt) == GIMPLE_OMP_FOR) { @@ -564,21 +564,21 @@ get_ws_args_for (gimple ws_stmt) extract_omp_for_data (ws_stmt, &fd, NULL); - ws_args = VEC_alloc (tree, gc, 3 + (fd.chunk_size != 0)); + vec_alloc (ws_args, 3 + (fd.chunk_size != 0)); t = fold_convert_loc (loc, long_integer_type_node, fd.loop.n1); - VEC_quick_push (tree, ws_args, t); + ws_args->quick_push (t); t = fold_convert_loc (loc, long_integer_type_node, fd.loop.n2); - VEC_quick_push (tree, ws_args, t); + ws_args->quick_push (t); t = fold_convert_loc (loc, long_integer_type_node, fd.loop.step); - VEC_quick_push (tree, ws_args, t); + ws_args->quick_push (t); if (fd.chunk_size) { t = fold_convert_loc (loc, long_integer_type_node, fd.chunk_size); - VEC_quick_push (tree, ws_args, t); + ws_args->quick_push (t); } return ws_args; @@ -590,8 +590,8 @@ get_ws_args_for (gimple ws_stmt) the exit of the sections region. */ basic_block bb = single_succ (gimple_bb (ws_stmt)); t = build_int_cst (unsigned_type_node, EDGE_COUNT (bb->succs) - 1); - ws_args = VEC_alloc (tree, gc, 1); - VEC_quick_push (tree, ws_args, t); + vec_alloc (ws_args, 1); + ws_args->quick_push (t); return ws_args; } @@ -2937,7 +2937,7 @@ gimple_build_cond_empty (tree cond) static void expand_parallel_call (struct omp_region *region, basic_block bb, - gimple entry_stmt, VEC(tree,gc) *ws_args) + gimple entry_stmt, vec<tree, va_gc> *ws_args) { tree t, t1, t2, val, cond, c, clauses; gimple_stmt_iterator gsi; @@ -2945,7 +2945,7 @@ expand_parallel_call (struct omp_region *region, basic_block bb, enum built_in_function start_ix; int start_ix2; location_t clause_loc; - VEC(tree,gc) *args; + vec<tree, va_gc> *args; clauses = gimple_omp_parallel_clauses (entry_stmt); @@ -3076,11 +3076,12 @@ expand_parallel_call (struct omp_region *region, basic_block bb, t1 = build_fold_addr_expr (t); t2 = build_fold_addr_expr (gimple_omp_parallel_child_fn (entry_stmt)); - args = VEC_alloc (tree, gc, 3 + VEC_length (tree, ws_args)); - VEC_quick_push (tree, args, t2); - VEC_quick_push (tree, args, t1); - VEC_quick_push (tree, args, val); - VEC_splice (tree, args, ws_args); + vec_alloc (args, 3 + vec_safe_length (ws_args)); + args->quick_push (t2); + args->quick_push (t1); + args->quick_push (val); + if (ws_args) + args->splice (*ws_args); t = build_call_expr_loc_vec (UNKNOWN_LOCATION, builtin_decl_explicit (start_ix), args); @@ -3190,12 +3191,12 @@ maybe_catch_exception (gimple_seq body) /* Chain all the DECLs in LIST by their TREE_CHAIN fields. */ static tree -vec2chain (VEC(tree,gc) *v) +vec2chain (vec<tree, va_gc> *v) { tree chain = NULL_TREE, t; unsigned ix; - FOR_EACH_VEC_ELT_REVERSE (tree, v, ix, t) + FOR_EACH_VEC_SAFE_ELT_REVERSE (v, ix, t) { DECL_CHAIN (t) = chain; chain = t; @@ -3388,7 +3389,7 @@ expand_omp_taskreg (struct omp_region *region) gimple_stmt_iterator gsi; gimple entry_stmt, stmt; edge e; - VEC(tree,gc) *ws_args; + vec<tree, va_gc> *ws_args; entry_stmt = last_stmt (region->entry); child_fn = gimple_omp_taskreg_child_fn (entry_stmt); @@ -3563,18 +3564,18 @@ expand_omp_taskreg (struct omp_region *region) single_succ_edge (new_bb)->flags = EDGE_FALLTHRU; /* Remove non-local VAR_DECLs from child_cfun->local_decls list. */ - num = VEC_length (tree, child_cfun->local_decls); + num = vec_safe_length (child_cfun->local_decls); for (srcidx = 0, dstidx = 0; srcidx < num; srcidx++) { - t = VEC_index (tree, child_cfun->local_decls, srcidx); + t = (*child_cfun->local_decls)[srcidx]; if (DECL_CONTEXT (t) == cfun->decl) continue; if (srcidx != dstidx) - VEC_replace (tree, child_cfun->local_decls, dstidx, t); + (*child_cfun->local_decls)[dstidx] = t; dstidx++; } if (dstidx != num) - VEC_truncate (tree, child_cfun->local_decls, dstidx); + vec_safe_truncate (child_cfun->local_decls, dstidx); /* Inform the callgraph about the new function. */ DECL_STRUCT_FUNCTION (child_fn)->curr_properties @@ -4561,7 +4562,7 @@ expand_omp_for_static_chunk (struct omp_region *region, struct omp_for_data *fd) gimple_stmt_iterator psi; gimple phi; edge re, ene; - edge_var_map_vector head; + edge_var_map_vector *head; edge_var_map *vm; size_t i; @@ -4574,7 +4575,7 @@ expand_omp_for_static_chunk (struct omp_region *region, struct omp_for_data *fd) ene = single_succ_edge (entry_bb); psi = gsi_start_phis (fin_bb); - for (i = 0; !gsi_end_p (psi) && VEC_iterate (edge_var_map, head, i, vm); + for (i = 0; !gsi_end_p (psi) && head->iterate (i, &vm); gsi_next (&psi), ++i) { gimple nphi; @@ -4596,7 +4597,7 @@ expand_omp_for_static_chunk (struct omp_region *region, struct omp_for_data *fd) locus = redirect_edge_var_map_location (vm); add_phi_arg (nphi, redirect_edge_var_map_def (vm), re, locus); } - gcc_assert (!gsi_end_p (psi) && i == VEC_length (edge_var_map, head)); + gcc_assert (!gsi_end_p (psi) && i == head->length ()); redirect_edge_var_map_clear (re); while (1) { @@ -4721,7 +4722,7 @@ static void expand_omp_sections (struct omp_region *region) { tree t, u, vin = NULL, vmain, vnext, l2; - VEC (tree,heap) *label_vec; + vec<tree> label_vec; unsigned len; basic_block entry_bb, l0_bb, l1_bb, l2_bb, default_bb; gimple_stmt_iterator si, switch_si; @@ -4772,9 +4773,9 @@ expand_omp_sections (struct omp_region *region) and a default case to abort if something goes wrong. */ len = EDGE_COUNT (l0_bb->succs); - /* Use VEC_quick_push on label_vec throughout, since we know the size + /* Use vec::quick_push on label_vec throughout, since we know the size in advance. */ - label_vec = VEC_alloc (tree, heap, len); + label_vec.create (len); /* The call to GOMP_sections_start goes in ENTRY_BB, replacing the GIMPLE_OMP_SECTIONS statement. */ @@ -4819,7 +4820,7 @@ expand_omp_sections (struct omp_region *region) } t = build_case_label (build_int_cst (unsigned_type_node, 0), NULL, l2); - VEC_quick_push (tree, label_vec, t); + label_vec.quick_push (t); i = 1; /* Convert each GIMPLE_OMP_SECTION into a CASE_LABEL_EXPR. */ @@ -4843,7 +4844,7 @@ expand_omp_sections (struct omp_region *region) t = gimple_block_label (s_entry_bb); u = build_int_cst (unsigned_type_node, casei); u = build_case_label (u, NULL, t); - VEC_quick_push (tree, label_vec, u); + label_vec.quick_push (u); si = gsi_last_bb (s_entry_bb); gcc_assert (gimple_code (gsi_stmt (si)) == GIMPLE_OMP_SECTION); @@ -4869,7 +4870,7 @@ expand_omp_sections (struct omp_region *region) stmt = gimple_build_switch (vmain, u, label_vec); gsi_insert_after (&switch_si, stmt, GSI_SAME_STMT); gsi_remove (&switch_si, true); - VEC_free (tree, heap, label_vec); + label_vec.release (); si = gsi_start_bb (default_bb); stmt = gimple_build_call (builtin_decl_explicit (BUILT_IN_TRAP), 0); |