[03/14] gcc/config/*: use _P() defines from tree.h

Message ID 20230513232321.279733-4-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:

	* config/aarch64/aarch64.cc (aarch64_short_vector_p): Use _P
	defines from tree.h.
	(aarch64_mangle_type): Ditto.
	* config/alpha/alpha.cc (alpha_in_small_data_p): Ditto.
	(alpha_gimplify_va_arg_1): Ditto.
	* config/arc/arc.cc (arc_encode_section_info): Ditto.
	(arc_is_aux_reg_p): Ditto.
	(arc_is_uncached_mem_p): Ditto.
	(arc_handle_aux_attribute): Ditto.
	* config/arm/arm.cc (arm_handle_isr_attribute): Ditto.
	(arm_handle_cmse_nonsecure_call): Ditto.
	(arm_set_default_type_attributes): Ditto.
	(arm_is_segment_info_known): Ditto.
	(arm_mangle_type): Ditto.
	* config/arm/unknown-elf.h (IN_NAMED_SECTION_P): Ditto.
	* config/avr/avr.cc (avr_lookup_function_attribute1): Ditto.
	(avr_decl_absdata_p): Ditto.
	(avr_insert_attributes): Ditto.
	(avr_section_type_flags): Ditto.
	(avr_encode_section_info): Ditto.
	* config/bfin/bfin.cc (bfin_handle_l2_attribute): Ditto.
	* config/bpf/bpf.cc (bpf_core_compute): Ditto.
	* config/c6x/c6x.cc (c6x_in_small_data_p): Ditto.
	* config/csky/csky.cc (csky_handle_isr_attribute): Ditto.
	(csky_mangle_type): Ditto.
	* config/darwin-c.cc (darwin_pragma_unused): Ditto.
	* config/darwin.cc (is_objc_metadata): Ditto.
	* config/epiphany/epiphany.cc (epiphany_function_ok_for_sibcall): Ditto.
	* config/epiphany/epiphany.h (ROUND_TYPE_ALIGN): Ditto.
	* config/frv/frv.cc (frv_emit_movsi): Ditto.
	* config/gcn/gcn-tree.cc (gcn_lockless_update): Ditto.
	* config/gcn/gcn.cc (gcn_asm_output_symbol_ref): Ditto.
	* config/h8300/h8300.cc (h8300_encode_section_info): Ditto.
	* config/i386/i386-expand.cc: Ditto.
	* config/i386/i386.cc (type_natural_mode): Ditto.
	(ix86_function_arg): Ditto.
	(ix86_data_alignment): Ditto.
	(ix86_local_alignment): Ditto.
	(ix86_simd_clone_compute_vecsize_and_simdlen): Ditto.
	* config/i386/winnt-cxx.cc (i386_pe_type_dllimport_p): Ditto.
	(i386_pe_type_dllexport_p): Ditto.
	(i386_pe_adjust_class_at_definition): Ditto.
	* config/i386/winnt.cc (i386_pe_determine_dllimport_p): Ditto.
	(i386_pe_binds_local_p): Ditto.
	(i386_pe_section_type_flags): Ditto.
	* config/ia64/ia64.cc (ia64_encode_section_info): Ditto.
	(ia64_gimplify_va_arg): Ditto.
	(ia64_in_small_data_p): Ditto.
	* config/iq2000/iq2000.cc (iq2000_function_arg): Ditto.
	* config/lm32/lm32.cc (lm32_in_small_data_p): Ditto.
	* config/loongarch/loongarch.cc (loongarch_handle_model_attribute): Ditto.
	* config/m32c/m32c.cc (m32c_insert_attributes): Ditto.
	* config/mcore/mcore.cc (mcore_mark_dllimport): Ditto.
	(mcore_encode_section_info): Ditto.
	* config/microblaze/microblaze.cc (microblaze_elf_in_small_data_p): Ditto.
	* config/mips/mips.cc (mips_output_aligned_decl_common): Ditto.
	* config/mmix/mmix.cc (mmix_encode_section_info): Ditto.
	* config/nvptx/nvptx.cc (nvptx_encode_section_info): Ditto.
	(pass_in_memory): Ditto.
	(nvptx_generate_vector_shuffle): Ditto.
	(nvptx_lockless_update): Ditto.
	* config/pa/pa.cc (pa_function_arg_padding): Ditto.
	(pa_function_value): Ditto.
	(pa_function_arg): Ditto.
	* config/pa/pa.h (IN_NAMED_SECTION_P): Ditto.
	(TEXT_SPACE_P): Ditto.
	* config/pa/som.h (MAKE_DECL_ONE_ONLY): Ditto.
	* config/pdp11/pdp11.cc (pdp11_return_in_memory): Ditto.
	* config/riscv/riscv.cc (riscv_in_small_data_p): Ditto.
	(riscv_mangle_type): Ditto.
	* config/rl78/rl78.cc (rl78_insert_attributes): Ditto.
	(rl78_addsi3_internal): Ditto.
	* config/rs6000/aix.h (ROUND_TYPE_ALIGN): Ditto.
	* config/rs6000/darwin.h (ROUND_TYPE_ALIGN): Ditto.
	* config/rs6000/freebsd64.h (ROUND_TYPE_ALIGN): Ditto.
	* config/rs6000/linux64.h (ROUND_TYPE_ALIGN): Ditto.
	* config/rs6000/rs6000-call.cc (rs6000_function_arg_boundary): Ditto.
	(rs6000_function_arg_advance_1): Ditto.
	(rs6000_function_arg): Ditto.
	(rs6000_pass_by_reference): Ditto.
	* config/rs6000/rs6000-logue.cc (rs6000_function_ok_for_sibcall): Ditto.
	* config/rs6000/rs6000.cc (rs6000_data_alignment): Ditto.
	(rs6000_set_default_type_attributes): Ditto.
	(rs6000_elf_in_small_data_p): Ditto.
	(IN_NAMED_SECTION): Ditto.
	(rs6000_xcoff_encode_section_info): Ditto.
	(rs6000_function_value): Ditto.
	(invalid_arg_for_unprototyped_fn): Ditto.
	* config/s390/s390-c.cc (s390_fn_types_compatible): Ditto.
	(s390_vec_n_elem): Ditto.
	* config/s390/s390.cc (s390_check_type_for_vector_abi): Ditto.
	(s390_function_arg_integer): Ditto.
	(s390_return_in_memory): Ditto.
	(s390_encode_section_info): Ditto.
	* config/sh/sh.cc (sh_gimplify_va_arg_expr): Ditto.
	(sh_function_value): Ditto.
	* config/sol2.cc (solaris_insert_attributes): Ditto.
	* config/sparc/sparc.cc (function_arg_slotno): Ditto.
	* config/sparc/sparc.h (ROUND_TYPE_ALIGN): Ditto.
	* config/stormy16/stormy16.cc (xstormy16_encode_section_info): Ditto.
	(xstormy16_handle_below100_attribute): Ditto.
	* config/v850/v850.cc (v850_encode_section_info): Ditto.
	(v850_insert_attributes): Ditto.
	* config/visium/visium.cc (visium_pass_by_reference): Ditto.
	(visium_return_in_memory): Ditto.
	* config/xtensa/xtensa.cc (xtensa_multibss_section_type_flags): Ditto.
---
 gcc/config/aarch64/aarch64.cc       |  4 ++--
 gcc/config/alpha/alpha.cc           |  6 +++---
 gcc/config/arc/arc.cc               |  8 ++++----
 gcc/config/arm/arm.cc               | 16 +++++++---------
 gcc/config/arm/unknown-elf.h        |  2 +-
 gcc/config/avr/avr.cc               | 11 +++++------
 gcc/config/bfin/bfin.cc             |  2 +-
 gcc/config/bpf/bpf.cc               |  2 +-
 gcc/config/c6x/c6x.cc               |  4 ++--
 gcc/config/csky/csky.cc             |  8 +++-----
 gcc/config/darwin-c.cc              |  2 +-
 gcc/config/darwin.cc                |  2 +-
 gcc/config/epiphany/epiphany.cc     |  3 +--
 gcc/config/epiphany/epiphany.h      |  6 ++----
 gcc/config/frv/frv.cc               |  4 ++--
 gcc/config/gcn/gcn-tree.cc          |  2 +-
 gcc/config/gcn/gcn.cc               |  4 ++--
 gcc/config/h8300/h8300.cc           |  2 +-
 gcc/config/i386/i386-expand.cc      |  2 +-
 gcc/config/i386/i386.cc             | 20 ++++++++------------
 gcc/config/i386/winnt-cxx.cc        | 12 ++++++------
 gcc/config/i386/winnt.cc            |  6 +++---
 gcc/config/ia64/ia64.cc             |  6 +++---
 gcc/config/iq2000/iq2000.cc         |  8 +++-----
 gcc/config/lm32/lm32.cc             |  2 +-
 gcc/config/loongarch/loongarch.cc   |  2 +-
 gcc/config/m32c/m32c.cc             |  2 +-
 gcc/config/mcore/mcore.cc           |  6 +++---
 gcc/config/microblaze/microblaze.cc |  2 +-
 gcc/config/mips/mips.cc             |  2 +-
 gcc/config/mmix/mmix.cc             |  4 ++--
 gcc/config/nvptx/nvptx.cc           |  8 ++++----
 gcc/config/pa/pa.cc                 | 10 +++++-----
 gcc/config/pa/pa.h                  |  4 ++--
 gcc/config/pa/som.h                 |  2 +-
 gcc/config/pdp11/pdp11.cc           |  2 +-
 gcc/config/riscv/riscv.cc           |  4 ++--
 gcc/config/rl78/rl78.cc             |  4 ++--
 gcc/config/rs6000/aix.h             |  4 +---
 gcc/config/rs6000/darwin.h          |  6 ++----
 gcc/config/rs6000/freebsd64.h       |  4 +---
 gcc/config/rs6000/linux64.h         |  4 +---
 gcc/config/rs6000/rs6000-call.cc    | 10 +++++-----
 gcc/config/rs6000/rs6000-logue.cc   |  4 ++--
 gcc/config/rs6000/rs6000.cc         | 15 +++++++--------
 gcc/config/s390/s390-c.cc           |  4 ++--
 gcc/config/s390/s390.cc             |  8 ++++----
 gcc/config/sh/sh.cc                 | 12 ++++++------
 gcc/config/sol2.cc                  |  2 +-
 gcc/config/sparc/sparc.cc           |  2 +-
 gcc/config/sparc/sparc.h            |  4 +---
 gcc/config/stormy16/stormy16.cc     |  4 ++--
 gcc/config/v850/v850.cc             |  6 +++---
 gcc/config/visium/visium.cc         |  4 ++--
 gcc/config/xtensa/xtensa.cc         |  2 +-
 55 files changed, 133 insertions(+), 158 deletions(-)
  

Comments

Iain Sandoe May 14, 2023, 8:21 a.m. UTC | #1
Hi Bernhard

> On 14 May 2023, at 00:23, Bernhard Reutner-Fischer via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> 
> From: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
> 
> gcc/ChangeLog:
> 

> 	* config/darwin-c.cc (darwin_pragma_unused): Ditto.
> 	* config/darwin.cc (is_objc_metadata): Ditto.

> 	* config/rs6000/darwin.h (ROUND_TYPE_ALIGN): Ditto.

I guess it would be easier for a global maintainer to review this one … but…
… FAOD, the Darwin parts ar OK for trunk, thanks
Iain
  
Richard Biener May 15, 2023, 7:46 a.m. UTC | #2
On Sun, May 14, 2023 at 10:22 AM Iain Sandoe <iain@sandoe.co.uk> wrote:
>
> Hi Bernhard
>
> > On 14 May 2023, at 00:23, Bernhard Reutner-Fischer via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> >
> > From: Bernhard Reutner-Fischer <aldot@gcc.gnu.org>
> >
> > gcc/ChangeLog:
> >
>
> >       * config/darwin-c.cc (darwin_pragma_unused): Ditto.
> >       * config/darwin.cc (is_objc_metadata): Ditto.
>
> >       * config/rs6000/darwin.h (ROUND_TYPE_ALIGN): Ditto.
>
> I guess it would be easier for a global maintainer to review this one … but…
> … FAOD, the Darwin parts ar OK for trunk, thanks

I'll chime in for this and say "OK if the rest of the series is approved" then.

Thanks,
Richard.

> Iain
>
>
  

Patch

diff --git a/gcc/config/aarch64/aarch64.cc b/gcc/config/aarch64/aarch64.cc
index 546cb121331..224e614266e 100644
--- a/gcc/config/aarch64/aarch64.cc
+++ b/gcc/config/aarch64/aarch64.cc
@@ -20453,7 +20453,7 @@  aarch64_short_vector_p (const_tree type,
 {
   poly_int64 size = -1;
 
-  if (type && TREE_CODE (type) == VECTOR_TYPE)
+  if (type && VECTOR_TYPE_P (type))
     {
       if (aarch64_sve::builtin_type_p (type))
 	return false;
@@ -20893,7 +20893,7 @@  aarch64_mangle_type (const_tree type)
     return "St9__va_list";
 
   /* Half-precision floating point types.  */
-  if (TREE_CODE (type) == REAL_TYPE && TYPE_PRECISION (type) == 16)
+  if (SCALAR_FLOAT_TYPE_P (type) && TYPE_PRECISION (type) == 16)
     {
       if (TYPE_MAIN_VARIANT (type) == float16_type_node)
 	return NULL;
diff --git a/gcc/config/alpha/alpha.cc b/gcc/config/alpha/alpha.cc
index 1d826085198..360b50e20d4 100644
--- a/gcc/config/alpha/alpha.cc
+++ b/gcc/config/alpha/alpha.cc
@@ -784,10 +784,10 @@  alpha_in_small_data_p (const_tree exp)
     return false;
 
   /* COMMON symbols are never small data.  */
-  if (TREE_CODE (exp) == VAR_DECL && DECL_COMMON (exp))
+  if (VAR_P (exp) && DECL_COMMON (exp))
     return false;
 
-  if (TREE_CODE (exp) == VAR_DECL && DECL_SECTION_NAME (exp))
+  if (VAR_P (exp) && DECL_SECTION_NAME (exp))
     {
       const char *section = DECL_SECTION_NAME (exp);
       if (strcmp (section, ".sdata") == 0
@@ -6253,7 +6253,7 @@  alpha_gimplify_va_arg_1 (tree type, tree base, tree offset,
 
       return build2 (COMPLEX_EXPR, type, real_temp, imag_part);
     }
-  else if (TREE_CODE (type) == REAL_TYPE)
+  else if (SCALAR_FLOAT_TYPE_P (type))
     {
       tree fpaddend, cond, fourtyeight;
 
diff --git a/gcc/config/arc/arc.cc b/gcc/config/arc/arc.cc
index b47935a9214..dd012ffa975 100644
--- a/gcc/config/arc/arc.cc
+++ b/gcc/config/arc/arc.cc
@@ -5784,7 +5784,7 @@  arc_encode_section_info (tree decl, rtx rtl, int first)
 
       SYMBOL_REF_FLAGS (symbol) = flags;
     }
-  else if (TREE_CODE (decl) == VAR_DECL)
+  else if (VAR_P (decl))
     {
       rtx symbol = XEXP (rtl, 0);
 
@@ -8935,7 +8935,7 @@  arc_is_aux_reg_p (rtx pat)
     return false;
 
   /* Get the attributes.  */
-  if (TREE_CODE (addr) == VAR_DECL)
+  if (VAR_P (addr))
     attrs = DECL_ATTRIBUTES (addr);
   else if (TREE_CODE (addr) == MEM_REF)
     attrs = TYPE_ATTRIBUTES (TREE_TYPE (TREE_OPERAND (addr, 0)));
@@ -11247,7 +11247,7 @@  arc_is_uncached_mem_p (rtx pat)
 
   /* Get the attributes.  */
   if (TREE_CODE (addr) == MEM_REF
-      || TREE_CODE (addr) == VAR_DECL)
+      || VAR_P (addr))
     {
       attrs = TYPE_ATTRIBUTES (TREE_TYPE (addr));
       if (lookup_attribute ("uncached", attrs))
@@ -11315,7 +11315,7 @@  arc_handle_aux_attribute (tree *node,
 	  /* FIXME! add range check.  TREE_INT_CST_LOW (arg) */
 	}
 
-      if (TREE_CODE (*node) == VAR_DECL)
+      if (VAR_P (*node))
 	{
 	  tree fntype = TREE_TYPE (*node);
 	  if (fntype && TREE_CODE (fntype) == POINTER_TYPE)
diff --git a/gcc/config/arm/arm.cc b/gcc/config/arm/arm.cc
index 06e0756e4e8..6f218c96a2e 100644
--- a/gcc/config/arm/arm.cc
+++ b/gcc/config/arm/arm.cc
@@ -7463,8 +7463,7 @@  arm_handle_isr_attribute (tree *node, tree name, tree args, int flags,
     }
   else
     {
-      if (TREE_CODE (*node) == FUNCTION_TYPE
-	  || TREE_CODE (*node) == METHOD_TYPE)
+      if (FUNC_OR_METHOD_TYPE_P (*node))
 	{
 	  if (arm_isr_value (args) == ARM_FT_UNKNOWN)
 	    {
@@ -7474,8 +7473,7 @@  arm_handle_isr_attribute (tree *node, tree name, tree args, int flags,
 	    }
 	}
       else if (TREE_CODE (*node) == POINTER_TYPE
-	       && (TREE_CODE (TREE_TYPE (*node)) == FUNCTION_TYPE
-		   || TREE_CODE (TREE_TYPE (*node)) == METHOD_TYPE)
+	       && FUNC_OR_METHOD_TYPE_P (TREE_TYPE (*node))
 	       && arm_isr_value (args) != ARM_FT_UNKNOWN)
 	{
 	  *node = build_variant_type_copy (*node);
@@ -7683,7 +7681,7 @@  arm_handle_cmse_nonsecure_call (tree *node, tree name,
     {
       fntype = TREE_TYPE (*node);
 
-      if (TREE_CODE (*node) == VAR_DECL || TREE_CODE (*node) == TYPE_DECL)
+      if (VAR_P (*node) || TREE_CODE (*node) == TYPE_DECL)
 	decl = *node;
     }
   else
@@ -7804,7 +7802,7 @@  arm_set_default_type_attributes (tree type)
   /* Add __attribute__ ((long_call)) to all functions, when
      inside #pragma long_calls or __attribute__ ((short_call)),
      when inside #pragma no_long_calls.  */
-  if (TREE_CODE (type) == FUNCTION_TYPE || TREE_CODE (type) == METHOD_TYPE)
+  if (FUNC_OR_METHOD_TYPE_P (type))
     {
       tree type_attr_list, attr_name;
       type_attr_list = TYPE_ATTRIBUTES (type);
@@ -8452,7 +8450,7 @@  arm_is_segment_info_known (rtx orig, bool *is_readonly)
 	      || !DECL_COMMON (SYMBOL_REF_DECL (orig))))
 	{
 	  tree decl = SYMBOL_REF_DECL (orig);
-	  tree init = (TREE_CODE (decl) == VAR_DECL)
+	  tree init = VAR_P (decl)
 	    ? DECL_INITIAL (decl) : (TREE_CODE (decl) == CONSTRUCTOR)
 	    ? decl : 0;
 	  int reloc = 0;
@@ -8461,7 +8459,7 @@  arm_is_segment_info_known (rtx orig, bool *is_readonly)
 	  if (init && init != error_mark_node)
 	    reloc = compute_reloc_for_constant (init);
 
-	  named_section = TREE_CODE (decl) == VAR_DECL
+	  named_section = VAR_P (decl)
 	    && lookup_attribute ("section", DECL_ATTRIBUTES (decl));
 	  readonly = decl_readonly_section (decl, reloc);
 
@@ -30575,7 +30573,7 @@  arm_mangle_type (const_tree type)
     return "St9__va_list";
 
   /* Half-precision floating point types.  */
-  if (TREE_CODE (type) == REAL_TYPE && TYPE_PRECISION (type) == 16)
+  if (SCALAR_FLOAT_TYPE_P (type) && TYPE_PRECISION (type) == 16)
     {
       if (TYPE_MAIN_VARIANT (type) == float16_type_node)
 	return NULL;
diff --git a/gcc/config/arm/unknown-elf.h b/gcc/config/arm/unknown-elf.h
index 397ac3f68b9..42b97ce9458 100644
--- a/gcc/config/arm/unknown-elf.h
+++ b/gcc/config/arm/unknown-elf.h
@@ -51,7 +51,7 @@ 
 
 /* Return a nonzero value if DECL has a section attribute.  */
 #define IN_NAMED_SECTION_P(DECL)					\
-  ((TREE_CODE (DECL) == FUNCTION_DECL || TREE_CODE (DECL) == VAR_DECL)	\
+  ((TREE_CODE (DECL) == FUNCTION_DECL || VAR_P (DECL))	\
    && DECL_SECTION_NAME (DECL) != NULL)
 
 #undef  ASM_OUTPUT_ALIGNED_BSS
diff --git a/gcc/config/avr/avr.cc b/gcc/config/avr/avr.cc
index c193430cf07..d5af40f7091 100644
--- a/gcc/config/avr/avr.cc
+++ b/gcc/config/avr/avr.cc
@@ -961,8 +961,7 @@  avr_lookup_function_attribute1 (const_tree func, const char *name)
       func = TREE_TYPE (func);
     }
 
-  gcc_assert (TREE_CODE (func) == FUNCTION_TYPE
-              || TREE_CODE (func) == METHOD_TYPE);
+  gcc_assert (FUNC_OR_METHOD_TYPE_P (func));
 
   return NULL_TREE != lookup_attribute (name, TYPE_ATTRIBUTES (func));
 }
@@ -9839,7 +9838,7 @@  avr_progmem_p (tree decl, tree attributes)
 static bool
 avr_decl_absdata_p (tree decl, tree attributes)
 {
-  return (TREE_CODE (decl) == VAR_DECL
+  return (VAR_P (decl)
           && NULL_TREE != lookup_attribute ("absdata", attributes));
 }
 
@@ -9976,7 +9975,7 @@  avr_insert_attributes (tree node, tree *attributes)
 
   /* Add the section attribute if the variable is in progmem.  */
 
-  if (TREE_CODE (node) == VAR_DECL
+  if (VAR_P (node)
       && (TREE_STATIC (node) || DECL_EXTERNAL (node))
       && avr_progmem_p (node, *attributes))
     {
@@ -10190,7 +10189,7 @@  avr_section_type_flags (tree decl, const char *name, int reloc)
 
   if (startswith (name, ".noinit"))
     {
-      if (decl && TREE_CODE (decl) == VAR_DECL
+      if (decl && VAR_P (decl)
 	  && DECL_INITIAL (decl) == NULL_TREE)
 	flags |= SECTION_BSS;  /* @nobits */
       else
@@ -10338,7 +10337,7 @@  avr_encode_section_info (tree decl, rtx rtl, int new_decl_p)
 
   if (AVR_TINY
       && decl
-      && VAR_DECL == TREE_CODE (decl)
+      && VAR_P (decl)
       && MEM_P (rtl)
       && SYMBOL_REF_P (XEXP (rtl, 0)))
     {
diff --git a/gcc/config/bfin/bfin.cc b/gcc/config/bfin/bfin.cc
index c70d2281f06..4320ec26722 100644
--- a/gcc/config/bfin/bfin.cc
+++ b/gcc/config/bfin/bfin.cc
@@ -4877,7 +4877,7 @@  bfin_handle_l2_attribute (tree *node, tree ARG_UNUSED (name),
       else
 	set_decl_section_name (decl, ".l2.text");
     }
-  else if (TREE_CODE (decl) == VAR_DECL)
+  else if (VAR_P (decl))
     {
       if (DECL_SECTION_NAME (decl) != NULL
 	  && strcmp (DECL_SECTION_NAME (decl),
diff --git a/gcc/config/bpf/bpf.cc b/gcc/config/bpf/bpf.cc
index d8693f8cfbe..e0324e1e0e0 100644
--- a/gcc/config/bpf/bpf.cc
+++ b/gcc/config/bpf/bpf.cc
@@ -1406,7 +1406,7 @@  bpf_core_compute (tree node, vec<unsigned int> *accessors)
   if (TREE_CODE (node) == ADDR_EXPR)
     node = TREE_OPERAND (node, 0);
 
-  else if (TREE_CODE (node) == INDIRECT_REF
+  else if (INDIRECT_REF_P (node)
 	   || TREE_CODE (node) == POINTER_PLUS_EXPR)
     {
       accessors->safe_push (0);
diff --git a/gcc/config/c6x/c6x.cc b/gcc/config/c6x/c6x.cc
index 15be3b23716..0c9cb821f28 100644
--- a/gcc/config/c6x/c6x.cc
+++ b/gcc/config/c6x/c6x.cc
@@ -855,10 +855,10 @@  c6x_in_small_data_p (const_tree exp)
   if (TREE_CODE (exp) == FUNCTION_DECL)
     return false;
 
-  if (TREE_CODE (exp) == VAR_DECL && DECL_WEAK (exp))
+  if (VAR_P (exp) && DECL_WEAK (exp))
     return false;
 
-  if (TREE_CODE (exp) == VAR_DECL && DECL_SECTION_NAME (exp))
+  if (VAR_P (exp) && DECL_SECTION_NAME (exp))
     {
       const char *section = DECL_SECTION_NAME (exp);
 
diff --git a/gcc/config/csky/csky.cc b/gcc/config/csky/csky.cc
index ddc6954dad1..b4ee3b273a4 100644
--- a/gcc/config/csky/csky.cc
+++ b/gcc/config/csky/csky.cc
@@ -6490,8 +6490,7 @@  csky_handle_isr_attribute (tree *node, tree name, tree args, int flags,
     }
   else
     {
-      if (TREE_CODE (*node) == FUNCTION_TYPE
-	  || TREE_CODE (*node) == METHOD_TYPE)
+      if (FUNC_OR_METHOD_TYPE_P (*node))
 	{
 	  if (csky_isr_value (args) == CSKY_FT_UNKNOWN)
 	    {
@@ -6500,8 +6499,7 @@  csky_handle_isr_attribute (tree *node, tree name, tree args, int flags,
 	    }
 	}
       else if (TREE_CODE (*node) == POINTER_TYPE
-	       && (TREE_CODE (TREE_TYPE (*node)) == FUNCTION_TYPE
-		   || TREE_CODE (TREE_TYPE (*node)) == METHOD_TYPE)
+	       && FUNC_OR_METHOD_TYPE_P (TREE_TYPE (*node))
 	       && csky_isr_value (args) != CSKY_FT_UNKNOWN)
 	{
 	  *node = build_variant_type_copy (*node);
@@ -7319,7 +7317,7 @@  csky_init_builtins (void)
 static const char *
 csky_mangle_type (const_tree type)
 {
-  if (TREE_CODE (type) == REAL_TYPE
+  if (SCALAR_FLOAT_TYPE_P (type)
       && TYPE_PRECISION (type) == 16
       && TYPE_MAIN_VARIANT (type) != float16_type_node)
     return "Dh";
diff --git a/gcc/config/darwin-c.cc b/gcc/config/darwin-c.cc
index 579b9fa9317..ded0cd46c76 100644
--- a/gcc/config/darwin-c.cc
+++ b/gcc/config/darwin-c.cc
@@ -139,7 +139,7 @@  darwin_pragma_unused (cpp_reader *pfile ATTRIBUTE_UNUSED)
 	{
 	  tree local = lookup_name (decl);
 	  if (local && (TREE_CODE (local) == PARM_DECL
-			|| TREE_CODE (local) == VAR_DECL))
+			|| VAR_P (local)))
 	    {
 	      TREE_USED (local) = 1;
 	      DECL_READ_P (local) = 1;
diff --git a/gcc/config/darwin.cc b/gcc/config/darwin.cc
index ced2f7e40a6..efbcb3856ca 100644
--- a/gcc/config/darwin.cc
+++ b/gcc/config/darwin.cc
@@ -1415,7 +1415,7 @@  static tree
 is_objc_metadata (tree decl)
 {
   if (DECL_P (decl)
-      && (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == CONST_DECL)
+      && (VAR_P (decl) || TREE_CODE (decl) == CONST_DECL)
       && DECL_ATTRIBUTES (decl))
     {
       tree meta = lookup_attribute ("OBJC2META", DECL_ATTRIBUTES (decl));
diff --git a/gcc/config/epiphany/epiphany.cc b/gcc/config/epiphany/epiphany.cc
index 20c20e18ea0..60a2845d6d1 100644
--- a/gcc/config/epiphany/epiphany.cc
+++ b/gcc/config/epiphany/epiphany.cc
@@ -2159,8 +2159,7 @@  epiphany_function_ok_for_sibcall (tree decl, tree exp)
 
       gcc_assert (POINTER_TYPE_P (fn_type));
       fn_type = TREE_TYPE (fn_type);
-      gcc_assert (TREE_CODE (fn_type) == FUNCTION_TYPE
-		  || TREE_CODE (fn_type) == METHOD_TYPE);
+      gcc_assert (FUNC_OR_METHOD_TYPE_P (fn_type));
       call_interrupt_p
 	= lookup_attribute ("interrupt", TYPE_ATTRIBUTES (fn_type)) != NULL;
     }
diff --git a/gcc/config/epiphany/epiphany.h b/gcc/config/epiphany/epiphany.h
index c742709309e..0baeb298540 100644
--- a/gcc/config/epiphany/epiphany.h
+++ b/gcc/config/epiphany/epiphany.h
@@ -170,12 +170,10 @@  along with GCC; see the file COPYING3.  If not see
 /* layout_type overrides our ADJUST_ALIGNMENT settings from epiphany-modes.def
    for vector modes, so we have to override it back.  */
 #define ROUND_TYPE_ALIGN(TYPE, MANGLED_ALIGN, SPECIFIED_ALIGN) \
- (TREE_CODE (TYPE) == VECTOR_TYPE && !TYPE_USER_ALIGN (TYPE) \
+ (VECTOR_TYPE_P (TYPE) && !TYPE_USER_ALIGN (TYPE) \
   && SPECIFIED_ALIGN <= GET_MODE_ALIGNMENT (TYPE_MODE (TYPE)) \
   ? GET_MODE_ALIGNMENT (TYPE_MODE (TYPE)) \
-  : ((TREE_CODE (TYPE) == RECORD_TYPE \
-      || TREE_CODE (TYPE) == UNION_TYPE \
-      || TREE_CODE (TYPE) == QUAL_UNION_TYPE) \
+  : (RECORD_OR_UNION_TYPE_P (TYPE) \
      && !TYPE_PACKED (TYPE)) \
   ? epiphany_special_round_type_align ((TYPE), (MANGLED_ALIGN), \
 				       (SPECIFIED_ALIGN)) \
diff --git a/gcc/config/frv/frv.cc b/gcc/config/frv/frv.cc
index 99f79325cd6..2dbaa75f3dc 100644
--- a/gcc/config/frv/frv.cc
+++ b/gcc/config/frv/frv.cc
@@ -4061,7 +4061,7 @@  frv_emit_movsi (rtx dest, rtx src)
 			   || !DECL_COMMON (SYMBOL_REF_DECL (sym))))
 		{
 		  tree decl = SYMBOL_REF_DECL (sym);
-		  tree init = TREE_CODE (decl) == VAR_DECL
+		  tree init = VAR_P (decl)
 		    ? DECL_INITIAL (decl)
 		    : TREE_CODE (decl) == CONSTRUCTOR
 		    ? decl : 0;
@@ -4071,7 +4071,7 @@  frv_emit_movsi (rtx dest, rtx src)
 		  if (init && init != error_mark_node)
 		    reloc = compute_reloc_for_constant (init);
 
-		  named_section = TREE_CODE (decl) == VAR_DECL
+		  named_section = VAR_P (decl)
 		    && lookup_attribute ("section", DECL_ATTRIBUTES (decl));
 		  readonly = decl_readonly_section (decl, reloc);
 
diff --git a/gcc/config/gcn/gcn-tree.cc b/gcc/config/gcn/gcn-tree.cc
index 3c3bf377dd6..c99c1767659 100644
--- a/gcc/config/gcn/gcn-tree.cc
+++ b/gcc/config/gcn/gcn-tree.cc
@@ -104,7 +104,7 @@  gcn_lockless_update (location_t loc, gimple_stmt_iterator *gsi,
   tree var_type = TREE_TYPE (var);
 
   if (TREE_CODE (var_type) == COMPLEX_TYPE
-      || TREE_CODE (var_type) == REAL_TYPE)
+      || SCALAR_FLOAT_TYPE_P (var_type))
     code = VIEW_CONVERT_EXPR;
 
   if (TYPE_SIZE (var_type) == TYPE_SIZE (long_long_unsigned_type_node))
diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc
index 7bb71392c4c..007730da2f9 100644
--- a/gcc/config/gcn/gcn.cc
+++ b/gcc/config/gcn/gcn.cc
@@ -6523,7 +6523,7 @@  gcn_asm_output_symbol_ref (FILE *file, rtx x)
   tree decl;
   if (cfun
       && (decl = SYMBOL_REF_DECL (x)) != 0
-      && TREE_CODE (decl) == VAR_DECL
+      && VAR_P (decl)
       && AS_LDS_P (TYPE_ADDR_SPACE (TREE_TYPE (decl))))
     {
       /* LDS symbols (emitted using this hook) are only used at present
@@ -6539,7 +6539,7 @@  gcn_asm_output_symbol_ref (FILE *file, rtx x)
       /* FIXME: See above -- this condition is unreachable.  */
       if (cfun
 	  && (decl = SYMBOL_REF_DECL (x)) != 0
-	  && TREE_CODE (decl) == VAR_DECL
+	  && VAR_P (decl)
 	  && AS_LDS_P (TYPE_ADDR_SPACE (TREE_TYPE (decl))))
 	fputs ("@abs32", file);
     }
diff --git a/gcc/config/h8300/h8300.cc b/gcc/config/h8300/h8300.cc
index c3674933f90..7412c0535fc 100644
--- a/gcc/config/h8300/h8300.cc
+++ b/gcc/config/h8300/h8300.cc
@@ -5009,7 +5009,7 @@  h8300_encode_section_info (tree decl, rtx rtl, int first)
   if (TREE_CODE (decl) == FUNCTION_DECL
       && h8300_funcvec_function_p (decl))
     extra_flags = SYMBOL_FLAG_FUNCVEC_FUNCTION;
-  else if (TREE_CODE (decl) == VAR_DECL
+  else if (VAR_P (decl)
 	   && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
     {
       if (h8300_eightbit_data_p (decl))
diff --git a/gcc/config/i386/i386-expand.cc b/gcc/config/i386/i386-expand.cc
index 634fe61ba79..0e7966f9b3f 100644
--- a/gcc/config/i386/i386-expand.cc
+++ b/gcc/config/i386/i386-expand.cc
@@ -14571,7 +14571,7 @@  rdseed_step:
 		op0 = pc_rtx;
 	    }
 	  else if (TREE_CODE (arg3) == SSA_NAME
-		   && TREE_CODE (TREE_TYPE (arg3)) == VECTOR_TYPE)
+		   && VECTOR_TYPE_P (TREE_TYPE (arg3)))
 	    {
 	      /* Recognize also when mask is like:
 		 __v2df src = _mm_setzero_pd ();
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index b1d08ecdb3d..52ce4d45154 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -1887,7 +1887,7 @@  type_natural_mode (const_tree type, const CUMULATIVE_ARGS *cum,
 {
   machine_mode mode = TYPE_MODE (type);
 
-  if (TREE_CODE (type) == VECTOR_TYPE && !VECTOR_MODE_P (mode))
+  if (VECTOR_TYPE_P (type) && !VECTOR_MODE_P (mode))
     {
       HOST_WIDE_INT size = int_size_in_bytes (type);
       if ((size == 8 || size == 16 || size == 32 || size == 64)
@@ -1904,7 +1904,7 @@  type_natural_mode (const_tree type, const CUMULATIVE_ARGS *cum,
 	  if (DECIMAL_FLOAT_MODE_P (innermode))
 	    return mode;
 
-	  if (TREE_CODE (TREE_TYPE (type)) == REAL_TYPE)
+	  if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (type)))
 	    mode = MIN_MODE_VECTOR_FLOAT;
 	  else
 	    mode = MIN_MODE_VECTOR_INT;
@@ -3412,7 +3412,7 @@  ix86_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
 
   /* To simplify the code below, represent vector types with a vector mode
      even if MMX/SSE are not active.  */
-  if (arg.type && TREE_CODE (arg.type) == VECTOR_TYPE)
+  if (arg.type && VECTOR_TYPE_P (arg.type))
     mode = type_natural_mode (arg.type, cum, false);
 
   if (TARGET_64BIT)
@@ -17470,9 +17470,7 @@  ix86_data_alignment (tree type, unsigned int align, bool opt)
 	   || TYPE_MODE (type) == TCmode) && align < 128)
 	return 128;
     }
-  else if ((TREE_CODE (type) == RECORD_TYPE
-	    || TREE_CODE (type) == UNION_TYPE
-	    || TREE_CODE (type) == QUAL_UNION_TYPE)
+  else if (RECORD_OR_UNION_TYPE_P (type)
 	   && TYPE_FIELDS (type))
     {
       if (DECL_MODE (TYPE_FIELDS (type)) == DFmode && align < 64)
@@ -17480,7 +17478,7 @@  ix86_data_alignment (tree type, unsigned int align, bool opt)
       if (ALIGN_MODE_128 (DECL_MODE (TYPE_FIELDS (type))) && align < 128)
 	return 128;
     }
-  else if (TREE_CODE (type) == REAL_TYPE || TREE_CODE (type) == VECTOR_TYPE
+  else if (SCALAR_FLOAT_TYPE_P (type) || VECTOR_TYPE_P (type)
 	   || TREE_CODE (type) == INTEGER_TYPE)
     {
       if (TYPE_MODE (type) == DFmode && align < 64)
@@ -17596,9 +17594,7 @@  ix86_local_alignment (tree exp, machine_mode mode,
 	   || TYPE_MODE (type) == TCmode) && align < 128)
 	return 128;
     }
-  else if ((TREE_CODE (type) == RECORD_TYPE
-	    || TREE_CODE (type) == UNION_TYPE
-	    || TREE_CODE (type) == QUAL_UNION_TYPE)
+  else if (RECORD_OR_UNION_TYPE_P (type)
 	   && TYPE_FIELDS (type))
     {
       if (DECL_MODE (TYPE_FIELDS (type)) == DFmode && align < 64)
@@ -17606,7 +17602,7 @@  ix86_local_alignment (tree exp, machine_mode mode,
       if (ALIGN_MODE_128 (DECL_MODE (TYPE_FIELDS (type))) && align < 128)
 	return 128;
     }
-  else if (TREE_CODE (type) == REAL_TYPE || TREE_CODE (type) == VECTOR_TYPE
+  else if (SCALAR_FLOAT_TYPE_P (type) || VECTOR_TYPE_P (type)
 	   || TREE_CODE (type) == INTEGER_TYPE)
     {
 
@@ -23831,7 +23827,7 @@  ix86_simd_clone_compute_vecsize_and_simdlen (struct cgraph_node *node,
 	 for 64-bit code), accept that SIMDLEN, otherwise warn and don't
 	 emit corresponding clone.  */
       tree ctype = ret_type;
-      if (TREE_CODE (ret_type) == VOID_TYPE)
+      if (VOID_TYPE_P (ret_type))
 	ctype = base_type;
       int cnt = GET_MODE_BITSIZE (TYPE_MODE (ctype)) * clonei->simdlen;
       if (SCALAR_INT_MODE_P (TYPE_MODE (ctype)))
diff --git a/gcc/config/i386/winnt-cxx.cc b/gcc/config/i386/winnt-cxx.cc
index 9982d986501..6306d830fcf 100644
--- a/gcc/config/i386/winnt-cxx.cc
+++ b/gcc/config/i386/winnt-cxx.cc
@@ -30,7 +30,7 @@  along with GCC; see the file COPYING3.  If not see
 bool
 i386_pe_type_dllimport_p (tree decl)
 {
-  gcc_assert (TREE_CODE (decl) == VAR_DECL 
+  gcc_assert (VAR_P (decl)
 	      || TREE_CODE (decl) == FUNCTION_DECL);
 
   if (TARGET_NOP_FUN_DLLIMPORT && TREE_CODE (decl) == FUNCTION_DECL)
@@ -54,7 +54,7 @@  i386_pe_type_dllimport_p (tree decl)
 bool
 i386_pe_type_dllexport_p (tree decl)
 {
-  gcc_assert (TREE_CODE (decl) == VAR_DECL 
+  gcc_assert (VAR_P (decl)
               || TREE_CODE (decl) == FUNCTION_DECL);
 
   /* Avoid exporting compiler-generated default dtors and copy ctors.
@@ -118,7 +118,7 @@  i386_pe_adjust_class_at_definition (tree t)
 
       /* Check FUNCTION_DECL's and static VAR_DECL's.  */
       for (member = TYPE_FIELDS (t); member; member = DECL_CHAIN (member))
-	if (TREE_CODE (member) == VAR_DECL)     
+	if (VAR_P (member))
 	  maybe_add_dllexport (member);
 	else if (TREE_CODE (member) == FUNCTION_DECL)
 	  {
@@ -134,7 +134,7 @@  i386_pe_adjust_class_at_definition (tree t)
       /* Check vtables  */
       for (member = CLASSTYPE_VTABLES (t);
 	   member; member = DECL_CHAIN (member))
-	if (TREE_CODE (member) == VAR_DECL) 
+	if (VAR_P (member))
 	  maybe_add_dllexport (member);
     }
 
@@ -150,7 +150,7 @@  i386_pe_adjust_class_at_definition (tree t)
 
       /* Check FUNCTION_DECL's and static VAR_DECL's.  */
       for (member = TYPE_FIELDS (t); member; member = DECL_CHAIN (member))
-	if (TREE_CODE (member) == VAR_DECL)     
+	if (VAR_P (member))
 	  maybe_add_dllimport (member);
 	else if (TREE_CODE (member) == FUNCTION_DECL)
 	  {
@@ -166,7 +166,7 @@  i386_pe_adjust_class_at_definition (tree t)
       /* Check vtables  */
       for (member = CLASSTYPE_VTABLES (t);
 	   member;  member = DECL_CHAIN (member))
-	if (TREE_CODE (member) == VAR_DECL) 
+	if (VAR_P (member))
 	  maybe_add_dllimport (member);
 
       /* We leave typeinfo tables alone.  We can't mark TI objects as
diff --git a/gcc/config/i386/winnt.cc b/gcc/config/i386/winnt.cc
index 6b64eca3316..83a21c67704 100644
--- a/gcc/config/i386/winnt.cc
+++ b/gcc/config/i386/winnt.cc
@@ -147,7 +147,7 @@  i386_pe_determine_dllimport_p (tree decl)
      out-of-class definition of static data.  */
   assoc = associated_type (decl);
   if (assoc && lookup_attribute ("dllimport", TYPE_ATTRIBUTES (assoc))
-      && TREE_CODE (decl) == VAR_DECL
+      && VAR_P (decl)
       && TREE_STATIC (decl) && TREE_PUBLIC (decl)
       && !DECL_EXTERNAL (decl)
       /* vtable's are linkonce constants, so defining a vtable is not
@@ -335,7 +335,7 @@  i386_pe_encode_section_info (tree decl, rtx rtl, int first)
 bool
 i386_pe_binds_local_p (const_tree exp)
 {
-  if ((TREE_CODE (exp) == VAR_DECL || TREE_CODE (exp) == FUNCTION_DECL)
+  if ((VAR_P (exp) || TREE_CODE (exp) == FUNCTION_DECL)
       && DECL_DLLIMPORT_P (exp))
     return false;
 
@@ -459,7 +459,7 @@  i386_pe_section_type_flags (tree decl, const char *, int reloc)
     {
       flags = SECTION_WRITE;
 
-      if (decl && TREE_CODE (decl) == VAR_DECL
+      if (decl && VAR_P (decl)
 	  && lookup_attribute ("shared", DECL_ATTRIBUTES (decl)))
 	flags |= SECTION_PE_SHARED;
     }
diff --git a/gcc/config/ia64/ia64.cc b/gcc/config/ia64/ia64.cc
index f32efb3bd80..92f34dd1ee7 100644
--- a/gcc/config/ia64/ia64.cc
+++ b/gcc/config/ia64/ia64.cc
@@ -873,7 +873,7 @@  ia64_encode_section_info (tree decl, rtx rtl, int first)
   default_encode_section_info (decl, rtl, first);
 
   /* Careful not to prod global register variables.  */
-  if (TREE_CODE (decl) == VAR_DECL
+  if (VAR_P (decl)
       && GET_CODE (DECL_RTL (decl)) == MEM
       && GET_CODE (XEXP (DECL_RTL (decl), 0)) == SYMBOL_REF
       && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
@@ -5156,7 +5156,7 @@  ia64_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
      the next even boundary.  Integer and floating point arguments
      do so if they are larger than 8 bytes, whether or not they are
      also aligned larger than 8 bytes.  */
-  if ((TREE_CODE (type) == REAL_TYPE || TREE_CODE (type) == INTEGER_TYPE)
+  if ((SCALAR_FLOAT_TYPE_P (type) || TREE_CODE (type) == INTEGER_TYPE)
       ? int_size_in_bytes (type) > 8 : TYPE_ALIGN (type) > 8 * BITS_PER_UNIT)
     {
       tree t = fold_build_pointer_plus_hwi (valist, 2 * UNITS_PER_WORD - 1);
@@ -10003,7 +10003,7 @@  ia64_in_small_data_p (const_tree exp)
   if (TREE_CODE (exp) == FUNCTION_DECL)
     return false;
 
-  if (TREE_CODE (exp) == VAR_DECL && DECL_SECTION_NAME (exp))
+  if (VAR_P (exp) && DECL_SECTION_NAME (exp))
     {
       const char *section = DECL_SECTION_NAME (exp);
 
diff --git a/gcc/config/iq2000/iq2000.cc b/gcc/config/iq2000/iq2000.cc
index 067154a0a0d..733fecac2b7 100644
--- a/gcc/config/iq2000/iq2000.cc
+++ b/gcc/config/iq2000/iq2000.cc
@@ -1226,9 +1226,7 @@  iq2000_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
   int bias = 0;
   unsigned int *arg_words = &cum->arg_words;
   int struct_p = (type != 0
-		  && (TREE_CODE (type) == RECORD_TYPE
-		      || TREE_CODE (type) == UNION_TYPE
-		      || TREE_CODE (type) == QUAL_UNION_TYPE));
+		  && RECORD_OR_UNION_TYPE_P (type));
 
   if (TARGET_DEBUG_D_MODE)
     {
@@ -1304,7 +1302,7 @@  iq2000_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
 
 	  for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
 	    if (TREE_CODE (field) == FIELD_DECL
-		&& TREE_CODE (TREE_TYPE (field)) == REAL_TYPE
+		&& SCALAR_FLOAT_TYPE_P (TREE_TYPE (field))
 		&& TYPE_PRECISION (TREE_TYPE (field)) == BITS_PER_WORD
 		&& tree_fits_shwi_p (bit_position (field))
 		&& int_bit_position (field) % BITS_PER_WORD == 0)
@@ -1346,7 +1344,7 @@  iq2000_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
 
 		  if (field
 		      && int_bit_position (field) == bitpos
-		      && TREE_CODE (TREE_TYPE (field)) == REAL_TYPE
+		      && SCALAR_FLOAT_TYPE_P (TREE_TYPE (field))
 		      && TYPE_PRECISION (TREE_TYPE (field)) == BITS_PER_WORD)
 		    reg = gen_rtx_REG (DFmode, regno++);
 		  else
diff --git a/gcc/config/lm32/lm32.cc b/gcc/config/lm32/lm32.cc
index 37a6eb86da0..6528358009d 100644
--- a/gcc/config/lm32/lm32.cc
+++ b/gcc/config/lm32/lm32.cc
@@ -787,7 +787,7 @@  lm32_in_small_data_p (const_tree exp)
   if (TREE_CODE (exp) == FUNCTION_DECL)
     return false;
 
-  if (TREE_CODE (exp) == VAR_DECL && DECL_SECTION_NAME (exp))
+  if (VAR_P (exp) && DECL_SECTION_NAME (exp))
     {
       const char *section = DECL_SECTION_NAME (exp);
       if (strcmp (section, ".sdata") == 0 || strcmp (section, ".sbss") == 0)
diff --git a/gcc/config/loongarch/loongarch.cc b/gcc/config/loongarch/loongarch.cc
index 7f4e0e59573..eb73d11b869 100644
--- a/gcc/config/loongarch/loongarch.cc
+++ b/gcc/config/loongarch/loongarch.cc
@@ -6535,7 +6535,7 @@  loongarch_handle_model_attribute (tree *node, tree name, tree arg, int,
 				  bool *no_add_attrs)
 {
   tree decl = *node;
-  if (TREE_CODE (decl) == VAR_DECL)
+  if (VAR_P (decl))
     {
       if (DECL_THREAD_LOCAL_P (decl))
 	{
diff --git a/gcc/config/m32c/m32c.cc b/gcc/config/m32c/m32c.cc
index e0d06f833d3..65971d62990 100644
--- a/gcc/config/m32c/m32c.cc
+++ b/gcc/config/m32c/m32c.cc
@@ -3027,7 +3027,7 @@  m32c_insert_attributes (tree node ATTRIBUTE_UNUSED,
   unsigned addr;
   /* See if we need to make #pragma address variables volatile.  */
 
-  if (TREE_CODE (node) == VAR_DECL)
+  if (VAR_P (node))
     {
       const char *name = IDENTIFIER_POINTER (DECL_NAME (node));
       if (m32c_get_pragma_address  (name, &addr))
diff --git a/gcc/config/mcore/mcore.cc b/gcc/config/mcore/mcore.cc
index e800af78e14..92e7f960f75 100644
--- a/gcc/config/mcore/mcore.cc
+++ b/gcc/config/mcore/mcore.cc
@@ -2953,7 +2953,7 @@  mcore_mark_dllimport (tree decl)
      and that would be a good question.  */
 
   /* Imported variables can't be initialized.  */
-  if (TREE_CODE (decl) == VAR_DECL
+  if (VAR_P (decl)
       && !DECL_VIRTUAL_P (decl)
       && DECL_INITIAL (decl))
     {
@@ -2963,7 +2963,7 @@  mcore_mark_dllimport (tree decl)
   
   /* `extern' needn't be specified with dllimport.
      Specify `extern' now and hope for the best.  Sigh.  */
-  if (TREE_CODE (decl) == VAR_DECL
+  if (VAR_P (decl)
       /* ??? Is this test for vtables needed?  */
       && !DECL_VIRTUAL_P (decl))
     {
@@ -3024,7 +3024,7 @@  mcore_encode_section_info (tree decl, rtx rtl ATTRIBUTE_UNUSED, int first ATTRIB
      a subsequent definition nullified that.  The attribute is gone
      but DECL_RTL still has @i.__imp_foo.  We need to remove that.  */
   else if ((TREE_CODE (decl) == FUNCTION_DECL
-	    || TREE_CODE (decl) == VAR_DECL)
+	    || VAR_P (decl))
 	   && DECL_RTL (decl) != NULL_RTX
 	   && GET_CODE (DECL_RTL (decl)) == MEM
 	   && GET_CODE (XEXP (DECL_RTL (decl), 0)) == MEM
diff --git a/gcc/config/microblaze/microblaze.cc b/gcc/config/microblaze/microblaze.cc
index ebe78304f89..cbabf1af712 100644
--- a/gcc/config/microblaze/microblaze.cc
+++ b/gcc/config/microblaze/microblaze.cc
@@ -3232,7 +3232,7 @@  microblaze_elf_in_small_data_p (const_tree decl)
   if (TREE_CODE (decl) == FUNCTION_DECL)
     return false;
 
-  if (TREE_CODE (decl) == VAR_DECL && DECL_SECTION_NAME (decl))
+  if (VAR_P (decl) && DECL_SECTION_NAME (decl))
     {
       const char *section = DECL_SECTION_NAME (decl);
       if (strcmp (section, ".sdata") == 0
diff --git a/gcc/config/mips/mips.cc b/gcc/config/mips/mips.cc
index ca822758b41..ca491b981a3 100644
--- a/gcc/config/mips/mips.cc
+++ b/gcc/config/mips/mips.cc
@@ -9838,7 +9838,7 @@  mips_output_aligned_decl_common (FILE *stream, tree decl, const char *name,
      .rdata then don't put them in .comm.  */
   if (TARGET_EMBEDDED_DATA
       && TARGET_UNINIT_CONST_IN_RODATA
-      && TREE_CODE (decl) == VAR_DECL
+      && VAR_P (decl)
       && TREE_READONLY (decl)
       && (DECL_INITIAL (decl) == 0 || DECL_INITIAL (decl) == error_mark_node))
     {
diff --git a/gcc/config/mmix/mmix.cc b/gcc/config/mmix/mmix.cc
index eda2959adb9..1d36306fdb6 100644
--- a/gcc/config/mmix/mmix.cc
+++ b/gcc/config/mmix/mmix.cc
@@ -1262,7 +1262,7 @@  static void
 mmix_encode_section_info (tree decl, rtx rtl, int first)
 {
   /* Test for an external declaration, and do nothing if it is one.  */
-  if ((TREE_CODE (decl) == VAR_DECL
+  if ((VAR_P (decl)
        && (DECL_EXTERNAL (decl) || TREE_PUBLIC (decl)))
       || (TREE_CODE (decl) == FUNCTION_DECL && TREE_PUBLIC (decl)))
     ;
@@ -1291,7 +1291,7 @@  mmix_encode_section_info (tree decl, rtx rtl, int first)
      For now, functions and things we know or have been told are constant.  */
   if (TREE_CODE (decl) == FUNCTION_DECL
       || TREE_CONSTANT (decl)
-      || (TREE_CODE (decl) == VAR_DECL
+      || (VAR_P (decl)
 	  && TREE_READONLY (decl)
 	  && !TREE_SIDE_EFFECTS (decl)
 	  && (!DECL_INITIAL (decl)
diff --git a/gcc/config/nvptx/nvptx.cc b/gcc/config/nvptx/nvptx.cc
index 89349dae9e6..d76c0bbce2f 100644
--- a/gcc/config/nvptx/nvptx.cc
+++ b/gcc/config/nvptx/nvptx.cc
@@ -452,7 +452,7 @@  nvptx_encode_section_info (tree decl, rtx rtl, int first)
 
       if (TREE_CONSTANT (decl))
 	area = DATA_AREA_CONST;
-      else if (TREE_CODE (decl) == VAR_DECL)
+      else if (VAR_P (decl))
 	{
 	  if (lookup_attribute ("shared", DECL_ATTRIBUTES (decl)))
 	    {
@@ -635,7 +635,7 @@  pass_in_memory (machine_mode mode, const_tree type, bool for_return)
     {
       if (AGGREGATE_TYPE_P (type))
 	return true;
-      if (TREE_CODE (type) == VECTOR_TYPE)
+      if (VECTOR_TYPE_P (type))
 	return true;
     }
 
@@ -6699,7 +6699,7 @@  nvptx_generate_vector_shuffle (location_t loc,
   if (TREE_CODE (var_type) == COMPLEX_TYPE)
     var_type = TREE_TYPE (var_type);
 
-  if (TREE_CODE (var_type) == REAL_TYPE)
+  if (SCALAR_FLOAT_TYPE_P (var_type))
     code = VIEW_CONVERT_EXPR;
 
   if (TYPE_SIZE (var_type)
@@ -6789,7 +6789,7 @@  nvptx_lockless_update (location_t loc, gimple_stmt_iterator *gsi,
   tree var_type = TREE_TYPE (var);
 
   if (TREE_CODE (var_type) == COMPLEX_TYPE
-      || TREE_CODE (var_type) == REAL_TYPE)
+      || SCALAR_FLOAT_TYPE_P (var_type))
     code = VIEW_CONVERT_EXPR;
 
   if (TYPE_SIZE (var_type) == TYPE_SIZE (long_long_unsigned_type_node))
diff --git a/gcc/config/pa/pa.cc b/gcc/config/pa/pa.cc
index db633b275e5..0fa9e5fd632 100644
--- a/gcc/config/pa/pa.cc
+++ b/gcc/config/pa/pa.cc
@@ -6387,7 +6387,7 @@  pa_function_arg_padding (machine_mode mode, const_tree type)
 	  && type
 	  && (AGGREGATE_TYPE_P (type)
 	      || TREE_CODE (type) == COMPLEX_TYPE
-	      || TREE_CODE (type) == VECTOR_TYPE)))
+	      || VECTOR_TYPE_P (type))))
     {
       /* Return PAD_NONE if justification is not required.  */
       if (type
@@ -9660,7 +9660,7 @@  pa_function_value (const_tree valtype,
 
   if (AGGREGATE_TYPE_P (valtype)
       || TREE_CODE (valtype) == COMPLEX_TYPE
-      || TREE_CODE (valtype) == VECTOR_TYPE)
+      || VECTOR_TYPE_P (valtype))
     {
       HOST_WIDE_INT valsize = int_size_in_bytes (valtype);
 
@@ -9709,7 +9709,7 @@  pa_function_value (const_tree valtype,
   else
     valmode = TYPE_MODE (valtype);
 
-  if (TREE_CODE (valtype) == REAL_TYPE
+  if (SCALAR_FLOAT_TYPE_P (valtype)
       && !AGGREGATE_TYPE_P (valtype)
       && TYPE_MODE (valtype) != TFmode
       && !TARGET_SOFT_FLOAT)
@@ -9828,7 +9828,7 @@  pa_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
 	  || mode == BLKmode
 	  || (type && (AGGREGATE_TYPE_P (type)
 		       || TREE_CODE (type) == COMPLEX_TYPE
-		       || TREE_CODE (type) == VECTOR_TYPE)))
+		       || VECTOR_TYPE_P (type))))
 	{
 	  /* Double-extended precision (80-bit), quad-precision (128-bit)
 	     and aggregates including complex numbers are aligned on
@@ -9888,7 +9888,7 @@  pa_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
 	  if (mode == BLKmode
 	      || (type && (AGGREGATE_TYPE_P (type)
 			   || TREE_CODE (type) == COMPLEX_TYPE
-			   || TREE_CODE (type) == VECTOR_TYPE)))
+			   || VECTOR_TYPE_P (type))))
 	    {
 	      rtx loc = gen_rtx_EXPR_LIST (VOIDmode,
 					   gen_rtx_REG (DImode, gpr_reg_base),
diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h
index 6e29be282ad..e65af522966 100644
--- a/gcc/config/pa/pa.h
+++ b/gcc/config/pa/pa.h
@@ -930,7 +930,7 @@  do {									     \
 
 /* Return a nonzero value if DECL has a section attribute.  */
 #define IN_NAMED_SECTION_P(DECL) \
-  ((TREE_CODE (DECL) == FUNCTION_DECL || TREE_CODE (DECL) == VAR_DECL) \
+  ((TREE_CODE (DECL) == FUNCTION_DECL || VAR_P (DECL)) \
    && DECL_SECTION_NAME (DECL) != NULL)
 
 /* Define this macro if references to a symbol must be treated
@@ -952,7 +952,7 @@  do {									     \
 
 #define TEXT_SPACE_P(DECL)\
   (TREE_CODE (DECL) == FUNCTION_DECL					\
-   || (TREE_CODE (DECL) == VAR_DECL					\
+   || (VAR_P (DECL)					\
        && TREE_READONLY (DECL) && ! TREE_SIDE_EFFECTS (DECL)		\
        && (! DECL_INITIAL (DECL) || ! pa_reloc_needed (DECL_INITIAL (DECL))) \
        && !flag_pic)							\
diff --git a/gcc/config/pa/som.h b/gcc/config/pa/som.h
index eaa0ee31105..5999aa37b2a 100644
--- a/gcc/config/pa/som.h
+++ b/gcc/config/pa/som.h
@@ -287,7 +287,7 @@  do {						\
    initialized variables and functions.  */
 #define MAKE_DECL_ONE_ONLY(DECL) \
   do {									\
-    if (TREE_CODE (DECL) == VAR_DECL					\
+    if (VAR_P (DECL)					\
         && (DECL_INITIAL (DECL) == 0					\
             || DECL_INITIAL (DECL) == error_mark_node))			\
       DECL_COMMON (DECL) = 1;						\
diff --git a/gcc/config/pdp11/pdp11.cc b/gcc/config/pdp11/pdp11.cc
index 4af26f8cd70..f6dd841f184 100644
--- a/gcc/config/pdp11/pdp11.cc
+++ b/gcc/config/pdp11/pdp11.cc
@@ -1881,7 +1881,7 @@  pdp11_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
      in registers.  The rest go into memory.  */
   return (TYPE_MODE (type) == DImode
 	  || (FLOAT_MODE_P (TYPE_MODE (type)) && ! TARGET_AC0)
-	  || TREE_CODE (type) == VECTOR_TYPE
+	  || VECTOR_TYPE_P (type)
 	  || COMPLEX_MODE_P (TYPE_MODE (type)));
 }
 
diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 8684271f8ac..c3e6d5f5cd6 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -4704,7 +4704,7 @@  riscv_in_small_data_p (const_tree x)
   if (TREE_CODE (x) == STRING_CST || TREE_CODE (x) == FUNCTION_DECL)
     return false;
 
-  if (TREE_CODE (x) == VAR_DECL && DECL_SECTION_NAME (x))
+  if (VAR_P (x) && DECL_SECTION_NAME (x))
     {
       const char *sec = DECL_SECTION_NAME (x);
       return strcmp (sec, ".sdata") == 0 || strcmp (sec, ".sbss") == 0;
@@ -7014,7 +7014,7 @@  static const char *
 riscv_mangle_type (const_tree type)
 {
   /* Half-precision float, _Float16 is "DF16_".  */
-  if (TREE_CODE (type) == REAL_TYPE && TYPE_PRECISION (type) == 16)
+  if (SCALAR_FLOAT_TYPE_P (type) && TYPE_PRECISION (type) == 16)
     return "DF16_";
 
   /* Mangle all vector type for vector extension.  */
diff --git a/gcc/config/rl78/rl78.cc b/gcc/config/rl78/rl78.cc
index 7ed28d35883..9083096c4ae 100644
--- a/gcc/config/rl78/rl78.cc
+++ b/gcc/config/rl78/rl78.cc
@@ -4724,7 +4724,7 @@  static void
 rl78_insert_attributes (tree decl, tree *attributes ATTRIBUTE_UNUSED)
 {
   if (TARGET_ES0
-      && TREE_CODE (decl) == VAR_DECL
+      && VAR_P (decl)
       && TREE_READONLY (decl)
       && TREE_ADDRESSABLE (decl)
       && TYPE_ADDR_SPACE (TREE_TYPE (decl)) == ADDR_SPACE_GENERIC)
@@ -4880,7 +4880,7 @@  rl78_addsi3_internal (rtx * operands, unsigned int alternative)
      this address.  So we can skip adding in the high bytes.  */
   if (TARGET_ES0
       && GET_CODE (operands[2]) == SYMBOL_REF
-      && TREE_CODE (SYMBOL_REF_DECL (operands[2])) == VAR_DECL
+      && VAR_P (SYMBOL_REF_DECL (operands[2]))
       && TREE_READONLY (SYMBOL_REF_DECL (operands[2]))
       && ! TREE_SIDE_EFFECTS (SYMBOL_REF_DECL (operands[2])))
     return "movw ax, %h1\n\taddw ax, %h2\n\tmovw %h0, ax";
diff --git a/gcc/config/rs6000/aix.h b/gcc/config/rs6000/aix.h
index 69db93ef47b..7b01ba9dc5b 100644
--- a/gcc/config/rs6000/aix.h
+++ b/gcc/config/rs6000/aix.h
@@ -228,9 +228,7 @@ 
 /* AIX increases natural record alignment to doubleword if the first
    field is an FP double while the FP fields remain word aligned.  */
 #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED)			\
-  ((TREE_CODE (STRUCT) == RECORD_TYPE					\
-    || TREE_CODE (STRUCT) == UNION_TYPE					\
-    || TREE_CODE (STRUCT) == QUAL_UNION_TYPE)				\
+  (RECORD_OR_UNION_TYPE_P (STRUCT)				\
    && TARGET_ALIGN_NATURAL == 0						\
    ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED)	\
    : MAX ((COMPUTED), (SPECIFIED)))
diff --git a/gcc/config/rs6000/darwin.h b/gcc/config/rs6000/darwin.h
index 4d5d6f6d5a8..bf9dfaf2f34 100644
--- a/gcc/config/rs6000/darwin.h
+++ b/gcc/config/rs6000/darwin.h
@@ -427,12 +427,10 @@ 
 /* Darwin increases natural record alignment to doubleword if the first
    field is an FP double while the FP fields remain word aligned.  */
 #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED)			  \
-  ((TREE_CODE (STRUCT) == RECORD_TYPE					  \
-    || TREE_CODE (STRUCT) == UNION_TYPE					  \
-    || TREE_CODE (STRUCT) == QUAL_UNION_TYPE)				  \
+  (RECORD_OR_UNION_TYPE_P (STRUCT)				  \
    && TARGET_ALIGN_NATURAL == 0						  \
    ? darwin_rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED) \
-   : (TREE_CODE (STRUCT) == VECTOR_TYPE					  \
+   : (VECTOR_TYPE_P (STRUCT)					  \
       && ALTIVEC_VECTOR_MODE (TYPE_MODE (STRUCT)))			  \
    ? MAX (MAX ((COMPUTED), (SPECIFIED)), 128)				  \
    : MAX ((COMPUTED), (SPECIFIED)))
diff --git a/gcc/config/rs6000/freebsd64.h b/gcc/config/rs6000/freebsd64.h
index 111aa14bf9d..918d6c2ce5a 100644
--- a/gcc/config/rs6000/freebsd64.h
+++ b/gcc/config/rs6000/freebsd64.h
@@ -140,9 +140,7 @@  extern int dot_symbols;
 #undef  ROUND_TYPE_ALIGN
 #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED)			\
   ((TARGET_64BIT							\
-    && (TREE_CODE (STRUCT) == RECORD_TYPE				\
-	|| TREE_CODE (STRUCT) == UNION_TYPE				\
-	|| TREE_CODE (STRUCT) == QUAL_UNION_TYPE)			\
+    && RECORD_OR_UNION_TYPE_P (STRUCT)			\
     && TARGET_ALIGN_NATURAL == 0)					\
    ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED)	\
    : MAX ((COMPUTED), (SPECIFIED)))
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
index 6e4acaf00c2..98b7255c95f 100644
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -224,9 +224,7 @@  extern int dot_symbols;
 #undef  ROUND_TYPE_ALIGN
 #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED)			\
   ((TARGET_64BIT							\
-    && (TREE_CODE (STRUCT) == RECORD_TYPE				\
-	|| TREE_CODE (STRUCT) == UNION_TYPE				\
-	|| TREE_CODE (STRUCT) == QUAL_UNION_TYPE)			\
+    && RECORD_OR_UNION_TYPE_P (STRUCT)			\
     && TARGET_ALIGN_NATURAL == 0)					\
    ? rs6000_special_round_type_align (STRUCT, COMPUTED, SPECIFIED)	\
    : MAX ((COMPUTED), (SPECIFIED)))
diff --git a/gcc/config/rs6000/rs6000-call.cc b/gcc/config/rs6000/rs6000-call.cc
index 214613e083e..5384c10b986 100644
--- a/gcc/config/rs6000/rs6000-call.cc
+++ b/gcc/config/rs6000/rs6000-call.cc
@@ -826,12 +826,12 @@  rs6000_function_arg_boundary (machine_mode mode, const_tree type)
     return 64;
   else if (FLOAT128_VECTOR_P (mode))
     return 128;
-  else if (type && TREE_CODE (type) == VECTOR_TYPE
+  else if (type && VECTOR_TYPE_P (type)
 	   && int_size_in_bytes (type) >= 8
 	   && int_size_in_bytes (type) < 16)
     return 64;
   else if (ALTIVEC_OR_VSX_VECTOR_MODE (elt_mode)
-	   || (type && TREE_CODE (type) == VECTOR_TYPE
+	   || (type && VECTOR_TYPE_P (type)
 	       && int_size_in_bytes (type) >= 16))
     return 128;
 
@@ -1094,7 +1094,7 @@  rs6000_function_arg_advance_1 (CUMULATIVE_ARGS *cum, machine_mode mode,
 
   if (TARGET_ALTIVEC_ABI
       && (ALTIVEC_OR_VSX_VECTOR_MODE (elt_mode)
-	  || (type && TREE_CODE (type) == VECTOR_TYPE
+	  || (type && VECTOR_TYPE_P (type)
 	      && int_size_in_bytes (type) == 16)))
     {
       bool stack = false;
@@ -1699,7 +1699,7 @@  rs6000_function_arg (cumulative_args_t cum_v, const function_arg_info &arg)
     }
   else if (TARGET_ALTIVEC_ABI
 	   && (ALTIVEC_OR_VSX_VECTOR_MODE (mode)
-	       || (type && TREE_CODE (type) == VECTOR_TYPE
+	       || (type && VECTOR_TYPE_P (type)
 		   && int_size_in_bytes (type) == 16)))
     {
       if (named || abi == ABI_V4)
@@ -2017,7 +2017,7 @@  rs6000_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
     }
 
   /* Pass synthetic vectors in memory.  */
-  if (TREE_CODE (arg.type) == VECTOR_TYPE
+  if (VECTOR_TYPE_P (arg.type)
       && int_size_in_bytes (arg.type) > (TARGET_ALTIVEC_ABI ? 16 : 8))
     {
       static bool warned_for_pass_big_vectors = false;
diff --git a/gcc/config/rs6000/rs6000-logue.cc b/gcc/config/rs6000/rs6000-logue.cc
index d6c9c6e5b52..bc6b153b59f 100644
--- a/gcc/config/rs6000/rs6000-logue.cc
+++ b/gcc/config/rs6000/rs6000-logue.cc
@@ -1171,12 +1171,12 @@  rs6000_function_ok_for_sibcall (tree decl, tree exp)
 	 prototype, so the argument type info must be available
 	 here.  */
       FOREACH_FUNCTION_ARGS(fntype, type, args_iter)
-	if (TREE_CODE (type) == VECTOR_TYPE
+	if (VECTOR_TYPE_P (type)
 	    && ALTIVEC_OR_VSX_VECTOR_MODE (TYPE_MODE (type)))
 	  nvreg++;
 
       FOREACH_FUNCTION_ARGS(TREE_TYPE (current_function_decl), type, args_iter)
-	if (TREE_CODE (type) == VECTOR_TYPE
+	if (VECTOR_TYPE_P (type)
 	    && ALTIVEC_OR_VSX_VECTOR_MODE (TYPE_MODE (type)))
 	  nvreg--;
 
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 3f129ea37d2..29ed0da6e20 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -8059,7 +8059,7 @@  rs6000_data_alignment (tree type, unsigned int align, enum data_align how)
 {
   if (how != align_opt)
     {
-      if (TREE_CODE (type) == VECTOR_TYPE && align < 128)
+      if (VECTOR_TYPE_P (type) && align < 128)
 	align = 128;
     }
 
@@ -20397,8 +20397,7 @@  static void
 rs6000_set_default_type_attributes (tree type)
 {
   if (rs6000_default_long_calls
-      && (TREE_CODE (type) == FUNCTION_TYPE
-	  || TREE_CODE (type) == METHOD_TYPE))
+      && FUNC_OR_METHOD_TYPE_P (type))
     TYPE_ATTRIBUTES (type) = tree_cons (get_identifier ("longcall"),
 					NULL_TREE,
 					TYPE_ATTRIBUTES (type));
@@ -20640,7 +20639,7 @@  rs6000_elf_in_small_data_p (const_tree decl)
   if (TREE_CODE (decl) == FUNCTION_DECL)
     return false;
 
-  if (TREE_CODE (decl) == VAR_DECL && DECL_SECTION_NAME (decl))
+  if (VAR_P (decl) && DECL_SECTION_NAME (decl))
     {
       const char *section = DECL_SECTION_NAME (decl);
       if (compare_section_name (section, ".sdata")
@@ -21364,7 +21363,7 @@  rs6000_xcoff_asm_named_section (const char *name, unsigned int flags,
 }
 
 #define IN_NAMED_SECTION(DECL) \
-  ((TREE_CODE (DECL) == FUNCTION_DECL || TREE_CODE (DECL) == VAR_DECL) \
+  ((TREE_CODE (DECL) == FUNCTION_DECL || VAR_P (DECL)) \
    && DECL_SECTION_NAME (DECL) != NULL)
 
 static section *
@@ -21855,7 +21854,7 @@  rs6000_xcoff_encode_section_info (tree decl, rtx rtl, int first)
 
   flags = SYMBOL_REF_FLAGS (symbol);
 
-  if (TREE_CODE (decl) == VAR_DECL && DECL_THREAD_LOCAL_P (decl))
+  if (VAR_P (decl) && DECL_THREAD_LOCAL_P (decl))
     flags &= ~SYMBOL_FLAG_HAS_BLOCK_INFO;
 
   SYMBOL_REF_FLAGS (symbol) = flags;
@@ -23736,7 +23735,7 @@  rs6000_function_value (const_tree valtype,
   /* VSX is a superset of Altivec and adds V2DImode/V2DFmode.  Since the same
      return register is used in both cases, and we won't see V2DImode/V2DFmode
      for pure altivec, combine the two cases.  */
-  else if ((TREE_CODE (valtype) == VECTOR_TYPE || VECTOR_ALIGNMENT_P (mode))
+  else if ((VECTOR_TYPE_P (valtype) || VECTOR_ALIGNMENT_P (mode))
 	   && TARGET_ALTIVEC && TARGET_ALTIVEC_ABI
 	   && ALTIVEC_OR_VSX_VECTOR_MODE (mode))
     regno = ALTIVEC_ARG_RETURN;
@@ -24116,7 +24115,7 @@  invalid_arg_for_unprototyped_fn (const_tree typelist, const_tree funcdecl, const
 {
   return (!rs6000_darwin64_abi
 	  && typelist == 0
-          && TREE_CODE (TREE_TYPE (val)) == VECTOR_TYPE
+	  && VECTOR_TYPE_P (TREE_TYPE (val))
           && (funcdecl == NULL_TREE
               || (TREE_CODE (funcdecl) == FUNCTION_DECL
                   && DECL_BUILT_IN_CLASS (funcdecl) != BUILT_IN_MD)))
diff --git a/gcc/config/s390/s390-c.cc b/gcc/config/s390/s390-c.cc
index 56e77b69993..269f4f8e978 100644
--- a/gcc/config/s390/s390-c.cc
+++ b/gcc/config/s390/s390-c.cc
@@ -781,7 +781,7 @@  s390_fn_types_compatible (enum s390_builtin_ov_type_index typeindex,
       tree in_arg = (*arglist)[i];
       tree in_type = TREE_TYPE (in_arg);
 
-      if (TREE_CODE (b_arg_type) == VECTOR_TYPE)
+      if (VECTOR_TYPE_P (b_arg_type))
 	{
 	  /* Vector types have to match precisely.  */
 	  if (b_arg_type != in_type
@@ -854,7 +854,7 @@  s390_vec_n_elem (tree fndecl)
   tree b_arg_chain;
   int n_elem = -1;
 
-  if (TREE_CODE (TREE_TYPE (TREE_TYPE (fndecl))) == VECTOR_TYPE)
+  if (VECTOR_TYPE_P (TREE_TYPE (TREE_TYPE (fndecl))))
     n_elem = TYPE_VECTOR_SUBPARTS (TREE_TYPE (TREE_TYPE ((fndecl))));
 
   for (b_arg_chain = TYPE_ARG_TYPES (TREE_TYPE (fndecl));
diff --git a/gcc/config/s390/s390.cc b/gcc/config/s390/s390.cc
index 505de995da8..4fb4c45c497 100644
--- a/gcc/config/s390/s390.cc
+++ b/gcc/config/s390/s390.cc
@@ -604,7 +604,7 @@  s390_check_type_for_vector_abi (const_tree type, bool arg_p, bool in_struct_p)
 	 true here.  */
       s390_check_type_for_vector_abi (TREE_TYPE (type), arg_p, in_struct_p);
     }
-  else if (TREE_CODE (type) == FUNCTION_TYPE || TREE_CODE (type) == METHOD_TYPE)
+  else if (FUNC_OR_METHOD_TYPE_P (type))
     {
       tree arg_chain;
 
@@ -12515,7 +12515,7 @@  s390_function_arg_integer (machine_mode mode, const_tree type)
       || POINTER_TYPE_P (type)
       || TREE_CODE (type) == NULLPTR_TYPE
       || TREE_CODE (type) == OFFSET_TYPE
-      || (TARGET_SOFT_FLOAT && TREE_CODE (type) == REAL_TYPE))
+      || (TARGET_SOFT_FLOAT && SCALAR_FLOAT_TYPE_P (type)))
     return true;
 
   /* We also accept structs of size 1, 2, 4, 8 that are not
@@ -12684,7 +12684,7 @@  s390_return_in_memory (const_tree type, const_tree fundecl ATTRIBUTE_UNUSED)
   if (INTEGRAL_TYPE_P (type)
       || POINTER_TYPE_P (type)
       || TREE_CODE (type) == OFFSET_TYPE
-      || TREE_CODE (type) == REAL_TYPE)
+      || SCALAR_FLOAT_TYPE_P (type))
     return int_size_in_bytes (type) > 8;
 
   /* vector types which fit into a VR.  */
@@ -13451,7 +13451,7 @@  s390_encode_section_info (tree decl, rtx rtl, int first)
 {
   default_encode_section_info (decl, rtl, first);
 
-  if (TREE_CODE (decl) == VAR_DECL)
+  if (VAR_P (decl))
     {
       /* Store the alignment to be able to check if we can use
 	 a larl/load-relative instruction.  We only handle the cases
diff --git a/gcc/config/sh/sh.cc b/gcc/config/sh/sh.cc
index cf6188bd19d..938f7aa6281 100644
--- a/gcc/config/sh/sh.cc
+++ b/gcc/config/sh/sh.cc
@@ -7697,7 +7697,7 @@  sh_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
       eff_type = type;
       while (TREE_CODE (eff_type) == RECORD_TYPE
 	     && (member = find_sole_member (eff_type))
-	     && (TREE_CODE (TREE_TYPE (member)) == REAL_TYPE
+	     && (SCALAR_FLOAT_TYPE_P (TREE_TYPE (member))
 		 || TREE_CODE (TREE_TYPE (member)) == COMPLEX_TYPE
 		 || TREE_CODE (TREE_TYPE (member)) == RECORD_TYPE))
 	{
@@ -7718,14 +7718,14 @@  sh_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
       bool pass_as_float;
       if (TARGET_FPU_DOUBLE)
 	{
-	  pass_as_float = ((TREE_CODE (eff_type) == REAL_TYPE && size <= 8)
+	  pass_as_float = ((SCALAR_FLOAT_TYPE_P (eff_type) && size <= 8)
 			   || (TREE_CODE (eff_type) == COMPLEX_TYPE
-			       && TREE_CODE (TREE_TYPE (eff_type)) == REAL_TYPE
+			       && SCALAR_FLOAT_TYPE_P (TREE_TYPE (eff_type))
 			       && size <= 16));
 	}
       else
 	{
-	  pass_as_float = (TREE_CODE (eff_type) == REAL_TYPE && size == 4);
+	  pass_as_float = (SCALAR_FLOAT_TYPE_P (eff_type) && size == 4);
 	}
 
       addr = create_tmp_var (pptr_type_node);
@@ -7738,7 +7738,7 @@  sh_gimplify_va_arg_expr (tree valist, tree type, gimple_seq *pre_p,
 	{
 	  tree next_fp_tmp = create_tmp_var (TREE_TYPE (f_next_fp));
 	  tree cmp;
-	  bool is_double = size == 8 && TREE_CODE (eff_type) == REAL_TYPE;
+	  bool is_double = size == 8 && SCALAR_FLOAT_TYPE_P (eff_type);
 
 	  tmp = build1 (ADDR_EXPR, pptr_type_node, unshare_expr (next_fp));
 	  gimplify_assign (unshare_expr (addr), tmp, pre_p);
@@ -8139,7 +8139,7 @@  sh_function_value (const_tree valtype,
 	     && (TREE_CODE (valtype) == INTEGER_TYPE
 		 || TREE_CODE (valtype) == ENUMERAL_TYPE
 		 || TREE_CODE (valtype) == BOOLEAN_TYPE
-		 || TREE_CODE (valtype) == REAL_TYPE
+		 || SCALAR_FLOAT_TYPE_P (valtype)
 		 || TREE_CODE (valtype) == OFFSET_TYPE))
 	    && sh_promote_prototypes (fn_decl_or_type)
 	    ? SImode : TYPE_MODE (valtype)),
diff --git a/gcc/config/sol2.cc b/gcc/config/sol2.cc
index 78b780a41c0..25f62beec13 100644
--- a/gcc/config/sol2.cc
+++ b/gcc/config/sol2.cc
@@ -46,7 +46,7 @@  solaris_insert_attributes (tree decl, tree *attributes)
 {
   tree *x, next;
 
-  if (solaris_pending_aligns != NULL && TREE_CODE (decl) == VAR_DECL)
+  if (solaris_pending_aligns != NULL && VAR_P (decl))
     for (x = &solaris_pending_aligns; *x; x = &TREE_CHAIN (*x))
       {
 	tree name = TREE_PURPOSE (*x);
diff --git a/gcc/config/sparc/sparc.cc b/gcc/config/sparc/sparc.cc
index 8c0c9dce971..0aade05faf5 100644
--- a/gcc/config/sparc/sparc.cc
+++ b/gcc/config/sparc/sparc.cc
@@ -6904,7 +6904,7 @@  function_arg_slotno (const struct sparc_args *cum, machine_mode mode,
      their mode, depending upon whether VIS instructions are enabled.  */
   if (type && VECTOR_TYPE_P (type))
     {
-      if (TREE_CODE (TREE_TYPE (type)) == REAL_TYPE)
+      if (SCALAR_FLOAT_TYPE_P (TREE_TYPE (type)))
 	{
 	  /* The SPARC port defines no floating-point vector modes.  */
 	  gcc_assert (mode == BLKmode);
diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h
index c34f2f53b39..2d45437f5a2 100644
--- a/gcc/config/sparc/sparc.h
+++ b/gcc/config/sparc/sparc.h
@@ -551,9 +551,7 @@  along with GCC; see the file COPYING3.  If not see
    the smaller of COMPUTED and `BIGGEST_ALIGNMENT' */
 #define ROUND_TYPE_ALIGN(STRUCT, COMPUTED, SPECIFIED)	\
  (TARGET_FASTER_STRUCTS ?				\
-  ((TREE_CODE (STRUCT) == RECORD_TYPE			\
-    || TREE_CODE (STRUCT) == UNION_TYPE                 \
-    || TREE_CODE (STRUCT) == QUAL_UNION_TYPE)           \
+  (RECORD_OR_UNION_TYPE_P (STRUCT)	   \
    && TYPE_FIELDS (STRUCT) != 0                         \
      ? MAX (MAX ((COMPUTED), (SPECIFIED)), BIGGEST_ALIGNMENT) \
      : MAX ((COMPUTED), (SPECIFIED)))			\
diff --git a/gcc/config/stormy16/stormy16.cc b/gcc/config/stormy16/stormy16.cc
index 81b32dbc958..cd453c2a2f7 100644
--- a/gcc/config/stormy16/stormy16.cc
+++ b/gcc/config/stormy16/stormy16.cc
@@ -1756,7 +1756,7 @@  xstormy16_encode_section_info (tree decl, rtx r, int first)
 {
   default_encode_section_info (decl, r, first);
 
-   if (TREE_CODE (decl) == VAR_DECL
+   if (VAR_P (decl)
       && (lookup_attribute ("below100", DECL_ATTRIBUTES (decl))
 	  || lookup_attribute ("BELOW100", DECL_ATTRIBUTES (decl))))
     {
@@ -2427,7 +2427,7 @@  xstormy16_handle_below100_attribute (tree *node,
 	       "%<__BELOW100__%> attribute only applies to variables");
       *no_add_attrs = true;
     }
-  else if (args == NULL_TREE && TREE_CODE (*node) == VAR_DECL)
+  else if (args == NULL_TREE && VAR_P (*node))
     {
       if (! (TREE_PUBLIC (*node) || TREE_STATIC (*node)))
 	{
diff --git a/gcc/config/v850/v850.cc b/gcc/config/v850/v850.cc
index 367ba033d66..0fb72716b17 100644
--- a/gcc/config/v850/v850.cc
+++ b/gcc/config/v850/v850.cc
@@ -2161,7 +2161,7 @@  v850_encode_section_info (tree decl, rtx rtl, int first)
 {
   default_encode_section_info (decl, rtl, first);
 
-  if (TREE_CODE (decl) == VAR_DECL
+  if (VAR_P (decl)
       && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)))
     v850_encode_data_area (decl, XEXP (rtl, 0));
 }
@@ -2482,7 +2482,7 @@  v850_insert_attributes (tree decl, tree * attr_ptr ATTRIBUTE_UNUSED )
   if (data_area_stack
       && data_area_stack->data_area
       && current_function_decl == NULL_TREE
-      && (TREE_CODE (decl) == VAR_DECL || TREE_CODE (decl) == CONST_DECL)
+      && (VAR_P (decl) || TREE_CODE (decl) == CONST_DECL)
       && v850_get_data_area (decl) == DATA_AREA_NORMAL)
     v850_set_data_area (decl, data_area_stack->data_area);
 
@@ -2508,7 +2508,7 @@  v850_insert_attributes (tree decl, tree * attr_ptr ATTRIBUTE_UNUSED )
     }
   
   if (current_function_decl == NULL_TREE
-      && (TREE_CODE (decl) == VAR_DECL
+      && (VAR_P (decl)
 	  || TREE_CODE (decl) == CONST_DECL
 	  || TREE_CODE (decl) == FUNCTION_DECL)
       && (!DECL_EXTERNAL (decl) || DECL_INITIAL (decl))
diff --git a/gcc/config/visium/visium.cc b/gcc/config/visium/visium.cc
index ec4c2e9ae5c..48a61744db6 100644
--- a/gcc/config/visium/visium.cc
+++ b/gcc/config/visium/visium.cc
@@ -1313,7 +1313,7 @@  static bool
 visium_pass_by_reference (cumulative_args_t, const function_arg_info &arg)
 {
   tree type = arg.type;
-  return type && (AGGREGATE_TYPE_P (type) || TREE_CODE (type) == VECTOR_TYPE);
+  return type && (AGGREGATE_TYPE_P (type) || VECTOR_TYPE_P (type));
 }
 
 /* Define how arguments are passed.
@@ -1409,7 +1409,7 @@  visium_function_arg_advance (cumulative_args_t pcum_v,
 static bool
 visium_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED)
 {
-  return (AGGREGATE_TYPE_P (type) || TREE_CODE (type) == VECTOR_TYPE);
+  return (AGGREGATE_TYPE_P (type) || VECTOR_TYPE_P (type));
 }
 
 /* Define how scalar values are returned.  */
diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc
index 9e5d314e143..bb1444c44b6 100644
--- a/gcc/config/xtensa/xtensa.cc
+++ b/gcc/config/xtensa/xtensa.cc
@@ -4287,7 +4287,7 @@  xtensa_multibss_section_type_flags (tree decl, const char *name, int reloc)
   suffix = strrchr (name, '.');
   if (suffix && strcmp (suffix, ".bss") == 0)
     {
-      if (!decl || (TREE_CODE (decl) == VAR_DECL
+      if (!decl || (VAR_P (decl)
 		    && DECL_INITIAL (decl) == NULL_TREE))
 	flags |= SECTION_BSS;  /* @nobits */
       else