This is the mail archive of the gcc@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]

[DFA] better scheduler debug dumps


> > >   Yes, The output is pure.  I could add this feature too.  But there
> > > will be two troubles with that.  The first one is that it may increase
> > > considerably tables in insn-attrtab.c (although I could implement more
> > > smart encoding of that).  The second one is that the unit reservations
> > > may be not useful after automata minimization.  You should switch off
> > 
> > I found that sched-verbose prints me the strings for each instruction that
> > makes me quite happy.  I guess for my need it is enought to know the cycle,
> > the instruction and the reservation string. THe instruction is printed as
> > uid that is bit impractical, perhaps we can use the short printing from
> > existing haifa to get nice table.   I will try to implement it.
> > 
> 
> That would be nice.

Hi
This patch makes scheduler to print out table of instructions and reservations
as they are issued, like:

;;   ======================================================
;;   -- basic block 0 from 140 to 103 -- after reload
;;   ======================================================

;;	  0--> 22   dx=[`maxiter']                     :athlon-direct,athlon-load
;;	  0--> 140  [--sp]=bp                          :athlon-direct,nothing,athlon-store
;;	  2--> 142  bp=sp                              :athlon-direct,athlon-ieu
;;	  3--> 102  flags=cmp(dx,0x0)                  :athlon-direct,athlon-ieu
;;	  3--> 8    st(6)=[bp+0x10]                    :athlon-direct,athlon-fany,nothing,athlon-load
;;	  3--> 10   st(5)=[bp+0x14]                    :athlon-direct,athlon-fany,nothing,athlon-load
;;	  4--> 128  ax=dx                              :athlon-direct,athlon-ieu
;;	  4--> 26   st=[bp+0x8]                        :athlon-direct,athlon-fany,nothing,athlon-load
;;	  4--> 29   st(1)=[bp+0xc]                     :athlon-direct,athlon-fany,nothing,athlon-load
;;	  5--> 103  pc={(flags==0x0)?L70:pc}           :athlon-direct,athlon-ieu

Honza

Sun Apr 28 20:24:04 CEST 2002  Jan Hubicka  <jh@suse.cz>
	* haifa-sched.c (schedule_insn): Print table of instructions and
	reservations.
	(sched_block): Do not print ready list at verbosity level 1.
	* sched-vis.c (print_insn): Make global.
	* sched-ebb.c (ebb_print_insn): Rename from...
	(print_insn): ... this one.
	* sched-int.h (print_insn): Declare.

*** haifa-sched.c.old	Sat Apr 27 19:04:21 2002
--- haifa-sched.c	Sat Apr 27 19:28:38 2002
*************** schedule_insn (insn, ready, clock)
*** 1121,1151 ****
    if (!targetm.sched.use_dfa_pipeline_interface
        || !(*targetm.sched.use_dfa_pipeline_interface) ())
      unit = insn_unit (insn);
! 
!   if (sched_verbose >= 2)
      {
  
!       if (targetm.sched.use_dfa_pipeline_interface
! 	  && (*targetm.sched.use_dfa_pipeline_interface) ())
! 	{
! 	  fprintf (sched_dump,
! 		   ";;\t\t--> scheduling insn <<<%d>>>:reservation ",
! 		   INSN_UID (insn));
! 	  
! 	  if (recog_memoized (insn) < 0)
! 	    fprintf (sched_dump, "nothing");
! 	  else
! 	    print_reservation (sched_dump, insn);
! 	}
        else
! 	{
! 	  fprintf (sched_dump, ";;\t\t--> scheduling insn <<<%d>>> on unit ",
! 		   INSN_UID (insn));
! 	  insn_print_units (insn);
! 	}
! 
        fprintf (sched_dump, "\n");
      }
  
    if (!targetm.sched.use_dfa_pipeline_interface
        || !(*targetm.sched.use_dfa_pipeline_interface) ())
--- 1121,1159 ----
    if (!targetm.sched.use_dfa_pipeline_interface
        || !(*targetm.sched.use_dfa_pipeline_interface) ())
      unit = insn_unit (insn);
!   if (targetm.sched.use_dfa_pipeline_interface
!       && sched_verbose >= 1
!       && (*targetm.sched.use_dfa_pipeline_interface) ())
      {
+       char buf[2048];
  
!       print_insn (buf, insn, 0);
!       buf[40]=0;
!       fprintf (sched_dump,
! 	       ";;\t%3i--> %-40s:",
! 	       clock, buf);
!       
!       if (recog_memoized (insn) < 0)
! 	fprintf (sched_dump, "nothing");
        else
! 	print_reservation (sched_dump, insn);
        fprintf (sched_dump, "\n");
      }
+   else
+     if (sched_verbose >= 2)
+       {
+ 	if (targetm.sched.use_dfa_pipeline_interface
+ 	    && (*targetm.sched.use_dfa_pipeline_interface) ())
+ 	  ;
+ 	else
+ 	  {
+ 	    fprintf (sched_dump, ";;\t\t--> scheduling insn <<<%d>>> on unit ",
+ 		     INSN_UID (insn));
+ 	    insn_print_units (insn);
+ 	  }
+ 
+ 	fprintf (sched_dump, "\n");
+       }
  
    if (!targetm.sched.use_dfa_pipeline_interface
        || !(*targetm.sched.use_dfa_pipeline_interface) ())
*************** schedule_block (b, rgn_n_insns)
*** 2038,2044 ****
  	  rtx insn;
  	  int cost;
  
! 	  if (sched_verbose)
  	    {
  	      fprintf (sched_dump, ";;\tReady list (t =%3d):  ",
  		       clock_var);
--- 2046,2052 ----
  	  rtx insn;
  	  int cost;
  
! 	  if (sched_verbose >= 2)
  	    {
  	      fprintf (sched_dump, ";;\tReady list (t =%3d):  ",
  		       clock_var);
*** sched-vis.c.old	Sat Apr 27 19:08:00 2002
--- sched-vis.c	Sat Apr 27 19:14:13 2002
*************** static int get_visual_tbl_length PARAMS 
*** 49,55 ****
  static void print_exp PARAMS ((char *, rtx, int));
  static void print_value PARAMS ((char *, rtx, int));
  static void print_pattern PARAMS ((char *, rtx, int));
- static void print_insn PARAMS ((char *, rtx, int));
  
  /* Print names of units on which insn can/should execute, for debugging.  */
  
--- 49,54 ----
*************** print_pattern (buf, x, verbose)
*** 759,765 ****
     (Probably the last "option" should be extended somehow, since it
     depends now on sched.c inner variables ...)  */
  
! static void
  print_insn (buf, x, verbose)
       char *buf;
       rtx x;
--- 758,764 ----
     (Probably the last "option" should be extended somehow, since it
     depends now on sched.c inner variables ...)  */
  
! void
  print_insn (buf, x, verbose)
       char *buf;
       rtx x;
*** sched-ebb.c.old	Sat Apr 27 19:11:22 2002
--- sched-ebb.c	Sat Apr 27 19:11:38 2002
*************** static void init_ready_list PARAMS ((str
*** 49,55 ****
  static int can_schedule_ready_p PARAMS ((rtx));
  static int new_ready PARAMS ((rtx));
  static int schedule_more_p PARAMS ((void));
! static const char *print_insn PARAMS ((rtx, int));
  static int rank PARAMS ((rtx, rtx));
  static int contributes_to_priority PARAMS ((rtx, rtx));
  static void compute_jump_reg_dependencies PARAMS ((rtx, regset));
--- 49,55 ----
  static int can_schedule_ready_p PARAMS ((rtx));
  static int new_ready PARAMS ((rtx));
  static int schedule_more_p PARAMS ((void));
! static const char *ebb_print_insn PARAMS ((rtx, int));
  static int rank PARAMS ((rtx, rtx));
  static int contributes_to_priority PARAMS ((rtx, rtx));
  static void compute_jump_reg_dependencies PARAMS ((rtx, regset));
*************** new_ready (next)
*** 128,134 ****
     to be formatted so that multiple output lines will line up nicely.  */
  
  static const char *
! print_insn (insn, aligned)
       rtx insn;
       int aligned ATTRIBUTE_UNUSED;
  {
--- 128,134 ----
     to be formatted so that multiple output lines will line up nicely.  */
  
  static const char *
! ebb_print_insn (insn, aligned)
       rtx insn;
       int aligned ATTRIBUTE_UNUSED;
  {
*************** static struct sched_info ebb_sched_info 
*** 188,194 ****
    schedule_more_p,
    new_ready,
    rank,
!   print_insn,
    contributes_to_priority,
    compute_jump_reg_dependencies,
  
--- 188,194 ----
    schedule_more_p,
    new_ready,
    rank,
!   ebb_print_insn,
    contributes_to_priority,
    compute_jump_reg_dependencies,
  
*** sched-int.h.old	Sun Apr 28 20:23:51 2002
--- sched-int.h	Sat Apr 27 19:08:28 2002
*************** extern int insn_unit PARAMS ((rtx));
*** 310,312 ****
--- 310,313 ----
  extern int insn_cost PARAMS ((rtx, rtx, rtx));
  extern rtx get_unit_last_insn PARAMS ((int));
  extern int actual_hazard_this_instance PARAMS ((int, int, rtx, int, int));
+ extern void print_insn PARAMS ((char *, rtx, int));


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