Deleted Added
full compact
omp-low.c (169689) omp-low.c (171825)
1/* Lowering pass for OpenMP directives. Converts OpenMP directives
2 into explicit calls to the runtime library (libgomp) and data
3 marshalling to implement data sharing and copying clauses.
4 Contributed by Diego Novillo <dnovillo@redhat.com>
5
6 Copyright (C) 2005, 2006 Free Software Foundation, Inc.
7
8This file is part of GCC.

--- 370 unchanged lines hidden (view full) ---

379 WS_EXIT_BB -> PAR_EXIT_BB. */
380 par_entry_bb = region->entry;
381 par_exit_bb = region->exit;
382 ws_entry_bb = region->inner->entry;
383 ws_exit_bb = region->inner->exit;
384
385 if (single_succ (par_entry_bb) == ws_entry_bb
386 && single_succ (ws_exit_bb) == par_exit_bb
1/* Lowering pass for OpenMP directives. Converts OpenMP directives
2 into explicit calls to the runtime library (libgomp) and data
3 marshalling to implement data sharing and copying clauses.
4 Contributed by Diego Novillo <dnovillo@redhat.com>
5
6 Copyright (C) 2005, 2006 Free Software Foundation, Inc.
7
8This file is part of GCC.

--- 370 unchanged lines hidden (view full) ---

379 WS_EXIT_BB -> PAR_EXIT_BB. */
380 par_entry_bb = region->entry;
381 par_exit_bb = region->exit;
382 ws_entry_bb = region->inner->entry;
383 ws_exit_bb = region->inner->exit;
384
385 if (single_succ (par_entry_bb) == ws_entry_bb
386 && single_succ (ws_exit_bb) == par_exit_bb
387 && workshare_safe_to_combine_p (par_entry_bb, ws_entry_bb))
387 && workshare_safe_to_combine_p (par_entry_bb, ws_entry_bb)
388 && (OMP_PARALLEL_COMBINED (last_stmt (par_entry_bb))
389 || (last_and_only_stmt (ws_entry_bb)
390 && last_and_only_stmt (par_exit_bb))))
388 {
391 {
389 tree ws_stmt = last_stmt (region->inner->entry);
392 tree ws_stmt = last_stmt (ws_entry_bb);
390
391 if (region->inner->type == OMP_FOR)
392 {
393 /* If this is a combined parallel loop, we need to determine
394 whether or not to use the combined library calls. There
395 are two cases where we do not apply the transformation:
396 static loops and any kind of ordered loop. In the first
397 case, we already open code the loop so there is no need

--- 1102 unchanged lines hidden (view full) ---

1500 tree t;
1501 omp_context *up;
1502
1503 gcc_assert (ctx->is_nested);
1504
1505 for (up = ctx->outer, t = NULL; up && t == NULL; up = up->outer)
1506 t = maybe_lookup_decl (decl, up);
1507
393
394 if (region->inner->type == OMP_FOR)
395 {
396 /* If this is a combined parallel loop, we need to determine
397 whether or not to use the combined library calls. There
398 are two cases where we do not apply the transformation:
399 static loops and any kind of ordered loop. In the first
400 case, we already open code the loop so there is no need

--- 1102 unchanged lines hidden (view full) ---

1503 tree t;
1504 omp_context *up;
1505
1506 gcc_assert (ctx->is_nested);
1507
1508 for (up = ctx->outer, t = NULL; up && t == NULL; up = up->outer)
1509 t = maybe_lookup_decl (decl, up);
1510
1508 gcc_assert (t);
1511 gcc_assert (t || is_global_var (decl));
1509
1512
1510 return t;
1513 return t ? t : decl;
1511}
1512
1513
1514/* Similar to lookup_decl_in_outer_ctx, but return DECL if not found
1515 in outer contexts. */
1516
1517static tree
1518maybe_lookup_decl_in_outer_ctx (tree decl, omp_context *ctx)

--- 2595 unchanged lines hidden (view full) ---

4114 pop_gimplify_context (NULL_TREE);
4115 record_vars_into (ctx->block_vars, ctx->cb.dst_fn);
4116
4117 OMP_FOR_BODY (stmt) = NULL_TREE;
4118 OMP_FOR_PRE_BODY (stmt) = NULL_TREE;
4119 *stmt_p = new_stmt;
4120}
4121
1514}
1515
1516
1517/* Similar to lookup_decl_in_outer_ctx, but return DECL if not found
1518 in outer contexts. */
1519
1520static tree
1521maybe_lookup_decl_in_outer_ctx (tree decl, omp_context *ctx)

--- 2595 unchanged lines hidden (view full) ---

4117 pop_gimplify_context (NULL_TREE);
4118 record_vars_into (ctx->block_vars, ctx->cb.dst_fn);
4119
4120 OMP_FOR_BODY (stmt) = NULL_TREE;
4121 OMP_FOR_PRE_BODY (stmt) = NULL_TREE;
4122 *stmt_p = new_stmt;
4123}
4124
4125/* Callback for walk_stmts. Check if *TP only contains OMP_FOR
4126 or OMP_PARALLEL. */
4122
4127
4128static tree
4129check_combined_parallel (tree *tp, int *walk_subtrees, void *data)
4130{
4131 struct walk_stmt_info *wi = data;
4132 int *info = wi->info;
4133
4134 *walk_subtrees = 0;
4135 switch (TREE_CODE (*tp))
4136 {
4137 case OMP_FOR:
4138 case OMP_SECTIONS:
4139 *info = *info == 0 ? 1 : -1;
4140 break;
4141 default:
4142 *info = -1;
4143 break;
4144 }
4145 return NULL;
4146}
4147
4123/* Lower the OpenMP parallel directive in *STMT_P. CTX holds context
4124 information for the directive. */
4125
4126static void
4127lower_omp_parallel (tree *stmt_p, omp_context *ctx)
4128{
4129 tree clauses, par_bind, par_body, new_body, bind;
4130 tree olist, ilist, par_olist, par_ilist;
4131 tree stmt, child_fn, t;
4132
4133 stmt = *stmt_p;
4134
4135 clauses = OMP_PARALLEL_CLAUSES (stmt);
4136 par_bind = OMP_PARALLEL_BODY (stmt);
4137 par_body = BIND_EXPR_BODY (par_bind);
4138 child_fn = ctx->cb.dst_fn;
4148/* Lower the OpenMP parallel directive in *STMT_P. CTX holds context
4149 information for the directive. */
4150
4151static void
4152lower_omp_parallel (tree *stmt_p, omp_context *ctx)
4153{
4154 tree clauses, par_bind, par_body, new_body, bind;
4155 tree olist, ilist, par_olist, par_ilist;
4156 tree stmt, child_fn, t;
4157
4158 stmt = *stmt_p;
4159
4160 clauses = OMP_PARALLEL_CLAUSES (stmt);
4161 par_bind = OMP_PARALLEL_BODY (stmt);
4162 par_body = BIND_EXPR_BODY (par_bind);
4163 child_fn = ctx->cb.dst_fn;
4164 if (!OMP_PARALLEL_COMBINED (stmt))
4165 {
4166 struct walk_stmt_info wi;
4167 int ws_num = 0;
4139
4168
4169 memset (&wi, 0, sizeof (wi));
4170 wi.callback = check_combined_parallel;
4171 wi.info = &ws_num;
4172 wi.val_only = true;
4173 walk_stmts (&wi, &par_bind);
4174 if (ws_num == 1)
4175 OMP_PARALLEL_COMBINED (stmt) = 1;
4176 }
4177
4140 push_gimplify_context ();
4141
4142 par_olist = NULL_TREE;
4143 par_ilist = NULL_TREE;
4144 lower_rec_input_clauses (clauses, &par_ilist, &par_olist, ctx);
4145 lower_omp (&par_body, ctx);
4146 lower_reduction_clauses (clauses, &par_olist, ctx);
4147

--- 475 unchanged lines hidden ---
4178 push_gimplify_context ();
4179
4180 par_olist = NULL_TREE;
4181 par_ilist = NULL_TREE;
4182 lower_rec_input_clauses (clauses, &par_ilist, &par_olist, ctx);
4183 lower_omp (&par_body, ctx);
4184 lower_reduction_clauses (clauses, &par_olist, ctx);
4185

--- 475 unchanged lines hidden ---