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]

[PATCH v2 14/18] Use LABEL_REF_P macro. Autogenerated patch by running ../contrib/rtl-pred.sh LABEL_REF


2019-08-05  Arvind Sankar  <nivedita@alum.mit.edu>

	gcc/ChangeLog:

	* alias.c: Convert GET_CODE (..) == LABEL_REF to
	LABEL_REF_P (..).
	* bb-reorder.c: Likewise.
	* cfgbuild.c: Likewise.
	* cfgexpand.c: Likewise.
	* cfgrtl.c: Likewise.
	* combine.c: Likewise.
	* config/aarch64/aarch64.c: Likewise.
	* config/alpha/predicates.md: Likewise.
	* config/arc/arc.c: Likewise.
	* config/arc/arc.h: Likewise.
	* config/arm/arm.c: Likewise.
	* config/arm/thumb1.md: Likewise.
	* config/avr/avr.c: Likewise.
	* config/bfin/bfin.c: Likewise.
	* config/bfin/bfin.h: Likewise.
	* config/bfin/predicates.md: Likewise.
	* config/c6x/c6x.c: Likewise.
	* config/c6x/c6x.md: Likewise.
	* config/c6x/predicates.md: Likewise.
	* config/cr16/cr16.c: Likewise.
	* config/cr16/cr16.h: Likewise.
	* config/cris/cris.c: Likewise.
	* config/cris/cris.md: Likewise.
	* config/csky/constraints.md: Likewise.
	* config/csky/csky.c: Likewise.
	* config/csky/csky.h: Likewise.
	* config/darwin.c: Likewise.
	* config/epiphany/epiphany.h: Likewise.
	* config/epiphany/predicates.md: Likewise.
	* config/frv/frv.c: Likewise.
	* config/frv/predicates.md: Likewise.
	* config/ft32/constraints.md: Likewise.
	* config/ft32/ft32.c: Likewise.
	* config/ft32/ft32.md: Likewise.
	* config/ft32/predicates.md: Likewise.
	* config/gcn/gcn.c: Likewise.
	* config/gcn/gcn.md: Likewise.
	* config/h8300/h8300.h: Likewise.
	* config/i386/i386.c: Likewise.
	* config/i386/i386.h: Likewise.
	* config/i386/i386.md: Likewise.
	* config/i386/predicates.md: Likewise.
	* config/iq2000/iq2000.c: Likewise.
	* config/iq2000/iq2000.h: Likewise.
	* config/iq2000/predicates.md: Likewise.
	* config/lm32/lm32.c: Likewise.
	* config/lm32/lm32.h: Likewise.
	* config/lm32/lm32.md: Likewise.
	* config/m32r/constraints.md: Likewise.
	* config/m32r/m32r.c: Likewise.
	* config/m32r/m32r.h: Likewise.
	* config/m32r/predicates.md: Likewise.
	* config/m68k/constraints.md: Likewise.
	* config/m68k/m68k.c: Likewise.
	* config/m68k/m68k.h: Likewise.
	* config/m68k/predicates.md: Likewise.
	* config/mcore/constraints.md: Likewise.
	* config/mcore/mcore.c: Likewise.
	* config/mcore/mcore.h: Likewise.
	* config/mcore/predicates.md: Likewise.
	* config/microblaze/microblaze.c: Likewise.
	* config/microblaze/predicates.md: Likewise.
	* config/mips/mips.c: Likewise.
	* config/mmix/mmix.c: Likewise.
	* config/mmix/predicates.md: Likewise.
	* config/mn10300/mn10300.c: Likewise.
	* config/mn10300/mn10300.h: Likewise.
	* config/moxie/constraints.md: Likewise.
	* config/moxie/moxie.c: Likewise.
	* config/moxie/predicates.md: Likewise.
	* config/nds32/nds32-cost.c: Likewise.
	* config/nds32/nds32-md-auxiliary.c: Likewise.
	* config/nds32/nds32.h: Likewise.
	* config/nios2/nios2.c: Likewise.
	* config/nvptx/nvptx.c: Likewise.
	* config/nvptx/nvptx.md: Likewise.
	* config/pa/pa.c: Likewise.
	* config/pa/pa.h: Likewise.
	* config/pa/pa.md: Likewise.
	* config/pa/predicates.md: Likewise.
	* config/riscv/riscv.c: Likewise.
	* config/rs6000/freebsd64.h: Likewise.
	* config/rs6000/linux64.h: Likewise.
	* config/rs6000/rs6000.c: Likewise.
	* config/rs6000/rs6000.h: Likewise.
	* config/rs6000/rtems.h: Likewise.
	* config/rs6000/sysv4.h: Likewise.
	* config/rs6000/xcoff.h: Likewise.
	* config/rx/rx.c: Likewise.
	* config/s390/predicates.md: Likewise.
	* config/s390/s390.c: Likewise.
	* config/s390/s390.h: Likewise.
	* config/sh/predicates.md: Likewise.
	* config/sh/sh.c: Likewise.
	* config/sh/sh.h: Likewise.
	* config/sparc/predicates.md: Likewise.
	* config/sparc/sparc.c: Likewise.
	* config/sparc/sparc.md: Likewise.
	* config/spu/constraints.md: Likewise.
	* config/spu/spu.c: Likewise.
	* config/tilegx/predicates.md: Likewise.
	* config/tilegx/tilegx.c: Likewise.
	* config/tilepro/predicates.md: Likewise.
	* config/tilepro/tilepro.c: Likewise.
	* config/v850/v850.c: Likewise.
	* config/vax/predicates.md: Likewise.
	* config/vax/vax.c: Likewise.
	* config/xtensa/xtensa.c: Likewise.
	* config/xtensa/xtensa.h: Likewise.
	* cprop.c: Likewise.
	* cse.c: Likewise.
	* dbxout.c: Likewise.
	* explow.c: Likewise.
	* expr.c: Likewise.
	* final.c: Likewise.
	* genattrtab.c: Likewise.
	* gensupport.c: Likewise.
	* ifcvt.c: Likewise.
	* ira.c: Likewise.
	* jump.c: Likewise.
	* loop-doloop.c: Likewise.
	* lower-subreg.c: Likewise.
	* print-rtl.c: Likewise.
	* read-rtl-function.c: Likewise.
	* recog.c: Likewise.
	* reginfo.c: Likewise.
	* reload.c: Likewise.
	* reload1.c: Likewise.
	* reorg.c: Likewise.
	* rtlanal.c: Likewise.
	* simplify-rtx.c: Likewise.
	* tree-ssa-address.c: Likewise.
	* varasm.c: Likewise.

 133 files changed, 351 insertions(+), 351 deletions(-)

diff --git a/gcc/alias.c b/gcc/alias.c
index 2755df72907..24eaeae86f3 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -2954,7 +2954,7 @@ true_dependence_1 (const_rtx mem, machine_mode mem_mode, rtx mem_addr,
     return 1;
 
   base = find_base_term (x_addr);
-  if (base && (GET_CODE (base) == LABEL_REF
+  if (base && (LABEL_REF_P (base)
 	       || (GET_CODE (base) == SYMBOL_REF
 		   && CONSTANT_POOL_ADDRESS_P (base))))
     return 0;
@@ -3063,7 +3063,7 @@ write_dependence_p (const_rtx mem,
   base = find_base_term (true_mem_addr);
   if (! writep
       && base
-      && (GET_CODE (base) == LABEL_REF
+      && (LABEL_REF_P (base)
 	  || (GET_CODE (base) == SYMBOL_REF
 	      && CONSTANT_POOL_ADDRESS_P (base))))
     return 0;
diff --git a/gcc/bb-reorder.c b/gcc/bb-reorder.c
index 0ac39140c6c..43623e00d76 100644
--- a/gcc/bb-reorder.c
+++ b/gcc/bb-reorder.c
@@ -2167,7 +2167,7 @@ fix_crossing_conditional_branches (void)
 		  new_label = gen_label_rtx ();
 		  emit_label (new_label);
 
-		  gcc_assert (GET_CODE (old_label) == LABEL_REF);
+		  gcc_assert (LABEL_REF_P (old_label));
 		  old_jump_target = old_jump_insn->jump_target ();
 		  new_jump = as_a <rtx_jump_insn *>
 		    (emit_jump_insn (targetm.gen_jump (old_jump_target)));
diff --git a/gcc/cfgbuild.c b/gcc/cfgbuild.c
index 934325c6538..8ac13b753dd 100644
--- a/gcc/cfgbuild.c
+++ b/gcc/cfgbuild.c
@@ -273,7 +273,7 @@ make_edges (basic_block min, basic_block max, int update_p)
 	      if ((tmp = single_set (insn)) != NULL
 		  && SET_DEST (tmp) == pc_rtx
 		  && GET_CODE (SET_SRC (tmp)) == IF_THEN_ELSE
-		  && GET_CODE (XEXP (SET_SRC (tmp), 2)) == LABEL_REF)
+		  && LABEL_REF_P (XEXP (SET_SRC (tmp), 2)))
 		make_label_edge (edge_cache, bb,
 				 label_ref_label (XEXP (SET_SRC (tmp), 2)), 0);
 	    }
@@ -414,7 +414,7 @@ purge_dead_tablejump_edges (basic_block bb, rtx_jump_table_data *table)
   if ((tmp = single_set (insn)) != NULL
        && SET_DEST (tmp) == pc_rtx
        && GET_CODE (SET_SRC (tmp)) == IF_THEN_ELSE
-       && GET_CODE (XEXP (SET_SRC (tmp), 2)) == LABEL_REF)
+       && LABEL_REF_P (XEXP (SET_SRC (tmp), 2)))
     mark_tablejump_edge (label_ref_label (XEXP (SET_SRC (tmp), 2)));
 
   for (ei = ei_start (bb->succs); (e = ei_safe_edge (ei)); )
diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index aff97bb41be..f4832c6d2bb 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -5482,7 +5482,7 @@ expand_debug_locations (void)
 			|| (GET_MODE (val) == VOIDmode
 			    && (CONST_SCALAR_INT_P (val)
 				|| CONST_FIXED_P (val)
-				|| GET_CODE (val) == LABEL_REF)));
+				|| LABEL_REF_P (val))));
 	  }
 
 	INSN_VAR_LOCATION_LOC (insn) = val;
diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c
index 1f222aea5d1..6e5ccd46c22 100644
--- a/gcc/cfgrtl.c
+++ b/gcc/cfgrtl.c
@@ -1217,7 +1217,7 @@ patch_jump_insn (rtx_insn *insn, rtx_insn *old_label, basic_block new_bb)
       if ((tmp = single_set (insn)) != NULL
 	  && SET_DEST (tmp) == pc_rtx
 	  && GET_CODE (SET_SRC (tmp)) == IF_THEN_ELSE
-	  && GET_CODE (XEXP (SET_SRC (tmp), 2)) == LABEL_REF
+	  && LABEL_REF_P (XEXP (SET_SRC (tmp), 2))
 	  && label_ref_label (XEXP (SET_SRC (tmp), 2)) == old_label)
 	{
 	  XEXP (SET_SRC (tmp), 2) = gen_rtx_LABEL_REF (Pmode,
@@ -1238,7 +1238,7 @@ patch_jump_insn (rtx_insn *insn, rtx_insn *old_label, basic_block new_bb)
       for (i = 0; i < n; ++i)
 	{
 	  rtx old_ref = ASM_OPERANDS_LABEL (tmp, i);
-	  gcc_assert (GET_CODE (old_ref) == LABEL_REF);
+	  gcc_assert (LABEL_REF_P (old_ref));
 	  if (XEXP (old_ref, 0) == old_label)
 	    {
 	      ASM_OPERANDS_LABEL (tmp, i)
diff --git a/gcc/combine.c b/gcc/combine.c
index a7af1ace40b..f1e786d5678 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -14483,14 +14483,14 @@ distribute_notes (rtx notes, rtx_insn *from_insn, rtx_insn *i3, rtx_insn *i2,
 	  /* ??? Ignore the without-reg_equal-note problem for now.  */
 	  if (reg_mentioned_p (XEXP (note, 0), PATTERN (i3))
 	      || ((tem_note = find_reg_note (i3, REG_EQUAL, NULL_RTX))
-		  && GET_CODE (XEXP (tem_note, 0)) == LABEL_REF
+		  && LABEL_REF_P (XEXP (tem_note, 0))
 		  && label_ref_label (XEXP (tem_note, 0)) == XEXP (note, 0)))
 	    place = i3;
 
 	  if (i2
 	      && (reg_mentioned_p (XEXP (note, 0), PATTERN (i2))
 		  || ((tem_note = find_reg_note (i2, REG_EQUAL, NULL_RTX))
-		      && GET_CODE (XEXP (tem_note, 0)) == LABEL_REF
+		      && LABEL_REF_P (XEXP (tem_note, 0))
 		      && label_ref_label (XEXP (tem_note, 0)) == XEXP (note, 0))))
 	    {
 	      if (place)
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index f54a0d462a8..4927ee9320f 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -3291,7 +3291,7 @@ aarch64_expand_mov_immediate (rtx dest, rtx imm,
   /* Check on what type of symbol it is.  */
   scalar_int_mode int_mode;
   if ((GET_CODE (imm) == SYMBOL_REF
-       || GET_CODE (imm) == LABEL_REF
+       || LABEL_REF_P (imm)
        || GET_CODE (imm) == CONST
        || GET_CODE (imm) == CONST_POLY_INT)
       && is_a <scalar_int_mode> (mode, &int_mode))
@@ -6329,7 +6329,7 @@ aarch64_cannot_force_const_mem (machine_mode mode ATTRIBUTE_UNUSED, rtx x)
       return true;
 
   split_const (x, &base, &offset);
-  if (GET_CODE (base) == SYMBOL_REF || GET_CODE (base) == LABEL_REF)
+  if (GET_CODE (base) == SYMBOL_REF || LABEL_REF_P (base))
     {
       if (aarch64_classify_symbol (base, INTVAL (offset))
 	  != SYMBOL_FORCE_TO_MEM)
@@ -6854,7 +6854,7 @@ aarch64_classify_address (struct aarch64_address_info *info,
 	  rtx sym, addend;
 
 	  split_const (x, &sym, &addend);
-	  return ((GET_CODE (sym) == LABEL_REF
+	  return ((LABEL_REF_P (sym)
 		   || (GET_CODE (sym) == SYMBOL_REF
 		       && CONSTANT_POOL_ADDRESS_P (sym)
 		       && aarch64_pcrelative_literal_loads)));
@@ -6932,7 +6932,7 @@ aarch64_symbolic_address_p (rtx x)
   rtx offset;
 
   split_const (x, &x, &offset);
-  return GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF;
+  return GET_CODE (x) == SYMBOL_REF || LABEL_REF_P (x);
 }
 
 /* Classify the base of symbolic expression X.  */
@@ -8236,7 +8236,7 @@ aarch64_label_mentioned_p (rtx x)
   const char *fmt;
   int i;
 
-  if (GET_CODE (x) == LABEL_REF)
+  if (LABEL_REF_P (x))
     return true;
 
   /* UNSPEC_TLS entries for a symbol include a LABEL_REF for the
@@ -13091,7 +13091,7 @@ aarch64_classify_tls_symbol (rtx x)
 enum aarch64_symbol_type
 aarch64_classify_symbol (rtx x, HOST_WIDE_INT offset)
 {
-  if (GET_CODE (x) == LABEL_REF)
+  if (LABEL_REF_P (x))
     {
       switch (aarch64_cmodel)
 	{
@@ -13249,7 +13249,7 @@ aarch64_legitimate_constant_p (machine_mode mode, rtx x)
     return true;
 
   /* Label references are always constant.  */
-  if (GET_CODE (x) == LABEL_REF)
+  if (LABEL_REF_P (x))
     return true;
 
   return false;
diff --git a/gcc/config/alpha/predicates.md b/gcc/config/alpha/predicates.md
index 63110c77b53..f96c16b533c 100644
--- a/gcc/config/alpha/predicates.md
+++ b/gcc/config/alpha/predicates.md
@@ -296,7 +296,7 @@
       && CONST_INT_P (XEXP (XEXP (op, 0), 1)))
     op = XEXP (XEXP (op, 0), 0);
 
-  if (GET_CODE (op) == LABEL_REF)
+  if (LABEL_REF_P (op))
     return 1;
 
   if (GET_CODE (op) != SYMBOL_REF)
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index e79f36761b2..13cb4706ae5 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -5198,9 +5198,9 @@ arc_ccfsm_advance (rtx_insn *insn, struct arc_ccfsm *state)
 	  if (!seeking_return)
 	    label = XEXP (SET_SRC (body), 0);
 	}
-      else if (GET_CODE (XEXP (SET_SRC (body), 1)) == LABEL_REF)
+      else if (LABEL_REF_P (XEXP (SET_SRC (body), 1)))
 	label = XEXP (XEXP (SET_SRC (body), 1), 0);
-      else if (GET_CODE (XEXP (SET_SRC (body), 2)) == LABEL_REF)
+      else if (LABEL_REF_P (XEXP (SET_SRC (body), 2)))
 	{
 	  label = XEXP (XEXP (SET_SRC (body), 2), 0);
 	  then_not_else = FALSE;
@@ -5295,7 +5295,7 @@ arc_ccfsm_advance (rtx_insn *insn, struct arc_ccfsm *state)
 	      if (GET_CODE (scanbody) == SET
 		  && GET_CODE (SET_DEST (scanbody)) == PC)
 		{
-		  if (GET_CODE (SET_SRC (scanbody)) == LABEL_REF
+		  if (LABEL_REF_P (SET_SRC (scanbody))
 		      && XEXP (SET_SRC (scanbody), 0) == label && !reverse)
 		    {
 		      state->state = 2;
@@ -6032,7 +6032,7 @@ arc_legitimate_pic_addr_p (rtx addr)
     return false;
 
   if (GET_CODE (XVECEXP (addr, 0, 0)) != SYMBOL_REF
-      && GET_CODE (XVECEXP (addr, 0, 0)) != LABEL_REF)
+      && !LABEL_REF_P (XVECEXP (addr, 0, 0)))
     return false;
 
   return true;
@@ -6048,7 +6048,7 @@ symbolic_reference_mentioned_p (rtx op)
   register const char *fmt;
   register int i;
 
-  if (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == LABEL_REF)
+  if (GET_CODE (op) == SYMBOL_REF || LABEL_REF_P (op))
     return true;
 
   fmt = GET_RTX_FORMAT (GET_CODE (op));
diff --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h
index 377e29d3547..94101cff349 100644
--- a/gcc/config/arc/arc.h
+++ b/gcc/config/arc/arc.h
@@ -841,7 +841,7 @@ extern int arc_initial_elimination_offset(int from, int to);
 /* Recognize any constant value that is a valid address.  */
 #define CONSTANT_ADDRESS_P(X)					\
   (flag_pic ? (arc_legitimate_pic_addr_p (X) || LABEL_P (X)):	\
-   (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF	\
+   (LABEL_REF_P (X) || GET_CODE (X) == SYMBOL_REF	\
     || CONST_INT_P (X) || GET_CODE (X) == CONST))
 
 /* Is the argument a const_int rtx, containing an exact power of 2 */
@@ -1060,7 +1060,7 @@ arc_select_cc_mode (OP, X, Y)
 #define ASM_OUTPUT_INT(FILE, VALUE) \
 do {									\
   fprintf (FILE, "\t.word\t");						\
-  if (GET_CODE (VALUE) == LABEL_REF)					\
+  if (LABEL_REF_P (VALUE))					\
     {									\
       fprintf (FILE, "%%st(@");						\
       output_addr_const (FILE, (VALUE));				\
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index fd18f92b6ec..2f8d68507ec 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -7518,7 +7518,7 @@ legitimize_pic_address (rtx orig, machine_mode mode, rtx reg, rtx pic_reg,
   gcc_assert (compute_now == (pic_reg != NULL_RTX));
 
   if (GET_CODE (orig) == SYMBOL_REF
-      || GET_CODE (orig) == LABEL_REF)
+      || LABEL_REF_P (orig))
     {
       if (reg == 0)
 	{
@@ -7535,7 +7535,7 @@ legitimize_pic_address (rtx orig, machine_mode mode, rtx reg, rtx pic_reg,
       /* References to weak symbols cannot be resolved locally: they
 	 may be overridden by a non-weak definition at link time.  */
       rtx_insn *insn;
-      if ((GET_CODE (orig) == LABEL_REF
+      if ((LABEL_REF_P (orig)
 	   || (GET_CODE (orig) == SYMBOL_REF
 	       && SYMBOL_REF_LOCAL_P (orig)
 	       && (SYMBOL_REF_DECL (orig)
@@ -7895,7 +7895,7 @@ arm_legitimate_address_outer_p (machine_mode mode, rtx x, RTX_CODE outer,
 	   && (code == LABEL_REF
 	       || (code == CONST
 		   && GET_CODE (XEXP (x, 0)) == PLUS
-		   && GET_CODE (XEXP (XEXP (x, 0), 0)) == LABEL_REF
+		   && LABEL_REF_P (XEXP (XEXP (x, 0), 0))
 		   && CONST_INT_P (XEXP (XEXP (x, 0), 1)))))
     return 1;
 
@@ -8008,7 +8008,7 @@ thumb2_legitimate_address_p (machine_mode mode, rtx x, int strict_p)
 	   && (code == LABEL_REF
 	       || (code == CONST
 		   && GET_CODE (XEXP (x, 0)) == PLUS
-		   && GET_CODE (XEXP (XEXP (x, 0), 0)) == LABEL_REF
+		   && LABEL_REF_P (XEXP (XEXP (x, 0), 0))
 		   && CONST_INT_P (XEXP (XEXP (x, 0), 1)))))
     return 1;
 
@@ -8337,10 +8337,10 @@ thumb1_legitimate_address_p (machine_mode mode, rtx x, int strict_p)
   /* This is PC relative data after arm_reorg runs.  */
   else if ((GET_MODE_SIZE (mode) >= 4 || mode == HFmode)
 	   && reload_completed
-	   && (GET_CODE (x) == LABEL_REF
+	   && (LABEL_REF_P (x)
 	       || (GET_CODE (x) == CONST
 		   && GET_CODE (XEXP (x, 0)) == PLUS
-		   && GET_CODE (XEXP (XEXP (x, 0), 0)) == LABEL_REF
+		   && LABEL_REF_P (XEXP (XEXP (x, 0), 0))
 		   && CONST_INT_P (XEXP (XEXP (x, 0), 1)))))
     return 1;
 
@@ -12571,10 +12571,10 @@ arm_coproc_mem_operand (rtx op, bool wb)
   ind = XEXP (op, 0);
 
   if (reload_completed
-      && (GET_CODE (ind) == LABEL_REF
+      && (LABEL_REF_P (ind)
 	  || (GET_CODE (ind) == CONST
 	      && GET_CODE (XEXP (ind, 0)) == PLUS
-	      && GET_CODE (XEXP (XEXP (ind, 0), 0)) == LABEL_REF
+	      && LABEL_REF_P (XEXP (XEXP (ind, 0), 0))
 	      && CONST_INT_P (XEXP (XEXP (ind, 0), 1)))))
     return TRUE;
 
@@ -12643,10 +12643,10 @@ neon_vector_mem_operand (rtx op, int type, bool strict)
   ind = XEXP (op, 0);
 
   if (reload_completed
-      && (GET_CODE (ind) == LABEL_REF
+      && (LABEL_REF_P (ind)
 	  || (GET_CODE (ind) == CONST
 	      && GET_CODE (XEXP (ind, 0)) == PLUS
-	      && GET_CODE (XEXP (XEXP (ind, 0), 0)) == LABEL_REF
+	      && LABEL_REF_P (XEXP (XEXP (ind, 0), 0))
 	      && CONST_INT_P (XEXP (XEXP (ind, 0), 1)))))
     return TRUE;
 
@@ -12709,10 +12709,10 @@ neon_struct_mem_operand (rtx op)
   ind = XEXP (op, 0);
 
   if (reload_completed
-      && (GET_CODE (ind) == LABEL_REF
+      && (LABEL_REF_P (ind)
 	  || (GET_CODE (ind) == CONST
 	      && GET_CODE (XEXP (ind, 0)) == PLUS
-	      && GET_CODE (XEXP (XEXP (ind, 0), 0)) == LABEL_REF
+	      && LABEL_REF_P (XEXP (XEXP (ind, 0), 0))
 	      && CONST_INT_P (XEXP (XEXP (ind, 0), 1)))))
     return TRUE;
 
@@ -12859,7 +12859,7 @@ label_mentioned_p (rtx x)
   const char * fmt;
   int i;
 
-  if (GET_CODE (x) == LABEL_REF)
+  if (LABEL_REF_P (x))
     return 1;
 
   /* UNSPEC_TLS entries for a symbol include a LABEL_REF for the referencing
@@ -19113,7 +19113,7 @@ arm_attr_length_move_neon (rtx_insn *insn)
   if (GET_CODE (addr) == CONST && GET_CODE (XEXP (addr, 0)) == PLUS)
     addr = XEXP (addr, 0);
 
-  if (GET_CODE (addr) == LABEL_REF || GET_CODE (addr) == PLUS)
+  if (LABEL_REF_P (addr) || GET_CODE (addr) == PLUS)
     {
       int insns = REG_NREGS (reg) / 2;
       return insns * 4;
@@ -23034,7 +23034,7 @@ arm_assemble_integer (rtx x, unsigned int size, int aligned_p)
       /* Mark symbols as position independent.  We only do this in the
 	 .text segment, not in the .data segment.  */
       if (NEED_GOT_RELOC && flag_pic && making_const_table &&
-	  (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF))
+	  (GET_CODE (x) == SYMBOL_REF || LABEL_REF_P (x)))
 	{
 	  /* See legitimize_pic_address for an explanation of the
 	     TARGET_VXWORKS_RTP check.  */
@@ -23542,9 +23542,9 @@ arm_final_prescan_insn (rtx_insn *insn)
 	  if (!seeking_return)
 	    label = XEXP (SET_SRC (body), 0);
         }
-      else if (GET_CODE (XEXP (SET_SRC (body), 1)) == LABEL_REF)
+      else if (LABEL_REF_P (XEXP (SET_SRC (body), 1)))
 	label = XEXP (XEXP (SET_SRC (body), 1), 0);
-      else if (GET_CODE (XEXP (SET_SRC (body), 2)) == LABEL_REF)
+      else if (LABEL_REF_P (XEXP (SET_SRC (body), 2)))
 	{
 	  label = XEXP (XEXP (SET_SRC (body), 2), 0);
 	  then_not_else = FALSE;
@@ -23643,7 +23643,7 @@ arm_final_prescan_insn (rtx_insn *insn)
 	      if (GET_CODE (scanbody) == SET
 		  && GET_CODE (SET_DEST (scanbody)) == PC)
 		{
-		  if (GET_CODE (SET_SRC (scanbody)) == LABEL_REF
+		  if (LABEL_REF_P (SET_SRC (scanbody))
 		      && XEXP (SET_SRC (scanbody), 0) == label && !reverse)
 		    {
 		      arm_ccfsm_state = 2;
@@ -29914,7 +29914,7 @@ arm_valid_symbolic_address_p (rtx addr)
   if (target_word_relocations)
     return false;
 
-  if (GET_CODE (tmp) == SYMBOL_REF || GET_CODE (tmp) == LABEL_REF)
+  if (GET_CODE (tmp) == SYMBOL_REF || LABEL_REF_P (tmp))
     return true;
 
   /* (const (plus: symbol_ref const_int))  */
diff --git a/gcc/config/arm/thumb1.md b/gcc/config/arm/thumb1.md
index b142bfcb837..13ac28d0d85 100644
--- a/gcc/config/arm/thumb1.md
+++ b/gcc/config/arm/thumb1.md
@@ -464,7 +464,7 @@
     if (GET_CODE (mem) == CONST)
       mem = XEXP (mem, 0);
 
-    if (GET_CODE (mem) == LABEL_REF)
+    if (LABEL_REF_P (mem))
       return \"ldr\\t%0, %1\";
 
     if (GET_CODE (mem) == PLUS)
@@ -472,7 +472,7 @@
         rtx a = XEXP (mem, 0);
         rtx b = XEXP (mem, 1);
 
-        if (GET_CODE (a) == LABEL_REF
+        if (LABEL_REF_P (a)
 	    && CONST_INT_P (b))
           return \"ldr\\t%0, %1\";
 
@@ -844,10 +844,10 @@
 	rtx addr;
 	gcc_assert (MEM_P (operands[1]));
 	addr = XEXP (operands[1], 0);
-	if (GET_CODE (addr) == LABEL_REF
+	if (LABEL_REF_P (addr)
 	    || (GET_CODE (addr) == CONST
 		&& GET_CODE (XEXP (addr, 0)) == PLUS
-		&& GET_CODE (XEXP (XEXP (addr, 0), 0)) == LABEL_REF
+		&& LABEL_REF_P (XEXP (XEXP (addr, 0), 0))
 		&& CONST_INT_P (XEXP (XEXP (addr, 0), 1))))
 	  {
 	    /* Constant pool entry.  */
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c
index 015d36728a3..86c6cce55f0 100644
--- a/gcc/config/avr/avr.c
+++ b/gcc/config/avr/avr.c
@@ -3150,7 +3150,7 @@ avr_notice_update_cc (rtx body ATTRIBUTE_UNUSED, rtx_insn *insn)
 int
 avr_jump_mode (rtx x, rtx_insn *insn)
 {
-  int dest_addr = INSN_ADDRESSES (INSN_UID (GET_CODE (x) == LABEL_REF
+  int dest_addr = INSN_ADDRESSES (INSN_UID (LABEL_REF_P (x)
                                             ? XEXP (x, 0) : x));
   int cur_addr = INSN_ADDRESSES (INSN_UID (insn));
   int jump_distance = cur_addr - dest_addr;
@@ -12114,7 +12114,7 @@ avr_2word_insn_p (rtx_insn *insn)
 int
 jump_over_one_insn_p (rtx_insn *insn, rtx dest)
 {
-  int uid = INSN_UID (GET_CODE (dest) == LABEL_REF
+  int uid = INSN_UID (LABEL_REF_P (dest)
 		      ? XEXP (dest, 0)
 		      : dest);
   int jump_addr = INSN_ADDRESSES (INSN_UID (insn));
diff --git a/gcc/config/bfin/bfin.c b/gcc/config/bfin/bfin.c
index 7ae604716e6..cf0986b2f13 100644
--- a/gcc/config/bfin/bfin.c
+++ b/gcc/config/bfin/bfin.c
@@ -138,7 +138,7 @@ legitimize_pic_address (rtx orig, rtx reg, rtx picreg)
   rtx addr = orig;
   rtx new_rtx = orig;
 
-  if (GET_CODE (addr) == SYMBOL_REF || GET_CODE (addr) == LABEL_REF)
+  if (GET_CODE (addr) == SYMBOL_REF || LABEL_REF_P (addr))
     {
       int unspec;
       rtx tmp;
@@ -1791,7 +1791,7 @@ symbolic_reference_mentioned_p (rtx op)
   register const char *fmt;
   register int i;
 
-  if (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == LABEL_REF)
+  if (GET_CODE (op) == SYMBOL_REF || LABEL_REF_P (op))
     return 1;
 
   fmt = GET_RTX_FORMAT (GET_CODE (op));
diff --git a/gcc/config/bfin/bfin.h b/gcc/config/bfin/bfin.h
index 4aba596f68e..2ee2abbd226 100644
--- a/gcc/config/bfin/bfin.h
+++ b/gcc/config/bfin/bfin.h
@@ -783,7 +783,7 @@ typedef struct {
 
 #define SYMBOLIC_CONST(X)	\
 (GET_CODE (X) == SYMBOL_REF						\
- || GET_CODE (X) == LABEL_REF						\
+ || LABEL_REF_P (X)						\
  || (GET_CODE (X) == CONST && symbolic_reference_mentioned_p (X)))
 
 #define NOTICE_UPDATE_CC(EXPR, INSN) 0
diff --git a/gcc/config/bfin/predicates.md b/gcc/config/bfin/predicates.md
index fa29cea79c3..261323a41b2 100644
--- a/gcc/config/bfin/predicates.md
+++ b/gcc/config/bfin/predicates.md
@@ -163,7 +163,7 @@
        (and (match_code "const")
 	    (match_test "GET_CODE (XEXP (op,0)) == PLUS
 			 && (GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF
-			     || GET_CODE (XEXP (XEXP (op, 0), 0)) == LABEL_REF)
+			     || LABEL_REF_P (XEXP (XEXP (op, 0), 0)))
 			 && CONST_INT_P (XEXP (XEXP (op, 0), 1))"))))
 
 ;; Returns 1 if OP is a plain constant or matched by symbolic_operand.
diff --git a/gcc/config/c6x/c6x.c b/gcc/config/c6x/c6x.c
index 938e42f24d6..7e52de17a4b 100644
--- a/gcc/config/c6x/c6x.c
+++ b/gcc/config/c6x/c6x.c
@@ -1290,7 +1290,7 @@ legitimize_pic_address (rtx orig, rtx reg, rtx picreg)
   rtx addr = orig;
   rtx new_rtx = orig;
 
-  if (GET_CODE (addr) == SYMBOL_REF || GET_CODE (addr) == LABEL_REF)
+  if (GET_CODE (addr) == SYMBOL_REF || LABEL_REF_P (addr))
     {
       int unspec = UNSPEC_LOAD_GOT;
       rtx tmp;
@@ -2430,7 +2430,7 @@ c6x_legitimate_address_p_1 (machine_mode mode, rtx x, bool strict,
 	  && XINT (XEXP (x, 1), 1) == UNSPEC_LOAD_GOT
 	  && XEXP (x, 0) == pic_offset_table_rtx
 	  && (GET_CODE (XVECEXP (XEXP (x, 1), 0, 0)) == SYMBOL_REF
-	      || GET_CODE (XVECEXP (XEXP (x, 1), 0, 0)) == LABEL_REF))
+	      || LABEL_REF_P (XVECEXP (XEXP (x, 1), 0, 0))))
 	return !no_large_offset;
       if (!CONST_INT_P (XEXP (x, 1)))
 	return false;
diff --git a/gcc/config/c6x/c6x.md b/gcc/config/c6x/c6x.md
index f108c671796..9ece4e9de8c 100644
--- a/gcc/config/c6x/c6x.md
+++ b/gcc/config/c6x/c6x.md
@@ -1521,7 +1521,7 @@
 	   UNSPEC_REAL_JUMP)]
   ""
 {
-  if (GET_CODE (operands[0]) == LABEL_REF)
+  if (LABEL_REF_P (operands[0]))
     return "%|%.\\tb\\t%$\\t%l0";
   return "%|%.\\tb\\t%$\\t%0";
 }
diff --git a/gcc/config/c6x/predicates.md b/gcc/config/c6x/predicates.md
index b933de8b9dc..1670df870cc 100644
--- a/gcc/config/c6x/predicates.md
+++ b/gcc/config/c6x/predicates.md
@@ -85,7 +85,7 @@
        (and (match_code "const")
 	    (match_test "GET_CODE (XEXP (op,0)) == PLUS
 			 && (GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF
-			     || GET_CODE (XEXP (XEXP (op, 0), 0)) == LABEL_REF)
+			     || LABEL_REF_P (XEXP (XEXP (op, 0), 0)))
 			 && CONST_INT_P (XEXP (XEXP (op, 0), 1))"))))
 
 (define_predicate "const_int_or_symbolic_operand"
diff --git a/gcc/config/cr16/cr16.c b/gcc/config/cr16/cr16.c
index fbc2b5cf67a..1fc95285ba5 100644
--- a/gcc/config/cr16/cr16.c
+++ b/gcc/config/cr16/cr16.c
@@ -1163,7 +1163,7 @@ legitimate_pic_operand_p (rtx x)
       /* REVISIT: Use something like symbol_referenced_p.  */
       if (GET_CODE (XEXP (x, 0)) == PLUS
 	  && (GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF
-	      || GET_CODE (XEXP (XEXP (x, 0), 0)) == LABEL_REF)
+	      || LABEL_REF_P (XEXP (XEXP (x, 0), 0)))
 	  && (CONST_INT_P (XEXP (XEXP (x, 0), 1))))
 	return 0;
       break;
@@ -1191,7 +1191,7 @@ legitimize_pic_address (rtx orig, machine_mode mode ATTRIBUTE_UNUSED,
 			rtx reg)
 {
   /* First handle a simple SYMBOL_REF or LABEL_REF.  */
-  if (GET_CODE (orig) == SYMBOL_REF || GET_CODE (orig) == LABEL_REF)
+  if (GET_CODE (orig) == SYMBOL_REF || LABEL_REF_P (orig))
     {
       if (reg == 0)
 	reg = gen_reg_rtx (Pmode);
diff --git a/gcc/config/cr16/cr16.h b/gcc/config/cr16/cr16.h
index dbc012a197d..9814b725aec 100644
--- a/gcc/config/cr16/cr16.h
+++ b/gcc/config/cr16/cr16.h
@@ -414,7 +414,7 @@ struct cumulative_args
 /* ADDRESSING MODES.  */
 
 #define CONSTANT_ADDRESS_P(X)       \
-  (GET_CODE (X) == LABEL_REF        \
+  (LABEL_REF_P (X)        \
    || GET_CODE (X) == SYMBOL_REF    \
    || GET_CODE (X) == CONST         \
    || CONST_INT_P (X))
diff --git a/gcc/config/cris/cris.c b/gcc/config/cris/cris.c
index 2073f35f119..6a573dda1ab 100644
--- a/gcc/config/cris/cris.c
+++ b/gcc/config/cris/cris.c
@@ -3957,7 +3957,7 @@ cris_output_addr_const_extra (FILE *file, rtx xconst)
     case UNSPEC:
       x = XVECEXP (xconst, 0, 0);
       CRIS_ASSERT (GET_CODE (x) == SYMBOL_REF
-		   || GET_CODE (x) == LABEL_REF
+		   || LABEL_REF_P (x)
 		   || GET_CODE (x) == CONST);
       output_addr_const (file, x);
       switch (XINT (xconst, 1))
diff --git a/gcc/config/cris/cris.md b/gcc/config/cris/cris.md
index 0c7ac21b2c7..94ebb9d8539 100644
--- a/gcc/config/cris/cris.md
+++ b/gcc/config/cris/cris.md
@@ -1088,7 +1088,7 @@
        {
 	 if (!flag_pic
 	     && (GET_CODE (operands[1]) == SYMBOL_REF
-		 || GET_CODE (operands[1]) == LABEL_REF
+		 || LABEL_REF_P (operands[1])
 		 || (GET_CODE (operands[1]) == CONST
 		     && (GET_CODE (XEXP (operands[1], 0)) != UNSPEC
 			 || (XINT (XEXP (operands[1], 0), 1)
diff --git a/gcc/config/csky/constraints.md b/gcc/config/csky/constraints.md
index d22e5a6237c..e8ada7af8a0 100644
--- a/gcc/config/csky/constraints.md
+++ b/gcc/config/csky/constraints.md
@@ -39,7 +39,7 @@
 (define_constraint "R"
   "Memory operands whose address is a label_ref"
   (and (match_code "mem")
-       (match_test "GET_CODE (XEXP (op, 0)) == LABEL_REF")))
+       (match_test "LABEL_REF_P (XEXP (op, 0))")))
 
 (define_constraint "S"
   "Symbol reference with optional offset"
diff --git a/gcc/config/csky/csky.c b/gcc/config/csky/csky.c
index 2cd0630ac88..a41b8ed431e 100644
--- a/gcc/config/csky/csky.c
+++ b/gcc/config/csky/csky.c
@@ -1413,7 +1413,7 @@ csky_minipool_load_p (rtx_insn *insn)
   addr = XEXP (op1, 0);
   if (GET_CODE (addr) == PLUS && CONST_INT_P (XEXP (addr, 1)))
     addr = XEXP (addr, 0);
-  return GET_CODE (addr) == LABEL_REF;
+  return LABEL_REF_P (addr);
 }
 
 
@@ -3056,14 +3056,14 @@ csky_legitimate_address_p (machine_mode mode, rtx addr, bool strict_p)
       && ((code == LABEL_REF)
 	   || (code == CONST
 	       && GET_CODE (XEXP (addr, 0)) == PLUS
-	       && GET_CODE (XEXP (XEXP (addr, 0), 0)) == LABEL_REF
+	       && LABEL_REF_P (XEXP (XEXP (addr, 0), 0))
 	       && CONST_INT_P (XEXP (XEXP (addr, 0), 1)))))
     return 1;
 
   if (is_csky_address_register_rtx_p (addr, strict_p))
     return 1;
   /* It is a pc-relative load, may be generated for constpool.  */
-  else if (GET_CODE (addr) == LABEL_REF)
+  else if (LABEL_REF_P (addr))
     return 1;
 
   if (code == PLUS)
@@ -3152,7 +3152,7 @@ decompose_csky_address (rtx addr, struct csky_address *out)
       return true;
     }
 
-  if (GET_CODE (addr) == LABEL_REF)
+  if (LABEL_REF_P (addr))
     {
       out->label = addr;
       return true;
@@ -3168,7 +3168,7 @@ decompose_csky_address (rtx addr, struct csky_address *out)
       addends[0] = XEXP (addr, 0);
       addends[1] = XEXP (addr, 1);
 
-      if (GET_CODE (addends[0]) == LABEL_REF && CONST_INT_P (addends[1]))
+      if (LABEL_REF_P (addends[0]) && CONST_INT_P (addends[1]))
 	{
 	  out->label = addends[0];
 	  out->disp = addends[1];
@@ -3301,7 +3301,7 @@ csky_output_constpool_label (FILE *stream, rtx x)
 {
   char buf[15];
 
-  gcc_assert (GET_CODE (x) == LABEL_REF);
+  gcc_assert (LABEL_REF_P (x));
   x = XEXP (x, 0);
 
   if (GET_CODE (x) == UNSPEC_VOLATILE && XINT (x, 1) == VUNSPEC_POOL_LABEL)
@@ -4255,10 +4255,10 @@ csky_output_movedouble (rtx operands[],
 
 	  decompose_csky_address (XEXP (src, 0), &op0);
 
-	  if (GET_CODE (memexp) == LABEL_REF
+	  if (LABEL_REF_P (memexp)
 	      || (GET_CODE (memexp) == CONST
 		  && GET_CODE (XEXP (memexp, 0)) == PLUS
-		  && GET_CODE (XEXP (XEXP (memexp, 0), 0)) == LABEL_REF))
+		  && LABEL_REF_P (XEXP (XEXP (memexp, 0), 0))))
 	    return "lrw\t%0, [%1]\n\tlrw\t%R0, [%R1]";
 	  else if (REG_P (memexp))
 	    basereg = REGNO (memexp);
@@ -4390,10 +4390,10 @@ csky_output_ck801_movedouble (rtx operands[],
 
 	  decompose_csky_address (XEXP (src, 0), &op0);
 
-	  if (GET_CODE (memexp) == LABEL_REF
+	  if (LABEL_REF_P (memexp)
 	      || (GET_CODE (memexp) == CONST
 		  && GET_CODE (XEXP (memexp, 0)) == PLUS
-		  && GET_CODE (XEXP (XEXP (memexp, 0), 0)) == LABEL_REF))
+		  && LABEL_REF_P (XEXP (XEXP (memexp, 0), 0))))
 	    return "lrw\t%0, [%1]\n\tlrw\t%R0, [%R1]";
 	  else if (REG_P (memexp))
 	    basereg = REGNO (memexp);
@@ -4732,7 +4732,7 @@ csky_symbolic_address_p (rtx x)
     case CONST:
       x = XEXP (x, 0);
       return ((GET_CODE (XEXP (x, 0)) == SYMBOL_REF
-	       || GET_CODE (XEXP (x, 0)) == LABEL_REF)
+	       || LABEL_REF_P (XEXP (x, 0)))
 	      && CONST_INT_P (XEXP (x, 1)));
     default:
       return 0;
@@ -5621,7 +5621,7 @@ csky_label_mentioned_p (rtx x)
   const char *fmt;
   int i;
 
-  if (GET_CODE (x) == LABEL_REF)
+  if (LABEL_REF_P (x))
     return true;
 
   fmt = GET_RTX_FORMAT (GET_CODE (x));
@@ -5679,7 +5679,7 @@ csky_legitimize_pic_address (rtx orig, rtx reg, bool gotrel_p)
   rtx pic_reg = gen_rtx_REG (SImode, PIC_OFFSET_TABLE_REGNUM);
   bool optimize_p = false;
 
-  if (GET_CODE (orig) == SYMBOL_REF || GET_CODE (orig) == LABEL_REF)
+  if (GET_CODE (orig) == SYMBOL_REF || LABEL_REF_P (orig))
     {
       rtx pic_ref, address, rtx_tmp;
       rtx insn;
diff --git a/gcc/config/csky/csky.h b/gcc/config/csky/csky.h
index ea95290eae2..1c86fd10b18 100644
--- a/gcc/config/csky/csky.h
+++ b/gcc/config/csky/csky.h
@@ -686,7 +686,7 @@ extern enum reg_class regno_reg_class[FIRST_PSEUDO_REGISTER];
 
 /* Recognize any constant value that is a valid address.  */
 #define CONSTANT_ADDRESS_P(X) \
-  (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF)
+  (LABEL_REF_P (X) || GET_CODE (X) == SYMBOL_REF)
 
 /* Maximum number of registers that can appear in a valid memory address.
    Shifts in addresses can't be by a register.  */
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
index ef6e27ff34c..4ca16520080 100644
--- a/gcc/config/darwin.c
+++ b/gcc/config/darwin.c
@@ -822,7 +822,7 @@ machopic_legitimize_pic_address (rtx orig, machine_mode mode, rtx reg)
     return orig;
 
   /* First handle a simple SYMBOL_REF or LABEL_REF */
-  if (GET_CODE (orig) == LABEL_REF
+  if (LABEL_REF_P (orig)
       || GET_CODE (orig) == SYMBOL_REF)
     {
       /* addr(foo) = &func+(foo-func) */
@@ -849,7 +849,7 @@ machopic_legitimize_pic_address (rtx orig, machine_mode mode, rtx reg)
 #if HAVE_lo_sum
 	  if (MACHO_DYNAMIC_NO_PIC_P
 	      && (GET_CODE (XEXP (orig, 0)) == SYMBOL_REF
-		  || GET_CODE (XEXP (orig, 0)) == LABEL_REF))
+		  || LABEL_REF_P (XEXP (orig, 0))))
 	    {
 #if defined (TARGET_TOC)	/* ppc  */
 	      rtx temp_reg = (!can_create_pseudo_p ()
@@ -872,7 +872,7 @@ machopic_legitimize_pic_address (rtx orig, machine_mode mode, rtx reg)
 	    }
 	  else
 	  if (GET_CODE (XEXP (orig, 0)) == SYMBOL_REF
-	      || GET_CODE (XEXP (orig, 0)) == LABEL_REF)
+	      || LABEL_REF_P (XEXP (orig, 0)))
 	    {
 	      rtx offset = machopic_gen_offset (XEXP (orig, 0));
 #if defined (TARGET_TOC) /* i.e., PowerPC */
@@ -942,7 +942,7 @@ machopic_legitimize_pic_address (rtx orig, machine_mode mode, rtx reg)
 
 #if HAVE_lo_sum
 	  if (GET_CODE (orig) == SYMBOL_REF
-	      || GET_CODE (orig) == LABEL_REF)
+	      || LABEL_REF_P (orig))
 	    {
 	      rtx offset = machopic_gen_offset (orig);
 #if defined (TARGET_TOC) /* i.e., PowerPC */
@@ -1025,7 +1025,7 @@ machopic_legitimize_pic_address (rtx orig, machine_mode mode, rtx reg)
   else if (GET_CODE (orig) == PLUS
 	   && (MEM_P (XEXP (orig, 0))
 	       || GET_CODE (XEXP (orig, 0)) == SYMBOL_REF
-	       || GET_CODE (XEXP (orig, 0)) == LABEL_REF)
+	       || LABEL_REF_P (XEXP (orig, 0)))
 	   && XEXP (orig, 0) != pic_offset_table_rtx
 	   && !REG_P (XEXP (orig, 1)))
 
@@ -1770,7 +1770,7 @@ machopic_select_rtx_section (machine_mode mode, rtx x,
   else if (MACHOPIC_INDIRECT
 	   && (GET_CODE (x) == SYMBOL_REF
 	       || GET_CODE (x) == CONST
-	       || GET_CODE (x) == LABEL_REF))
+	       || LABEL_REF_P (x)))
     return darwin_sections[const_data_section];
   else
     return darwin_sections[const_section];
diff --git a/gcc/config/epiphany/epiphany.h b/gcc/config/epiphany/epiphany.h
index 38f6cac5a59..8d5a9c55616 100644
--- a/gcc/config/epiphany/epiphany.h
+++ b/gcc/config/epiphany/epiphany.h
@@ -602,7 +602,7 @@ typedef struct GTY (()) machine_function
 
 /* Recognize any constant value that is a valid address.  */
 #define CONSTANT_ADDRESS_P(X) \
-(GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF	\
+(LABEL_REF_P (X) || GET_CODE (X) == SYMBOL_REF	\
  || CONST_INT_P (X) || GET_CODE (X) == CONST)
 
 #define RTX_OK_FOR_OFFSET_P(MODE, X) \
diff --git a/gcc/config/epiphany/predicates.md b/gcc/config/epiphany/predicates.md
index 07b44b5ec65..b59c23b9c10 100644
--- a/gcc/config/epiphany/predicates.md
+++ b/gcc/config/epiphany/predicates.md
@@ -27,7 +27,7 @@
   if (GET_CODE (op) == SYMBOL_REF)
     return (!epiphany_is_long_call_p (op)
 	    && (!flag_pic || SYMBOL_REF_LOCAL_P (op)));
-  if (GET_CODE (op) == LABEL_REF)
+  if (LABEL_REF_P (op))
     return true;
   if (GET_CODE (op) == CONST)
     {
diff --git a/gcc/config/frv/frv.c b/gcc/config/frv/frv.c
index e16508dba44..13e8dafbc7d 100644
--- a/gcc/config/frv/frv.c
+++ b/gcc/config/frv/frv.c
@@ -4046,7 +4046,7 @@ frv_emit_movsi (rtx dest, rtx src)
 	    sym = XEXP (sym, 0);
 	  if (GET_CODE (sym) == SYMBOL_REF)
 	    goto handle_sym;
-	  else if (GET_CODE (sym) == LABEL_REF)
+	  else if (LABEL_REF_P (sym))
 	    goto handle_label;
 	  else
 	    goto handle_whatever;
@@ -4280,7 +4280,7 @@ output_move_single (rtx operands[], rtx insn)
 	    }
 
           else if (GET_CODE (src) == SYMBOL_REF
-		   || GET_CODE (src) == LABEL_REF
+		   || LABEL_REF_P (src)
 		   || GET_CODE (src) == CONST)
 	    {
 	      return "#";
@@ -6825,7 +6825,7 @@ frv_assemble_integer (rtx value, unsigned int size, int aligned_p)
     {
       if (GET_CODE (value) == CONST
 	  || GET_CODE (value) == SYMBOL_REF
-	  || GET_CODE (value) == LABEL_REF)
+	  || LABEL_REF_P (value))
 	{
 	  if (TARGET_FDPIC && GET_CODE (value) == SYMBOL_REF
 	      && SYMBOL_REF_FUNCTION_P (value))
diff --git a/gcc/config/frv/predicates.md b/gcc/config/frv/predicates.md
index fb4f13b32e6..9fd855646c8 100644
--- a/gcc/config/frv/predicates.md
+++ b/gcc/config/frv/predicates.md
@@ -524,7 +524,7 @@
       op = XEXP (op, 0);
       if (GET_CODE (op) == PLUS && CONST_INT_P (XEXP (op, 1)))
 	op = XEXP (op, 0);
-      return GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == LABEL_REF;
+      return GET_CODE (op) == SYMBOL_REF || LABEL_REF_P (op);
 
     case SYMBOL_REF:
       if (TARGET_FDPIC)
diff --git a/gcc/config/ft32/constraints.md b/gcc/config/ft32/constraints.md
index 09a687e309a..b6f2bb1ba87 100644
--- a/gcc/config/ft32/constraints.md
+++ b/gcc/config/ft32/constraints.md
@@ -27,14 +27,14 @@
   (and (match_code "mem")
        (match_test "(!ft32_is_mem_pm(op))")
        (ior (match_test "GET_CODE (XEXP (op, 0)) == SYMBOL_REF")
-            (match_test "GET_CODE (XEXP (op, 0)) == LABEL_REF")
+            (match_test "LABEL_REF_P (XEXP (op, 0))")
             (match_test "CONST_INT_P (XEXP (op, 0))")
             (and (match_test "(GET_CODE (XEXP (op, 0)) == PLUS)")
                  (ior (match_test "GET_CODE (XEXP (XEXP (op, 0), 0)) == SYMBOL_REF")
-                      (match_test "GET_CODE (XEXP (XEXP (op, 0), 0)) == LABEL_REF")
+                      (match_test "LABEL_REF_P (XEXP (XEXP (op, 0), 0))")
                       (match_test "CONST_INT_P (XEXP (XEXP (op, 0), 0))"))
                  (ior (match_test "GET_CODE (XEXP (XEXP (op, 0), 1)) == SYMBOL_REF")
-                      (match_test "GET_CODE (XEXP (XEXP (op, 0), 1)) == LABEL_REF")
+                      (match_test "LABEL_REF_P (XEXP (XEXP (op, 0), 1))")
                       (match_test "CONST_INT_P (XEXP (XEXP (op, 0), 1))"))))))
 
 (define_memory_constraint "B"
@@ -55,7 +55,7 @@
   (and (match_code "mem")
        (match_test "ft32_is_mem_pm(op) && (
           (GET_CODE (XEXP (op, 0)) == SYMBOL_REF) ||
-          (GET_CODE (XEXP (op, 0)) == LABEL_REF) ||
+          (LABEL_REF_P (XEXP (op, 0))) ||
           (CONST_INT_P (XEXP (op, 0))) ||
           (GET_CODE (XEXP (op, 0)) == CONST))"
        )))
@@ -98,7 +98,7 @@
   (ior
     (and (match_code "const_int")
          (match_test "ival >= -524288 && ival <= 524287"))
-    (match_test "GET_CODE (op) == LABEL_REF")
+    (match_test "LABEL_REF_P (op)")
     (match_test "GET_CODE (op) == SYMBOL_REF")
     (match_test "GET_CODE (op) == CONST")))
 
diff --git a/gcc/config/ft32/ft32.c b/gcc/config/ft32/ft32.c
index d0f2ce262db..87defc3824f 100644
--- a/gcc/config/ft32/ft32.c
+++ b/gcc/config/ft32/ft32.c
@@ -890,7 +890,7 @@ ft32_addr_space_legitimate_address_p (machine_mode mode, rtx x, bool strict,
       if (REG_P (x) && reg_ok_for_base_p (x, strict))
         goto yes;
       if (GET_CODE (x) == SYMBOL_REF
-          || GET_CODE (x) == LABEL_REF || CONST_INT_P (x))
+          || LABEL_REF_P (x) || CONST_INT_P (x))
         goto yes;
     }
   else
diff --git a/gcc/config/ft32/ft32.md b/gcc/config/ft32/ft32.md
index 174ef8d0bf7..cf30c11848d 100644
--- a/gcc/config/ft32/ft32.md
+++ b/gcc/config/ft32/ft32.md
@@ -301,7 +301,7 @@
         if (!REG_P(o) &&
             !CONST_INT_P(o) &&
             GET_CODE(o) != SYMBOL_REF &&
-            GET_CODE(o) != LABEL_REF) {
+            !LABEL_REF_P (o)) {
           operands[0] = gen_rtx_MEM (SImode, force_reg (SImode, XEXP (operands[0], 0)));
         }
       }
@@ -440,7 +440,7 @@
           if (!REG_P(o) &&
               !CONST_INT_P(o) &&
               GET_CODE(o) != SYMBOL_REF &&
-              GET_CODE(o) != LABEL_REF) {
+              !LABEL_REF_P (o)) {
             operands[0] = gen_rtx_MEM (HImode, force_reg (SImode, XEXP (operands[0], 0)));
           }
         }
diff --git a/gcc/config/ft32/predicates.md b/gcc/config/ft32/predicates.md
index a77301f0b37..51bdedd60ef 100644
--- a/gcc/config/ft32/predicates.md
+++ b/gcc/config/ft32/predicates.md
@@ -33,7 +33,7 @@
   (match_code "mem,const_int,reg,subreg,symbol_ref,label_ref,const")
 {
   /* Any (MEM LABEL_REF) is OK.  That is a pc-relative load.  */
-  if (MEM_P (op) && GET_CODE (XEXP (op, 0)) == LABEL_REF)
+  if (MEM_P (op) && LABEL_REF_P (XEXP (op, 0)))
     return 1;
 
   if (MEM_P (op)
diff --git a/gcc/config/gcn/gcn.c b/gcc/config/gcn/gcn.c
index bc57f0d7c33..402713135d4 100644
--- a/gcc/config/gcn/gcn.c
+++ b/gcc/config/gcn/gcn.c
@@ -2112,14 +2112,14 @@ gcn_valid_move_p (machine_mode mode, rtx dest, rtx src)
       && AS_FLAT_P (MEM_ADDR_SPACE (dest))
       && (gcn_flat_address_p (XEXP (dest, 0), mode)
 	  || GET_CODE (XEXP (dest, 0)) == SYMBOL_REF
-	  || GET_CODE (XEXP (dest, 0)) == LABEL_REF)
+	  || LABEL_REF_P (XEXP (dest, 0)))
       && gcn_vgpr_register_operand (src, mode))
     return true;
   else if (MEM_P (src)
 	   && AS_FLAT_P (MEM_ADDR_SPACE (src))
 	   && (gcn_flat_address_p (XEXP (src, 0), mode)
 	       || GET_CODE (XEXP (src, 0)) == SYMBOL_REF
-	       || GET_CODE (XEXP (src, 0)) == LABEL_REF)
+	       || LABEL_REF_P (XEXP (src, 0)))
 	   && gcn_vgpr_register_operand (dest, mode))
     return true;
 
@@ -2127,14 +2127,14 @@ gcn_valid_move_p (machine_mode mode, rtx dest, rtx src)
       && AS_GLOBAL_P (MEM_ADDR_SPACE (dest))
       && (gcn_global_address_p (XEXP (dest, 0))
 	  || GET_CODE (XEXP (dest, 0)) == SYMBOL_REF
-	  || GET_CODE (XEXP (dest, 0)) == LABEL_REF)
+	  || LABEL_REF_P (XEXP (dest, 0)))
       && gcn_vgpr_register_operand (src, mode))
     return true;
   else if (MEM_P (src)
 	   && AS_GLOBAL_P (MEM_ADDR_SPACE (src))
 	   && (gcn_global_address_p (XEXP (src, 0))
 	       || GET_CODE (XEXP (src, 0)) == SYMBOL_REF
-	       || GET_CODE (XEXP (src, 0)) == LABEL_REF)
+	       || LABEL_REF_P (XEXP (src, 0)))
 	   && gcn_vgpr_register_operand (dest, mode))
     return true;
 
@@ -2142,14 +2142,14 @@ gcn_valid_move_p (machine_mode mode, rtx dest, rtx src)
       && MEM_ADDR_SPACE (dest) == ADDR_SPACE_SCALAR_FLAT
       && (gcn_scalar_flat_address_p (XEXP (dest, 0))
 	  || GET_CODE (XEXP (dest, 0)) == SYMBOL_REF
-	  || GET_CODE (XEXP (dest, 0)) == LABEL_REF)
+	  || LABEL_REF_P (XEXP (dest, 0)))
       && gcn_ssrc_register_operand (src, mode))
     return true;
   else if (MEM_P (src)
 	   && MEM_ADDR_SPACE (src) == ADDR_SPACE_SCALAR_FLAT
 	   && (gcn_scalar_flat_address_p (XEXP (src, 0))
 	       || GET_CODE (XEXP (src, 0)) == SYMBOL_REF
-	       || GET_CODE (XEXP (src, 0)) == LABEL_REF)
+	       || LABEL_REF_P (XEXP (src, 0)))
 	   && gcn_sdst_register_operand (dest, mode))
     return true;
 
diff --git a/gcc/config/gcn/gcn.md b/gcc/config/gcn/gcn.md
index f4c8e8d1251..202805b486a 100644
--- a/gcc/config/gcn/gcn.md
+++ b/gcc/config/gcn/gcn.md
@@ -407,7 +407,7 @@
 
     if (<MODE>mode == DImode
 	&& (GET_CODE (operands[1]) == SYMBOL_REF
-	    || GET_CODE (operands[1]) == LABEL_REF))
+	    || LABEL_REF_P (operands[1])))
       {
 	if (lra_in_progress)
 	  emit_insn (gen_movdi_symbol_save_scc (operands[0], operands[1]));
@@ -819,7 +819,7 @@
  [(set (match_operand:DI 0 "nonimmediate_operand" "=Sg")
        (match_operand:DI 1 "general_operand" "Y"))
   (clobber (reg:BI SCC_REG))]
- "GET_CODE (operands[1]) == SYMBOL_REF || GET_CODE (operands[1]) == LABEL_REF"
+ "GET_CODE (operands[1]) == SYMBOL_REF || LABEL_REF_P (operands[1])"
   {
     if (SYMBOL_REF_P (operands[1])
 	&& SYMBOL_REF_WEAK (operands[1]))
@@ -840,7 +840,7 @@
  [(set (match_operand:DI 0 "nonimmediate_operand" "=Sg")
        (match_operand:DI 1 "general_operand" "Y"))
   (clobber (reg:BI CC_SAVE_REG))]
- "(GET_CODE (operands[1]) == SYMBOL_REF || GET_CODE (operands[1]) == LABEL_REF)
+ "(GET_CODE (operands[1]) == SYMBOL_REF || LABEL_REF_P (operands[1]))
   && (lra_in_progress || reload_completed)"
   {
     /* !!! These sequences clobber CC_SAVE_REG.  */
diff --git a/gcc/config/h8300/h8300.h b/gcc/config/h8300/h8300.h
index 7a676f7ba8d..f0f95125404 100644
--- a/gcc/config/h8300/h8300.h
+++ b/gcc/config/h8300/h8300.h
@@ -477,7 +477,7 @@ struct cum_arg
 /* 1 if X is an rtx for a constant that is a valid address.  */
 
 #define CONSTANT_ADDRESS_P(X)					\
-  (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF	\
+  (LABEL_REF_P (X) || GET_CODE (X) == SYMBOL_REF	\
    || (CONST_INT_P (X)				\
        /* We handle signed and unsigned offsets here.  */	\
        && INTVAL (X) > (TARGET_H8300 ? -0x10000 : -0x1000000)	\
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 180a0a1c88d..4b74e1fe0f2 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -4941,7 +4941,7 @@ symbolic_reference_mentioned_p (rtx op)
   const char *fmt;
   int i;
 
-  if (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == LABEL_REF)
+  if (GET_CODE (op) == SYMBOL_REF || LABEL_REF_P (op))
     return true;
 
   fmt = GET_RTX_FORMAT (GET_CODE (op));
@@ -9886,7 +9886,7 @@ ix86_legitimate_constant_p (machine_mode mode, rtx x)
 	  }
 
       /* We must have drilled down to a symbol.  */
-      if (GET_CODE (x) == LABEL_REF)
+      if (LABEL_REF_P (x))
 	return true;
       if (GET_CODE (x) != SYMBOL_REF)
 	return false;
@@ -10056,7 +10056,7 @@ legitimate_pic_address_disp_p (rtx disp)
 	  if (INTVAL (op1) >= 16*1024*1024
 	      || INTVAL (op1) < -16*1024*1024)
 	    break;
-	  if (GET_CODE (op0) == LABEL_REF)
+	  if (LABEL_REF_P (op0))
 	    return true;
 	  if (GET_CODE (op0) == CONST
 	      && GET_CODE (XEXP (op0, 0)) == UNSPEC
@@ -10130,7 +10130,7 @@ legitimate_pic_address_disp_p (rtx disp)
 	return false;
 
       if (GET_CODE (XVECEXP (disp, 0, 0)) != SYMBOL_REF
-	  && GET_CODE (XVECEXP (disp, 0, 0)) != LABEL_REF)
+	  && !LABEL_REF_P (XVECEXP (disp, 0, 0)))
 	return false;
       return true;
     }
@@ -10159,13 +10159,13 @@ legitimate_pic_address_disp_p (rtx disp)
 	 text labels with @GOT rather than @GOTOFF.  See gotoff_operand for
 	 details.  */
       return (GET_CODE (XVECEXP (disp, 0, 0)) == SYMBOL_REF
-	      || GET_CODE (XVECEXP (disp, 0, 0)) == LABEL_REF);
+	      || LABEL_REF_P (XVECEXP (disp, 0, 0)));
     case UNSPEC_GOTOFF:
       /* Refuse GOTOFF in 64bit mode since it is always 64bit when used.
 	 While ABI specify also 32bit relocation but we don't produce it in
 	 small PIC model at all.  */
       if ((GET_CODE (XVECEXP (disp, 0, 0)) == SYMBOL_REF
-	   || GET_CODE (XVECEXP (disp, 0, 0)) == LABEL_REF)
+	   || LABEL_REF_P (XVECEXP (disp, 0, 0)))
 	  && !TARGET_64BIT)
         return !TARGET_PECOFF && gotoff_operand (XVECEXP (disp, 0, 0), Pmode);
       return false;
@@ -10408,7 +10408,7 @@ ix86_legitimate_address_p (machine_mode, rtx addr, bool strict)
 	     that never results in lea, this seems to be easier and
 	     correct fix for crash to disable this test.  */
 	}
-      else if (GET_CODE (disp) != LABEL_REF
+      else if (!LABEL_REF_P (disp)
 	       && !CONST_INT_P (disp)
 	       && (GET_CODE (disp) != CONST
 		   || !ix86_legitimate_constant_p (Pmode, disp))
@@ -10530,7 +10530,7 @@ legitimize_pic_address (rtx orig, rtx reg)
   else if ((GET_CODE (addr) == SYMBOL_REF && SYMBOL_REF_TLS_MODEL (addr) == 0)
 	   /* We can't use @GOTOFF for text labels
 	      on VxWorks, see gotoff_operand.  */
-	   || (TARGET_VXWORKS_RTP && GET_CODE (addr) == LABEL_REF))
+	   || (TARGET_VXWORKS_RTP && LABEL_REF_P (addr)))
     {
       rtx tmp = legitimize_pe_coff_symbol (addr, true);
       if (tmp)
@@ -10654,7 +10654,7 @@ legitimize_pic_address (rtx orig, rtx reg)
 		     just disp32, not base nor index.  */
 		  if (TARGET_64BIT
 		      && (GET_CODE (base) == SYMBOL_REF
-			  || GET_CODE (base) == LABEL_REF))
+			  || LABEL_REF_P (base)))
 		    base = force_reg (mode, base);
 		  if (GET_CODE (new_rtx) == PLUS
 		      && CONSTANT_P (XEXP (new_rtx, 1)))
@@ -12957,7 +12957,7 @@ ix86_print_operand (FILE *file, rtx x, int code)
 		putc ('$', file);
 	    }
 	  else if (GET_CODE (x) == CONST || GET_CODE (x) == SYMBOL_REF
-		   || GET_CODE (x) == LABEL_REF)
+		   || LABEL_REF_P (x))
 	    {
 	      if (ASSEMBLER_DIALECT == ASM_ATT)
 		putc ('$', file);
@@ -13052,7 +13052,7 @@ ix86_print_operand_address_as (FILE *file, rtx addr,
 	  && CONST_INT_P (XEXP (XEXP (disp, 0), 1)))
 	symbol = XEXP (XEXP (disp, 0), 0);
 
-      if (GET_CODE (symbol) == LABEL_REF
+      if (LABEL_REF_P (symbol)
 	  || (GET_CODE (symbol) == SYMBOL_REF
 	      && SYMBOL_REF_TLS_MODEL (symbol) == 0))
 	base = pc_rtx;
@@ -13141,7 +13141,7 @@ ix86_print_operand_address_as (FILE *file, rtx addr,
 	    {
 	      if (flag_pic)
 		output_pic_addr_const (file, disp, 0);
-	      else if (GET_CODE (disp) == LABEL_REF)
+	      else if (LABEL_REF_P (disp))
 		output_asm_label (disp);
 	      else
 		output_addr_const (file, disp);
@@ -13177,7 +13177,7 @@ ix86_print_operand_address_as (FILE *file, rtx addr,
 
 	      if (flag_pic)
 		output_pic_addr_const (file, disp, 0);
-	      else if (GET_CODE (disp) == LABEL_REF)
+	      else if (LABEL_REF_P (disp))
 		output_asm_label (disp);
 	      else if (CONST_INT_P (disp))
 		offset = disp;
@@ -15663,7 +15663,7 @@ ix86_rip_relative_addr_p (struct ix86_address *parts)
 	      && CONST_INT_P (XEXP (symbol, 1)))
 	    symbol = XEXP (symbol, 0);
 
-	  if (GET_CODE (symbol) == LABEL_REF
+	  if (LABEL_REF_P (symbol)
 	      || (GET_CODE (symbol) == SYMBOL_REF
 		  && SYMBOL_REF_TLS_MODEL (symbol) == 0)
 	      || (GET_CODE (symbol) == UNSPEC
diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h
index fba015c4260..3f037a72b18 100644
--- a/gcc/config/i386/i386.h
+++ b/gcc/config/i386/i386.h
@@ -1844,7 +1844,7 @@ typedef struct ix86_args {
 
 #define SYMBOLIC_CONST(X)	\
   (GET_CODE (X) == SYMBOL_REF						\
-   || GET_CODE (X) == LABEL_REF						\
+   || LABEL_REF_P (X)						\
    || (GET_CODE (X) == CONST && symbolic_reference_mentioned_p (X)))
 
 /* Max number of args passed in registers.  If this is more than 3, we will
diff --git a/gcc/config/i386/i386.md b/gcc/config/i386/i386.md
index e19a591fa9d..785a0d11b1b 100644
--- a/gcc/config/i386/i386.md
+++ b/gcc/config/i386/i386.md
@@ -8477,7 +8477,7 @@
 	      (clobber (reg:CC FLAGS_REG))])]
 {
   if (GET_CODE (operands[2]) == SYMBOL_REF
-      || GET_CODE (operands[2]) == LABEL_REF)
+      || LABEL_REF_P (operands[2]))
     {
       operands[2] = shallow_copy_rtx (operands[2]);
       PUT_MODE (operands[2], SImode);
diff --git a/gcc/config/i386/predicates.md b/gcc/config/i386/predicates.md
index 8a241915ee8..9cf0473bd97 100644
--- a/gcc/config/i386/predicates.md
+++ b/gcc/config/i386/predicates.md
@@ -511,7 +511,7 @@
     case CONST:
       op = XEXP (op, 0);
       if (GET_CODE (op) == SYMBOL_REF
-	  || GET_CODE (op) == LABEL_REF
+	  || LABEL_REF_P (op)
 	  || (GET_CODE (op) == UNSPEC
 	      && (XINT (op, 1) == UNSPEC_GOT
 		  || XINT (op, 1) == UNSPEC_GOTOFF
@@ -524,7 +524,7 @@
 
       op = XEXP (op, 0);
       if (GET_CODE (op) == SYMBOL_REF
-	  || GET_CODE (op) == LABEL_REF)
+	  || LABEL_REF_P (op))
 	return true;
       /* Only @GOTOFF gets offsets.  */
       if (GET_CODE (op) != UNSPEC
@@ -533,7 +533,7 @@
 
       op = XVECEXP (op, 0, 0);
       if (GET_CODE (op) == SYMBOL_REF
-	  || GET_CODE (op) == LABEL_REF)
+	  || LABEL_REF_P (op))
 	return true;
       return false;
 
@@ -551,7 +551,7 @@
       && CONST_INT_P (XEXP (XEXP (op, 0), 1)))
     op = XEXP (XEXP (op, 0), 0);
 
-  if (GET_CODE (op) == LABEL_REF)
+  if (LABEL_REF_P (op))
     return true;
 
   if (GET_CODE (op) != SYMBOL_REF)
@@ -1132,7 +1132,7 @@
       if (TARGET_64BIT
 	  && flag_pic
 	  && (GET_CODE (disp) == SYMBOL_REF
-	      || GET_CODE (disp) == LABEL_REF))
+	      || LABEL_REF_P (disp)))
 	return false;
     }
 
diff --git a/gcc/config/iq2000/iq2000.c b/gcc/config/iq2000/iq2000.c
index 74e52a16c7b..44a6fbfe122 100644
--- a/gcc/config/iq2000/iq2000.c
+++ b/gcc/config/iq2000/iq2000.c
@@ -292,7 +292,7 @@ iq2000_check_split (rtx address, machine_mode mode)
   if ((GET_CODE (address) == SYMBOL_REF)
       || (GET_CODE (address) == CONST
 	  && GET_CODE (XEXP (XEXP (address, 0), 0)) == SYMBOL_REF)
-      || GET_CODE (address) == LABEL_REF)
+      || LABEL_REF_P (address))
     return 1;
 
   return 0;
@@ -822,7 +822,7 @@ iq2000_address_cost (rtx addr, machine_mode mode, addr_space_t as,
 	rtx offset = const0_rtx;
 
 	addr = eliminate_constant_term (XEXP (addr, 0), & offset);
-	if (GET_CODE (addr) == LABEL_REF)
+	if (LABEL_REF_P (addr))
 	  return 2;
 
 	if (GET_CODE (addr) != SYMBOL_REF)
@@ -3441,7 +3441,7 @@ iq2000_rtx_costs (rtx x, machine_mode mode, int outer_code ATTRIBUTE_UNUSED,
 	rtx offset = const0_rtx;
 	rtx symref = eliminate_constant_term (XEXP (x, 0), & offset);
 
-	if (GET_CODE (symref) == LABEL_REF)
+	if (LABEL_REF_P (symref))
 	  * total = COSTS_N_INSNS (2);
 	else if (GET_CODE (symref) != SYMBOL_REF)
 	  * total = COSTS_N_INSNS (4);
diff --git a/gcc/config/iq2000/iq2000.h b/gcc/config/iq2000/iq2000.h
index 04a36ab35b1..5224b0a49be 100644
--- a/gcc/config/iq2000/iq2000.h
+++ b/gcc/config/iq2000/iq2000.h
@@ -345,7 +345,7 @@ typedef struct iq2000_args
 /* Addressing Modes.  */
 
 #define CONSTANT_ADDRESS_P(X)						\
-  (   (GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF		\
+  (   (LABEL_REF_P (X) || GET_CODE (X) == SYMBOL_REF		\
     || CONST_INT_P (X) || GET_CODE (X) == HIGH		\
     || (GET_CODE (X) == CONST)))
 
diff --git a/gcc/config/iq2000/predicates.md b/gcc/config/iq2000/predicates.md
index e75fb05cac7..c2a0f54b769 100644
--- a/gcc/config/iq2000/predicates.md
+++ b/gcc/config/iq2000/predicates.md
@@ -193,7 +193,7 @@
   if (op == pc_rtx)
     return 1;
 
-  if (GET_CODE (op) == LABEL_REF)
+  if (LABEL_REF_P (op))
     return 1;
 
   return 0;
diff --git a/gcc/config/lm32/lm32.c b/gcc/config/lm32/lm32.c
index 13ad0bf65d7..9f7c4cc54aa 100644
--- a/gcc/config/lm32/lm32.c
+++ b/gcc/config/lm32/lm32.c
@@ -899,7 +899,7 @@ nonpic_symbol_mentioned_p (rtx x)
   const char *fmt;
   int i;
 
-  if (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF
+  if (GET_CODE (x) == SYMBOL_REF || LABEL_REF_P (x)
       || GET_CODE (x) == PC)
     return 1;
 
diff --git a/gcc/config/lm32/lm32.h b/gcc/config/lm32/lm32.h
index 8e98e37d16a..636e13e25e7 100644
--- a/gcc/config/lm32/lm32.h
+++ b/gcc/config/lm32/lm32.h
@@ -305,7 +305,7 @@ enum reg_class
 /*---------------------*/
 
 #define CONSTANT_ADDRESS_P(X)						\
-  ((GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF		\
+  ((LABEL_REF_P (X) || GET_CODE (X) == SYMBOL_REF		\
     || CONST_INT_P (X) || GET_CODE (X) == HIGH		\
     || (GET_CODE (X) == CONST)))
 
diff --git a/gcc/config/lm32/lm32.md b/gcc/config/lm32/lm32.md
index 76fe95bbf18..31337484f13 100644
--- a/gcc/config/lm32/lm32.md
+++ b/gcc/config/lm32/lm32.md
@@ -148,7 +148,7 @@
 
   if (flag_pic && symbolic_operand (operands[1], SImode)) 
     {
-      if (GET_CODE (operands[1]) == LABEL_REF
+      if (LABEL_REF_P (operands[1])
           || (GET_CODE (operands[1]) == SYMBOL_REF 
               && SYMBOL_REF_LOCAL_P (operands[1])
               && !SYMBOL_REF_WEAK (operands[1])))
@@ -173,7 +173,7 @@
         {
           rtx arg0 = XEXP (op, 0);
           rtx arg1 = XEXP (op, 1);
-          if (GET_CODE (arg0) == LABEL_REF
+          if (LABEL_REF_P (arg0)
               || (GET_CODE (arg0) == SYMBOL_REF 
                   && SYMBOL_REF_LOCAL_P (arg0)
                   && !SYMBOL_REF_WEAK (arg0)))
diff --git a/gcc/config/m32r/constraints.md b/gcc/config/m32r/constraints.md
index ad338e75d3f..0734a88a841 100644
--- a/gcc/config/m32r/constraints.md
+++ b/gcc/config/m32r/constraints.md
@@ -106,13 +106,13 @@
 (define_constraint "Q"
   "A symbolic address loadable when ld24."
   (ior (and (match_test "TARGET_ADDR24")
-	    (match_test "GET_CODE (op) == LABEL_REF"))
+	    (match_test "LABEL_REF_P (op)"))
        (match_test "addr24_operand (op, VOIDmode)")))
 
 (define_constraint "R"
   "A symbolic address loadable with ld24 can't be used."
   (ior (and (match_test "TARGET_ADDR32")
-	    (match_test "GET_CODE (op) == LABEL_REF"))
+	    (match_test "LABEL_REF_P (op)"))
        (match_test "addr32_operand (op, VOIDmode)")))
 
 (define_constraint "S"
diff --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c
index 044718fdc69..19533fa4323 100644
--- a/gcc/config/m32r/m32r.c
+++ b/gcc/config/m32r/m32r.c
@@ -571,7 +571,7 @@ addr24_operand (rtx op, machine_mode mode ATTRIBUTE_UNUSED)
   if (flag_pic)
     return 0;
 
-  if (GET_CODE (op) == LABEL_REF)
+  if (LABEL_REF_P (op))
     return TARGET_ADDR24;
 
   if (GET_CODE (op) == SYMBOL_REF)
@@ -602,7 +602,7 @@ addr32_operand (rtx op, machine_mode mode)
 {
   rtx sym;
 
-  if (GET_CODE (op) == LABEL_REF)
+  if (LABEL_REF_P (op))
     return TARGET_ADDR32;
 
   if (GET_CODE (op) == SYMBOL_REF)
@@ -1931,13 +1931,13 @@ direct_return (void)
 int
 m32r_legitimate_pic_operand_p (rtx x)
 {
-  if (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF)
+  if (GET_CODE (x) == SYMBOL_REF || LABEL_REF_P (x))
     return 0;
 
   if (GET_CODE (x) == CONST
       && GET_CODE (XEXP (x, 0)) == PLUS
       && (GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF
-          || GET_CODE (XEXP (XEXP (x, 0), 0)) == LABEL_REF)
+          || LABEL_REF_P (XEXP (XEXP (x, 0), 0)))
       && (CONST_INT_P (XEXP (XEXP (x, 0), 1))))
     return 0;
 
@@ -1951,7 +1951,7 @@ m32r_legitimize_pic_address (rtx orig, rtx reg)
   printf("m32r_legitimize_pic_address()\n");
 #endif
 
-  if (GET_CODE (orig) == SYMBOL_REF || GET_CODE (orig) == LABEL_REF)
+  if (GET_CODE (orig) == SYMBOL_REF || LABEL_REF_P (orig))
     {
       rtx pic_ref, address;
       int subregs = 0;
@@ -1971,7 +1971,7 @@ m32r_legitimize_pic_address (rtx orig, rtx reg)
 
       crtl->uses_pic_offset_table = 1;
 
-      if (GET_CODE (orig) == LABEL_REF
+      if (LABEL_REF_P (orig)
           || (GET_CODE (orig) == SYMBOL_REF && SYMBOL_REF_LOCAL_P (orig)))
         {
           emit_insn (gen_gotoff_load_addr (reg, orig));
@@ -2964,7 +2964,7 @@ m32r_legitimate_constant_p (machine_mode mode ATTRIBUTE_UNUSED, rtx x)
   return !(GET_CODE (x) == CONST
 	   && GET_CODE (XEXP (x, 0)) == PLUS
 	   && (GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF
-	       || GET_CODE (XEXP (XEXP (x, 0), 0)) == LABEL_REF)
+	       || LABEL_REF_P (XEXP (XEXP (x, 0), 0)))
 	   && CONST_INT_P (XEXP (XEXP (x, 0), 1))
 	   && UINTVAL (XEXP (XEXP (x, 0), 1)) > 32767);
 }
diff --git a/gcc/config/m32r/m32r.h b/gcc/config/m32r/m32r.h
index 2e7aacf0ccc..99b976523a8 100644
--- a/gcc/config/m32r/m32r.h
+++ b/gcc/config/m32r/m32r.h
@@ -685,7 +685,7 @@ L2:     .word STATIC
 
 /* Recognize any constant value that is a valid address.  */
 #define CONSTANT_ADDRESS_P(X)   \
-  (    GET_CODE (X) == LABEL_REF  \
+  (    LABEL_REF_P (X)  \
    ||  GET_CODE (X) == SYMBOL_REF \
    ||  CONST_INT_P (X)  \
    || (GET_CODE (X) == CONST      \
diff --git a/gcc/config/m32r/predicates.md b/gcc/config/m32r/predicates.md
index 1d7e195f5bd..e180aee143e 100644
--- a/gcc/config/m32r/predicates.md
+++ b/gcc/config/m32r/predicates.md
@@ -427,7 +427,7 @@
     return 0;
 
   if (GET_CODE (op) == SYMBOL_REF
-      || GET_CODE (op) == LABEL_REF)
+      || LABEL_REF_P (op))
     return 1;
 
   if (GET_CODE (op) == CONST
diff --git a/gcc/config/m68k/constraints.md b/gcc/config/m68k/constraints.md
index 2ccb5dd7570..c0318055286 100644
--- a/gcc/config/m68k/constraints.md
+++ b/gcc/config/m68k/constraints.md
@@ -88,7 +88,7 @@
   (and (match_code "mem")
        (match_test "TARGET_PCREL
 		    && (GET_CODE (XEXP (op, 0)) == SYMBOL_REF
-			|| GET_CODE (XEXP (op, 0)) == LABEL_REF
+			|| LABEL_REF_P (XEXP (op, 0))
 			|| GET_CODE (XEXP (op, 0)) == CONST)")))
 
 (define_constraint "T"
diff --git a/gcc/config/m68k/m68k.c b/gcc/config/m68k/m68k.c
index 0f4c1f4fda9..64cedf626e9 100644
--- a/gcc/config/m68k/m68k.c
+++ b/gcc/config/m68k/m68k.c
@@ -1985,7 +1985,7 @@ m68k_legitimate_constant_address_p (rtx x, unsigned int reach, bool strict_p)
 static bool
 m68k_jump_table_ref_p (rtx x)
 {
-  if (GET_CODE (x) != LABEL_REF)
+  if (!LABEL_REF_P (x))
     return false;
 
   rtx_insn *insn = as_a <rtx_insn *> (XEXP (x, 0));
@@ -2471,7 +2471,7 @@ legitimize_pic_address (rtx orig, machine_mode mode ATTRIBUTE_UNUSED,
   rtx pic_ref = orig;
 
   /* First handle a simple SYMBOL_REF or LABEL_REF */
-  if (GET_CODE (orig) == SYMBOL_REF || GET_CODE (orig) == LABEL_REF)
+  if (GET_CODE (orig) == SYMBOL_REF || LABEL_REF_P (orig))
     {
       gcc_assert (reg);
 
@@ -4662,7 +4662,7 @@ m68k_delegitimize_address (rtx orig_x)
 	  && XINT (unspec, 1) != UNSPEC_RELOC32))
     return orig_x;
   x = XVECEXP (unspec, 0, 0);
-  gcc_assert (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF);
+  gcc_assert (GET_CODE (x) == SYMBOL_REF || LABEL_REF_P (x));
   if (unspec != XEXP (addr.offset, 0))
     x = gen_rtx_PLUS (Pmode, x, XEXP (XEXP (addr.offset, 0), 1));
   if (addr.index)
@@ -4757,7 +4757,7 @@ print_operand_address (FILE *file, rtx addr)
 	 label being accessed, otherwise it is -1.  */
       labelno = (address.offset
 		 && !address.base
-		 && GET_CODE (address.offset) == LABEL_REF
+		 && LABEL_REF_P (address.offset)
 		 ? CODE_LABEL_NUMBER (XEXP (address.offset, 0))
 		 : -1);
       if (MOTOROLA)
diff --git a/gcc/config/m68k/m68k.h b/gcc/config/m68k/m68k.h
index 4f7adbff060..cd74628fe55 100644
--- a/gcc/config/m68k/m68k.h
+++ b/gcc/config/m68k/m68k.h
@@ -630,7 +630,7 @@ __transfer_from_trampoline ()					\
 #define MAX_REGS_PER_ADDRESS 2
 
 #define CONSTANT_ADDRESS_P(X)						\
-  ((GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF		\
+  ((LABEL_REF_P (X) || GET_CODE (X) == SYMBOL_REF		\
     || CONST_INT_P (X) || GET_CODE (X) == CONST		\
     || GET_CODE (X) == HIGH)						\
    && m68k_legitimate_constant_p (Pmode, X))
diff --git a/gcc/config/m68k/predicates.md b/gcc/config/m68k/predicates.md
index 3238211a0de..6fa1df65938 100644
--- a/gcc/config/m68k/predicates.md
+++ b/gcc/config/m68k/predicates.md
@@ -27,7 +27,7 @@
   if (TARGET_PCREL
       && MEM_P (op)
       && (GET_CODE (XEXP (op, 0)) == SYMBOL_REF
-	  || GET_CODE (XEXP (op, 0)) == LABEL_REF
+	  || LABEL_REF_P (XEXP (op, 0))
 	  || GET_CODE (XEXP (op, 0)) == CONST))
     return 1;
   return general_operand (op, mode);
@@ -42,7 +42,7 @@
 {
   if (TARGET_PCREL && MEM_P (op)
       && (GET_CODE (XEXP (op, 0)) == SYMBOL_REF
-	  || GET_CODE (XEXP (op, 0)) == LABEL_REF
+	  || LABEL_REF_P (XEXP (op, 0))
 	  || GET_CODE (XEXP (op, 0)) == CONST))
     return 1;
   return nonimmediate_operand (op, mode);
@@ -56,7 +56,7 @@
 {
   if (TARGET_PCREL && MEM_P (op)
       && (GET_CODE (XEXP (op, 0)) == SYMBOL_REF
-	  || GET_CODE (XEXP (op, 0)) == LABEL_REF
+	  || LABEL_REF_P (XEXP (op, 0))
 	  || GET_CODE (XEXP (op, 0)) == CONST))
     return 1;
   return memory_operand (op, mode);
@@ -151,7 +151,7 @@
     case CONST:
       op = XEXP (op, 0);
       return ((GET_CODE (XEXP (op, 0)) == SYMBOL_REF
-	       || GET_CODE (XEXP (op, 0)) == LABEL_REF)
+	       || LABEL_REF_P (XEXP (op, 0)))
 	      && CONST_INT_P (XEXP (op, 1)));
 
 #if 0 /* Deleted, with corresponding change in m68k.h,
diff --git a/gcc/config/mcore/constraints.md b/gcc/config/mcore/constraints.md
index 7e00a2c587e..95750775517 100644
--- a/gcc/config/mcore/constraints.md
+++ b/gcc/config/mcore/constraints.md
@@ -93,7 +93,7 @@
 (define_constraint "R"
   "@internal"
   (and (match_code "mem")
-       (match_test "GET_CODE (XEXP (op, 0)) == LABEL_REF")))
+       (match_test "LABEL_REF_P (XEXP (op, 0))")))
 
 (define_constraint "S"
   "An integer constant with 0, 1, or 2 bits clear."
diff --git a/gcc/config/mcore/mcore.c b/gcc/config/mcore/mcore.c
index 30d8c8b7c58..d7c70861426 100644
--- a/gcc/config/mcore/mcore.c
+++ b/gcc/config/mcore/mcore.c
@@ -699,7 +699,7 @@ mcore_symbolic_address_p (rtx x)
     case CONST:
       x = XEXP (x, 0);
       return (   (GET_CODE (XEXP (x, 0)) == SYMBOL_REF
-	       || GET_CODE (XEXP (x, 0)) == LABEL_REF)
+	       || LABEL_REF_P (XEXP (x, 0)))
 	      && CONST_INT_P (XEXP (x, 1)));
     default:
       return 0;
@@ -1293,7 +1293,7 @@ mcore_output_move (rtx insn ATTRIBUTE_UNUSED, rtx operands[],
 	}
       else if (MEM_P (src))
 	{
-	  if (GET_CODE (XEXP (src, 0)) == LABEL_REF) 
+	  if (LABEL_REF_P (XEXP (src, 0))) 
             return "lrw\t%0,[%1]";              /* a-R */
 	  else
 	    switch (GET_MODE (src))		/* r-m */
@@ -1371,7 +1371,7 @@ mcore_output_movedouble (rtx operands[], machine_mode mode ATTRIBUTE_UNUSED)
 	  int dstreg = REGNO (dst);
 	  int basereg = -1;
 	  
-	  if (GET_CODE (memexp) == LABEL_REF)
+	  if (LABEL_REF_P (memexp))
 	    return "lrw\t%0,[%1]\n\tlrw\t%R0,[%R1]";
 	  else if (REG_P (memexp)) 
 	    basereg = REGNO (memexp);
@@ -2334,7 +2334,7 @@ is_cond_candidate (rtx insn)
     }
   else if (JUMP_P (insn)
 	   && GET_CODE (PATTERN (insn)) == SET
-	   && GET_CODE (XEXP (PATTERN (insn), 1)) == LABEL_REF)
+	   && LABEL_REF_P (XEXP (PATTERN (insn), 1)))
     return COND_BRANCH_INSN;
 
   return COND_NO;
@@ -2489,7 +2489,7 @@ conditionalize_block (rtx_insn *first)
   cond = (GET_CODE (XEXP (XEXP (br_pat, 1), 0)) == EQ);
 
   /* Determine what kind of branch we have.  */
-  if (GET_CODE (XEXP (XEXP (br_pat, 1), 1)) == LABEL_REF)
+  if (LABEL_REF_P (XEXP (XEXP (br_pat, 1), 1)))
     {
       /* A normal branch, so extract label out of first arm.  */
       br_lab_num = CODE_LABEL_NUMBER (XEXP (XEXP (XEXP (br_pat, 1), 1), 0));
diff --git a/gcc/config/mcore/mcore.h b/gcc/config/mcore/mcore.h
index 5830c8514c2..2c299453016 100644
--- a/gcc/config/mcore/mcore.h
+++ b/gcc/config/mcore/mcore.h
@@ -494,7 +494,7 @@ extern const enum reg_class regno_reg_class[FIRST_PSEUDO_REGISTER];
 #define MAX_REGS_PER_ADDRESS 1
 
 /* Recognize any constant value that is a valid address.  */
-#define CONSTANT_ADDRESS_P(X) 	 (GET_CODE (X) == LABEL_REF)
+#define CONSTANT_ADDRESS_P(X) 	 (LABEL_REF_P (X))
 
 /* Specify the machine mode that this machine uses
    for the index in the tablejump instruction.  */
diff --git a/gcc/config/mcore/predicates.md b/gcc/config/mcore/predicates.md
index d34f9f7125b..820761e67af 100644
--- a/gcc/config/mcore/predicates.md
+++ b/gcc/config/mcore/predicates.md
@@ -40,7 +40,7 @@
   (match_code "mem,const_int,reg,subreg,symbol_ref,label_ref,const")
 {
   /* Any (MEM LABEL_REF) is OK.  That is a pc-relative load.  */
-  if (MEM_P (op) && GET_CODE (XEXP (op, 0)) == LABEL_REF)
+  if (MEM_P (op) && LABEL_REF_P (XEXP (op, 0)))
     return 1;
 
   return general_operand (op, mode);
diff --git a/gcc/config/microblaze/microblaze.c b/gcc/config/microblaze/microblaze.c
index e89c527cc41..d85030c47da 100644
--- a/gcc/config/microblaze/microblaze.c
+++ b/gcc/config/microblaze/microblaze.c
@@ -506,7 +506,7 @@ label_mentioned_p (rtx x)
   const char * fmt;
   int i;
 
-  if (GET_CODE (x) == LABEL_REF)
+  if (LABEL_REF_P (x))
     return 1;
 
   /* UNSPEC entries for a symbol include a LABEL_REF for the referencing
@@ -779,7 +779,7 @@ microblaze_classify_address (struct microblaze_address_info *info, rtx x,
 		return microblaze_classify_unspec (info, xplus1);
 	      }
 	    else if ((GET_CODE (xplus1) == SYMBOL_REF ||
-		      GET_CODE (xplus1) == LABEL_REF))
+		      LABEL_REF_P (xplus1)))
 	      {
 		if (flag_pic == 2 || microblaze_tls_symbol_p(xplus1))
 		  return false;
@@ -817,7 +817,7 @@ microblaze_classify_address (struct microblaze_address_info *info, rtx x,
 		  }
 
 		if (GET_CODE (xconst0) == SYMBOL_REF
-		    || GET_CODE (xconst0) == LABEL_REF)
+		    || LABEL_REF_P (xconst0))
 		  {
 		    if (flag_pic == 2 || microblaze_tls_symbol_p(xconst0))
 		      return false;
@@ -883,7 +883,7 @@ microblaze_classify_address (struct microblaze_address_info *info, rtx x,
 
 	/* Avoid error in print_operand_address in case UNSPEC
 	 is removed from SYMBOL or LABEL REFS during optimization.  */
-	if ((GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF)
+	if ((GET_CODE (x) == SYMBOL_REF || LABEL_REF_P (x))
 	    && flag_pic && TARGET_PIC_DATA_TEXT_REL && strict == 2)
 	  {
 	    info->type = ADDRESS_SYMBOLIC_TXT_REL;
@@ -928,7 +928,7 @@ microblaze_legitimate_address_p (machine_mode mode, rtx x, bool strict)
 bool
 microblaze_constant_address_p (rtx x)
 {
-  return ((GET_CODE (x) == LABEL_REF) || (GET_CODE (x) == SYMBOL_REF)
+  return ((LABEL_REF_P (x)) || (GET_CODE (x) == SYMBOL_REF)
 	  || CONST_INT_P (x)
 	  || (GET_CODE (x) == CONST
 	  && ! (flag_pic && pic_address_needs_scratch (x))));
@@ -1505,7 +1505,7 @@ pic_address_needs_scratch (rtx x)
       p0 = XEXP (XEXP (x, 0), 0);
       p1 = XEXP (XEXP (x, 0), 1);
 
-      if ((GET_CODE (p0) == SYMBOL_REF || GET_CODE (p0) == LABEL_REF)
+      if ((GET_CODE (p0) == SYMBOL_REF || LABEL_REF_P (p0))
           && (CONST_INT_P (p1))
           && (flag_pic == 2 || microblaze_tls_symbol_p (p0) || !SMALL_INT (p1)))
         return 1;
@@ -3396,7 +3396,7 @@ microblaze_expand_move (machine_mode mode, rtx operands[])
     }
   /* If operands[1] is a constant address invalid for pic, then we need to
      handle it just like LEGITIMIZE_ADDRESS does.  */
-  if (GET_CODE (op1) == SYMBOL_REF || GET_CODE (op1) == LABEL_REF)
+  if (GET_CODE (op1) == SYMBOL_REF || LABEL_REF_P (op1))
     {
       rtx result;
       if (microblaze_tls_symbol_p(op1))
@@ -3451,7 +3451,7 @@ microblaze_expand_move (machine_mode mode, rtx operands[])
 
       if ((CONST_INT_P (p1))
 	  && ((GET_CODE (p0) == UNSPEC)
-	      || ((GET_CODE (p0) == SYMBOL_REF || GET_CODE (p0) == LABEL_REF)
+	      || ((GET_CODE (p0) == SYMBOL_REF || LABEL_REF_P (p0))
 	          && (flag_pic == 2 || microblaze_tls_symbol_p (p0)
 		      || !SMALL_INT (p1)))))
 	{
@@ -3787,7 +3787,7 @@ microblaze_legitimate_constant_p (machine_mode mode ATTRIBUTE_UNUSED, rtx x)
             if ((GET_CODE (p0) == UNSPEC))
               return false;
 
-            if ((GET_CODE (p0) == SYMBOL_REF || GET_CODE (p0) == LABEL_REF)
+            if ((GET_CODE (p0) == SYMBOL_REF || LABEL_REF_P (p0))
                  && (microblaze_tls_symbol_p (p0) || !SMALL_INT (p1)))
               return false;
           }
diff --git a/gcc/config/microblaze/predicates.md b/gcc/config/microblaze/predicates.md
index 10ec60ca70c..fae269894c4 100644
--- a/gcc/config/microblaze/predicates.md
+++ b/gcc/config/microblaze/predicates.md
@@ -64,7 +64,7 @@
                   p1 = XEXP (const0, 1);
 
                   if ((GET_CODE(p0) == SYMBOL_REF
-                       || GET_CODE (p0) == LABEL_REF)
+                       || LABEL_REF_P (p0))
                       && CONST_INT_P (p1))
                     {
                       return arith_plus_operand (p0, GET_MODE(p0));
diff --git a/gcc/config/mips/mips.c b/gcc/config/mips/mips.c
index 4730c75ec5f..34287cb40e1 100644
--- a/gcc/config/mips/mips.c
+++ b/gcc/config/mips/mips.c
@@ -2071,7 +2071,7 @@ mips_classify_symbol (const_rtx x, enum mips_symbol_context context)
   if (TARGET_RTP_PIC)
     return SYMBOL_GOT_DISP;
 
-  if (GET_CODE (x) == LABEL_REF)
+  if (LABEL_REF_P (x))
     {
       /* Only return SYMBOL_PC_RELATIVE if we are generating MIPS16
 	 code and if we know that the label is in the current function's
@@ -2185,7 +2185,7 @@ mips_symbolic_constant_p (rtx x, enum mips_symbol_context context,
       *symbol_type = UNSPEC_ADDRESS_TYPE (x);
       x = UNSPEC_ADDRESS (x);
     }
-  else if (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF)
+  else if (GET_CODE (x) == SYMBOL_REF || LABEL_REF_P (x))
     {
       *symbol_type = mips_classify_symbol (x, context);
       if (*symbol_type == SYMBOL_TLS)
@@ -2219,7 +2219,7 @@ mips_symbolic_constant_p (rtx x, enum mips_symbol_context context,
       /* Allow constant pool references to be converted to LABEL+CONSTANT.
 	 In this case, we no longer have access to the underlying constant,
 	 but the original symbol-based access was known to be valid.  */
-      if (GET_CODE (x) == LABEL_REF)
+      if (LABEL_REF_P (x))
 	return true;
 
       /* Fall through.  */
diff --git a/gcc/config/mmix/mmix.c b/gcc/config/mmix/mmix.c
index 5da6713b5a2..6f68981f777 100644
--- a/gcc/config/mmix/mmix.c
+++ b/gcc/config/mmix/mmix.c
@@ -1062,7 +1062,7 @@ mmix_constant_address_p (rtx x)
 	  rtx x1 = XEXP (XEXP (x, 0), 1);
 
 	  if ((GET_CODE (x0) == SYMBOL_REF
-	       || GET_CODE (x0) == LABEL_REF)
+	       || LABEL_REF_P (x0))
 	      && (CONST_INT_P (x1)
 		  || (CONST_DOUBLE_P (x1)
 		      && GET_MODE (x1) == VOIDmode)))
diff --git a/gcc/config/mmix/predicates.md b/gcc/config/mmix/predicates.md
index f74c771f30f..41e4f342826 100644
--- a/gcc/config/mmix/predicates.md
+++ b/gcc/config/mmix/predicates.md
@@ -111,7 +111,7 @@
       /* The reason why this body still is C.  */
       op = XEXP (op, 0);
       if ((GET_CODE (XEXP (op, 0)) == SYMBOL_REF
-	   || GET_CODE (XEXP (op, 0)) == LABEL_REF)
+	   || LABEL_REF_P (XEXP (op, 0)))
 	  && (CONST_INT_P (XEXP (op, 1))
 	      || (CONST_DOUBLE_P (XEXP (op, 1))
 		  && GET_MODE (XEXP (op, 1)) == VOIDmode)))
diff --git a/gcc/config/mn10300/mn10300.c b/gcc/config/mn10300/mn10300.c
index 5d5bc734898..10cce63ca3f 100644
--- a/gcc/config/mn10300/mn10300.c
+++ b/gcc/config/mn10300/mn10300.c
@@ -1799,7 +1799,7 @@ mn10300_symbolic_operand (rtx op,
     case CONST:
       op = XEXP (op, 0);
       return ((GET_CODE (XEXP (op, 0)) == SYMBOL_REF
-               || GET_CODE (XEXP (op, 0)) == LABEL_REF)
+               || LABEL_REF_P (XEXP (op, 0)))
               && CONST_INT_P (XEXP (op, 1)));
     default:
       return 0;
@@ -1866,7 +1866,7 @@ mn10300_legitimize_pic_address (rtx orig, rtx reg)
   rtx x;
   rtx_insn *insn;
 
-  if (GET_CODE (orig) == LABEL_REF
+  if (LABEL_REF_P (orig)
       || (GET_CODE (orig) == SYMBOL_REF
 	  && (CONSTANT_POOL_ADDRESS_P (orig)
 	      || ! MN10300_GLOBAL_P (orig))))
@@ -1908,7 +1908,7 @@ mn10300_legitimate_pic_operand_p (rtx x)
   const char *fmt;
   int i;
 
-  if (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF)
+  if (GET_CODE (x) == SYMBOL_REF || LABEL_REF_P (x))
     return 0;
 
   if (GET_CODE (x) == UNSPEC
diff --git a/gcc/config/mn10300/mn10300.h b/gcc/config/mn10300/mn10300.h
index 6a75b967a27..4239598aece 100644
--- a/gcc/config/mn10300/mn10300.h
+++ b/gcc/config/mn10300/mn10300.h
@@ -538,7 +538,7 @@ do {									     \
 #define GOT_SYMBOL_NAME "*_GLOBAL_OFFSET_TABLE_"
 
 #define SYMBOLIC_CONST_P(X)	\
-((GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == LABEL_REF)	\
+((GET_CODE (X) == SYMBOL_REF || LABEL_REF_P (X))	\
   && ! LEGITIMATE_PIC_OPERAND_P (X))
 
 /* Non-global SYMBOL_REFs have SYMBOL_REF_FLAG enabled.  */
diff --git a/gcc/config/moxie/constraints.md b/gcc/config/moxie/constraints.md
index 2d3bdc84930..554b5cb5105 100644
--- a/gcc/config/moxie/constraints.md
+++ b/gcc/config/moxie/constraints.md
@@ -26,7 +26,7 @@
   "An absolute address."
   (and (match_code "mem")
        (ior (match_test "GET_CODE (XEXP (op, 0)) == SYMBOL_REF")
-	    (match_test "GET_CODE (XEXP (op, 0)) == LABEL_REF")
+	    (match_test "LABEL_REF_P (XEXP (op, 0))")
 	    (match_test "GET_CODE (XEXP (op, 0)) == CONST"))))
 
 (define_constraint "B"
diff --git a/gcc/config/moxie/moxie.c b/gcc/config/moxie/moxie.c
index 7f1bb5aac95..ed532244357 100644
--- a/gcc/config/moxie/moxie.c
+++ b/gcc/config/moxie/moxie.c
@@ -604,7 +604,7 @@ moxie_legitimate_address_p (machine_mode mode ATTRIBUTE_UNUSED,
   if (REG_P (x) && moxie_reg_ok_for_base_p (x, strict_p))
     return true;
   if (GET_CODE (x) == SYMBOL_REF
-      || GET_CODE (x) == LABEL_REF
+      || LABEL_REF_P (x)
       || GET_CODE (x) == CONST)
     return true;
   return false;
diff --git a/gcc/config/moxie/predicates.md b/gcc/config/moxie/predicates.md
index c61ce12ac28..02c7f8cc8a7 100644
--- a/gcc/config/moxie/predicates.md
+++ b/gcc/config/moxie/predicates.md
@@ -28,7 +28,7 @@
   (match_code "mem,const_int,reg,subreg,symbol_ref,label_ref,const")
 {
   /* Any (MEM LABEL_REF) is OK.  That is a pc-relative load.  */
-  if (MEM_P (op) && GET_CODE (XEXP (op, 0)) == LABEL_REF)
+  if (MEM_P (op) && LABEL_REF_P (XEXP (op, 0)))
     return 1;
 
   if (MEM_P (op)
diff --git a/gcc/config/nds32/nds32-cost.c b/gcc/config/nds32/nds32-cost.c
index 010a5ce6402..d5a9f478001 100644
--- a/gcc/config/nds32/nds32-cost.c
+++ b/gcc/config/nds32/nds32-cost.c
@@ -339,7 +339,7 @@ nds32_rtx_costs_speed_prefer (rtx x ATTRIBUTE_UNUSED,
       return true;
 
     case IF_THEN_ELSE:
-      if (GET_CODE (XEXP (x, 1)) == LABEL_REF)
+      if (LABEL_REF_P (XEXP (x, 1)))
 	/* branch */
 	*total = COSTS_N_INSNS (2);
       else
diff --git a/gcc/config/nds32/nds32-md-auxiliary.c b/gcc/config/nds32/nds32-md-auxiliary.c
index 1bc365f11ba..90f9c89643c 100644
--- a/gcc/config/nds32/nds32-md-auxiliary.c
+++ b/gcc/config/nds32/nds32-md-auxiliary.c
@@ -3456,7 +3456,7 @@ symbolic_reference_mentioned_p (rtx op)
   const char *fmt;
   int i;
 
-  if (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == LABEL_REF)
+  if (GET_CODE (op) == SYMBOL_REF || LABEL_REF_P (op))
     return true;
 
   fmt = GET_RTX_FORMAT (GET_CODE (op));
@@ -3502,7 +3502,7 @@ nds32_legitimize_pic_address (rtx x)
   rtx pat;
   int relax_group_id = nds32_alloc_relax_group_id ();
 
-  if (GET_CODE (x) == LABEL_REF
+  if (LABEL_REF_P (x)
       || (GET_CODE (x) == SYMBOL_REF
 	  && (CONSTANT_POOL_ADDRESS_P (x)
 	      || SYMBOL_REF_LOCAL_P (x))))
@@ -3531,7 +3531,7 @@ nds32_legitimize_pic_address (rtx x)
       rtx op0 = XEXP (addr, 0);
       rtx op1 = XEXP (addr, 1);
 
-      if ((GET_CODE (op0) == LABEL_REF
+      if ((LABEL_REF_P (op0)
 	   || (GET_CODE (op0) == SYMBOL_REF
 	       && (CONSTANT_POOL_ADDRESS_P (op0)
 		   || SYMBOL_REF_LOCAL_P (op0))))
diff --git a/gcc/config/nds32/nds32.h b/gcc/config/nds32/nds32.h
index 60a5f19cfd8..1a8a6675bba 100644
--- a/gcc/config/nds32/nds32.h
+++ b/gcc/config/nds32/nds32.h
@@ -1492,7 +1492,7 @@ enum reg_class
 
 #define SYMBOLIC_CONST_P(X)	\
 (GET_CODE (X) == SYMBOL_REF						\
- || GET_CODE (X) == LABEL_REF						\
+ || LABEL_REF_P (X)						\
  || (GET_CODE (X) == CONST && symbolic_reference_mentioned_p (X)))
 
 
diff --git a/gcc/config/nios2/nios2.c b/gcc/config/nios2/nios2.c
index 6378b7567a5..d2a85d0ad6f 100644
--- a/gcc/config/nios2/nios2.c
+++ b/gcc/config/nios2/nios2.c
@@ -2048,7 +2048,7 @@ nios2_symbolic_constant_p (rtx x)
 
   if (flag_pic)
     return false;
-  if (GET_CODE (x) == LABEL_REF)
+  if (LABEL_REF_P (x))
     return true;
   else if (CONSTANT_P (x))
     {
@@ -2554,7 +2554,7 @@ nios2_legitimate_pic_operand_p (rtx x)
     return true;
 
   return ! (GET_CODE (x) == SYMBOL_REF
-	    || GET_CODE (x) == LABEL_REF || GET_CODE (x) == CONST);
+	    || LABEL_REF_P (x) || GET_CODE (x) == CONST);
 }
 
 /* Return TRUE if X is a thread-local symbol.  */
diff --git a/gcc/config/nvptx/nvptx.c b/gcc/config/nvptx/nvptx.c
index dd3b14c515a..07180eaad07 100644
--- a/gcc/config/nvptx/nvptx.c
+++ b/gcc/config/nvptx/nvptx.c
@@ -4863,13 +4863,13 @@ nvptx_condjump_label (const rtx_insn *insn, bool strict = true)
   if (!x)
     return NULL_RTX;
   x = SET_SRC (x);
-  if (GET_CODE (x) == LABEL_REF)
+  if (LABEL_REF_P (x))
     return x;
   if (GET_CODE (x) != IF_THEN_ELSE)
     return NULL_RTX;
-  if (XEXP (x, 2) == pc_rtx && GET_CODE (XEXP (x, 1)) == LABEL_REF)
+  if (XEXP (x, 2) == pc_rtx && LABEL_REF_P (XEXP (x, 1)))
     return XEXP (x, 1);
-  if (XEXP (x, 1) == pc_rtx && GET_CODE (XEXP (x, 2)) == LABEL_REF)
+  if (XEXP (x, 1) == pc_rtx && LABEL_REF_P (XEXP (x, 2)))
     return XEXP (x, 2);
   return NULL_RTX;
 }
diff --git a/gcc/config/nvptx/nvptx.md b/gcc/config/nvptx/nvptx.md
index 58a18fe21cf..20f97be5861 100644
--- a/gcc/config/nvptx/nvptx.md
+++ b/gcc/config/nvptx/nvptx.md
@@ -288,7 +288,7 @@
       DONE;
     }
 
-  if (GET_CODE (operands[1]) == LABEL_REF)
+  if (LABEL_REF_P (operands[1]))
     sorry ("target cannot support label values");
 })
 
diff --git a/gcc/config/pa/pa.c b/gcc/config/pa/pa.c
index 1df00c00dbf..418dfc8c8f4 100644
--- a/gcc/config/pa/pa.c
+++ b/gcc/config/pa/pa.c
@@ -10355,7 +10355,7 @@ pa_legitimate_constant_p (machine_mode mode, rtx x)
   if (GET_MODE_CLASS (mode) == MODE_FLOAT && x != CONST0_RTX (mode))
     return false;
 
-  if (!NEW_HP_ASSEMBLER && !TARGET_GAS && GET_CODE (x) == LABEL_REF)
+  if (!NEW_HP_ASSEMBLER && !TARGET_GAS && LABEL_REF_P (x))
     return false;
 
   /* TLS_MODEL_GLOBAL_DYNAMIC and TLS_MODEL_LOCAL_DYNAMIC are not
diff --git a/gcc/config/pa/pa.h b/gcc/config/pa/pa.h
index 8de85da726d..b6b7ed17a5c 100644
--- a/gcc/config/pa/pa.h
+++ b/gcc/config/pa/pa.h
@@ -766,7 +766,7 @@ extern int may_call_alloca;
    use most of the constants accepted by CONSTANT_P, except CONST_DOUBLE.  */
 
 #define CONSTANT_ADDRESS_P(X) \
-  ((GET_CODE (X) == LABEL_REF 						\
+  ((LABEL_REF_P (X) 						\
    || (GET_CODE (X) == SYMBOL_REF && !SYMBOL_REF_TLS_MODEL (X))		\
    || CONST_INT_P (X)						\
    || (GET_CODE (X) == CONST && !tls_referenced_p (X))			\
diff --git a/gcc/config/pa/pa.md b/gcc/config/pa/pa.md
index f0e498e2782..5f7c45053cf 100644
--- a/gcc/config/pa/pa.md
+++ b/gcc/config/pa/pa.md
@@ -2538,7 +2538,7 @@
   xoperands[0] = operands[0];
   xoperands[1] = operands[1];
 
-  if (GET_CODE (operands[1]) == LABEL_REF
+  if (LABEL_REF_P (operands[1])
       && !LABEL_REF_NONLOCAL_P (operands[1]))
     {
       xoperands[2] = gen_label_rtx ();
@@ -2588,7 +2588,7 @@
   xoperands[0] = operands[0];
   xoperands[1] = operands[1];
 
-  if (GET_CODE (operands[1]) == LABEL_REF
+  if (LABEL_REF_P (operands[1])
       && !LABEL_REF_NONLOCAL_P (operands[1]))
     {
       xoperands[2] = gen_label_rtx ();
diff --git a/gcc/config/pa/predicates.md b/gcc/config/pa/predicates.md
index 5fd0279c9fa..a633a276509 100644
--- a/gcc/config/pa/predicates.md
+++ b/gcc/config/pa/predicates.md
@@ -504,7 +504,7 @@
       return true;
     case CONST:
       op = XEXP (op, 0);
-      return (GET_CODE (XEXP (op, 0)) == LABEL_REF
+      return (LABEL_REF_P (XEXP (op, 0))
 	      && CONST_INT_P (XEXP (op, 1)));
     default:
       gcc_unreachable ();
@@ -630,7 +630,7 @@
       return (GET_CODE (op) == PLUS
 	      && ((GET_CODE (XEXP (op, 0)) == SYMBOL_REF
 		   && !SYMBOL_REF_TLS_MODEL (XEXP (op, 0)))
-		  || GET_CODE (XEXP (op, 0)) == LABEL_REF)
+		  || LABEL_REF_P (XEXP (op, 0)))
 	      && CONST_INT_P (XEXP (op, 1)));
     default:
       break;
diff --git a/gcc/config/riscv/riscv.c b/gcc/config/riscv/riscv.c
index c03f5b1e66c..c885bb5f0eb 100644
--- a/gcc/config/riscv/riscv.c
+++ b/gcc/config/riscv/riscv.c
@@ -581,7 +581,7 @@ riscv_symbolic_constant_p (rtx x, enum riscv_symbol_type *symbol_type)
       *symbol_type = UNSPEC_ADDRESS_TYPE (x);
       x = UNSPEC_ADDRESS (x);
     }
-  else if (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF)
+  else if (GET_CODE (x) == SYMBOL_REF || LABEL_REF_P (x))
     *symbol_type = riscv_classify_symbol (x);
   else
     return false;
diff --git a/gcc/config/rs6000/freebsd64.h b/gcc/config/rs6000/freebsd64.h
index 9367a6e40f3..b6b75635799 100644
--- a/gcc/config/rs6000/freebsd64.h
+++ b/gcc/config/rs6000/freebsd64.h
@@ -405,7 +405,7 @@ extern int dot_symbols;
    && (SYMBOL_REF_P (X)							\
        || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS      \
            && SYMBOL_REF_P (XEXP (XEXP (X, 0), 0)))			\
-       || GET_CODE (X) == LABEL_REF                                     \
+       || LABEL_REF_P (X)                                     \
        || (CONST_INT_P (X)						\
            && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode))      \
        || (CONST_DOUBLE_P (X)						\
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
index 4d329b544ad..f34c16a29f7 100644
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -574,7 +574,7 @@ extern int dot_symbols;
    && (SYMBOL_REF_P (X)							\
        || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS	\
 	   && SYMBOL_REF_P (XEXP (XEXP (X, 0), 0)))			\
-       || GET_CODE (X) == LABEL_REF					\
+       || LABEL_REF_P (X)					\
        || (CONST_INT_P (X)						\
 	   && TARGET_CMODEL != CMODEL_MEDIUM				\
 	   && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode))	\
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index d84e743c1af..facc468ec7c 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -9738,7 +9738,7 @@ rs6000_emit_move (rtx dest, rtx source, machine_mode mode)
 	      && TARGET_NO_SUM_IN_TOC
 	      && GET_CODE (XEXP (operands[1], 0)) == PLUS
 	      && add_operand (XEXP (XEXP (operands[1], 0), 1), mode)
-	      && (GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == LABEL_REF
+	      && (LABEL_REF_P (XEXP (XEXP (operands[1], 0), 0))
 		  || SYMBOL_REF_P (XEXP (XEXP (operands[1], 0), 0)))
 	      && ! side_effects_p (operands[0]))
 	    {
@@ -11976,7 +11976,7 @@ rs6000_secondary_reload_class (enum reg_class rclass, machine_mode mode,
       if (rclass != BASE_REGS
 	  && (SYMBOL_REF_P (in)
 	      || GET_CODE (in) == HIGH
-	      || GET_CODE (in) == LABEL_REF
+	      || LABEL_REF_P (in)
 	      || GET_CODE (in) == CONST))
 	return BASE_REGS;
     }
@@ -12629,7 +12629,7 @@ print_operand (FILE *file, rtx x, int code)
 	{
 	  if (GET_CODE (XEXP (x, 0)) != PLUS
 	      || (!SYMBOL_REF_P (XEXP (XEXP (x, 0), 0))
-		  && GET_CODE (XEXP (XEXP (x, 0), 0)) != LABEL_REF)
+		  && !LABEL_REF_P (XEXP (XEXP (x, 0), 0)))
 	      || !CONST_INT_P (XEXP (XEXP (x, 0), 1)))
 	    output_operand_lossage ("invalid %%K value");
 	}
@@ -13097,7 +13097,7 @@ print_operand_address (FILE *file, rtx x)
       fputs ("@pcrel", file);
     }
   else if (SYMBOL_REF_P (x) || GET_CODE (x) == CONST
-	   || GET_CODE (x) == LABEL_REF)
+	   || LABEL_REF_P (x))
     {
       output_addr_const (file, x);
       if (small_data_operand (x, GET_MODE (x)))
@@ -16064,7 +16064,7 @@ output_toc (FILE *file, rtx x, int labelno, machine_mode mode)
      TOC entries (this happens on AIX if there is any kind of TOC,
      and on SVR4 under -fPIC or -mrelocatable).  Don't do this for
      CODE_LABELs.  */
-  if (TARGET_TOC && GET_CODE (x) != LABEL_REF)
+  if (TARGET_TOC && !LABEL_REF_P (x))
     {
       struct toc_hash_struct *h;
 
diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h
index 9c11a3e4d46..b1952ca6ab1 100644
--- a/gcc/config/rs6000/rs6000.h
+++ b/gcc/config/rs6000/rs6000.h
@@ -1745,7 +1745,7 @@ typedef struct rs6000_args
 /* Recognize any constant value that is a valid address.  */
 
 #define CONSTANT_ADDRESS_P(X)   \
-  (GET_CODE (X) == LABEL_REF || SYMBOL_REF_P (X)			\
+  (LABEL_REF_P (X) || SYMBOL_REF_P (X)			\
    || CONST_INT_P (X) || GET_CODE (X) == CONST				\
    || GET_CODE (X) == HIGH)
 
diff --git a/gcc/config/rs6000/rtems.h b/gcc/config/rs6000/rtems.h
index 0c198020a42..7176bb5f2a4 100644
--- a/gcc/config/rs6000/rtems.h
+++ b/gcc/config/rs6000/rtems.h
@@ -225,7 +225,7 @@
    && (SYMBOL_REF_P (X)							\
        || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS	\
 	   && SYMBOL_REF_P (XEXP (XEXP (X, 0), 0)))			\
-       || GET_CODE (X) == LABEL_REF					\
+       || LABEL_REF_P (X)					\
        || (CONST_INT_P (X)						\
 	   && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode))	\
        || (CONST_DOUBLE_P (X)						\
diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h
index 4645ef3b21e..ad80cb9bc91 100644
--- a/gcc/config/rs6000/sysv4.h
+++ b/gcc/config/rs6000/sysv4.h
@@ -380,7 +380,7 @@ do {									\
    && (SYMBOL_REF_P (X)							\
        || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS	\
 	   && SYMBOL_REF_P (XEXP (XEXP (X, 0), 0)))			\
-       || GET_CODE (X) == LABEL_REF					\
+       || LABEL_REF_P (X)					\
        || (CONST_INT_P (X)						\
 	   && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode))	\
        || (!TARGET_NO_FP_IN_TOC						\
diff --git a/gcc/config/rs6000/xcoff.h b/gcc/config/rs6000/xcoff.h
index 80b2dcfba55..23e3f5efb68 100644
--- a/gcc/config/rs6000/xcoff.h
+++ b/gcc/config/rs6000/xcoff.h
@@ -78,7 +78,7 @@
    && (SYMBOL_REF_P (X)							\
        || (GET_CODE (X) == CONST && GET_CODE (XEXP (X, 0)) == PLUS	\
 	   && SYMBOL_REF_P (XEXP (XEXP (X, 0), 0)))			\
-       || GET_CODE (X) == LABEL_REF					\
+       || LABEL_REF_P (X)					\
        || (CONST_INT_P (X)						\
 	   && GET_MODE_BITSIZE (MODE) <= GET_MODE_BITSIZE (Pmode))	\
        || (CONST_DOUBLE_P (X)						\
diff --git a/gcc/config/rx/rx.c b/gcc/config/rx/rx.c
index e529f8b173e..b8d182e5944 100644
--- a/gcc/config/rx/rx.c
+++ b/gcc/config/rx/rx.c
@@ -136,7 +136,7 @@ rx_pid_data_operand (rtx op)
     {
       /* Sigh, some special cases.  */
       if (GET_CODE (op) == SYMBOL_REF
-	  || GET_CODE (op) == LABEL_REF)
+	  || LABEL_REF_P (op))
 	return PID_UNENCODED;
     }
 
diff --git a/gcc/config/s390/predicates.md b/gcc/config/s390/predicates.md
index e7ce44dbb43..40b11c23d03 100644
--- a/gcc/config/s390/predicates.md
+++ b/gcc/config/s390/predicates.md
@@ -158,7 +158,7 @@
   (match_code "label_ref, symbol_ref, const")
 {
   /* Allow labels and local symbols.  */
-  if (GET_CODE (op) == LABEL_REF)
+  if (LABEL_REF_P (op))
     return true;
   if (SYMBOL_REF_P (op))
     return (!SYMBOL_FLAG_NOTALIGN2_P (op)
@@ -183,7 +183,7 @@
     }
 
   /* Labels and local symbols allowed here as well.  */
-  if (GET_CODE (op) == LABEL_REF)
+  if (LABEL_REF_P (op))
     return true;
   if (SYMBOL_REF_P (op))
     return (!SYMBOL_FLAG_NOTALIGN2_P (op)
diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c
index acec764bc42..6f85090f2ce 100644
--- a/gcc/config/s390/s390.c
+++ b/gcc/config/s390/s390.c
@@ -3961,7 +3961,7 @@ symbolic_reference_mentioned_p (rtx op)
   const char *fmt;
   int i;
 
-  if (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == LABEL_REF)
+  if (GET_CODE (op) == SYMBOL_REF || LABEL_REF_P (op))
     return 1;
 
   fmt = GET_RTX_FORMAT (GET_CODE (op));
@@ -4885,7 +4885,7 @@ legitimize_pic_address (rtx orig, rtx reg)
       addr = XEXP (addr, 0);
     }
 
-  if ((GET_CODE (addr) == LABEL_REF
+  if ((LABEL_REF_P (addr)
        || (SYMBOL_REF_P (addr) && s390_rel_address_ok_p (addr))
        || (GET_CODE (addr) == UNSPEC &&
 	   (XINT (addr, 1) == UNSPEC_GOTENT
@@ -13861,10 +13861,10 @@ s390_fix_long_loop_prediction (rtx_insn *insn)
       && XEXP (SET_SRC (set), 2) == pc_rtx)
     return false;
 
-  label_ref = (GET_CODE (XEXP (SET_SRC (set), 1)) == LABEL_REF ?
+  label_ref = (LABEL_REF_P (XEXP (SET_SRC (set), 1)) ?
 	       XEXP (SET_SRC (set), 1) : XEXP (SET_SRC (set), 2));
 
-  gcc_assert (GET_CODE (label_ref) == LABEL_REF);
+  gcc_assert (LABEL_REF_P (label_ref));
 
   code_label = XEXP (label_ref, 0);
 
diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h
index 969f58a2ba0..adf64951258 100644
--- a/gcc/config/s390/s390.h
+++ b/gcc/config/s390/s390.h
@@ -808,7 +808,7 @@ CUMULATIVE_ARGS;
 /* Helper macro for s390.c and s390.md to check for symbolic constants.  */
 #define SYMBOLIC_CONST(X)						\
   (GET_CODE (X) == SYMBOL_REF						\
-   || GET_CODE (X) == LABEL_REF						\
+   || LABEL_REF_P (X)						\
    || (GET_CODE (X) == CONST && symbolic_reference_mentioned_p (X)))
 
 #define TLS_SYMBOLIC_CONST(X)						\
diff --git a/gcc/config/sh/predicates.md b/gcc/config/sh/predicates.md
index 4b19143d90e..5907bc8d73d 100644
--- a/gcc/config/sh/predicates.md
+++ b/gcc/config/sh/predicates.md
@@ -286,11 +286,11 @@
       if (GET_CODE (inside) == CONST)
 	inside = XEXP (inside, 0);
 
-      if (GET_CODE (inside) == LABEL_REF)
+      if (LABEL_REF_P (inside))
 	return 1;
 
       if (GET_CODE (inside) == PLUS
-	  && GET_CODE (XEXP (inside, 0)) == LABEL_REF
+	  && LABEL_REF_P (XEXP (inside, 0))
 	  && CONST_INT_P (XEXP (inside, 1)))
 	return 1;
 
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 1a2d110c2ae..2d1bd801851 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -4838,7 +4838,7 @@ mova_p (rtx_insn *insn)
 	  && GET_CODE (SET_SRC (PATTERN (insn))) == UNSPEC
 	  && XINT (SET_SRC (PATTERN (insn)), 1) == UNSPEC_MOVA
 	  /* Don't match mova_const.  */
-	  && GET_CODE (MOVA_LABELREF (insn)) == LABEL_REF);
+	  && LABEL_REF_P (MOVA_LABELREF (insn)));
 }
 
 /* Fix up a mova from a switch that went out of range.  */
@@ -5711,7 +5711,7 @@ fixup_addr_diff_vecs (rtx_insn *first)
 	  if (GET_CODE (x) != USE)
 	    continue;
 	  x = XEXP (x, 0);
-	  if (GET_CODE (x) == LABEL_REF && XEXP (x, 0) == vec_lab)
+	  if (LABEL_REF_P (x) && XEXP (x, 0) == vec_lab)
 	    break;
 	}
       /* FIXME: This is a bug in the optimizer, but it seems harmless
@@ -5988,7 +5988,7 @@ sh_reorg (void)
 	     optimize calls to a constant location, but the assembler
 	     and linker do not support that at present.  */
 	  if (GET_CODE (SET_SRC (set)) != SYMBOL_REF
-	      && GET_CODE (SET_SRC (set)) != LABEL_REF)
+	      && !LABEL_REF_P (SET_SRC (set)))
 	    continue;
 
 	  /* Scan forward from LINK to the place where REG dies, and
@@ -9096,7 +9096,7 @@ sh_legitimate_address_p (machine_mode mode, rtx x, bool strict)
 bool
 nonpic_symbol_mentioned_p (rtx x)
 {
-  if (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF
+  if (GET_CODE (x) == SYMBOL_REF || LABEL_REF_P (x)
       || GET_CODE (x) == PC)
     return true;
 
@@ -9145,7 +9145,7 @@ legitimize_pic_address (rtx orig, machine_mode mode ATTRIBUTE_UNUSED, rtx reg)
   if (tls_symbolic_operand (orig, Pmode) != TLS_MODEL_NONE)
     return orig;
 
-  if (GET_CODE (orig) == LABEL_REF
+  if (LABEL_REF_P (orig)
       || (GET_CODE (orig) == SYMBOL_REF && SYMBOL_REF_LOCAL_P (orig)))
     {
       if (reg == NULL_RTX)
@@ -9162,7 +9162,7 @@ legitimize_pic_address (rtx orig, machine_mode mode ATTRIBUTE_UNUSED, rtx reg)
 	    emit_insn (gen_symGOTOFFFUNCDESC2reg (reg, orig));
 	}
       else if (TARGET_FDPIC
-	       && (GET_CODE (orig) == LABEL_REF
+	       && (LABEL_REF_P (orig)
 		   || (GET_CODE (orig) == SYMBOL_REF && SYMBOL_REF_DECL (orig)
 		       && (TREE_READONLY (SYMBOL_REF_DECL (orig))
 			   || SYMBOL_REF_EXTERNAL_P (orig)
@@ -10710,7 +10710,7 @@ sh_mark_label (rtx address, int nuses)
 	address = XEXP (address, 0);
       address = XVECEXP (address, 0, 0);
     }
-  if (GET_CODE (address) == LABEL_REF
+  if (LABEL_REF_P (address)
       && LABEL_P (XEXP (address, 0)))
     LABEL_NUSES (XEXP (address, 0)) += nuses;
 }
diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h
index f753c611aaf..4305398f9ff 100644
--- a/gcc/config/sh/sh.h
+++ b/gcc/config/sh/sh.h
@@ -1338,7 +1338,7 @@ extern bool current_function_interrupt;
 #define MAX_REGS_PER_ADDRESS 2
 
 /* Recognize any constant value that is a valid address.  */
-#define CONSTANT_ADDRESS_P(X)	(GET_CODE (X) == LABEL_REF)
+#define CONSTANT_ADDRESS_P(X)	(LABEL_REF_P (X))
 
 /* The macros REG_OK_FOR..._P assume that the arg is a REG rtx
    and check its validity for a certain class.
@@ -1363,10 +1363,10 @@ extern bool current_function_interrupt;
 /* Macros for extra constraints.  */
 
 #define IS_PC_RELATIVE_LOAD_ADDR_P(OP)					\
-  ((GET_CODE ((OP)) == LABEL_REF)					\
+  ((LABEL_REF_P ((OP)))					\
    || (GET_CODE ((OP)) == CONST						\
        && GET_CODE (XEXP ((OP), 0)) == PLUS				\
-       && GET_CODE (XEXP (XEXP ((OP), 0), 0)) == LABEL_REF		\
+       && LABEL_REF_P (XEXP (XEXP ((OP), 0), 0))		\
        && CONST_INT_P (XEXP (XEXP ((OP), 0), 1))))
 
 #define IS_NON_EXPLICIT_CONSTANT_P(OP)					\
@@ -1376,7 +1376,7 @@ extern bool current_function_interrupt;
    && (!flag_pic							\
        || (LEGITIMATE_PIC_OPERAND_P (OP)				\
 	   && !PIC_ADDR_P (OP)						\
-	   && GET_CODE (OP) != LABEL_REF)))
+	   && !LABEL_REF_P (OP))))
 
 #define GOT_ENTRY_P(OP) \
   (GET_CODE (OP) == CONST && GET_CODE (XEXP ((OP), 0)) == UNSPEC \
@@ -1406,13 +1406,13 @@ extern bool current_function_interrupt;
    && XINT (XEXP ((OP), 0), 1) == UNSPEC_PCREL_SYMOFF)
 
 #define NON_PIC_REFERENCE_P(OP) \
-  (GET_CODE (OP) == LABEL_REF || GET_CODE (OP) == SYMBOL_REF \
+  (LABEL_REF_P (OP) || GET_CODE (OP) == SYMBOL_REF \
    || (GET_CODE (OP) == CONST \
-       && (GET_CODE (XEXP ((OP), 0)) == LABEL_REF \
+       && (LABEL_REF_P (XEXP ((OP), 0)) \
 	   || GET_CODE (XEXP ((OP), 0)) == SYMBOL_REF)) \
    || (GET_CODE (OP) == CONST && GET_CODE (XEXP ((OP), 0)) == PLUS \
        && (GET_CODE (XEXP (XEXP ((OP), 0), 0)) == SYMBOL_REF \
-	   || GET_CODE (XEXP (XEXP ((OP), 0), 0)) == LABEL_REF) \
+	   || LABEL_REF_P (XEXP (XEXP ((OP), 0), 0))) \
        && CONST_INT_P (XEXP (XEXP ((OP), 0), 1))))
 
 #define PIC_REFERENCE_P(OP) \
@@ -1595,7 +1595,7 @@ extern bool current_function_interrupt;
 	      || ! nonpic_symbol_mentioned_p (get_pool_constant (X)))))
 
 #define SYMBOLIC_CONST_P(X)	\
-((GET_CODE (X) == SYMBOL_REF || GET_CODE (X) == LABEL_REF)	\
+((GET_CODE (X) == SYMBOL_REF || LABEL_REF_P (X))	\
   && nonpic_symbol_mentioned_p (X))
 
 /* Compute extra cost of moving data between one register class
diff --git a/gcc/config/sparc/predicates.md b/gcc/config/sparc/predicates.md
index b1c2059dd43..7d1f700d421 100644
--- a/gcc/config/sparc/predicates.md
+++ b/gcc/config/sparc/predicates.md
@@ -108,7 +108,7 @@
       op = XEXP (op, 0);
       return (((GET_CODE (XEXP (op, 0)) == SYMBOL_REF
 		&& !SYMBOL_REF_TLS_MODEL (XEXP (op, 0)))
-	       || GET_CODE (XEXP (op, 0)) == LABEL_REF)
+	       || LABEL_REF_P (XEXP (op, 0)))
 	      && CONST_INT_P (XEXP (op, 1)));
 
     default:
diff --git a/gcc/config/sparc/sparc.c b/gcc/config/sparc/sparc.c
index f3f61bdb947..b5540da8d4a 100644
--- a/gcc/config/sparc/sparc.c
+++ b/gcc/config/sparc/sparc.c
@@ -2253,11 +2253,11 @@ sparc_expand_move (machine_mode mode, rtx *operands)
 	operands[1] = sparc_legitimize_pic_address (operands[1], NULL_RTX);
 
       /* We cannot use the mov{si,di}_pic_label_ref patterns in all cases.  */
-      if ((GET_CODE (operands[1]) == LABEL_REF
+      if ((LABEL_REF_P (operands[1])
 	   && can_use_mov_pic_label_ref (operands[1]))
 	  || (GET_CODE (operands[1]) == CONST
 	      && GET_CODE (XEXP (operands[1], 0)) == PLUS
-	      && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) == LABEL_REF
+	      && LABEL_REF_P (XEXP (XEXP (operands[1], 0), 0))
 	      && CONST_INT_P (XEXP (XEXP (operands[1], 0), 1))
 	      && can_use_mov_pic_label_ref (XEXP (XEXP (operands[1], 0), 0))))
 	{
@@ -4848,7 +4848,7 @@ sparc_legitimize_pic_address (rtx orig, rtx reg)
 {
   if (GET_CODE (orig) == SYMBOL_REF
       /* See the comment in sparc_expand_move.  */
-      || (GET_CODE (orig) == LABEL_REF && !can_use_mov_pic_label_ref (orig)))
+      || (LABEL_REF_P (orig) && !can_use_mov_pic_label_ref (orig)))
     {
       bool gotdata_op = false;
       rtx pic_ref, address;
@@ -4945,7 +4945,7 @@ sparc_legitimize_pic_address (rtx orig, rtx reg)
 	}
       return gen_rtx_PLUS (Pmode, base, offset);
     }
-  else if (GET_CODE (orig) == LABEL_REF)
+  else if (LABEL_REF_P (orig))
     /* ??? We ought to be checking that the register is live instead, in case
        it is eliminated.  */
     crtl->uses_pic_offset_table = 1;
@@ -4997,7 +4997,7 @@ sparc_legitimize_address (rtx x, rtx oldx ATTRIBUTE_UNUSED,
 		      copy_to_mode_reg (Pmode, XEXP (x, 0)));
   else if (GET_CODE (x) == SYMBOL_REF
 	   || GET_CODE (x) == CONST
-	   || GET_CODE (x) == LABEL_REF)
+	   || LABEL_REF_P (x))
     x = copy_to_suggested_reg (x, NULL_RTX, Pmode);
 
   return x;
@@ -5042,10 +5042,10 @@ sparc_delegitimize_address (rtx x)
       if (GET_CODE (y) == UNSPEC && XINT (y, 1) == UNSPEC_MOVE_PIC_LABEL)
 	{
 	  x = XVECEXP (y, 0, 0);
-	  gcc_assert (GET_CODE (x) == LABEL_REF
+	  gcc_assert (LABEL_REF_P (x)
 		      || (GET_CODE (x) == CONST
 			  && GET_CODE (XEXP (x, 0)) == PLUS
-			  && GET_CODE (XEXP (XEXP (x, 0), 0)) == LABEL_REF
+			  && LABEL_REF_P (XEXP (XEXP (x, 0), 0))
 			  && CONST_INT_P (XEXP (XEXP (x, 0), 1))));
 	}
     }
@@ -9687,14 +9687,14 @@ sparc_print_operand_address (FILE *file, machine_mode /*mode*/, rtx x)
 	  else if (REG_P (index))
 	    fprintf (file, "+%s", reg_names[REGNO (index)]);
 	  else if (GET_CODE (index) == SYMBOL_REF
-		   || GET_CODE (index) == LABEL_REF
+		   || LABEL_REF_P (index)
 		   || GET_CODE (index) == CONST)
 	    fputc ('+', file), output_addr_const (file, index);
 	  else gcc_unreachable ();
 	}
     }
   else if (GET_CODE (addr) == MINUS
-	   && GET_CODE (XEXP (addr, 1)) == LABEL_REF)
+	   && LABEL_REF_P (XEXP (addr, 1)))
     {
       output_addr_const (file, XEXP (addr, 0));
       fputs ("-(", file);
diff --git a/gcc/config/sparc/sparc.md b/gcc/config/sparc/sparc.md
index 0c003a2fdf2..b7987b17923 100644
--- a/gcc/config/sparc/sparc.md
+++ b/gcc/config/sparc/sparc.md
@@ -6867,7 +6867,7 @@ visl")
 
   gcc_assert (CONST_INT_P (operands[3]));
 
-  if (GET_CODE (XEXP (operands[0], 0)) == LABEL_REF)
+  if (LABEL_REF_P (XEXP (operands[0], 0)))
     {
       /* This is really a PIC sequence.  We want to represent
 	 it as a funny jump so its delay slots can be filled. 
diff --git a/gcc/config/spu/constraints.md b/gcc/config/spu/constraints.md
index 0206d15d9a8..ad028ef3686 100644
--- a/gcc/config/spu/constraints.md
+++ b/gcc/config/spu/constraints.md
@@ -156,7 +156,7 @@
   (and (match_code "mem")
        (match_test "!TARGET_LARGE_MEM
 		    && ((GET_CODE (XEXP (op, 0)) == SYMBOL_REF
-			 || GET_CODE (XEXP (op, 0)) == LABEL_REF))")))
+			 || LABEL_REF_P (XEXP (op, 0))))")))
 
 (define_memory_constraint "T"
   "Call operand, const_int, for absolute calls."
diff --git a/gcc/config/spu/spu.c b/gcc/config/spu/spu.c
index 4527842e8b6..4888e90536b 100644
--- a/gcc/config/spu/spu.c
+++ b/gcc/config/spu/spu.c
@@ -2119,7 +2119,7 @@ spu_emit_branch_hint (rtx_insn *before, rtx_insn *branch, rtx target,
   INSN_LOCATION (hint) = INSN_LOCATION (branch);
   HINTED_P (branch) = 1;
 
-  if (GET_CODE (target) == LABEL_REF)
+  if (LABEL_REF_P (target))
     HINTED_P (XEXP (target, 0)) = 1;
   else if (tablejump_p (branch, 0, &table))
     {
@@ -3071,7 +3071,7 @@ spu_float_const (const char *string, machine_mode mode)
 int
 spu_constant_address_p (rtx x)
 {
-  return (GET_CODE (x) == LABEL_REF || GET_CODE (x) == SYMBOL_REF
+  return (LABEL_REF_P (x) || GET_CODE (x) == SYMBOL_REF
 	  || CONST_INT_P (x) || GET_CODE (x) == CONST
 	  || GET_CODE (x) == HIGH);
 }
@@ -3492,7 +3492,7 @@ spu_legitimate_constant_p (machine_mode mode, rtx x)
   if (!flag_pic
       && mode == V4SImode
       && (GET_CODE (CONST_VECTOR_ELT (x, 0)) == SYMBOL_REF
-	  || GET_CODE (CONST_VECTOR_ELT (x, 0)) == LABEL_REF
+	  || LABEL_REF_P (CONST_VECTOR_ELT (x, 0))
 	  || GET_CODE (CONST_VECTOR_ELT (x, 0)) == CONST))
     return const_vec_duplicate_p (x);
 
@@ -5220,7 +5220,7 @@ spu_assemble_integer (rtx x, unsigned int size, int aligned_p)
      in case users support it in their own run-time loader.  And we provide
      a warning for those users that don't.  */
   if ((GET_CODE (x) == SYMBOL_REF)
-      || GET_CODE (x) == LABEL_REF || GET_CODE (x) == CONST)
+      || LABEL_REF_P (x) || GET_CODE (x) == CONST)
     reloc_diagnostic (x);
 
   return default_assemble_integer (x, size, aligned_p);
@@ -6387,7 +6387,7 @@ spu_check_builtin_parm (struct spu_builtin_description *d, rtx op, int p)
 	  lsbits = 0;
 	}
 
-      if (GET_CODE (op) == LABEL_REF
+      if (LABEL_REF_P (op)
 	  || (GET_CODE (op) == SYMBOL_REF
 	      && SYMBOL_REF_FUNCTION_P (op))
 	  || (v & ((1 << lsbits) - 1)) != 0)
diff --git a/gcc/config/tilegx/predicates.md b/gcc/config/tilegx/predicates.md
index 354d8109bed..412a7ed24f4 100644
--- a/gcc/config/tilegx/predicates.md
+++ b/gcc/config/tilegx/predicates.md
@@ -260,7 +260,7 @@
        (and (match_code "const")
 	    (match_test "GET_CODE (XEXP (op,0)) == PLUS
 			 && (GET_CODE (XEXP (XEXP (op,0), 0)) == SYMBOL_REF
-			     || GET_CODE (XEXP (XEXP (op,0), 0)) == LABEL_REF)
+			     || LABEL_REF_P (XEXP (XEXP (op,0), 0)))
 			 && CONST_INT_P (XEXP (XEXP (op,0), 1))"))))
 
 ;; Return 1 for an unsigned 16 bit or a const symbolc operand.
diff --git a/gcc/config/tilegx/tilegx.c b/gcc/config/tilegx/tilegx.c
index 26ab4889147..b96994c5997 100644
--- a/gcc/config/tilegx/tilegx.c
+++ b/gcc/config/tilegx/tilegx.c
@@ -827,7 +827,7 @@ tilegx_pic_address_needs_scratch (rtx x)
   if (GET_CODE (x) == CONST
       && GET_CODE (XEXP (x, 0)) == PLUS
       && (GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF
-	  || GET_CODE (XEXP (XEXP (x, 0), 0)) == LABEL_REF)
+	  || LABEL_REF_P (XEXP (XEXP (x, 0), 0)))
       && (CONST_INT_P (XEXP (XEXP (x, 0), 1))))
     return true;
 
@@ -1327,7 +1327,7 @@ tilegx_legitimize_pic_address (rtx orig,
       else
 	gcc_unreachable ();
     }
-  else if (GET_CODE (orig) == LABEL_REF)
+  else if (LABEL_REF_P (orig))
     {
       rtx address;
       rtx temp_reg;
diff --git a/gcc/config/tilepro/predicates.md b/gcc/config/tilepro/predicates.md
index b711773f0c3..4f8ec509bf3 100644
--- a/gcc/config/tilepro/predicates.md
+++ b/gcc/config/tilepro/predicates.md
@@ -219,7 +219,7 @@
        (and (match_code "const")
 	    (match_test "GET_CODE (XEXP (op,0)) == PLUS
 			 && (GET_CODE (XEXP (XEXP (op,0), 0)) == SYMBOL_REF
-			     || GET_CODE (XEXP (XEXP (op,0), 0)) == LABEL_REF)
+			     || LABEL_REF_P (XEXP (XEXP (op,0), 0)))
 			 && CONST_INT_P (XEXP (XEXP (op,0), 1))"))))
 
 ;; Returns 1 if OP is a symbolic operand, or a const unspec wrapper
diff --git a/gcc/config/tilepro/tilepro.c b/gcc/config/tilepro/tilepro.c
index 2cf16edd86d..31b6d5af513 100644
--- a/gcc/config/tilepro/tilepro.c
+++ b/gcc/config/tilepro/tilepro.c
@@ -727,7 +727,7 @@ tilepro_pic_address_needs_scratch (rtx x)
   if (GET_CODE (x) == CONST
       && GET_CODE (XEXP (x, 0)) == PLUS
       && (GET_CODE (XEXP (XEXP (x, 0), 0)) == SYMBOL_REF
-	  || GET_CODE (XEXP (XEXP (x, 0), 0)) == LABEL_REF)
+	  || LABEL_REF_P (XEXP (XEXP (x, 0), 0)))
       && CONST_INT_P (XEXP (XEXP (x, 0), 1)))
     return true;
 
@@ -1084,7 +1084,7 @@ tilepro_legitimize_pic_address (rtx orig,
       else
 	gcc_unreachable ();
     }
-  else if (GET_CODE (orig) == LABEL_REF)
+  else if (LABEL_REF_P (orig))
     {
       rtx address, temp_reg;
       rtx text_label_symbol;
diff --git a/gcc/config/v850/v850.c b/gcc/config/v850/v850.c
index 001b1baa8ec..9ccc41d7f86 100644
--- a/gcc/config/v850/v850.c
+++ b/gcc/config/v850/v850.c
@@ -797,7 +797,7 @@ v850_output_addr_const_extra (FILE * file, rtx x)
      nothing, since the table will not be used.
      (cf gcc.c-torture/compile/990801-1.c).  */
   if (GET_CODE (x) == MINUS
-      && GET_CODE (XEXP (x, 0)) == LABEL_REF)
+      && LABEL_REF_P (XEXP (x, 0)))
     {
       rtx_code_label *label
 	= dyn_cast<rtx_code_label *> (XEXP (XEXP (x, 0), 0));
@@ -872,7 +872,7 @@ output_move_single (rtx * operands)
       else if (special_symbolref_operand (src, VOIDmode))
 	return "movea %O1(%P1),%Q1,%0";
 
-      else if (GET_CODE (src) == LABEL_REF
+      else if (LABEL_REF_P (src)
 	       || GET_CODE (src) == SYMBOL_REF
 	       || GET_CODE (src) == CONST)
 	{
diff --git a/gcc/config/vax/predicates.md b/gcc/config/vax/predicates.md
index c6d66f771ef..99c21d57d06 100644
--- a/gcc/config/vax/predicates.md
+++ b/gcc/config/vax/predicates.md
@@ -26,11 +26,11 @@
 (define_predicate "local_symbolic_operand"
   (match_code "const,symbol_ref,label_ref")
 {
-  if (GET_CODE (op) == LABEL_REF)
+  if (LABEL_REF_P (op))
     return 1;
   if (GET_CODE (op) == SYMBOL_REF)
     return !flag_pic || SYMBOL_REF_LOCAL_P (op);
-  if (GET_CODE (XEXP (XEXP (op, 0), 0)) == LABEL_REF)
+  if (LABEL_REF_P (XEXP (XEXP (op, 0), 0)))
     return 1;
   return !flag_pic || SYMBOL_REF_LOCAL_P (XEXP (XEXP (op, 0), 0));
 })
diff --git a/gcc/config/vax/vax.c b/gcc/config/vax/vax.c
index 3cee73c2e23..2094e852527 100644
--- a/gcc/config/vax/vax.c
+++ b/gcc/config/vax/vax.c
@@ -1637,7 +1637,7 @@ vax_output_int_subtract (rtx_insn *insn, rtx *operands, machine_mode mode)
 bool
 legitimate_constant_address_p (rtx x)
 {
-  if (GET_CODE (x) == LABEL_REF || GET_CODE (x) == SYMBOL_REF
+  if (LABEL_REF_P (x) || GET_CODE (x) == SYMBOL_REF
 	  || CONST_INT_P (x) || GET_CODE (x) == HIGH)
     return true;
   if (GET_CODE (x) != CONST)
diff --git a/gcc/config/xtensa/xtensa.c b/gcc/config/xtensa/xtensa.c
index 85b4777a91d..30b27cb629f 100644
--- a/gcc/config/xtensa/xtensa.c
+++ b/gcc/config/xtensa/xtensa.c
@@ -2470,7 +2470,7 @@ print_operand (FILE *file, rtx x, int letter)
 	     suitable for 'const16' that sets the high or low 16 bits.  */
 	  if (GET_CODE (XEXP (x, 0)) != PLUS
 	      || (GET_CODE (XEXP (XEXP (x, 0), 0)) != SYMBOL_REF
-		  && GET_CODE (XEXP (XEXP (x, 0), 0)) != LABEL_REF)
+		  && !LABEL_REF_P (XEXP (XEXP (x, 0), 0)))
 	      || !CONST_INT_P (XEXP (XEXP (x, 0), 1)))
 	    output_operand_lossage ("invalid %%t/%%b value");
 	  print_operand (file, XEXP (XEXP (x, 0), 0), 0);
diff --git a/gcc/config/xtensa/xtensa.h b/gcc/config/xtensa/xtensa.h
index a9e6e7ded5d..ccb64520c49 100644
--- a/gcc/config/xtensa/xtensa.h
+++ b/gcc/config/xtensa/xtensa.h
@@ -624,7 +624,7 @@ typedef struct xtensa_args
    valid address.  This is defined to be the same as 'CONSTANT_P (X)',
    but rejecting CONST_DOUBLE.  */
 #define CONSTANT_ADDRESS_P(X)						\
-  ((GET_CODE (X) == LABEL_REF || GET_CODE (X) == SYMBOL_REF		\
+  ((LABEL_REF_P (X) || GET_CODE (X) == SYMBOL_REF		\
     || CONST_INT_P (X) || GET_CODE (X) == HIGH		\
     || (GET_CODE (X) == CONST)))
 
@@ -634,7 +634,7 @@ typedef struct xtensa_args
 #define LEGITIMATE_PIC_OPERAND_P(X)					\
   ((GET_CODE (X) != SYMBOL_REF						\
     || (SYMBOL_REF_LOCAL_P (X) && !SYMBOL_REF_EXTERNAL_P (X)))		\
-   && GET_CODE (X) != LABEL_REF						\
+   && !LABEL_REF_P (X)						\
    && GET_CODE (X) != CONST)
 
 /* Specify the machine mode that this machine uses
diff --git a/gcc/cprop.c b/gcc/cprop.c
index 65c0130cc07..ecb383487bc 100644
--- a/gcc/cprop.c
+++ b/gcc/cprop.c
@@ -1621,7 +1621,7 @@ bypass_block (basic_block bb, rtx_insn *setcc, rtx_insn *jump)
 	      edest = FALLTHRU_EDGE (bb);
 	      dest = edest->insns.r ? NULL : edest->dest;
 	    }
-	  else if (GET_CODE (new_rtx) == LABEL_REF)
+	  else if (LABEL_REF_P (new_rtx))
 	    {
 	      dest = BLOCK_FOR_INSN (XEXP (new_rtx, 0));
 	      /* Don't bypass edges containing instructions.  */
diff --git a/gcc/cse.c b/gcc/cse.c
index afc6f50edbe..5662dc0eeae 100644
--- a/gcc/cse.c
+++ b/gcc/cse.c
@@ -3537,13 +3537,13 @@ fold_rtx (rtx x, rtx_insn *insn)
 	     with that LABEL_REF as its second operand.  If so, the result is
 	     the first operand of that MINUS.  This handles switches with an
 	     ADDR_DIFF_VEC table.  */
-	  if (const_arg1 && GET_CODE (const_arg1) == LABEL_REF)
+	  if (const_arg1 && LABEL_REF_P (const_arg1))
 	    {
 	      rtx y
 		= GET_CODE (folded_arg0) == MINUS ? folded_arg0
 		: lookup_as_function (folded_arg0, MINUS);
 
-	      if (y != 0 && GET_CODE (XEXP (y, 1)) == LABEL_REF
+	      if (y != 0 && LABEL_REF_P (XEXP (y, 1))
 		  && label_ref_label (XEXP (y, 1)) == label_ref_label (const_arg1))
 		return XEXP (y, 0);
 
@@ -3551,19 +3551,19 @@ fold_rtx (rtx x, rtx_insn *insn)
 	      if ((y = (GET_CODE (folded_arg0) == CONST ? folded_arg0
 			: lookup_as_function (folded_arg0, CONST))) != 0
 		  && GET_CODE (XEXP (y, 0)) == MINUS
-		  && GET_CODE (XEXP (XEXP (y, 0), 1)) == LABEL_REF
+		  && LABEL_REF_P (XEXP (XEXP (y, 0), 1))
 		  && label_ref_label (XEXP (XEXP (y, 0), 1)) == label_ref_label (const_arg1))
 		return XEXP (XEXP (y, 0), 0);
 	    }
 
 	  /* Likewise if the operands are in the other order.  */
-	  if (const_arg0 && GET_CODE (const_arg0) == LABEL_REF)
+	  if (const_arg0 && LABEL_REF_P (const_arg0))
 	    {
 	      rtx y
 		= GET_CODE (folded_arg1) == MINUS ? folded_arg1
 		: lookup_as_function (folded_arg1, MINUS);
 
-	      if (y != 0 && GET_CODE (XEXP (y, 1)) == LABEL_REF
+	      if (y != 0 && LABEL_REF_P (XEXP (y, 1))
 		  && label_ref_label (XEXP (y, 1)) == label_ref_label (const_arg0))
 		return XEXP (y, 0);
 
@@ -3571,7 +3571,7 @@ fold_rtx (rtx x, rtx_insn *insn)
 	      if ((y = (GET_CODE (folded_arg1) == CONST ? folded_arg1
 			: lookup_as_function (folded_arg1, CONST))) != 0
 		  && GET_CODE (XEXP (y, 0)) == MINUS
-		  && GET_CODE (XEXP (XEXP (y, 0), 1)) == LABEL_REF
+		  && LABEL_REF_P (XEXP (XEXP (y, 0), 1))
 		  && label_ref_label (XEXP (XEXP (y, 0), 1)) == label_ref_label (const_arg0))
 		return XEXP (XEXP (y, 0), 0);
 	    }
@@ -4310,7 +4310,7 @@ find_sets_in_insn (rtx_insn *insn, struct set **psets)
 	 and not be misled by unchanged instructions
 	 that were unconditional jumps to begin with.  */
       if (SET_DEST (x) == pc_rtx
-	  && GET_CODE (SET_SRC (x)) == LABEL_REF)
+	  && LABEL_REF_P (SET_SRC (x)))
 	;
       /* Don't count call-insns, (set (reg 0) (call ...)), as a set.
 	 The hard function value register is used only once, to copy to
@@ -4334,7 +4334,7 @@ find_sets_in_insn (rtx_insn *insn, struct set **psets)
 	      /* As above, we ignore unconditional jumps and call-insns and
 		 ignore the result of apply_change_group.  */
 	      if (SET_DEST (y) == pc_rtx
-		  && GET_CODE (SET_SRC (y)) == LABEL_REF)
+		  && LABEL_REF_P (SET_SRC (y)))
 		;
 	      else if (GET_CODE (SET_SRC (y)) == CALL)
 		;
@@ -4842,8 +4842,8 @@ cse_insn (rtx_insn *insn)
 		 "constant" here so we will record it. This allows us
 		 to fold switch statements when an ADDR_DIFF_VEC is used.  */
 	      || (GET_CODE (src_folded) == MINUS
-		  && GET_CODE (XEXP (src_folded, 0)) == LABEL_REF
-		  && GET_CODE (XEXP (src_folded, 1)) == LABEL_REF)))
+		  && LABEL_REF_P (XEXP (src_folded, 0))
+		  && LABEL_REF_P (XEXP (src_folded, 1)))))
 	src_const = src_folded, src_const_elt = elt;
       else if (src_const == 0 && src_eqv_here && CONSTANT_P (src_eqv_here))
 	src_const = src_eqv_here, src_const_elt = src_eqv_elt;
@@ -5155,7 +5155,7 @@ cse_insn (rtx_insn *insn)
 
       /* If this was an indirect jump insn, a known label will really be
 	 cheaper even though it looks more expensive.  */
-      if (dest == pc_rtx && src_const && GET_CODE (src_const) == LABEL_REF)
+      if (dest == pc_rtx && src_const && LABEL_REF_P (src_const))
 	src_folded = src_const, src_folded_cost = src_folded_regcost = -1;
 
       /* Terminate loop when replacement made.  This must terminate since
@@ -5341,11 +5341,11 @@ cse_insn (rtx_insn *insn)
 	     barriers).  */
 	  if (n_sets == 1 && dest == pc_rtx
 	      && (trial == pc_rtx
-		  || (GET_CODE (trial) == LABEL_REF
+		  || (LABEL_REF_P (trial)
 		      && ! condjump_p (insn))))
 	    {
 	      /* Don't substitute non-local labels, this confuses CFG.  */
-	      if (GET_CODE (trial) == LABEL_REF
+	      if (LABEL_REF_P (trial)
 		  && LABEL_REF_NONLOCAL_P (trial))
 		continue;
 
@@ -5380,8 +5380,8 @@ cse_insn (rtx_insn *insn)
 		       /* Likewise on IA-64, except without the
 			  truncate.  */
 		       || (GET_CODE (XEXP (trial, 0)) == MINUS
-			   && GET_CODE (XEXP (XEXP (trial, 0), 0)) == LABEL_REF
-			   && GET_CODE (XEXP (XEXP (trial, 0), 1)) == LABEL_REF)))
+			   && LABEL_REF_P (XEXP (XEXP (trial, 0), 0))
+			   && LABEL_REF_P (XEXP (XEXP (trial, 0), 1)))))
 	    /* Do nothing for this case.  */
 	    ;
 
@@ -5505,8 +5505,8 @@ cse_insn (rtx_insn *insn)
 	       && REG_P (SUBREG_REG (src_const)))
 	  && !(GET_CODE (src_const) == CONST
 	       && GET_CODE (XEXP (src_const, 0)) == MINUS
-	       && GET_CODE (XEXP (XEXP (src_const, 0), 0)) == LABEL_REF
-	       && GET_CODE (XEXP (XEXP (src_const, 0), 1)) == LABEL_REF)
+	       && LABEL_REF_P (XEXP (XEXP (src_const, 0), 0))
+	       && LABEL_REF_P (XEXP (XEXP (src_const, 0), 1)))
 	  && !rtx_equal_p (src, src_const))
 	{
 	  /* Make sure that the rtx is not shared.  */
@@ -5599,7 +5599,7 @@ cse_insn (rtx_insn *insn)
 
       /* If this SET is now setting PC to a label, we know it used to
 	 be a conditional or computed branch.  */
-      else if (dest == pc_rtx && GET_CODE (src) == LABEL_REF
+      else if (dest == pc_rtx && LABEL_REF_P (src)
 	       && !LABEL_REF_NONLOCAL_P (src))
 	{
 	  /* We reemit the jump in as many cases as possible just in
@@ -6582,7 +6582,7 @@ check_for_label_ref (rtx_insn *insn)
   FOR_EACH_SUBRTX (iter, array, PATTERN (insn), ALL)
     {
       const_rtx x = *iter;
-      if (GET_CODE (x) == LABEL_REF
+      if (LABEL_REF_P (x)
 	  && !LABEL_REF_NONLOCAL_P (x)
 	  && (!JUMP_P (insn)
 	      || !label_is_jump_target_p (label_ref_label (x), insn))
diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index 24672f62635..a3cdd4ace85 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -3072,7 +3072,7 @@ dbxout_symbol_location (tree decl, tree type, const char *suffix, rtx home)
 		  else
 		    marked = true;
 		}
-	      else if (GET_CODE (tmp) == LABEL_REF)
+	      else if (LABEL_REF_P (tmp))
 		{
 		  addr = tmp;
 		  marked = true;
diff --git a/gcc/explow.c b/gcc/explow.c
index 3253898b66e..bc813d07f2e 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -197,7 +197,7 @@ plus_constant (machine_mode mode, rtx x, poly_int64 c, bool inplace)
   if (maybe_ne (c, 0))
     x = gen_rtx_PLUS (mode, x, gen_int_mode (c, mode));
 
-  if (GET_CODE (x) == SYMBOL_REF || GET_CODE (x) == LABEL_REF)
+  if (GET_CODE (x) == SYMBOL_REF || LABEL_REF_P (x))
     return x;
   else if (all_constant)
     return gen_rtx_CONST (mode, x);
@@ -686,7 +686,7 @@ force_reg (machine_mode mode, rtx x)
 	if (SYMBOL_REF_DECL (x) && DECL_P (SYMBOL_REF_DECL (x)))
 	  align = DECL_ALIGN (SYMBOL_REF_DECL (x));
       }
-    else if (GET_CODE (x) == LABEL_REF)
+    else if (LABEL_REF_P (x))
       align = BITS_PER_UNIT;
     else if (GET_CODE (x) == CONST
 	     && GET_CODE (XEXP (x, 0)) == PLUS
diff --git a/gcc/expr.c b/gcc/expr.c
index cb933203a2c..bffd3ca50df 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -7449,7 +7449,7 @@ force_operand (rtx value, rtx target)
   if ((code == PLUS || code == MINUS)
       && XEXP (value, 0) == pic_offset_table_rtx
       && (GET_CODE (XEXP (value, 1)) == SYMBOL_REF
-	  || GET_CODE (XEXP (value, 1)) == LABEL_REF
+	  || LABEL_REF_P (XEXP (value, 1))
 	  || GET_CODE (XEXP (value, 1)) == CONST))
     {
       if (!subtarget)
diff --git a/gcc/final.c b/gcc/final.c
index 7e5a574a5bb..a93acb29539 100644
--- a/gcc/final.c
+++ b/gcc/final.c
@@ -4003,7 +4003,7 @@ output_asm_label (rtx x)
 {
   char buf[256];
 
-  if (GET_CODE (x) == LABEL_REF)
+  if (LABEL_REF_P (x))
     x = label_ref_label (x);
   if (LABEL_P (x)
       || (NOTE_P (x)
diff --git a/gcc/genattrtab.c b/gcc/genattrtab.c
index 6b24323f112..68aa1723073 100644
--- a/gcc/genattrtab.c
+++ b/gcc/genattrtab.c
@@ -3715,7 +3715,7 @@ write_test_expr (FILE *outf, rtx exp, unsigned int attrs_cached, int flags,
     /* The address of the branch target.  */
     case MATCH_DUP:
       fprintf (outf,
-	       "INSN_ADDRESSES_SET_P () ? INSN_ADDRESSES (INSN_UID (GET_CODE (operands[%d]) == LABEL_REF ? XEXP (operands[%d], 0) : operands[%d])) : 0",
+	       "INSN_ADDRESSES_SET_P () ? INSN_ADDRESSES (INSN_UID (LABEL_REF_P (operands[%d]) ? XEXP (operands[%d], 0) : operands[%d])) : 0",
 	       XINT (exp, 0), XINT (exp, 0), XINT (exp, 0));
       break;
 
diff --git a/gcc/gensupport.c b/gcc/gensupport.c
index c26057079fd..8bdd0ae7502 100644
--- a/gcc/gensupport.c
+++ b/gcc/gensupport.c
@@ -3156,7 +3156,7 @@ needs_barrier_p (rtx x)
 {
   return (GET_CODE (x) == SET
 	  && GET_CODE (SET_DEST (x)) == PC
-	  && GET_CODE (SET_SRC (x)) == LABEL_REF);
+	  && LABEL_REF_P (SET_SRC (x)));
 }
 
 #define NS "NULL"
diff --git a/gcc/ifcvt.c b/gcc/ifcvt.c
index 8ccf523c859..7a371a43bd9 100644
--- a/gcc/ifcvt.c
+++ b/gcc/ifcvt.c
@@ -438,7 +438,7 @@ cond_exec_get_condition (rtx_insn *jump)
 
   /* If this branches to JUMP_LABEL when the condition is false,
      reverse the condition.  */
-  if (GET_CODE (XEXP (test_if, 2)) == LABEL_REF
+  if (LABEL_REF_P (XEXP (test_if, 2))
       && label_ref_label (XEXP (test_if, 2)) == JUMP_LABEL (jump))
     {
       enum rtx_code rev = reversed_comparison_code (cond, jump);
@@ -832,7 +832,7 @@ noce_emit_store_flag (struct noce_if_info *if_info, rtx x, int reversep,
     {
       rtx set = pc_set (if_info->jump);
       cond = XEXP (SET_SRC (set), 0);
-      if (GET_CODE (XEXP (SET_SRC (set), 2)) == LABEL_REF
+      if (LABEL_REF_P (XEXP (SET_SRC (set), 2))
 	  && label_ref_label (XEXP (SET_SRC (set), 2)) == JUMP_LABEL (if_info->jump))
 	reversep = !reversep;
       if (if_info->then_else_reversed)
@@ -2316,7 +2316,7 @@ noce_get_alt_condition (struct noce_if_info *if_info, rtx target,
   set = pc_set (if_info->jump);
   cond = XEXP (SET_SRC (set), 0);
   reverse
-    = GET_CODE (XEXP (SET_SRC (set), 2)) == LABEL_REF
+    = LABEL_REF_P (XEXP (SET_SRC (set), 2))
       && label_ref_label (XEXP (SET_SRC (set), 2)) == JUMP_LABEL (if_info->jump);
   if (if_info->then_else_reversed)
     reverse = !reverse;
@@ -2928,7 +2928,7 @@ noce_get_condition (rtx_insn *jump, rtx_insn **earliest, bool then_else_reversed
 
   /* If this branches to JUMP_LABEL when the condition is false,
      reverse the condition.  */
-  reverse = (GET_CODE (XEXP (SET_SRC (set), 2)) == LABEL_REF
+  reverse = (LABEL_REF_P (XEXP (SET_SRC (set), 2))
 	     && label_ref_label (XEXP (SET_SRC (set), 2)) == JUMP_LABEL (jump));
 
   /* We may have to reverse because the caller's if block is not canonical,
diff --git a/gcc/ira.c b/gcc/ira.c
index 84bff57fc95..9f7a72e3fe5 100644
--- a/gcc/ira.c
+++ b/gcc/ira.c
@@ -3933,12 +3933,12 @@ indirect_jump_optimize (void)
 	      rtx_insn *def_insn = DF_REF_INSN (def);
 	      rtx lab = NULL_RTX;
 	      rtx set = single_set (def_insn);
-	      if (set && GET_CODE (SET_SRC (set)) == LABEL_REF)
+	      if (set && LABEL_REF_P (SET_SRC (set)))
 		lab = SET_SRC (set);
 	      else
 		{
 		  rtx eqnote = find_reg_note (def_insn, REG_EQUAL, NULL_RTX);
-		  if (eqnote && GET_CODE (XEXP (eqnote, 0)) == LABEL_REF)
+		  if (eqnote && LABEL_REF_P (XEXP (eqnote, 0)))
 		    lab = XEXP (eqnote, 0);
 		}
 	      if (lab && validate_replace_rtx (SET_SRC (x), lab, insn))
diff --git a/gcc/jump.c b/gcc/jump.c
index d6f4741e9f0..2ec071a6235 100644
--- a/gcc/jump.c
+++ b/gcc/jump.c
@@ -263,7 +263,7 @@ maybe_propagate_label_ref (rtx_insn *jump_insn, rtx_insn *prev_nonjump_insn)
       if (label_set != NULL
 	  /* The source must be the direct LABEL_REF, not a
 	     PLUS, UNSPEC, IF_THEN_ELSE etc.  */
-	  && GET_CODE (SET_SRC (label_set)) == LABEL_REF
+	  && LABEL_REF_P (SET_SRC (label_set))
 	  && (rtx_equal_p (label_dest, pc_src)
 	      || (GET_CODE (pc_src) == IF_THEN_ELSE
 		  && (rtx_equal_p (label_dest, XEXP (pc_src, 1))
@@ -773,7 +773,7 @@ simplejump_p (const rtx_insn *insn)
   return (JUMP_P (insn)
 	  && GET_CODE (PATTERN (insn)) == SET
 	  && GET_CODE (SET_DEST (PATTERN (insn))) == PC
-	  && GET_CODE (SET_SRC (PATTERN (insn))) == LABEL_REF);
+	  && LABEL_REF_P (SET_SRC (PATTERN (insn))));
 }
 
 /* Return nonzero if INSN is a (possibly) conditional jump
@@ -792,15 +792,15 @@ condjump_p (const rtx_insn *insn)
     return 0;
 
   x = SET_SRC (x);
-  if (GET_CODE (x) == LABEL_REF)
+  if (LABEL_REF_P (x))
     return 1;
   else
     return (GET_CODE (x) == IF_THEN_ELSE
 	    && ((GET_CODE (XEXP (x, 2)) == PC
-		 && (GET_CODE (XEXP (x, 1)) == LABEL_REF
+		 && (LABEL_REF_P (XEXP (x, 1))
 		     || ANY_RETURN_P (XEXP (x, 1))))
 		|| (GET_CODE (XEXP (x, 1)) == PC
-		    && (GET_CODE (XEXP (x, 2)) == LABEL_REF
+		    && (LABEL_REF_P (XEXP (x, 2))
 			|| ANY_RETURN_P (XEXP (x, 2))))));
 }
 
@@ -824,16 +824,16 @@ condjump_in_parallel_p (const rtx_insn *insn)
     return 0;
   if (GET_CODE (SET_DEST (x)) != PC)
     return 0;
-  if (GET_CODE (SET_SRC (x)) == LABEL_REF)
+  if (LABEL_REF_P (SET_SRC (x)))
     return 1;
   if (GET_CODE (SET_SRC (x)) != IF_THEN_ELSE)
     return 0;
   if (XEXP (SET_SRC (x), 2) == pc_rtx
-      && (GET_CODE (XEXP (SET_SRC (x), 1)) == LABEL_REF
+      && (LABEL_REF_P (XEXP (SET_SRC (x), 1))
 	  || ANY_RETURN_P (XEXP (SET_SRC (x), 1))))
     return 1;
   if (XEXP (SET_SRC (x), 1) == pc_rtx
-      && (GET_CODE (XEXP (SET_SRC (x), 2)) == LABEL_REF
+      && (LABEL_REF_P (XEXP (SET_SRC (x), 2))
 	  || ANY_RETURN_P (XEXP (SET_SRC (x), 2))))
     return 1;
   return 0;
@@ -868,7 +868,7 @@ any_uncondjump_p (const rtx_insn *insn)
   const_rtx x = pc_set (insn);
   if (!x)
     return 0;
-  if (GET_CODE (SET_SRC (x)) != LABEL_REF)
+  if (!LABEL_REF_P (SET_SRC (x)))
     return 0;
   if (find_reg_note (insn, REG_NON_LOCAL_GOTO, NULL_RTX))
     return 0;
@@ -911,13 +911,13 @@ condjump_label (const rtx_insn *insn)
   if (!x)
     return NULL_RTX;
   x = SET_SRC (x);
-  if (GET_CODE (x) == LABEL_REF)
+  if (LABEL_REF_P (x))
     return x;
   if (GET_CODE (x) != IF_THEN_ELSE)
     return NULL_RTX;
-  if (XEXP (x, 2) == pc_rtx && GET_CODE (XEXP (x, 1)) == LABEL_REF)
+  if (XEXP (x, 2) == pc_rtx && LABEL_REF_P (XEXP (x, 1)))
     return XEXP (x, 1);
-  if (XEXP (x, 1) == pc_rtx && GET_CODE (XEXP (x, 2)) == LABEL_REF)
+  if (XEXP (x, 1) == pc_rtx && LABEL_REF_P (XEXP (x, 2)))
     return XEXP (x, 2);
   return NULL_RTX;
 }
@@ -1438,7 +1438,7 @@ redirect_exp_1 (rtx *loc, rtx olabel, rtx nlabel, rtx_insn *insn)
       || x == olabel)
     {
       x = redirect_target (nlabel);
-      if (GET_CODE (x) == LABEL_REF && loc == &PATTERN (insn))
+      if (LABEL_REF_P (x) && loc == &PATTERN (insn))
  	x = gen_rtx_SET (pc_rtx, x);
       validate_change (insn, loc, x, 1);
       return;
@@ -1446,7 +1446,7 @@ redirect_exp_1 (rtx *loc, rtx olabel, rtx nlabel, rtx_insn *insn)
 
   if (code == SET && SET_DEST (x) == pc_rtx
       && ANY_RETURN_P (nlabel)
-      && GET_CODE (SET_SRC (x)) == LABEL_REF
+      && LABEL_REF_P (SET_SRC (x))
       && label_ref_label (SET_SRC (x)) == olabel)
     {
       validate_change (insn, loc, nlabel, 1);
diff --git a/gcc/loop-doloop.c b/gcc/loop-doloop.c
index 0efe7b449ff..e30d17be3ef 100644
--- a/gcc/loop-doloop.c
+++ b/gcc/loop-doloop.c
@@ -190,7 +190,7 @@ doloop_condition_get (rtx_insn *doloop_pat)
   if (GET_CODE (cmp) != SET
       || SET_DEST (cmp) != pc_rtx
       || GET_CODE (SET_SRC (cmp)) != IF_THEN_ELSE
-      || GET_CODE (XEXP (SET_SRC (cmp), 1)) != LABEL_REF
+      || !LABEL_REF_P (XEXP (SET_SRC (cmp), 1))
       || XEXP (SET_SRC (cmp), 2) != pc_rtx)
     return 0;
 
diff --git a/gcc/lower-subreg.c b/gcc/lower-subreg.c
index ea09cd39cc1..dcc6044e7a2 100644
--- a/gcc/lower-subreg.c
+++ b/gcc/lower-subreg.c
@@ -306,7 +306,7 @@ simple_move_operand (rtx x)
   if (!OBJECT_P (x))
     return false;
 
-  if (GET_CODE (x) == LABEL_REF
+  if (LABEL_REF_P (x)
       || GET_CODE (x) == SYMBOL_REF
       || GET_CODE (x) == HIGH
       || GET_CODE (x) == CONST)
diff --git a/gcc/print-rtl.c b/gcc/print-rtl.c
index 10948efddd9..849e22726d7 100644
--- a/gcc/print-rtl.c
+++ b/gcc/print-rtl.c
@@ -573,7 +573,7 @@ rtx_writer::print_rtx_operand_code_u (const_rtx in_rtx, int idx)
       rtx sub = XEXP (in_rtx, idx);
       enum rtx_code subc = GET_CODE (sub);
 
-      if (GET_CODE (in_rtx) == LABEL_REF)
+      if (LABEL_REF_P (in_rtx))
 	{
 	  if (subc == NOTE
 	      && NOTE_KIND (sub) == NOTE_INSN_DELETED_LABEL)
diff --git a/gcc/read-rtl-function.c b/gcc/read-rtl-function.c
index 25d9f674612..0a3f79c8c36 100644
--- a/gcc/read-rtl-function.c
+++ b/gcc/read-rtl-function.c
@@ -955,7 +955,7 @@ function_reader::read_rtx_operand_u (rtx x, int idx)
 {
   /* In compact mode, the PREV/NEXT insn uids are not dumped, so skip
      the "uu" when reading. */
-  if (is_compact () && GET_CODE (x) != LABEL_REF)
+  if (is_compact () && !LABEL_REF_P (x))
     return;
 
   struct md_name name;
diff --git a/gcc/recog.c b/gcc/recog.c
index 56bd5716a87..5b6e957b2b4 100644
--- a/gcc/recog.c
+++ b/gcc/recog.c
@@ -123,7 +123,7 @@ asm_labels_ok (rtx body)
     return true;
 
   for (i = 0; i < ASM_OPERANDS_LABEL_LENGTH (asmop); i++)
-    if (GET_CODE (ASM_OPERANDS_LABEL (asmop, i)) != LABEL_REF)
+    if (!LABEL_REF_P (ASM_OPERANDS_LABEL (asmop, i)))
       return false;
 
   return true;
diff --git a/gcc/reginfo.c b/gcc/reginfo.c
index 22129db915a..ce65873b0f6 100644
--- a/gcc/reginfo.c
+++ b/gcc/reginfo.c
@@ -1145,20 +1145,20 @@ reg_scan_mark_refs (rtx x, rtx_insn *insn)
 		  && REG_POINTER (XEXP (SET_SRC (x), 0)))
 	      || GET_CODE (SET_SRC (x)) == CONST
 	      || GET_CODE (SET_SRC (x)) == SYMBOL_REF
-	      || GET_CODE (SET_SRC (x)) == LABEL_REF
+	      || LABEL_REF_P (SET_SRC (x))
 	      || (GET_CODE (SET_SRC (x)) == HIGH
 		  && (GET_CODE (XEXP (SET_SRC (x), 0)) == CONST
 		      || GET_CODE (XEXP (SET_SRC (x), 0)) == SYMBOL_REF
-		      || GET_CODE (XEXP (SET_SRC (x), 0)) == LABEL_REF))
+		      || LABEL_REF_P (XEXP (SET_SRC (x), 0))))
 	      || ((GET_CODE (SET_SRC (x)) == PLUS
 		   || GET_CODE (SET_SRC (x)) == LO_SUM)
 		  && (GET_CODE (XEXP (SET_SRC (x), 1)) == CONST
 		      || GET_CODE (XEXP (SET_SRC (x), 1)) == SYMBOL_REF
-		      || GET_CODE (XEXP (SET_SRC (x), 1)) == LABEL_REF))
+		      || LABEL_REF_P (XEXP (SET_SRC (x), 1))))
 	      || ((note = find_reg_note (insn, REG_EQUAL, 0)) != 0
 		  && (GET_CODE (XEXP (note, 0)) == CONST
 		      || GET_CODE (XEXP (note, 0)) == SYMBOL_REF
-		      || GET_CODE (XEXP (note, 0)) == LABEL_REF))))
+		      || LABEL_REF_P (XEXP (note, 0))))))
 	REG_POINTER (SET_DEST (x)) = 1;
 
       /* If this is setting a register from a register or from a simple
diff --git a/gcc/reload.c b/gcc/reload.c
index e1f8329297c..a9efe22d965 100644
--- a/gcc/reload.c
+++ b/gcc/reload.c
@@ -4200,7 +4200,7 @@ find_reloads (rtx_insn *insn, int replace, int ind_levels, int live_known,
 	  /* If we're replacing an operand with a LABEL_REF, we need to
 	     make sure that there's a REG_LABEL_OPERAND note attached to
 	     this instruction.  */
-	  if (GET_CODE (substitution) == LABEL_REF
+	  if (LABEL_REF_P (substitution)
 	      && !find_reg_note (insn, REG_LABEL_OPERAND,
 				 label_ref_label (substitution))
 	      /* For a JUMP_P, if it was a branch target it must have
@@ -6266,7 +6266,7 @@ subst_reloads (rtx_insn *insn)
 	  /* If we're replacing a LABEL_REF with a register, there must
 	     already be an indication (to e.g. flow) which label this
 	     register refers to.  */
-	  gcc_assert (GET_CODE (*r->where) != LABEL_REF
+	  gcc_assert (!LABEL_REF_P (*r->where)
 		      || !JUMP_P (insn)
 		      || find_reg_note (insn,
 					REG_LABEL_OPERAND,
diff --git a/gcc/reload1.c b/gcc/reload1.c
index 5cc8bb5cada..1a68d0567fc 100644
--- a/gcc/reload1.c
+++ b/gcc/reload1.c
@@ -2436,13 +2436,13 @@ set_label_offsets (rtx x, rtx_insn *insn, int initial_p)
 
 	case IF_THEN_ELSE:
 	  tem = XEXP (SET_SRC (x), 1);
-	  if (GET_CODE (tem) == LABEL_REF)
+	  if (LABEL_REF_P (tem))
 	    set_label_offsets (label_ref_label (tem), insn, initial_p);
 	  else if (GET_CODE (tem) != PC && GET_CODE (tem) != RETURN)
 	    break;
 
 	  tem = XEXP (SET_SRC (x), 2);
-	  if (GET_CODE (tem) == LABEL_REF)
+	  if (LABEL_REF_P (tem))
 	    set_label_offsets (label_ref_label (tem), insn, initial_p);
 	  else if (GET_CODE (tem) != PC && GET_CODE (tem) != RETURN)
 	    break;
diff --git a/gcc/reorg.c b/gcc/reorg.c
index bdfcf8851cd..79684952595 100644
--- a/gcc/reorg.c
+++ b/gcc/reorg.c
@@ -894,19 +894,19 @@ get_branch_condition (const rtx_insn *insn, rtx target)
     return 0;
 
   src = SET_SRC (pat);
-  if (GET_CODE (src) == LABEL_REF && label_ref_label (src) == target)
+  if (LABEL_REF_P (src) && label_ref_label (src) == target)
     return const_true_rtx;
 
   else if (GET_CODE (src) == IF_THEN_ELSE
 	   && XEXP (src, 2) == pc_rtx
-	   && ((GET_CODE (XEXP (src, 1)) == LABEL_REF
+	   && ((LABEL_REF_P (XEXP (src, 1))
 		&& label_ref_label (XEXP (src, 1)) == target)
 	       || (ANY_RETURN_P (XEXP (src, 1)) && XEXP (src, 1) == target)))
     return XEXP (src, 0);
 
   else if (GET_CODE (src) == IF_THEN_ELSE
 	   && XEXP (src, 1) == pc_rtx
-	   && ((GET_CODE (XEXP (src, 2)) == LABEL_REF
+	   && ((LABEL_REF_P (XEXP (src, 2))
 		&& label_ref_label (XEXP (src, 2)) == target)
 	       || (ANY_RETURN_P (XEXP (src, 2)) && XEXP (src, 2) == target)))
     {
diff --git a/gcc/rtlanal.c b/gcc/rtlanal.c
index 69095f8e38a..cb6c8902353 100644
--- a/gcc/rtlanal.c
+++ b/gcc/rtlanal.c
@@ -1052,7 +1052,7 @@ reg_mentioned_p (const_rtx reg, const_rtx in)
   if (reg == in)
     return 1;
 
-  if (GET_CODE (in) == LABEL_REF)
+  if (LABEL_REF_P (in))
     return reg == label_ref_label (in);
 
   code = GET_CODE (in);
@@ -3196,7 +3196,7 @@ replace_label (rtx *loc, rtx old_label, rtx new_label, bool update_label_nuses)
 		}
 	    }
 
-	  if ((GET_CODE (x) == LABEL_REF
+	  if ((LABEL_REF_P (x)
 	       || GET_CODE (x) == INSN_LIST)
 	      && XEXP (x, 0) == old_label)
 	    {
@@ -3230,7 +3230,7 @@ rtx_referenced_p (const_rtx x, const_rtx body)
     if (const_rtx y = *iter)
       {
 	/* Check if a label_ref Y refers to label X.  */
-	if (GET_CODE (y) == LABEL_REF
+	if (LABEL_REF_P (y)
 	    && LABEL_P (x)
 	    && label_ref_label (y) == x)
 	  return true;
@@ -5804,7 +5804,7 @@ get_condition (rtx_insn *jump, rtx_insn **earliest, int allow_cc_mode,
   /* If this branches to JUMP_LABEL when the condition is false, reverse
      the condition.  */
   reverse
-    = GET_CODE (XEXP (SET_SRC (set), 2)) == LABEL_REF
+    = LABEL_REF_P (XEXP (SET_SRC (set), 2))
       && label_ref_label (XEXP (SET_SRC (set), 2)) == JUMP_LABEL (jump);
 
   return canonicalize_condition (jump, cond, reverse, earliest, NULL_RTX,
@@ -6567,7 +6567,7 @@ contains_symbolic_reference_p (const_rtx x)
 {
   subrtx_iterator::array_type array;
   FOR_EACH_SUBRTX (iter, array, x, ALL)
-    if (SYMBOL_REF_P (*iter) || GET_CODE (*iter) == LABEL_REF)
+    if (SYMBOL_REF_P (*iter) || LABEL_REF_P (*iter))
       return true;
 
   return false;
diff --git a/gcc/simplify-rtx.c b/gcc/simplify-rtx.c
index d1cb817df44..98f2fe112f1 100644
--- a/gcc/simplify-rtx.c
+++ b/gcc/simplify-rtx.c
@@ -1423,8 +1423,8 @@ simplify_unary_operation_1 (enum rtx_code code, machine_mode mode, rtx op)
       if (GET_CODE (op) == TRUNCATE
 	  && GET_MODE (XEXP (op, 0)) == mode
 	  && GET_CODE (XEXP (op, 0)) == MINUS
-	  && GET_CODE (XEXP (XEXP (op, 0), 0)) == LABEL_REF
-	  && GET_CODE (XEXP (XEXP (op, 0), 1)) == LABEL_REF)
+	  && LABEL_REF_P (XEXP (XEXP (op, 0), 0))
+	  && LABEL_REF_P (XEXP (XEXP (op, 0), 1)))
 	return XEXP (op, 0);
 
       /* Extending a widening multiplication should be canonicalized to
@@ -2263,12 +2263,12 @@ simplify_binary_operation_1 (enum rtx_code code, machine_mode mode,
 
       if ((GET_CODE (op0) == CONST
 	   || GET_CODE (op0) == SYMBOL_REF
-	   || GET_CODE (op0) == LABEL_REF)
+	   || LABEL_REF_P (op0))
 	  && poly_int_rtx_p (op1, &offset))
 	return plus_constant (mode, op0, offset);
       else if ((GET_CODE (op1) == CONST
 		|| GET_CODE (op1) == SYMBOL_REF
-		|| GET_CODE (op1) == LABEL_REF)
+		|| LABEL_REF_P (op1))
 	       && poly_int_rtx_p (op0, &offset))
 	return plus_constant (mode, op1, offset);
 
@@ -2542,7 +2542,7 @@ simplify_binary_operation_1 (enum rtx_code code, machine_mode mode,
 
       if ((GET_CODE (op0) == CONST
 	   || GET_CODE (op0) == SYMBOL_REF
-	   || GET_CODE (op0) == LABEL_REF)
+	   || LABEL_REF_P (op0))
 	  && poly_int_rtx_p (op1, &offset))
 	return plus_constant (mode, op0, trunc_int_for_mode (-offset, mode));
 
diff --git a/gcc/tree-ssa-address.c b/gcc/tree-ssa-address.c
index 1d85e03ee2e..49bd7661fe3 100644
--- a/gcc/tree-ssa-address.c
+++ b/gcc/tree-ssa-address.c
@@ -151,7 +151,7 @@ gen_addr_rtx (machine_mode address_mode,
 	    *offset_p = &XEXP (act_elem, 1);
 
 	  if (GET_CODE (symbol) == SYMBOL_REF
-	      || GET_CODE (symbol) == LABEL_REF
+	      || LABEL_REF_P (symbol)
 	      || GET_CODE (symbol) == CONST)
 	    act_elem = gen_rtx_CONST (address_mode, act_elem);
 	}
diff --git a/gcc/varasm.c b/gcc/varasm.c
index e6263f09226..5d69da0df96 100644
--- a/gcc/varasm.c
+++ b/gcc/varasm.c
@@ -3900,7 +3900,7 @@ force_const_mem (machine_mode in_mode, rtx x)
 
   /* If we're dropping a label to the constant pool, make sure we
      don't delete it.  */
-  if (GET_CODE (x) == LABEL_REF)
+  if (LABEL_REF_P (x))
     LABEL_PRESERVE_P (XEXP (x, 0)) = 1;
 
   return copy_rtx (def);
@@ -4049,7 +4049,7 @@ output_constant_pool_1 (class constant_descriptor_rtx *desc,
     {
     case CONST:
       if (GET_CODE (XEXP (tmp, 0)) != PLUS
-	  || GET_CODE (XEXP (XEXP (tmp, 0), 0)) != LABEL_REF)
+	  || !LABEL_REF_P (XEXP (XEXP (tmp, 0), 0)))
 	break;
       tmp = XEXP (XEXP (tmp, 0), 0);
       /* FALLTHRU  */
-- 
2.21.0


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