This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gimple-classes, committed 42/92] Introduce gimple_omp_teams


This corresponds to:
  [PATCH 44/89] Introduce gimple_omp_teams
  https://gcc.gnu.org/ml/gcc-patches/2014-04/msg01231.html
from the original 89-patch kit

That earlier patch was approved by Jeff:
> OK with expected changes due to renaming/updates to const handling.
> Please repost the final patch for archival purposes.
in https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00808.html

gcc/
	* coretypes.h (gimple_omp_teams): New typedef.
	(const_gimple_omp_teams): New typedef.

	* gimple.h (gimple_build_omp_teams): Return a gimple_omp_teams
	rather than a plain gimple.
	(gimple_omp_teams_set_clauses): Require a gimple_omp_teams rather
	than a plain gimple.

	* gimple-pretty-print.c (dump_gimple_omp_teams): Require a
	gimple_omp_teams rather than a plain gimple.
	(pp_gimple_stmt_1): Add checked cast to gimple_omp_teams within
	GIMPLE_OMP_TEAMS case of switch statement.

	* gimple.c (gimple_build_omp_teams): Return a gimple_omp_teams
	rather than a plain gimple.

	* omp-low.c (scan_omp_teams): Likewise.
	(scan_omp_1_stmt): Add checked cast to gimple_omp_teams within
	GIMPLE_OMP_TEAMS case of switch statement.
	(lower_omp_teams): Strengthen local "teams_stmt" from gimple to
	gimple_omp_teams.
---
 gcc/ChangeLog.gimple-classes | 26 ++++++++++++++++++++++++++
 gcc/coretypes.h              |  4 ++++
 gcc/gimple-pretty-print.c    |  6 ++++--
 gcc/gimple.c                 |  5 +++--
 gcc/gimple.h                 |  8 +++-----
 gcc/omp-low.c                |  6 +++---
 6 files changed, 43 insertions(+), 12 deletions(-)

diff --git a/gcc/ChangeLog.gimple-classes b/gcc/ChangeLog.gimple-classes
index e576b5e..65c7986 100644
--- a/gcc/ChangeLog.gimple-classes
+++ b/gcc/ChangeLog.gimple-classes
@@ -1,5 +1,31 @@
 2014-10-24  David Malcolm  <dmalcolm@redhat.com>
 
+	Introduce gimple_omp_teams
+
+	* coretypes.h (gimple_omp_teams): New typedef.
+	(const_gimple_omp_teams): New typedef.
+
+	* gimple.h (gimple_build_omp_teams): Return a gimple_omp_teams
+	rather than a plain gimple.
+	(gimple_omp_teams_set_clauses): Require a gimple_omp_teams rather
+	than a plain gimple.
+
+	* gimple-pretty-print.c (dump_gimple_omp_teams): Require a
+	gimple_omp_teams rather than a plain gimple.
+	(pp_gimple_stmt_1): Add checked cast to gimple_omp_teams within
+	GIMPLE_OMP_TEAMS case of switch statement.
+
+	* gimple.c (gimple_build_omp_teams): Return a gimple_omp_teams
+	rather than a plain gimple.
+
+	* omp-low.c (scan_omp_teams): Likewise.
+	(scan_omp_1_stmt): Add checked cast to gimple_omp_teams within
+	GIMPLE_OMP_TEAMS case of switch statement.
+	(lower_omp_teams): Strengthen local "teams_stmt" from gimple to
+	gimple_omp_teams.
+
+2014-10-24  David Malcolm  <dmalcolm@redhat.com>
+
 	Introduce gimple_omp_target
 
 	* coretypes.h (gimple_omp_target): New typedef.
diff --git a/gcc/coretypes.h b/gcc/coretypes.h
index 6996373..2cd33e5 100644
--- a/gcc/coretypes.h
+++ b/gcc/coretypes.h
@@ -204,6 +204,10 @@ struct gimple_statement_omp_target;
 typedef struct gimple_statement_omp_target *gimple_omp_target;
 typedef const struct gimple_statement_omp_target *const_gimple_omp_target;
 
+struct gimple_statement_omp_teams;
+typedef struct gimple_statement_omp_teams *gimple_omp_teams;
+typedef const struct gimple_statement_omp_teams *const_gimple_omp_teams;
+
 union section;
 typedef union section section;
 struct gcc_options;
diff --git a/gcc/gimple-pretty-print.c b/gcc/gimple-pretty-print.c
index 6491c55..d5e3639 100644
--- a/gcc/gimple-pretty-print.c
+++ b/gcc/gimple-pretty-print.c
@@ -1359,7 +1359,8 @@ dump_gimple_omp_target (pretty_printer *buffer, gimple_omp_target gs,
 /* Dump a GIMPLE_OMP_TEAMS tuple on the pretty_printer BUFFER.  */
 
 static void
-dump_gimple_omp_teams (pretty_printer *buffer, gimple gs, int spc, int flags)
+dump_gimple_omp_teams (pretty_printer *buffer, gimple_omp_teams gs, int spc,
+		       int flags)
 {
   if (flags & TDF_RAW)
     {
@@ -2178,7 +2179,8 @@ pp_gimple_stmt_1 (pretty_printer *buffer, gimple gs, int spc, int flags)
       break;
 
     case GIMPLE_OMP_TEAMS:
-      dump_gimple_omp_teams (buffer, gs, spc, flags);
+      dump_gimple_omp_teams (buffer, as_a <gimple_omp_teams> (gs), spc,
+			     flags);
       break;
 
     case GIMPLE_OMP_RETURN:
diff --git a/gcc/gimple.c b/gcc/gimple.c
index afeaa5b..b4b76f3 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -1071,10 +1071,11 @@ gimple_build_omp_target (gimple_seq body, int kind, tree clauses)
    BODY is the sequence of statements that will be executed.
    CLAUSES are any of the OMP teams construct's clauses.  */
 
-gimple
+gimple_omp_teams
 gimple_build_omp_teams (gimple_seq body, tree clauses)
 {
-  gimple p = gimple_alloc (GIMPLE_OMP_TEAMS, 0);
+  gimple_omp_teams p =
+    as_a <gimple_omp_teams> (gimple_alloc (GIMPLE_OMP_TEAMS, 0));
   if (body)
     gimple_omp_set_body (p, body);
   gimple_omp_teams_set_clauses (p, clauses);
diff --git a/gcc/gimple.h b/gcc/gimple.h
index 6bad165..462495e 100644
--- a/gcc/gimple.h
+++ b/gcc/gimple.h
@@ -1357,7 +1357,7 @@ gimple gimple_build_omp_sections (gimple_seq, tree);
 gimple gimple_build_omp_sections_switch (void);
 gimple_omp_single gimple_build_omp_single (gimple_seq, tree);
 gimple_omp_target gimple_build_omp_target (gimple_seq, int, tree);
-gimple gimple_build_omp_teams (gimple_seq, tree);
+gimple_omp_teams gimple_build_omp_teams (gimple_seq, tree);
 gimple_omp_atomic_load gimple_build_omp_atomic_load (tree, tree);
 gimple_omp_atomic_store gimple_build_omp_atomic_store (tree);
 gimple_transaction gimple_build_transaction (gimple_seq, tree);
@@ -5222,13 +5222,11 @@ gimple_omp_teams_clauses_ptr (gimple gs)
 }
 
 
-/* Set CLAUSES to be the clauses associated with OMP_TEAMS GS.  */
+/* Set CLAUSES to be the clauses associated with OMP_TEAMS_STMT.  */
 
 static inline void
-gimple_omp_teams_set_clauses (gimple gs, tree clauses)
+gimple_omp_teams_set_clauses (gimple_omp_teams omp_teams_stmt, tree clauses)
 {
-  gimple_statement_omp_teams *omp_teams_stmt =
-    as_a <gimple_statement_omp_teams *> (gs);
   omp_teams_stmt->clauses = clauses;
 }
 
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index 4b4ae4b..ce71618 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -2380,7 +2380,7 @@ scan_omp_target (gimple_omp_target stmt, omp_context *outer_ctx)
 /* Scan an OpenMP teams directive.  */
 
 static void
-scan_omp_teams (gimple stmt, omp_context *outer_ctx)
+scan_omp_teams (gimple_omp_teams stmt, omp_context *outer_ctx)
 {
   omp_context *ctx = new_omp_context (stmt, outer_ctx);
   scan_sharing_clauses (gimple_omp_teams_clauses (stmt), ctx);
@@ -2835,7 +2835,7 @@ scan_omp_1_stmt (gimple_stmt_iterator *gsi, bool *handled_ops_p,
       break;
 
     case GIMPLE_OMP_TEAMS:
-      scan_omp_teams (stmt, ctx);
+      scan_omp_teams (as_a <gimple_omp_teams> (stmt), ctx);
       break;
 
     case GIMPLE_BIND:
@@ -10356,7 +10356,7 @@ lower_omp_target (gimple_stmt_iterator *gsi_p, omp_context *ctx)
 static void
 lower_omp_teams (gimple_stmt_iterator *gsi_p, omp_context *ctx)
 {
-  gimple teams_stmt = gsi_stmt (*gsi_p);
+  gimple_omp_teams teams_stmt = as_a <gimple_omp_teams> (gsi_stmt (*gsi_p));
   push_gimplify_context ();
 
   tree block = make_node (BLOCK);
-- 
1.8.5.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]