aboutsummaryrefslogtreecommitdiff
path: root/gcc/omp-general.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/omp-general.c')
-rw-r--r--gcc/omp-general.c56
1 files changed, 56 insertions, 0 deletions
diff --git a/gcc/omp-general.c b/gcc/omp-general.c
index 315f24a..1a2e71e 100644
--- a/gcc/omp-general.c
+++ b/gcc/omp-general.c
@@ -42,6 +42,7 @@ along with GCC; see the file COPYING3. If not see
#include "hsa-common.h"
#include "tree-pass.h"
#include "omp-device-properties.h"
+#include "tree-iterator.h"
enum omp_requires omp_requires_mask;
@@ -504,6 +505,61 @@ omp_build_barrier (tree lhs)
return g;
}
+/* Find OMP_FOR resp. OMP_SIMD with non-NULL OMP_FOR_INIT. Also, fill in pdata
+ array, pdata[0] non-NULL if there is anything non-trivial in between,
+ pdata[1] is address of OMP_PARALLEL in between if any, pdata[2] is address
+ of OMP_FOR in between if any and pdata[3] is address of the inner
+ OMP_FOR/OMP_SIMD. */
+
+tree
+find_combined_omp_for (tree *tp, int *walk_subtrees, void *data)
+{
+ tree **pdata = (tree **) data;
+ *walk_subtrees = 0;
+ switch (TREE_CODE (*tp))
+ {
+ case OMP_FOR:
+ if (OMP_FOR_INIT (*tp) != NULL_TREE)
+ {
+ pdata[3] = tp;
+ return *tp;
+ }
+ pdata[2] = tp;
+ *walk_subtrees = 1;
+ break;
+ case OMP_SIMD:
+ if (OMP_FOR_INIT (*tp) != NULL_TREE)
+ {
+ pdata[3] = tp;
+ return *tp;
+ }
+ break;
+ case BIND_EXPR:
+ if (BIND_EXPR_VARS (*tp)
+ || (BIND_EXPR_BLOCK (*tp)
+ && BLOCK_VARS (BIND_EXPR_BLOCK (*tp))))
+ pdata[0] = tp;
+ *walk_subtrees = 1;
+ break;
+ case STATEMENT_LIST:
+ if (!tsi_one_before_end_p (tsi_start (*tp)))
+ pdata[0] = tp;
+ *walk_subtrees = 1;
+ break;
+ case TRY_FINALLY_EXPR:
+ pdata[0] = tp;
+ *walk_subtrees = 1;
+ break;
+ case OMP_PARALLEL:
+ pdata[1] = tp;
+ *walk_subtrees = 1;
+ break;
+ default:
+ break;
+ }
+ return NULL_TREE;
+}
+
/* Return maximum possible vectorization factor for the target. */
poly_uint64