[13/14] omp: use _P() defines from tree.h

Message ID 20230513232321.279733-14-rep.dot.nop@gmail.com
State Accepted
Headers
Series use _P() defines from tree.h |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Bernhard Reutner-Fischer May 13, 2023, 11:23 p.m. UTC
  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(-)
  

Patch

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