[cfg-branch] bb-reorder.c uses maybe_hot_bb_p

Josef Zlomek zlomj9am@artax.karlin.mff.cuni.cz
Mon Feb 18 13:07:00 GMT 2002


Hi,
this patch adds using the maybe_hot_bb_p and similar functions to set the parameters of the function copy_bb_p, which tells whether the basic block should be copied.

Bootstrapped on i686.

Joe 

Mon Feb 18 21:26:15 CET 2002  Josef Zlomek  <zlomek@matfyz.cz>

	bb-reorder.c (copy_bb_p): Set different parameters when bb is hot and
	when is not.

*** gcc-old/gcc/bb-reorder.c	Mon Feb 18 19:53:59 2002
--- gcc-new/gcc/bb-reorder.c	Mon Feb 18 19:54:47 2002
***************
*** 37,42 ****
--- 37,43 ----
  #include "cfglayout.h"
  #include "fibheap.h"
  #include "target.h"
+ #include "profile.h"
  
  /* The number of rounds.  */
  #define N_ROUNDS 4
*************** copy_bb_p (bb, trace, size_can_grow)
*** 543,548 ****
--- 544,550 ----
       bool size_can_grow;
  {
    int size = 0;
+   int max_size;
    rtx insn;
    static unsigned int id;
  
*************** copy_bb_p (bb, trace, size_can_grow)
*** 557,568 ****
      }
    else
      id++;
-     
    
    if (!bb->frequency)
      return false;
    if (!bb->pred || !bb->pred->pred_next)
      return false;
    while (1)
      {
        edge e, best_edge;
--- 559,580 ----
      }
    else
      id++;
    
    if (!bb->frequency)
      return false;
    if (!bb->pred || !bb->pred->pred_next)
      return false;
+ 
+   max_size = 8 * uncond_jump_length;
+   if (profile_info.count_profiles_merged
+       && flag_branch_probabilities)
+     {
+       if (maybe_hot_bb_p (bb))
+ 	max_size = 16 * uncond_jump_length;
+       else if (probably_never_executed_bb_p (bb))
+ 	size_can_grow = false;
+     }
+   
    while (1)
      {
        edge e, best_edge;
*************** copy_bb_p (bb, trace, size_can_grow)
*** 581,587 ****
  	  if (INSN_P (insn))
  	    size += get_attr_length (insn);
  	}
!       if (size > 8 * uncond_jump_length)
  	return false;
  
        /* Select the successor.  */
--- 593,599 ----
  	  if (INSN_P (insn))
  	    size += get_attr_length (insn);
  	}
!       if (size > max_size)
  	return false;
  
        /* Select the successor.  */



More information about the Gcc-patches mailing list