]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
i386: Use LABEL_REF_P predicate instead of open coding it
authorUros Bizjak <ubizjak@gmail.com>
Wed, 16 Jul 2025 18:04:44 +0000 (20:04 +0200)
committerUros Bizjak <ubizjak@gmail.com>
Wed, 16 Jul 2025 18:19:09 +0000 (20:19 +0200)
No functional changes.

gcc/ChangeLog:

* config/i386/i386.cc (symbolic_reference_mentioned_p):
Use LABEL_REF_P predicate instead of open coding it.
(ix86_legitimate_constant_p): Ditto.
(legitimate_pic_address_disp_p): Ditto.
(ix86_legitimate_address_p): Ditto.
(legitimize_pic_address): Ditto.
(ix86_print_operand): Ditto.
(ix86_print_operand_address_as): Ditto.
(ix86_rip_relative_addr_p): Ditto.
* config/i386/i386.h (SYMBOLIC_CONST): Ditto.
* config/i386/i386.md (*anddi_1 to *andsi_1_zext splitter): Ditto.
* config/i386/predicates.md (symbolic_operand): Ditto.
(local_symbolic_operand): Ditto.
(vsib_address_operand): Ditto.

gcc/config/i386/i386.cc
gcc/config/i386/i386.h
gcc/config/i386/i386.md
gcc/config/i386/predicates.md

index 92673e48d3f9a62da888414a91f2a406cb81fae7..11a724a0bd7ad42a685edb1914e48d396885a1a7 100644 (file)
@@ -5979,7 +5979,7 @@ symbolic_reference_mentioned_p (rtx op)
   const char *fmt;
   int i;
 
-  if (SYMBOL_REF_P (op) || GET_CODE (op) == LABEL_REF)
+  if (SYMBOL_REF_P (op) || LABEL_REF_P (op))
     return true;
 
   fmt = GET_RTX_FORMAT (GET_CODE (op));
@@ -11472,7 +11472,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 (!SYMBOL_REF_P (x))
        return false;
@@ -11656,7 +11656,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
@@ -11731,7 +11731,7 @@ legitimate_pic_address_disp_p (rtx disp)
        return false;
 
       if (!SYMBOL_REF_P (XVECEXP (disp, 0, 0))
-         && GET_CODE (XVECEXP (disp, 0, 0)) != LABEL_REF)
+         && !LABEL_REF_P (XVECEXP (disp, 0, 0)))
        return false;
       return true;
     }
@@ -11760,13 +11760,13 @@ legitimate_pic_address_disp_p (rtx disp)
         text labels with @GOT rather than @GOTOFF.  See gotoff_operand for
         details.  */
       return (SYMBOL_REF_P (XVECEXP (disp, 0, 0))
-             || 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 ((SYMBOL_REF_P (XVECEXP (disp, 0, 0))
-          || 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;
@@ -12130,7 +12130,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))
@@ -12244,7 +12244,7 @@ legitimize_pic_address (rtx orig, rtx reg)
   else if ((SYMBOL_REF_P (addr) && SYMBOL_REF_TLS_MODEL (addr) == 0)
           /* We can't always use @GOTOFF for text labels
              on VxWorks, see gotoff_operand.  */
-          || (TARGET_VXWORKS_VAROFF && GET_CODE (addr) == LABEL_REF))
+          || (TARGET_VXWORKS_VAROFF && LABEL_REF_P (addr)))
     {
 #if TARGET_PECOFF
       rtx tmp = legitimize_pe_coff_symbol (addr, true);
@@ -12380,7 +12380,7 @@ legitimize_pic_address (rtx orig, rtx reg)
                     just disp32, not base nor index.  */
                  if (TARGET_64BIT
                      && (SYMBOL_REF_P (base)
-                         || 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)))
@@ -14699,7 +14699,7 @@ ix86_print_operand (FILE *file, rtx x, int code)
                putc ('$', file);
            }
          else if (GET_CODE (x) == CONST || SYMBOL_REF_P (x)
-                  || GET_CODE (x) == LABEL_REF)
+                  || LABEL_REF_P (x))
            {
              if (ASSEMBLER_DIALECT == ASM_ATT)
                putc ('$', file);
@@ -14794,7 +14794,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)
          || (SYMBOL_REF_P (symbol)
              && SYMBOL_REF_TLS_MODEL (symbol) == 0))
        base = pc_rtx;
@@ -14883,7 +14883,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);
@@ -14919,7 +14919,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;
@@ -17678,7 +17678,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)
              || (SYMBOL_REF_P (symbol)
                  && SYMBOL_REF_TLS_MODEL (symbol) == 0)
              || (GET_CODE (symbol) == UNSPEC
index 3b11d838b25ba78d810e114e27408a1ca7ded9d2..791f3b9e13385c687cc9f93cd5167e408e778bc3 100644 (file)
@@ -1843,7 +1843,7 @@ typedef struct ix86_args {
 
 #define SYMBOLIC_CONST(X)      \
   (SYMBOL_REF_P (X)                                                    \
-   || GET_CODE (X) == LABEL_REF                                                \
+   || LABEL_REF_P (X)                                                  \
    || (GET_CODE (X) == CONST && symbolic_reference_mentioned_p (X)))
 \f
 /* Max number of args passed in registers.  If this is more than 3, we will
index 9c4687e9a2ba392064b66ef4f5813961672ce951..eb526997584b8d324c18cd9c8cb9b22a3cf0d557 100644 (file)
              (clobber (reg:CC FLAGS_REG))])]
 {
   if (SYMBOL_REF_P (operands[2])
-      || GET_CODE (operands[2]) == LABEL_REF)
+      || LABEL_REF_P (operands[2]))
     {
       operands[2] = shallow_copy_rtx (operands[2]);
       PUT_MODE (operands[2], SImode);
index cdde240f20be85f7c7cc77d5b3415de6c2ec7fac..b2d2eecc64f62e8f979fa366f478a2f9efb585cc 100644 (file)
     case CONST:
       op = XEXP (op, 0);
       if (SYMBOL_REF_P (op)
-         || GET_CODE (op) == LABEL_REF
+         || LABEL_REF_P (op)
          || (GET_CODE (op) == UNSPEC
              && (XINT (op, 1) == UNSPEC_GOT
                  || XINT (op, 1) == UNSPEC_GOTOFF
 
       op = XEXP (op, 0);
       if (SYMBOL_REF_P (op)
-         || GET_CODE (op) == LABEL_REF)
+         || LABEL_REF_P (op))
        return true;
       /* Only @GOTOFF gets offsets.  */
       if (GET_CODE (op) != UNSPEC
 
       op = XVECEXP (op, 0, 0);
       if (SYMBOL_REF_P (op)
-         || GET_CODE (op) == LABEL_REF)
+         || LABEL_REF_P (op))
        return true;
       return false;
 
       && 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 (!SYMBOL_REF_P (op))
       if (TARGET_64BIT
          && flag_pic
          && (SYMBOL_REF_P (disp)
-             || GET_CODE (disp) == LABEL_REF))
+             || LABEL_REF_P (disp)))
        return false;
     }