Commit 9410d9b2 by Jakub Jelinek Committed by Jakub Jelinek

omp-low.c (expand_omp_target): Use auto_vec<tree, 11> instead of vec<tree> *…

omp-low.c (expand_omp_target): Use auto_vec<tree, 11> instead of vec<tree> * with vec_alloc and release for args.

	* omp-low.c (expand_omp_target): Use auto_vec<tree, 11>
	instead of vec<tree> * with vec_alloc and release for args.
	Adjust all users.

From-SVN: r221460
parent 3713412b
2015-03-16 Jakub Jelinek <jakub@redhat.com>
* omp-low.c (expand_omp_target): Use auto_vec<tree, 11>
instead of vec<tree> * with vec_alloc and release for args.
Adjust all users.
PR middle-end/65431
* omp-low.c (delete_omp_context): Only splay_tree_delete
reduction_map in GIMPLE_OMP_TARGET is_gimple_omp_offloaded
......
......@@ -9105,14 +9105,11 @@ expand_omp_target (struct omp_region *region)
}
gimple g;
vec<tree> *args;
/* The maximum number used by any start_ix, without varargs. */
unsigned int argcnt = 11;
vec_alloc (args, argcnt);
args->quick_push (device);
auto_vec<tree, 11> args;
args.quick_push (device);
if (offloaded)
args->quick_push (build_fold_addr_expr (child_fn));
args.quick_push (build_fold_addr_expr (child_fn));
switch (start_ix)
{
case BUILT_IN_GOMP_TARGET:
......@@ -9120,7 +9117,7 @@ expand_omp_target (struct omp_region *region)
case BUILT_IN_GOMP_TARGET_UPDATE:
/* This const void * is part of the current ABI, but we're not actually
using it. */
args->quick_push (build_zero_cst (ptr_type_node));
args.quick_push (build_zero_cst (ptr_type_node));
break;
case BUILT_IN_GOACC_DATA_START:
case BUILT_IN_GOACC_ENTER_EXIT_DATA:
......@@ -9130,10 +9127,10 @@ expand_omp_target (struct omp_region *region)
default:
gcc_unreachable ();
}
args->quick_push (t1);
args->quick_push (t2);
args->quick_push (t3);
args->quick_push (t4);
args.quick_push (t1);
args.quick_push (t2);
args.quick_push (t3);
args.quick_push (t4);
switch (start_ix)
{
case BUILT_IN_GOACC_DATA_START:
......@@ -9166,9 +9163,9 @@ expand_omp_target (struct omp_region *region)
t_vector_length = fold_convert_loc (OMP_CLAUSE_LOCATION (c),
integer_type_node,
OMP_CLAUSE_VECTOR_LENGTH_EXPR (c));
args->quick_push (t_num_gangs);
args->quick_push (t_num_workers);
args->quick_push (t_vector_length);
args.quick_push (t_num_gangs);
args.quick_push (t_num_workers);
args.quick_push (t_vector_length);
}
/* FALLTHRU */
case BUILT_IN_GOACC_ENTER_EXIT_DATA:
......@@ -9190,13 +9187,13 @@ expand_omp_target (struct omp_region *region)
integer_type_node,
OMP_CLAUSE_ASYNC_EXPR (c));
args->quick_push (t_async);
args.quick_push (t_async);
/* Save the index, and... */
t_wait_idx = args->length ();
t_wait_idx = args.length ();
/* ... push a default value. */
args->quick_push (fold_convert_loc (gimple_location (entry_stmt),
integer_type_node,
integer_zero_node));
args.quick_push (fold_convert_loc (gimple_location (entry_stmt),
integer_type_node,
integer_zero_node));
c = find_omp_clause (clauses, OMP_CLAUSE_WAIT);
if (c)
{
......@@ -9206,19 +9203,19 @@ expand_omp_target (struct omp_region *region)
{
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_WAIT)
{
args->safe_push (fold_convert_loc (OMP_CLAUSE_LOCATION (c),
integer_type_node,
OMP_CLAUSE_WAIT_EXPR (c)));
args.safe_push (fold_convert_loc (OMP_CLAUSE_LOCATION (c),
integer_type_node,
OMP_CLAUSE_WAIT_EXPR (c)));
n++;
}
}
/* Now that we know the number, replace the default value. */
args->ordered_remove (t_wait_idx);
args->quick_insert (t_wait_idx,
fold_convert_loc (gimple_location (entry_stmt),
integer_type_node,
build_int_cst (integer_type_node, n)));
args.ordered_remove (t_wait_idx);
args.quick_insert (t_wait_idx,
fold_convert_loc (gimple_location (entry_stmt),
integer_type_node,
build_int_cst (integer_type_node, n)));
}
}
break;
......@@ -9226,8 +9223,7 @@ expand_omp_target (struct omp_region *region)
gcc_unreachable ();
}
g = gimple_build_call_vec (builtin_decl_explicit (start_ix), *args);
args->release ();
g = gimple_build_call_vec (builtin_decl_explicit (start_ix), args);
gimple_set_location (g, gimple_location (entry_stmt));
gsi_insert_before (&gsi, g, GSI_SAME_STMT);
if (!offloaded)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment