]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
middle-end: replace CONST_CAST_RTX with const_cast<rtx> [PR123892]
authorTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Wed, 4 Feb 2026 09:52:17 +0000 (10:52 +0100)
committerTorbjörn SVENSSON <torbjorn.svensson@foss.st.com>
Fri, 6 Feb 2026 08:02:03 +0000 (09:02 +0100)
gcc/ChangeLog:

PR middle-end/123892
* alias.cc: Replace CONST_CAST_RTX with const_cast<rtx>.
* config/i386/x86-tune-sched-bd.cc: Likewise.
* config/rs6000/rs6000.cc: Likewise.
* recog.cc: Likewise.
* sel-sched-ir.cc: Likewise.
* var-tracking.cc: Likewise.
* varasm.cc: Likewise.
* system.h (CONST_CAST_RTX): Remove.

Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
gcc/alias.cc
gcc/config/i386/x86-tune-sched-bd.cc
gcc/config/rs6000/rs6000.cc
gcc/recog.cc
gcc/sel-sched-ir.cc
gcc/system.h
gcc/var-tracking.cc
gcc/varasm.cc

index bce026200a197a1ca8a1b7c0fafd304532538f87..d210d632551220ab4031afa8e4d9186ba1c7f0c3 100644 (file)
@@ -3337,7 +3337,7 @@ memory_modified_in_insn_p (const_rtx mem, const_rtx insn)
     return true;
   memory_modified = false;
   note_stores (as_a<const rtx_insn *> (insn), memory_modified_1,
-              CONST_CAST_RTX(mem));
+              const_cast<rtx> (mem));
   return memory_modified;
 }
 
index 01f2785e217d97e248df8676f91f18f4a2e0d599..5602478f23513df1a9a660f06b7ea08b33bd581d 100644 (file)
@@ -345,7 +345,7 @@ find_constant (rtx in_rtx, imm_info *imm_values)
        case SYMBOL_REF:
        case CONST_INT:
          (imm_values->imm)++;
-         if (x86_64_immediate_operand (CONST_CAST_RTX (x), SImode))
+         if (x86_64_immediate_operand (const_cast<rtx> (x), SImode))
            (imm_values->imm32)++;
          else
            (imm_values->imm64)++;
index 10b2cf983cc83c86c4697d0375707478af7222fa..a4f60ecb58a867b40c804ba67a4811db39ed4e2e 100644 (file)
@@ -14669,7 +14669,7 @@ print_operand (FILE *file, rtx x, int code)
           (plus (unspec [(symbol_ref ("x")) (reg 2)] tocrel) 4)
           without this hack would be output as "x@toc+4".  We
           want "x+4@toc".  */
-       output_addr_const (file, CONST_CAST_RTX (tocrel_base_oac));
+       output_addr_const (file, const_cast<rtx> (tocrel_base_oac));
       else if (GET_CODE (x) == UNSPEC && XINT (x, 1) == UNSPEC_TLSGD)
        output_addr_const (file, XVECEXP (x, 0, 0));
       else if (GET_CODE (x) == UNSPEC && XINT (x, 1) == UNSPEC_PLTSEQ)
@@ -14780,7 +14780,7 @@ print_operand_address (FILE *file, rtx x)
         .       (plus (unspec [(symbol_ref ("x")) (reg 2)] tocrel) 8))
         without this hack would be output as "x@toc+8@l(9)".  We
         want "x+8@toc@l(9)".  */
-      output_addr_const (file, CONST_CAST_RTX (tocrel_base_oac));
+      output_addr_const (file, const_cast<rtx> (tocrel_base_oac));
       if (GET_CODE (x) == LO_SUM)
        fprintf (file, "@l(%s)", reg_names[REGNO (XEXP (x, 0))]);
       else
@@ -14807,7 +14807,7 @@ rs6000_output_addr_const_extra (FILE *file, rtx x)
          {
            if (INTVAL (tocrel_offset_oac) >= 0)
              fprintf (file, "+");
-           output_addr_const (file, CONST_CAST_RTX (tocrel_offset_oac));
+           output_addr_const (file, const_cast<rtx> (tocrel_offset_oac));
          }
        if (!TARGET_AIX || (TARGET_ELF && TARGET_MINIMAL_TOC))
          {
index a0b4925a8ee5d8307d45babcd2af4fa987d31b89..48f6b45ec6d7029a35acc657e563cbc981621877 100644 (file)
@@ -2030,7 +2030,7 @@ extract_asm_operands (rtx body)
 int
 asm_noperands (const_rtx body)
 {
-  rtx asm_op = extract_asm_operands (CONST_CAST_RTX (body));
+  rtx asm_op = extract_asm_operands (const_cast<rtx> (body));
   int i, n_sets = 0;
 
   if (asm_op == NULL)
index 4991de2dfa0c3073ff24a179ab88ae05d98f25b7..3e0ce5895f6a35cf80c5fef676de2069b5939126 100644 (file)
@@ -1090,7 +1090,7 @@ skip_unspecs_callback (const_rtx *xx, const_rtx *yy, rtx *nx, rtx* ny)
           || targetm.sched.skip_rtx_p (x)))
     {
       *nx = XVECEXP (x, 0, 0);
-      *ny = CONST_CAST_RTX (y);
+      *ny = const_cast<rtx> (y);
       return true;
     }
 
@@ -1098,7 +1098,7 @@ skip_unspecs_callback (const_rtx *xx, const_rtx *yy, rtx *nx, rtx* ny)
       && (targetm.sched.skip_rtx_p == NULL
           || targetm.sched.skip_rtx_p (y)))
     {
-      *nx = CONST_CAST_RTX (x);
+      *nx = const_cast<rtx> (x);
       *ny = XVECEXP (y, 0, 0);
       return true;
     }
index 58adb8e97bf034532260d334512fa0293152ce79..d1710307b3aa09c7d1ef10182a66b7bb1599e90e 100644 (file)
@@ -1195,7 +1195,6 @@ helper_const_non_const_cast (const char *p)
 #endif
 #define CONST_CAST(TYPE,X) CONST_CAST2 (TYPE, const TYPE, (X))
 #define CONST_CAST_TREE(X) CONST_CAST (union tree_node *, (X))
-#define CONST_CAST_RTX(X) CONST_CAST (struct rtx_def *, (X))
 #define CONST_CAST_BB(X) CONST_CAST (struct basic_block_def *, (X))
 #define CONST_CAST_GIMPLE(X) CONST_CAST (gimple *, (X))
 
index bfe75b0577d64f669bfbd1ea71f947a893f77728..e7065e81ca55984b05502a0473f23ca92d3f8958 100644 (file)
@@ -1195,7 +1195,7 @@ adjust_mem_stores (rtx loc, const_rtx expr, void *data)
                                              adjust_mems, data);
       if (new_dest != SET_DEST (expr))
        {
-         rtx xexpr = CONST_CAST_RTX (expr);
+         rtx xexpr = const_cast<rtx> (expr);
          validate_change (NULL_RTX, &SET_DEST (xexpr), new_dest, true);
        }
     }
index fec792ec2326f3fb631e5d8b3538f52a57347d66..dc5439be3ca32ab48108f0712217f2f06ad782c3 100644 (file)
@@ -4517,7 +4517,7 @@ mark_constants_in_pattern (rtx insn)
              if (!TREE_ASM_WRITTEN (DECL_INITIAL (decl)))
                {
                  n_deferred_constants--;
-                 output_constant_def_contents (CONST_CAST_RTX (x));
+                 output_constant_def_contents (const_cast<rtx> (x));
                }
            }
        }