Commit 8b9db065 by Richard Henderson Committed by Richard Henderson

gimple.h (CASE_GIMPLE_OMP): New.

* gimple.h (CASE_GIMPLE_OMP): New.
        (is_gimple_omp): Use it.
        * tree-cfg.c (is_ctrl_altering_stmt): Likewise.
        (verify_gimple_debug): Likewise.

From-SVN: r151565
parent 4056c2c6
2009-09-09 Richard Henderson <rth@redhat.com>
* gimple.h (CASE_GIMPLE_OMP): New.
(is_gimple_omp): Use it.
* tree-cfg.c (is_ctrl_altering_stmt): Likewise.
(verify_gimple_debug): Likewise.
2009-09-09 Richard Guenther <rguenther@suse.de> 2009-09-09 Richard Guenther <rguenther@suse.de>
PR tree-optimization/41101 PR tree-optimization/41101
......
...@@ -4190,23 +4190,32 @@ gimple_return_set_retval (gimple gs, tree retval) ...@@ -4190,23 +4190,32 @@ gimple_return_set_retval (gimple gs, tree retval)
/* Returns true when the gimple statment STMT is any of the OpenMP types. */ /* Returns true when the gimple statment STMT is any of the OpenMP types. */
#define CASE_GIMPLE_OMP \
case GIMPLE_OMP_PARALLEL: \
case GIMPLE_OMP_TASK: \
case GIMPLE_OMP_FOR: \
case GIMPLE_OMP_SECTIONS: \
case GIMPLE_OMP_SECTIONS_SWITCH: \
case GIMPLE_OMP_SINGLE: \
case GIMPLE_OMP_SECTION: \
case GIMPLE_OMP_MASTER: \
case GIMPLE_OMP_ORDERED: \
case GIMPLE_OMP_CRITICAL: \
case GIMPLE_OMP_RETURN: \
case GIMPLE_OMP_ATOMIC_LOAD: \
case GIMPLE_OMP_ATOMIC_STORE: \
case GIMPLE_OMP_CONTINUE
static inline bool static inline bool
is_gimple_omp (const_gimple stmt) is_gimple_omp (const_gimple stmt)
{ {
return (gimple_code (stmt) == GIMPLE_OMP_PARALLEL switch (gimple_code (stmt))
|| gimple_code (stmt) == GIMPLE_OMP_TASK {
|| gimple_code (stmt) == GIMPLE_OMP_FOR CASE_GIMPLE_OMP:
|| gimple_code (stmt) == GIMPLE_OMP_SECTIONS return true;
|| gimple_code (stmt) == GIMPLE_OMP_SECTIONS_SWITCH default:
|| gimple_code (stmt) == GIMPLE_OMP_SINGLE return false;
|| gimple_code (stmt) == GIMPLE_OMP_SECTION }
|| gimple_code (stmt) == GIMPLE_OMP_MASTER
|| gimple_code (stmt) == GIMPLE_OMP_ORDERED
|| gimple_code (stmt) == GIMPLE_OMP_CRITICAL
|| gimple_code (stmt) == GIMPLE_OMP_RETURN
|| gimple_code (stmt) == GIMPLE_OMP_ATOMIC_LOAD
|| gimple_code (stmt) == GIMPLE_OMP_ATOMIC_STORE
|| gimple_code (stmt) == GIMPLE_OMP_CONTINUE);
} }
......
...@@ -2748,24 +2748,30 @@ is_ctrl_altering_stmt (gimple t) ...@@ -2748,24 +2748,30 @@ is_ctrl_altering_stmt (gimple t)
{ {
gcc_assert (t); gcc_assert (t);
if (is_gimple_call (t)) switch (gimple_code (t))
{ {
int flags = gimple_call_flags (t); case GIMPLE_CALL:
{
int flags = gimple_call_flags (t);
/* A non-pure/const call alters flow control if the current /* A non-pure/const call alters flow control if the current
function has nonlocal labels. */ function has nonlocal labels. */
if (!(flags & (ECF_CONST | ECF_PURE)) if (!(flags & (ECF_CONST | ECF_PURE)) && cfun->has_nonlocal_label)
&& cfun->has_nonlocal_label) return true;
return true;
/* A call also alters control flow if it does not return. */ /* A call also alters control flow if it does not return. */
if (gimple_call_flags (t) & ECF_NORETURN) if (gimple_call_flags (t) & ECF_NORETURN)
return true; return true;
} }
break;
/* OpenMP directives alter control flow. */ CASE_GIMPLE_OMP:
if (is_gimple_omp (t)) /* OpenMP directives alter control flow. */
return true; return true;
default:
break;
}
/* If a statement can throw, it alters control flow. */ /* If a statement can throw, it alters control flow. */
return stmt_can_throw_internal (t); return stmt_can_throw_internal (t);
...@@ -4196,17 +4202,6 @@ verify_gimple_debug (gimple stmt ATTRIBUTE_UNUSED) ...@@ -4196,17 +4202,6 @@ verify_gimple_debug (gimple stmt ATTRIBUTE_UNUSED)
static bool static bool
verify_types_in_gimple_stmt (gimple stmt) verify_types_in_gimple_stmt (gimple stmt)
{ {
if (is_gimple_omp (stmt))
{
/* OpenMP directives are validated by the FE and never operated
on by the optimizers. Furthermore, GIMPLE_OMP_FOR may contain
non-gimple expressions when the main index variable has had
its address taken. This does not affect the loop itself
because the header of an GIMPLE_OMP_FOR is merely used to determine
how to setup the parallel iteration. */
return false;
}
switch (gimple_code (stmt)) switch (gimple_code (stmt))
{ {
case GIMPLE_ASSIGN: case GIMPLE_ASSIGN:
...@@ -4244,6 +4239,15 @@ verify_types_in_gimple_stmt (gimple stmt) ...@@ -4244,6 +4239,15 @@ verify_types_in_gimple_stmt (gimple stmt)
case GIMPLE_PREDICT: case GIMPLE_PREDICT:
return false; return false;
CASE_GIMPLE_OMP:
/* OpenMP directives are validated by the FE and never operated
on by the optimizers. Furthermore, GIMPLE_OMP_FOR may contain
non-gimple expressions when the main index variable has had
its address taken. This does not affect the loop itself
because the header of an GIMPLE_OMP_FOR is merely used to determine
how to setup the parallel iteration. */
return false;
case GIMPLE_DEBUG: case GIMPLE_DEBUG:
return verify_gimple_debug (stmt); return verify_gimple_debug (stmt);
......
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