https://gcc.gnu.org/g:dae6f53c3ef0e7945ed7d87d4a39520ccf06b6ba

commit r17-6004-gdae6f53c3ef0e7945ed7d87d4a39520ccf06b6ba
Author: Andrew Stubbs <[email protected]>
Date:   Thu Nov 5 15:19:05 2026 +0000

    amdgcn: break up gcn_md_reorg
    
    No functional changes; just a code cleanup so I don't have to roll this 
into a
    real change.
    
    gcc/ChangeLog:
    
            * config/gcn/gcn.cc (gcn_md_reorg): Break contents into ....
            (gcn_md_reorg_simd_execreg): ... this ...
            (gcn_md_reorg_manually_inserted_wait_states): ... and this.

Diff:
---
 gcc/config/gcn/gcn.cc | 73 +++++++++++++++++++++++++++++----------------------
 1 file changed, 41 insertions(+), 32 deletions(-)

diff --git a/gcc/config/gcn/gcn.cc b/gcc/config/gcn/gcn.cc
index a8c3e6cb8c54..0d2edc7595cf 100644
--- a/gcc/config/gcn/gcn.cc
+++ b/gcc/config/gcn/gcn.cc
@@ -6152,44 +6152,23 @@ gcn_restore_exec (rtx_insn *insn, rtx_insn 
*last_exec_def, int64_t curr_exec,
   return exec_value;
 }
 
-/* Implement TARGET_MACHINE_DEPENDENT_REORG.
-
-   Ensure that pipeline dependencies and lane masking are set correctly.  */
+/* This pass ensures that the EXEC register is set correctly, according
+   to the "exec" attribute.  However, care must be taken so that the
+   value that reaches explicit uses of the EXEC register remains the
+   same as before.  */
 
 static void
-gcn_md_reorg (void)
+gcn_md_reorg_simd_execreg ()
 {
   basic_block bb;
   rtx exec_reg = gen_rtx_REG (DImode, EXEC_REG);
-  regset_head live;
 
+  regset_head live;
   INIT_REG_SET (&live);
-
-  compute_bb_for_insn ();
-
-  if (!optimize)
-    {
-      split_all_insns ();
-      if (dump_file && (dump_flags & TDF_DETAILS))
-       {
-         fprintf (dump_file, "After split:\n");
-         print_rtl_with_bb (dump_file, get_insns (), dump_flags);
-       }
-
-      /* Update data-flow information for split instructions.  */
-      df_insn_rescan_all ();
-    }
-
   df_live_add_problem ();
   df_live_set_all_dirty ();
   df_analyze ();
 
-  /* This pass ensures that the EXEC register is set correctly, according
-     to the "exec" attribute.  However, care must be taken so that the
-     value that reaches explicit uses of the EXEC register remains the
-     same as before.
-   */
-
   FOR_EACH_BB_FN (bb, cfun)
     {
       if (dump_file && (dump_flags & TDF_DETAILS))
@@ -6379,14 +6358,18 @@ gcn_md_reorg (void)
     }
 
   CLEAR_REG_SET (&live);
+}
 
-  /* "Manually Inserted Wait States (NOPs)."
+/* "Manually Inserted Wait States (NOPs)."
 
-     GCN hardware detects most kinds of register dependencies, but there
-     are some exceptions documented in the ISA manual.  This pass
-     detects the missed cases, and inserts the documented number of NOPs
-     required for correct execution.  */
+   GCN hardware detects most kinds of register dependencies, but there
+   are some exceptions documented in the ISA manual.  This pass
+   detects the missed cases, and inserts the documented number of NOPs
+   required for correct execution.  */
 
+static void
+gcn_md_reorg_manually_inserted_wait_states ()
+{
   /* RDNA4 (not yet implemented) differs from RNDA 2/3/3.5 and requires some
      s_nop, see 5.7 and esp. 5.7.2. in its ISA manual.
      The assert here is a reminder to add those.  */
@@ -6711,6 +6694,32 @@ gcn_md_reorg (void)
     }
 }
 
+/* Implement TARGET_MACHINE_DEPENDENT_REORG.
+
+   Ensure that pipeline dependencies and lane masking are set correctly.  */
+
+static void
+gcn_md_reorg (void)
+{
+  compute_bb_for_insn ();
+
+  if (!optimize)
+    {
+      split_all_insns ();
+      if (dump_file && (dump_flags & TDF_DETAILS))
+       {
+         fprintf (dump_file, "After split:\n");
+         print_rtl_with_bb (dump_file, get_insns (), dump_flags);
+       }
+
+      /* Update data-flow information for split instructions.  */
+      df_insn_rescan_all ();
+    }
+
+  gcn_md_reorg_simd_execreg ();
+  gcn_md_reorg_manually_inserted_wait_states ();
+}
+
 /* }}}  */
 /* {{{ OpenACC / OpenMP.  */

Reply via email to