[COMMITTED,2/2] sched1: debug/model: dump predecessor list and BB num [NFC]

Message ID 20241204190339.39591-2-vineetg@rivosinc.com
State New
Headers
Series [COMMITTED,1/2] sched1: parameterize pressure scheduling spilling aggressiveness [PR/114729] |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 fail Patch failed to apply

Commit Message

Vineet Gupta Dec. 4, 2024, 7:03 p.m. UTC
  This is broken out of predecessor promotion patch so that debugging can
proceed during stage1 restrictions.

gcc/ChangeLog:
	* haifa-sched.cc (model_choose_insn): Dump unscheduled_preds.
	(model_dump_pressure_summary): Dump bb->index.
	(model_start_schedule): Pass bb.
	* sched-rgn.cc (debug_dependencies): Dump SD_LIST_HARD_BACK deps.

Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
---
 gcc/haifa-sched.cc | 10 +++++-----
 gcc/sched-rgn.cc   | 14 ++++++++++++--
 2 files changed, 17 insertions(+), 7 deletions(-)
  

Patch

diff --git a/gcc/haifa-sched.cc b/gcc/haifa-sched.cc
index cd4b6baddcd2..4d3977576eed 100644
--- a/gcc/haifa-sched.cc
+++ b/gcc/haifa-sched.cc
@@ -3762,10 +3762,10 @@  model_choose_insn (void)
       count = param_max_sched_ready_insns;
       while (count > 0 && insn)
 	{
-	  fprintf (sched_dump, ";;\t+---   %d [%d, %d, %d, %d]\n",
+	  fprintf (sched_dump, ";;\t+---   %d [%d, %d, %d, %d][%d]\n",
 		   INSN_UID (insn->insn), insn->model_priority,
 		   insn->depth + insn->alap, insn->depth,
-		   INSN_PRIORITY (insn->insn));
+		   INSN_PRIORITY (insn->insn), insn->unscheduled_preds);
 	  count--;
 	  insn = insn->next;
 	}
@@ -3859,11 +3859,11 @@  model_reset_queue_indices (void)
    to sched_dump.  */
 
 static void
-model_dump_pressure_summary (void)
+model_dump_pressure_summary (basic_block bb)
 {
   int pci, cl;
 
-  fprintf (sched_dump, ";; Pressure summary:");
+  fprintf (sched_dump, ";; Pressure summary (bb %d):", bb->index);
   for (pci = 0; pci < ira_pressure_classes_num; pci++)
     {
       cl = ira_pressure_classes[pci];
@@ -3902,7 +3902,7 @@  model_start_schedule (basic_block bb)
   model_curr_point = 0;
   initiate_reg_pressure_info (df_get_live_in (bb));
   if (sched_verbose >= 1)
-    model_dump_pressure_summary ();
+    model_dump_pressure_summary (bb);
 }
 
 /* Free the information associated with GROUP.  */
diff --git a/gcc/sched-rgn.cc b/gcc/sched-rgn.cc
index 3d8cff76aaf9..bedccc9f2b83 100644
--- a/gcc/sched-rgn.cc
+++ b/gcc/sched-rgn.cc
@@ -2855,15 +2855,25 @@  void debug_dependencies (rtx_insn *head, rtx_insn *tail)
       else
 	print_reservation (sched_dump, insn);
 
-      fprintf (sched_dump, "\t: ");
+      fprintf (sched_dump, "\t: FW:");
       {
 	sd_iterator_def sd_it;
 	dep_t dep;
 
 	FOR_EACH_DEP (insn, SD_LIST_FORW, sd_it, dep)
-	  fprintf (sched_dump, "%d%s%s ", INSN_UID (DEP_CON (dep)),
+	  fprintf (sched_dump, " %d%s%s%s", INSN_UID (DEP_CON (dep)),
+		   DEP_TYPE (dep) == REG_DEP_TRUE ? "t" : "",
 		   DEP_NONREG (dep) ? "n" : "",
 		   DEP_MULTIPLE (dep) ? "m" : "");
+	if (sched_verbose >= 5)
+	  {
+	    fprintf (sched_dump, "\n;;\t\t\t\t\t\t: BK:");
+	    FOR_EACH_DEP (insn, SD_LIST_HARD_BACK, sd_it, dep)
+	      fprintf (sched_dump, " %d%s%s%s", INSN_UID (DEP_PRO (dep)),
+		       DEP_TYPE (dep) == REG_DEP_TRUE ? "t" : "",
+		       DEP_NONREG (dep) ? "n" : "",
+		       DEP_MULTIPLE (dep) ? "m" : "");
+	  }
       }
       fprintf (sched_dump, "\n");
     }