public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
To: gcc-patches@gcc.gnu.org
Cc: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
Subject: [PATCH 13/14] omp: use _P() defines from tree.h
Date: Sun, 14 May 2023 01:23:20 +0200	[thread overview]
Message-ID: <20230513232321.279733-14-rep.dot.nop@gmail.com> (raw)
In-Reply-To: <20230513232321.279733-1-rep.dot.nop@gmail.com>

From: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>

gcc/ChangeLog:

	* omp-low.cc (scan_sharing_clauses): Use _P() defines from tree.h.
	(lower_reduction_clauses): Ditto.
	(lower_send_clauses): Ditto.
	(lower_omp_task_reductions): Ditto.
	* omp-oacc-neuter-broadcast.cc (install_var_field): Ditto.
	(worker_single_copy): Ditto.
	* omp-offload.cc (oacc_rewrite_var_decl): Ditto.
	* omp-simd-clone.cc (plausible_type_for_simd_clone): Ditto.
---
 gcc/omp-low.cc                   | 36 ++++++++++++++++----------------
 gcc/omp-oacc-neuter-broadcast.cc | 10 ++++-----
 gcc/omp-offload.cc               |  2 +-
 gcc/omp-simd-clone.cc            |  2 +-
 4 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/gcc/omp-low.cc b/gcc/omp-low.cc
index dddf5b59d8f..9db33d2a48b 100644
--- a/gcc/omp-low.cc
+++ b/gcc/omp-low.cc
@@ -1267,7 +1267,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
 	      tree t = TREE_OPERAND (decl, 0);
 	      if (TREE_CODE (t) == POINTER_PLUS_EXPR)
 		t = TREE_OPERAND (t, 0);
-	      if (TREE_CODE (t) == INDIRECT_REF
+	      if (INDIRECT_REF_P (t)
 		  || TREE_CODE (t) == ADDR_EXPR)
 		t = TREE_OPERAND (t, 0);
 	      if (is_omp_target (ctx->stmt))
@@ -1276,7 +1276,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
 		    {
 		      gcc_assert (DECL_HAS_VALUE_EXPR_P (t));
 		      t = DECL_VALUE_EXPR (t);
-		      gcc_assert (TREE_CODE (t) == INDIRECT_REF);
+		      gcc_assert (INDIRECT_REF_P (t));
 		      t = TREE_OPERAND (t, 0);
 		      gcc_assert (DECL_P (t));
 		    }
@@ -1383,7 +1383,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
 		}
 	      else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_HAS_DEVICE_ADDR)
 		{
-		  if (TREE_CODE (decl) == INDIRECT_REF)
+		  if (INDIRECT_REF_P (decl))
 		    decl = TREE_OPERAND (decl, 0);
 		  install_var_field (decl, true, 3, ctx);
 		}
@@ -1457,7 +1457,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
 	      && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST)
 	    {
 	      tree decl2 = DECL_VALUE_EXPR (decl);
-	      gcc_assert (TREE_CODE (decl2) == INDIRECT_REF);
+	      gcc_assert (INDIRECT_REF_P (decl2));
 	      decl2 = TREE_OPERAND (decl2, 0);
 	      gcc_assert (DECL_P (decl2));
 	      install_var_local (decl2, ctx);
@@ -1467,7 +1467,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
 
 	case OMP_CLAUSE_HAS_DEVICE_ADDR:
 	  decl = OMP_CLAUSE_DECL (c);
-	  while (TREE_CODE (decl) == INDIRECT_REF
+	  while (INDIRECT_REF_P (decl)
 		 || TREE_CODE (decl) == ARRAY_REF)
 	    decl = TREE_OPERAND (decl, 0);
 	  goto do_private;
@@ -1635,7 +1635,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
 		      == GOMP_MAP_FIRSTPRIVATE_REFERENCE)))
 	    {
 	      if (TREE_CODE (decl) == COMPONENT_REF
-		  || (TREE_CODE (decl) == INDIRECT_REF
+		  || (INDIRECT_REF_P (decl)
 		      && TREE_CODE (TREE_OPERAND (decl, 0)) == COMPONENT_REF
 		      && (((TREE_CODE (TREE_TYPE (TREE_OPERAND (decl, 0)))
 			    == REFERENCE_TYPE)
@@ -1646,7 +1646,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
 		  && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST)
 		{
 		  tree decl2 = DECL_VALUE_EXPR (decl);
-		  gcc_assert (TREE_CODE (decl2) == INDIRECT_REF);
+		  gcc_assert (INDIRECT_REF_P (decl2));
 		  decl2 = TREE_OPERAND (decl2, 0);
 		  gcc_assert (DECL_P (decl2));
 		  install_var_local (decl2, ctx);
@@ -1660,7 +1660,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
 		  && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST)
 		{
 		  tree decl2 = DECL_VALUE_EXPR (decl);
-		  gcc_assert (TREE_CODE (decl2) == INDIRECT_REF);
+		  gcc_assert (INDIRECT_REF_P (decl2));
 		  decl2 = TREE_OPERAND (decl2, 0);
 		  gcc_assert (DECL_P (decl2));
 		  install_var_field (decl2, true, 3, ctx);
@@ -1802,7 +1802,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
 	  decl = OMP_CLAUSE_DECL (c);
 	  if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_HAS_DEVICE_ADDR)
 	    {
-	      while (TREE_CODE (decl) == INDIRECT_REF
+	      while (INDIRECT_REF_P (decl)
 		     || TREE_CODE (decl) == ARRAY_REF)
 		decl = TREE_OPERAND (decl, 0);
 	    }
@@ -1815,7 +1815,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
 		  && is_gimple_omp_offloaded (ctx->stmt))
 		{
 		  tree decl2 = DECL_VALUE_EXPR (decl);
-		  gcc_assert (TREE_CODE (decl2) == INDIRECT_REF);
+		  gcc_assert (INDIRECT_REF_P (decl2));
 		  decl2 = TREE_OPERAND (decl2, 0);
 		  gcc_assert (DECL_P (decl2));
 		  install_var_local (decl2, ctx);
@@ -1902,7 +1902,7 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
 		       && TREE_CODE (DECL_SIZE (decl)) != INTEGER_CST)
 		{
 		  tree decl2 = DECL_VALUE_EXPR (decl);
-		  gcc_assert (TREE_CODE (decl2) == INDIRECT_REF);
+		  gcc_assert (INDIRECT_REF_P (decl2));
 		  decl2 = TREE_OPERAND (decl2, 0);
 		  gcc_assert (DECL_P (decl2));
 		  fixup_remapped_decl (decl2, ctx, false);
@@ -7772,7 +7772,7 @@ lower_reduction_clauses (tree clauses, gimple_seq *stmt_seqp,
 		 context e.g. on orphaned loop construct.  Pretend this
 		 is private variable's outer reference.  */
 	      ccode = OMP_CLAUSE_PRIVATE;
-	      if (TREE_CODE (var) == INDIRECT_REF)
+	      if (INDIRECT_REF_P (var))
 		var = TREE_OPERAND (var, 0);
 	    }
 	  orig_var = var;
@@ -7780,7 +7780,7 @@ lower_reduction_clauses (tree clauses, gimple_seq *stmt_seqp,
 	    {
 	      gcc_assert (DECL_HAS_VALUE_EXPR_P (var));
 	      var = DECL_VALUE_EXPR (var);
-	      gcc_assert (TREE_CODE (var) == INDIRECT_REF);
+	      gcc_assert (INDIRECT_REF_P (var));
 	      var = TREE_OPERAND (var, 0);
 	      gcc_assert (DECL_P (var));
 	    }
@@ -7853,7 +7853,7 @@ lower_reduction_clauses (tree clauses, gimple_seq *stmt_seqp,
 	    }
 	  /* For ref build_outer_var_ref already performs this, so
 	     only new_var needs a dereference.  */
-	  if (TREE_CODE (d) == INDIRECT_REF)
+	  if (INDIRECT_REF_P (d))
 	    {
 	      new_var = build_simple_mem_ref_loc (clause_loc, new_var);
 	      gcc_assert (omp_privatize_by_reference (var)
@@ -8118,7 +8118,7 @@ lower_send_clauses (tree clauses, gimple_seq *ilist, gimple_seq *olist,
 	  val = TREE_OPERAND (val, 0);
 	  if (TREE_CODE (val) == POINTER_PLUS_EXPR)
 	    val = TREE_OPERAND (val, 0);
-	  if (TREE_CODE (val) == INDIRECT_REF
+	  if (INDIRECT_REF_P (val)
 	      || TREE_CODE (val) == ADDR_EXPR)
 	    val = TREE_OPERAND (val, 0);
 	  if (is_variable_sized (val))
@@ -9351,14 +9351,14 @@ lower_omp_task_reductions (omp_context *ctx, enum tree_code code, tree clauses,
 	      tree v = var;
 	      if (TREE_CODE (var) == ADDR_EXPR)
 		var = TREE_OPERAND (var, 0);
-	      else if (TREE_CODE (var) == INDIRECT_REF)
+	      else if (INDIRECT_REF_P (var))
 		var = TREE_OPERAND (var, 0);
 	      tree orig_var = var;
 	      if (is_variable_sized (var))
 		{
 		  gcc_assert (DECL_HAS_VALUE_EXPR_P (var));
 		  var = DECL_VALUE_EXPR (var);
-		  gcc_assert (TREE_CODE (var) == INDIRECT_REF);
+		  gcc_assert (INDIRECT_REF_P (var));
 		  var = TREE_OPERAND (var, 0);
 		  gcc_assert (DECL_P (var));
 		}
@@ -9367,7 +9367,7 @@ lower_omp_task_reductions (omp_context *ctx, enum tree_code code, tree clauses,
 		gcc_assert (TREE_CODE (v) == ADDR_EXPR);
 	      else if (TREE_CODE (v) == ADDR_EXPR)
 		t = build_fold_addr_expr (t);
-	      else if (TREE_CODE (v) == INDIRECT_REF)
+	      else if (INDIRECT_REF_P (v))
 		t = build_fold_indirect_ref (t);
 	      if (TREE_CODE (TREE_OPERAND (decl, 0)) == POINTER_PLUS_EXPR)
 		{
diff --git a/gcc/omp-oacc-neuter-broadcast.cc b/gcc/omp-oacc-neuter-broadcast.cc
index 6328253018e..779dc6b1afb 100644
--- a/gcc/omp-oacc-neuter-broadcast.cc
+++ b/gcc/omp-oacc-neuter-broadcast.cc
@@ -555,7 +555,7 @@ install_var_field (tree var, tree record_type, field_map_t *fields)
 	  name = get_identifier (tmp);
 	}
     }
-  else if (TREE_CODE (var) == VAR_DECL)
+  else if (VAR_P (var))
     {
       name = DECL_NAME (var);
       if (!name)
@@ -577,7 +577,7 @@ install_var_field (tree var, tree record_type, field_map_t *fields)
 
   tree field = build_decl (BUILTINS_LOCATION, FIELD_DECL, name, type);
 
-  if (TREE_CODE (var) == VAR_DECL && type == TREE_TYPE (var))
+  if (VAR_P (var) && type == TREE_TYPE (var))
     {
       SET_DECL_ALIGN (field, DECL_ALIGN (var));
       DECL_USER_ALIGN (field) = DECL_USER_ALIGN (var);
@@ -1143,7 +1143,7 @@ worker_single_copy (basic_block from, basic_block to,
 	  update_stmt (barrier_phi);
 	}
       else
-	gcc_assert (TREE_CODE (var) == VAR_DECL);
+	gcc_assert (VAR_P (var));
 
       /* If we had no record type, we will have no fields map.  */
       field_map_t *fields = record_field_map->get (record_type);
@@ -1162,7 +1162,7 @@ worker_single_copy (basic_block from, basic_block to,
 	  gsi_insert_after (&copyout_gsi, recv, GSI_CONTINUE_LINKING);
 	  update_stmt (recv);
 
-	  if (TREE_CODE (var) == VAR_DECL)
+	  if (VAR_P (var))
 	    {
 	      /* If it's a VAR_DECL, we only copied to an SSA temporary.  Copy
 		 to the final location now.  */
@@ -1194,7 +1194,7 @@ worker_single_copy (basic_block from, basic_block to,
 	      gimple_seq_add_stmt (&sender_seq, send);
 	      update_stmt (send);
 	    }
-	  else if (TREE_CODE (var) == VAR_DECL)
+	  else if (VAR_P (var))
 	    {
 	      tree tmp = make_ssa_name (TREE_TYPE (var));
 	      gassign *send = gimple_build_assign (tmp, var);
diff --git a/gcc/omp-offload.cc b/gcc/omp-offload.cc
index 3bd144e9ccf..0d3c8794d54 100644
--- a/gcc/omp-offload.cc
+++ b/gcc/omp-offload.cc
@@ -1888,7 +1888,7 @@ oacc_rewrite_var_decl (tree *tp, int *walk_subtrees, void *data)
       *base = *new_decl;
       info->modified = true;
     }
-  else if (TREE_CODE (*tp) == VAR_DECL)
+  else if (VAR_P (*tp))
     {
       tree *new_decl = info->adjusted_vars->get (*tp);
       if (new_decl)
diff --git a/gcc/omp-simd-clone.cc b/gcc/omp-simd-clone.cc
index 03ff86e7d18..c1cb7cc8a5c 100644
--- a/gcc/omp-simd-clone.cc
+++ b/gcc/omp-simd-clone.cc
@@ -150,7 +150,7 @@ auto_simd_check_stmt (gimple *stmt, tree outer)
 static bool
 plausible_type_for_simd_clone (tree t)
 {
-  if (TREE_CODE (t) == VOID_TYPE)
+  if (VOID_TYPE_P (t))
     return true;
   else if (RECORD_OR_UNION_TYPE_P (t) || !is_a <scalar_mode> (TYPE_MODE (t)))
     /* Small record/union types may fit into a scalar mode, but are
-- 
2.30.2


  parent reply	other threads:[~2023-05-13 23:23 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-13 23:23 [PATCH 00/14] " Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 01/14] ada: " Bernhard Reutner-Fischer
2023-05-14 23:03   ` Jeff Law
2023-05-18 19:59     ` Bernhard Reutner-Fischer
2023-05-15 10:05   ` Eric Botcazou
2023-05-18 19:53     ` Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 02/14] analyzer: " Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 03/14] gcc/config/*: " Bernhard Reutner-Fischer
2023-05-14  8:21   ` Iain Sandoe
2023-05-15  7:46     ` Richard Biener
2023-05-13 23:23 ` [PATCH 04/14] c++: " Bernhard Reutner-Fischer
2023-06-01 15:24   ` Patrick Palka
2023-06-01 16:33     ` Bernhard Reutner-Fischer
2023-06-01 18:10       ` Bernhard Reutner-Fischer
2023-08-02 16:51         ` Patrick Palka
2023-08-08 20:31           ` Jason Merrill
2023-11-15 17:42             ` Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 05/14] m2: " Bernhard Reutner-Fischer
2023-05-14  1:44   ` Gaius Mulley
2023-05-14  1:47   ` Gaius Mulley
2023-05-13 23:23 ` [PATCH 06/14] lto: " Bernhard Reutner-Fischer
2023-05-15  7:45   ` Richard Biener
2023-05-13 23:23 ` [PATCH 07/14] d: " Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 08/14] fortran: " Bernhard Reutner-Fischer
2023-05-14 13:10   ` Mikael Morin
2023-05-18 15:18     ` Bernhard Reutner-Fischer
2023-05-18 19:20       ` Mikael Morin
2023-05-19 19:19         ` Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 09/14] rust: " Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 10/14] c: " Bernhard Reutner-Fischer
2023-05-13 23:23 ` [PATCH 11/14] objc: " Bernhard Reutner-Fischer
2023-05-14  8:13   ` Iain Sandoe
2023-05-13 23:23 ` [PATCH 12/14] go: " Bernhard Reutner-Fischer
2023-05-13 23:23 ` Bernhard Reutner-Fischer [this message]
2023-05-13 23:23 ` [PATCH 14/14] gcc: " Bernhard Reutner-Fischer
2023-05-15  7:45   ` Richard Biener

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230513232321.279733-14-rep.dot.nop@gmail.com \
    --to=rep.dot.nop@gmail.com \
    --cc=aldot@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).