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

[new-regalloc-branch]: Fix bunch of thinkos, stop useless spilling


We were doing a few silly things, and had some other silly bugs,
causing a lot of unnecessary spills. 

1. If a web had 0 conflicts, it's spill cost was 0, which is the exact
   opposite of what we want (we should *never* spill 0 conflict
   webs. They have no conflicts, we can always find a color for
   them. ). This is because the default spill 
   heuristic was (a * b) / num_conflicts. It's not (a *  b) /
   (num_conflicts + 1).
2. Because we would generate new registers in between passes, but not
   call recompute_register_usage/reg_scan_update/regclass, the new
   registers had a spill cost of 0 (which is wrong), and a preference
   of NO_REGS.  The preference meant that we would think we had 0
   *possible* (not available) registers we could put these pseudos in,
   which is completely wrong, and will cause us to spill repeatedly.  I added
   an abort so if this happens in the future, we'll know.     We also
   now call the approriate routines in between passes. This should be done
   incrementally for regclass, but isn't yet.
3. Regclass, which refuses to give a preference class for registers
   that have no refs (even if they have sets), depended on
   recompute_register_usage to change the number 
   of REG_N_REFS, but we don't call recompute_register_usage, and in
   fact, can't (we'll abort).  The real cause is a bug in regscan
   which would increment REG_N_SETS, but  not REG_N_REFS (The comment
   about REG_N_REFS says it includes sets).  I fixed it to increment
   both, which makes regclass happy, and gives us a preference class
   for the regs.
4. Flow has an annoying problem that i can't quite track down where
   when we are propagating life, we end up going back past the basic
   block head, and once we do that, the loop crashes (since it only
   terminates when insn == bb->head).  Fixed by making it stop if it
   gets to a null INSN.  This problem is also reproduceable on the
   mainline with a little work, so it's not a new regalloc problem
   exclusively.   I think the real fix is to stop when BLOCK_FOR_INSN
   (prev) != BLOCK_FOR_INSN (insn).
5. Store motion was fixed to take st_antloc into account when
   computing transparent. I had figured we needed to do that, the x86
   failure verified it.  I took the time to rid us of gcse_file while
   i was in there.

2001-07-26  Daniel Berlin  <dan@cgsoftware.com>

	* gcse.c: Use rtl_dump_file instead of gcse_file, remove gcse_file, 
 	and parameter file to gcse_main.
	(build_store_vectors): Take st_antloc into account as well.
 	
 	* rtl.h: Change gcse_main prototype.
 
 	* toplev.c: Don't pass file to gcse_main.
 
 	* ra.c : (default_spill_heuristic): Add one to num_conflicts, 
 	so that a web with 0 conflicts doesn't have a 0 spill cost.
 	(init_one_web): If we don't think we have any registers we can put
 	this thing in, ever, something is wrong, so abort (I.E. if
 	web->num_freedom == 0, abort)
 	(reg_alloc): Call reg_scan_update and regclass if stuff changed,
 	since we'll have more registers now.
 
 	* regclass.c (reg_scan_mark_refs): When we increase REG_N_SETS,
 	increase REG_N_REFS (like flow does), so that regclass doesn't
 	think a reg is useless, and thus, not calculate a class, when it
 	really should have.
 
 	* flow.c (propagate_block): When prev is null, but we haven't hit
 	the beginning of the block, we crash.  So just set prev to
 	something other than null at the start, and stop if it becomes
 	null. I think this is just a symptom of some *other* problem,
 	but I can't figure out what it is.
 	  


Index: ra.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/ra.c,v
retrieving revision 1.1.2.23
diff -c -3 -p -w -B -b -r1.1.2.23 ra.c
*** ra.c	2001/07/25 22:57:21	1.1.2.23
--- ra.c	2001/07/27 17:58:15
*************** init_one_web (web, reg)
*** 1448,1453 ****
--- 1448,1455 ----
        for (i = 0; i < FIRST_PSEUDO_REGISTER; i++)
  	if (TEST_HARD_REG_BIT (web->usable_regs, i))
  	  web->num_freedom++;
+       if (!web->num_freedom)
+ 	abort();
      }
    web->move_related = 0;
    web->defs = NULL;
*************** static long
*** 3039,3045 ****
  default_spill_heuristic (w)
       struct web *w;
  {
!   return (w->weight * w->spill_cost) / w->num_conflicts;
  }
  
  /* Select the cheapest spill to be potentially spilled (we don't
--- 3041,3047 ----
  default_spill_heuristic (w)
       struct web *w;
  {
!   return (w->weight * w->spill_cost) / (w->num_conflicts + 1);
  }
  
  /* Select the cheapest spill to be potentially spilled (we don't
*************** reg_alloc (void)
*** 4066,4075 ****
  	  delete_moves ();
  	  dump_constraints ();
  	}
        dump_ra (df);
        if (changed && rtl_dump_file)
  	{
! 	  /*print_rtl_with_bb (rtl_dump_file, get_insns ());*/
  	}
        free_all_lists ();
        free_mem (df);
--- 4068,4084 ----
  	  delete_moves ();
  	  dump_constraints ();
  	}
+       else
+ 	{
+ 	  allocate_reg_info (max_reg_num (), FALSE, TRUE);
+ 	  reg_scan_update (get_insns(), BLOCK_END (n_basic_blocks - 1), max_regno);
+ 	  regclass (get_insns (), max_reg_num (), rtl_dump_file);
+ 	}
        dump_ra (df);
        if (changed && rtl_dump_file)
  	{
! 	  print_rtl_with_bb (rtl_dump_file, get_insns ());
! 	  fflush (rtl_dump_file);
  	}
        free_all_lists ();
        free_mem (df);
*************** reg_alloc (void)
*** 4078,4096 ****
    while (changed);
    /*if (rtl_dump_file)
      print_rtl_with_bb (rtl_dump_file, get_insns ());*/
! 
!   no_new_pseudos = 0;
    compute_bb_for_insn (get_max_uid ());
    store_motion();
    allocate_reg_info (max_reg_num (), 0, 1);
    no_new_pseudos = 1;
-   /*recompute_reg_usage (get_insns (), TRUE);
-   regclass (get_insns (), max_reg_num (), rtl_dump_file);*/
-   /*count_or_remove_death_notes (NULL, 1);
-   allocate_reg_life_data ();
-   update_life_info (NULL, UPDATE_LIFE_GLOBAL, PROP_REG_INFO
- 		    | PROP_DEATH_NOTES | PROP_SCAN_DEAD_CODE
- 		    | PROP_KILL_DEAD_CODE);*/
    find_basic_blocks (get_insns (), max_reg_num (), rtl_dump_file);
    life_analysis (get_insns (), rtl_dump_file, PROP_FINAL);
    recompute_reg_usage (get_insns (), TRUE);
--- 4087,4099 ----
    while (changed);
  /*   if (rtl_dump_file)
      print_rtl_with_bb (rtl_dump_file, get_insns ()); */
!   no_new_pseudos = 1;
    compute_bb_for_insn (get_max_uid ());
+   allocate_reg_info (max_reg_num (), 0, 1);
+   no_new_pseudos = 0;
    store_motion();
    allocate_reg_info (max_reg_num (), 0, 1);
    no_new_pseudos = 1;
    find_basic_blocks (get_insns (), max_reg_num (), rtl_dump_file);
    life_analysis (get_insns (), rtl_dump_file, PROP_FINAL);
    recompute_reg_usage (get_insns (), TRUE);
Index: gcse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
retrieving revision 1.113.2.3
diff -c -3 -p -w -B -b -r1.113.2.3 gcse.c
*** gcse.c	2001/07/25 19:45:27	1.113.2.3
--- gcse.c	2001/07/27 17:58:21
*************** Boston, MA 02111-1307, USA.  */
*** 275,282 ****
  
  /* GCSE global vars.  */
  
- /* -dG dump file.  */
- static FILE *gcse_file;
  
  /* Note whether or not we should run jump optimization after gcse.  We
     want to do this for two cases.
--- 275,280 ----
*************** static void free_store_memory		PARAMS ((
*** 696,704 ****
     F is the first instruction in the function.  */
  
  int
! gcse_main (f, file)
       rtx f;
-      FILE *file;
  {
    int changed, pass;
    /* Bytes used at start of pass.  */
--- 694,701 ----
     F is the first instruction in the function.  */
  
  int
! gcse_main (f)
       rtx f;
  {
    int changed, pass;
    /* Bytes used at start of pass.  */
*************** gcse_main (f, file)
*** 722,735 ****
  
    /* For calling dump_foo fns from gdb.  */
    debug_stderr = stderr;
-   gcse_file = file;
  
    /* Identify the basic block information for this function, including
       successors and predecessors.  */
    max_gcse_regno = max_reg_num ();
  
!   if (file)
!     dump_flow_info (file);
  
    orig_bb_count = n_basic_blocks;
    /* Return if there's nothing to do.  */
--- 719,731 ----
  
    /* For calling dump_foo fns from gdb.  */
    debug_stderr = stderr;
  
    /* Identify the basic block information for this function, including
       successors and predecessors.  */
    max_gcse_regno = max_reg_num ();
  
!   if (rtl_dump_file)
!     dump_flow_info (rtl_dump_file);
  
    orig_bb_count = n_basic_blocks;
    /* Return if there's nothing to do.  */
*************** gcse_main (f, file)
*** 797,804 ****
    while (changed && pass < MAX_GCSE_PASSES)
      {
        changed = 0;
!       if (file)
! 	fprintf (file, "GCSE pass %d\n\n", pass + 1);
  
        /* Initialize bytes_used to the space for the pred/succ lists,
  	 and the reg_set_table data.  */
--- 793,800 ----
    while (changed && pass < MAX_GCSE_PASSES)
      {
        changed = 0;
!       if (rtl_dump_file)
! 	fprintf (rtl_dump_file, "GCSE pass %d\n\n", pass + 1);
  
        /* Initialize bytes_used to the space for the pred/succ lists,
  	 and the reg_set_table data.  */
*************** gcse_main (f, file)
*** 871,880 ****
  	    max_pass_bytes = bytes_used;
          }
  
!       if (file)
  	{
! 	  fprintf (file, "\n");
! 	  fflush (file);
  	}
  
        obstack_free (&gcse_obstack, gcse_obstack_bottom);
--- 867,876 ----
  	    max_pass_bytes = bytes_used;
          }
  
!       if (rtl_dump_file)
  	{
! 	  fprintf (rtl_dump_file, "\n");
! 	  fflush (rtl_dump_file);
  	}
  
        obstack_free (&gcse_obstack, gcse_obstack_bottom);
*************** gcse_main (f, file)
*** 890,900 ****
    one_cprop_pass (pass + 1, 1);
    free_gcse_mem ();
  
!   if (file)
      {
!       fprintf (file, "GCSE of %s: %d basic blocks, ",
  	       current_function_name, n_basic_blocks);
!       fprintf (file, "%d pass%s, %d bytes\n\n",
  	       pass, pass > 1 ? "es" : "", max_pass_bytes);
      }
  
--- 886,896 ----
    one_cprop_pass (pass + 1, 1);
    free_gcse_mem ();
  
!   if (rtl_dump_file)
      {
!       fprintf (rtl_dump_file, "GCSE of %s: %d basic blocks, ",
  	       current_function_name, n_basic_blocks);
!       fprintf (rtl_dump_file, "%d pass%s, %d bytes\n\n",
  	       pass, pass > 1 ? "es" : "", max_pass_bytes);
      }
  
*************** compute_rd ()
*** 2993,3000 ****
        passes++;
      }
  
!   if (gcse_file)
!     fprintf (gcse_file, "reaching def computation: %d passes\n", passes);
  }
  
  /* Classic GCSE available expression support.  */
--- 2989,2996 ----
        passes++;
      }
  
!   if (rtl_dump_file)
!     fprintf (rtl_dump_file, "reaching def computation: %d passes\n", passes);
  }
  
  /* Classic GCSE available expression support.  */
*************** handle_avail_expr (insn, expr)
*** 3461,3471 ****
        if (changed)
  	{
  	  gcse_subst_count++;
! 	  if (gcse_file != NULL)
  	    {
! 	      fprintf (gcse_file, "GCSE: Replacing the source in insn %d with",
  		       INSN_UID (insn));
! 	      fprintf (gcse_file, " reg %d %s insn %d\n",
  		       REGNO (to), use_src ? "from" : "set in",
  		       INSN_UID (insn_computes_expr));
  	    }
--- 3457,3467 ----
        if (changed)
  	{
  	  gcse_subst_count++;
! 	  if (rtl_dump_file != NULL)
  	    {
! 	      fprintf (rtl_dump_file, "GCSE: Replacing the source in insn %d with",
  		       INSN_UID (insn));
! 	      fprintf (rtl_dump_file, " reg %d %s insn %d\n",
  		       REGNO (to), use_src ? "from" : "set in",
  		       INSN_UID (insn_computes_expr));
  	    }
*************** handle_avail_expr (insn, expr)
*** 3498,3511 ****
        record_one_set (REGNO (to), new_insn);
  
        gcse_create_count++;
!       if (gcse_file != NULL)
  	{
! 	  fprintf (gcse_file, "GCSE: Creating insn %d to copy value of reg %d",
  		   INSN_UID (NEXT_INSN (insn_computes_expr)),
  		   REGNO (SET_SRC (PATTERN (NEXT_INSN (insn_computes_expr)))));
! 	  fprintf (gcse_file, ", computed in insn %d,\n",
  		   INSN_UID (insn_computes_expr));
! 	  fprintf (gcse_file, "      into newly allocated reg %d\n",
  		   REGNO (to));
  	}
  
--- 3494,3507 ----
        record_one_set (REGNO (to), new_insn);
  
        gcse_create_count++;
!       if (rtl_dump_file != NULL)
  	{
! 	  fprintf (rtl_dump_file, "GCSE: Creating insn %d to copy value of reg %d",
  		   INSN_UID (NEXT_INSN (insn_computes_expr)),
  		   REGNO (SET_SRC (PATTERN (NEXT_INSN (insn_computes_expr)))));
! 	  fprintf (rtl_dump_file, ", computed in insn %d,\n",
  		   INSN_UID (insn_computes_expr));
! 	  fprintf (rtl_dump_file, "      into newly allocated reg %d\n",
  		   REGNO (to));
  	}
  
*************** handle_avail_expr (insn, expr)
*** 3522,3535 ****
        if (changed)
  	{
  	  gcse_subst_count++;
! 	  if (gcse_file != NULL)
  	    {
! 	      fprintf (gcse_file,
  		       "GCSE: Replacing the source in insn %d with reg %d ",
  		       INSN_UID (insn),
  		       REGNO (SET_DEST (PATTERN (NEXT_INSN
  						 (insn_computes_expr)))));
! 	      fprintf (gcse_file, "set in insn %d\n",
  		       INSN_UID (insn_computes_expr)); 
  	    }
  	}
--- 3518,3531 ----
        if (changed)
  	{
  	  gcse_subst_count++;
! 	  if (rtl_dump_file != NULL)
  	    {
! 	      fprintf (rtl_dump_file,
  		       "GCSE: Replacing the source in insn %d with reg %d ",
  		       INSN_UID (insn),
  		       REGNO (SET_DEST (PATTERN (NEXT_INSN
  						 (insn_computes_expr)))));
! 	      fprintf (rtl_dump_file, "set in insn %d\n",
  		       INSN_UID (insn_computes_expr)); 
  	    }
  	}
*************** one_classic_gcse_pass (pass)
*** 3610,3617 ****
    alloc_expr_hash_table (max_cuid);
    alloc_rd_mem (n_basic_blocks, max_cuid);
    compute_expr_hash_table ();
!   if (gcse_file)
!     dump_hash_table (gcse_file, "Expression", expr_hash_table,
  		     expr_hash_table_size, n_exprs);
  
    if (n_exprs > 0)
--- 3606,3613 ----
    alloc_expr_hash_table (max_cuid);
    alloc_rd_mem (n_basic_blocks, max_cuid);
    compute_expr_hash_table ();
!   if (rtl_dump_file)
!     dump_hash_table (rtl_dump_file, "Expression", expr_hash_table,
  		     expr_hash_table_size, n_exprs);
  
    if (n_exprs > 0)
*************** one_classic_gcse_pass (pass)
*** 3629,3640 ****
    free_rd_mem ();
    free_expr_hash_table ();
  
!   if (gcse_file)
      {
!       fprintf (gcse_file, "\n");
!       fprintf (gcse_file, "GCSE of %s, pass %d: %d bytes needed, %d substs,",
  	       current_function_name, pass, bytes_used, gcse_subst_count);
!       fprintf (gcse_file, "%d insns created\n", gcse_create_count);
      }
  
    return changed;
--- 3625,3636 ----
    free_rd_mem ();
    free_expr_hash_table ();
  
!   if (rtl_dump_file)
      {
!       fprintf (rtl_dump_file, "\n");
!       fprintf (rtl_dump_file, "GCSE of %s, pass %d: %d bytes needed, %d substs,",
  	       current_function_name, pass, bytes_used, gcse_subst_count);
!       fprintf (rtl_dump_file, "%d insns created\n", gcse_create_count);
      }
  
    return changed;
*************** cprop_jump (insn, from, src)
*** 4049,4061 ****
    run_jump_opt_after_gcse = 1;
  
    const_prop_count++;
!   if (gcse_file != NULL)
      {
!       fprintf (gcse_file,
  	       "CONST-PROP: Replacing reg %d in insn %d with constant ",
  	       REGNO (from), INSN_UID (insn));
!       print_rtl (gcse_file, src);
!       fprintf (gcse_file, "\n");
      }
  
    return 1;
--- 4045,4057 ----
    run_jump_opt_after_gcse = 1;
  
    const_prop_count++;
!   if (rtl_dump_file != NULL)
      {
!       fprintf (rtl_dump_file,
  	       "CONST-PROP: Replacing reg %d in insn %d with constant ",
  	       REGNO (from), INSN_UID (insn));
!       print_rtl (rtl_dump_file, src);
!       fprintf (rtl_dump_file, "\n");
      }
  
    return 1;
*************** cprop_insn (insn, alter_jumps)
*** 4157,4170 ****
  	    {
  	      changed = 1;
  	      const_prop_count++;
! 	      if (gcse_file != NULL)
  		{
! 		  fprintf (gcse_file, "CONST-PROP: Replacing reg %d in ",
  			   regno);
! 		  fprintf (gcse_file, "insn %d with constant ",
  			   INSN_UID (insn));
! 		  print_rtl (gcse_file, src);
! 		  fprintf (gcse_file, "\n");
  		}
  
  	      /* The original insn setting reg_used may or may not now be
--- 4153,4166 ----
  	    {
  	      changed = 1;
  	      const_prop_count++;
! 	      if (rtl_dump_file != NULL)
  		{
! 		  fprintf (rtl_dump_file, "CONST-PROP: Replacing reg %d in ",
  			   regno);
! 		  fprintf (rtl_dump_file, "insn %d with constant ",
  			   INSN_UID (insn));
! 		  print_rtl (rtl_dump_file, src);
! 		  fprintf (rtl_dump_file, "\n");
  		}
  
  	      /* The original insn setting reg_used may or may not now be
*************** cprop_insn (insn, alter_jumps)
*** 4207,4217 ****
  	    {
  	      changed = 1;
  	      copy_prop_count++;
! 	      if (gcse_file != NULL)
  		{
! 		  fprintf (gcse_file, "COPY-PROP: Replacing reg %d in insn %d",
  			   regno, INSN_UID (insn));
! 		  fprintf (gcse_file, " with reg %d\n", REGNO (src));
  		}
  
  	      /* The original insn setting reg_used may or may not now be
--- 4203,4213 ----
  	    {
  	      changed = 1;
  	      copy_prop_count++;
! 	      if (rtl_dump_file != NULL)
  		{
! 		  fprintf (rtl_dump_file, "COPY-PROP: Replacing reg %d in insn %d",
  			   regno, INSN_UID (insn));
! 		  fprintf (rtl_dump_file, " with reg %d\n", REGNO (src));
  		}
  
  	      /* The original insn setting reg_used may or may not now be
*************** cprop (alter_jumps)
*** 4260,4267 ****
  	}
      }
  
!   if (gcse_file != NULL)
!     fprintf (gcse_file, "\n");
  
    return changed;
  }
--- 4256,4263 ----
  	}
      }
  
!   if (rtl_dump_file != NULL)
!     fprintf (rtl_dump_file, "\n");
  
    return changed;
  }
*************** one_cprop_pass (pass, alter_jumps)
*** 4282,4289 ****
  
    alloc_set_hash_table (max_cuid);
    compute_set_hash_table ();
!   if (gcse_file)
!     dump_hash_table (gcse_file, "SET", set_hash_table, set_hash_table_size,
  		     n_sets);
    if (n_sets > 0)
      {
--- 4278,4285 ----
  
    alloc_set_hash_table (max_cuid);
    compute_set_hash_table ();
!   if (rtl_dump_file)
!     dump_hash_table (rtl_dump_file, "SET", set_hash_table, set_hash_table_size,
  		     n_sets);
    if (n_sets > 0)
      {
*************** one_cprop_pass (pass, alter_jumps)
*** 4295,4305 ****
  
    free_set_hash_table ();
  
!   if (gcse_file)
      {
!       fprintf (gcse_file, "CPROP of %s, pass %d: %d bytes needed, ",
  	       current_function_name, pass, bytes_used);
!       fprintf (gcse_file, "%d const props, %d copy props\n\n",
  	       const_prop_count, copy_prop_count);
      }
  
--- 4291,4301 ----
  
    free_set_hash_table ();
  
!   if (rtl_dump_file)
      {
!       fprintf (rtl_dump_file, "CPROP of %s, pass %d: %d bytes needed, ",
  	       current_function_name, pass, bytes_used);
!       fprintf (rtl_dump_file, "%d const props, %d copy props\n\n",
  	       const_prop_count, copy_prop_count);
      }
  
*************** compute_pre_data ()
*** 4440,4446 ****
        sbitmap_not (ae_kill[i], ae_kill[i]);
      }
  
!   edge_list = pre_edge_lcm (gcse_file, n_exprs, transp, comp, antloc,
  			    ae_kill, &pre_insert_map, &pre_delete_map);
    sbitmap_vector_free (antloc);
    antloc = NULL;
--- 4436,4442 ----
        sbitmap_not (ae_kill[i], ae_kill[i]);
      }
  
!   edge_list = pre_edge_lcm (rtl_dump_file, n_exprs, transp, comp, antloc,
  			    ae_kill, &pre_insert_map, &pre_delete_map);
    sbitmap_vector_free (antloc);
    antloc = NULL;
*************** insert_insn_end_bb (expr, bb, pre)
*** 4722,4732 ****
  
    gcse_create_count++;
  
!   if (gcse_file)
      {
!       fprintf (gcse_file, "PRE/HOIST: end of bb %d, insn %d, ",
  	       bb->index, INSN_UID (new_insn));
!       fprintf (gcse_file, "copying expression %d to reg %d\n",
  	       expr->bitmap_index, regno);
      }
  }
--- 4718,4728 ----
  
    gcse_create_count++;
  
!   if (rtl_dump_file)
      {
!       fprintf (rtl_dump_file, "PRE/HOIST: end of bb %d, insn %d, ",
  	       bb->index, INSN_UID (new_insn));
!       fprintf (rtl_dump_file, "copying expression %d to reg %d\n",
  	       expr->bitmap_index, regno);
      }
  }
*************** pre_edge_insert (edge_list, index_map)
*** 4793,4804 ****
  			    insert_insn_on_edge (insn, eg);
  			  }
  
! 			if (gcse_file)
  			  {
! 			    fprintf (gcse_file, "PRE/HOIST: edge (%d,%d), ",
  				     bb->index,
  				     INDEX_EDGE_SUCC_BB (edge_list, e)->index);
! 			    fprintf (gcse_file, "copy expression %d\n",
  				     expr->bitmap_index);
  			  }
  
--- 4789,4800 ----
  			    insert_insn_on_edge (insn, eg);
  			  }
  
! 			if (rtl_dump_file)
  			  {
! 			    fprintf (rtl_dump_file, "PRE/HOIST: edge (%d,%d), ",
  				     bb->index,
  				     INDEX_EDGE_SUCC_BB (edge_list, e)->index);
! 			    fprintf (rtl_dump_file, "copy expression %d\n",
  				     expr->bitmap_index);
  			  }
  
*************** pre_insert_copy_insn (expr, insn)
*** 4845,4852 ****
  
    gcse_create_count++;
  
!   if (gcse_file)
!     fprintf (gcse_file,
  	     "PRE: bb %d, insn %d, copy expression %d in insn %d to reg %d\n",
  	      BLOCK_NUM (insn), INSN_UID (new_insn), indx,
  	      INSN_UID (insn), regno);
--- 4841,4848 ----
  
    gcse_create_count++;
  
!   if (rtl_dump_file)
!     fprintf (rtl_dump_file,
  	     "PRE: bb %d, insn %d, copy expression %d in insn %d to reg %d\n",
  	      BLOCK_NUM (insn), INSN_UID (new_insn), indx,
  	      INSN_UID (insn), regno);
*************** pre_delete ()
*** 4970,4981 ****
  		    gcse_subst_count++;
  		  }
  
! 		if (gcse_file)
  		  {
! 		    fprintf (gcse_file,
  			     "PRE: redundant insn %d (expression %d) in ",
  			       INSN_UID (insn), indx);
! 		    fprintf (gcse_file, "bb %d, reaching reg is %d\n",
  			     bb->index, REGNO (expr->reaching_reg));
  		  }
  	      }
--- 4966,4977 ----
  		    gcse_subst_count++;
  		  }
  
! 		if (rtl_dump_file)
  		  {
! 		    fprintf (rtl_dump_file,
  			     "PRE: redundant insn %d (expression %d) in ",
  			       INSN_UID (insn), indx);
! 		    fprintf (rtl_dump_file, "bb %d, reaching reg is %d\n",
  			     bb->index, REGNO (expr->reaching_reg));
  		  }
  	      }
*************** one_pre_gcse_pass (pass)
*** 5068,5075 ****
  
    compute_expr_hash_table ();
    trim_ld_motion_mems ();
!   if (gcse_file)
!     dump_hash_table (gcse_file, "Expression", expr_hash_table,
  		     expr_hash_table_size, n_exprs);
  
    if (n_exprs > 0)
--- 5064,5071 ----
  
    compute_expr_hash_table ();
    trim_ld_motion_mems ();
!   if (rtl_dump_file)
!     dump_hash_table (rtl_dump_file, "Expression", expr_hash_table,
  		     expr_hash_table_size, n_exprs);
  
    if (n_exprs > 0)
*************** one_pre_gcse_pass (pass)
*** 5085,5095 ****
    remove_fake_edges ();
    free_expr_hash_table ();
  
!   if (gcse_file)
      {
!       fprintf (gcse_file, "\nPRE GCSE of %s, pass %d: %d bytes needed, ",
  	       current_function_name, pass, bytes_used);
!       fprintf (gcse_file, "%d substs, %d insns created\n",
  	       gcse_subst_count, gcse_create_count);
      }
  
--- 5081,5091 ----
    remove_fake_edges ();
    free_expr_hash_table ();
  
!   if (rtl_dump_file)
      {
!       fprintf (rtl_dump_file, "\nPRE GCSE of %s, pass %d: %d bytes needed, ",
  	       current_function_name, pass, bytes_used);
!       fprintf (rtl_dump_file, "%d substs, %d insns created\n",
  	       gcse_subst_count, gcse_create_count);
      }
  
*************** compute_code_hoist_vbeinout ()
*** 5584,5591 ****
        passes++;
      }
  
!   if (gcse_file)
!     fprintf (gcse_file, "hoisting vbeinout computation: %d passes\n", passes);
  }
  
  /* Top level routine to do the dataflow analysis needed by code hoisting.  */
--- 5580,5587 ----
        passes++;
      }
  
!   if (rtl_dump_file)
!     fprintf (rtl_dump_file, "hoisting vbeinout computation: %d passes\n", passes);
  }
  
  /* Top level routine to do the dataflow analysis needed by code hoisting.  */
*************** compute_code_hoist_data ()
*** 5597,5604 ****
    compute_transpout ();
    compute_code_hoist_vbeinout ();
    calculate_dominance_info (NULL, dominators, CDI_DOMINATORS);
!   if (gcse_file)
!     fprintf (gcse_file, "\n");
  }
  
  /* Determine if the expression identified by EXPR_INDEX would
--- 5593,5600 ----
    compute_transpout ();
    compute_code_hoist_vbeinout ();
    calculate_dominance_info (NULL, dominators, CDI_DOMINATORS);
!   if (rtl_dump_file)
!     fprintf (rtl_dump_file, "\n");
  }
  
  /* Determine if the expression identified by EXPR_INDEX would
*************** one_code_hoisting_pass ()
*** 5843,5850 ****
  
    alloc_expr_hash_table (max_cuid);
    compute_expr_hash_table ();
!   if (gcse_file)
!     dump_hash_table (gcse_file, "Code Hosting Expressions", expr_hash_table,
  		     expr_hash_table_size, n_exprs);
  
    if (n_exprs > 0)
--- 5839,5846 ----
  
    alloc_expr_hash_table (max_cuid);
    compute_expr_hash_table ();
!   if (rtl_dump_file)
!     dump_hash_table (rtl_dump_file, "Code Hosting Expressions", expr_hash_table,
  		     expr_hash_table_size, n_exprs);
  
    if (n_exprs > 0)
*************** trim_ld_motion_mems ()
*** 6214,6221 ****
      }
  
    /* Show the world what we've found.  */
!   if (gcse_file && pre_ldst_mems != NULL)
!     print_ldst_list (gcse_file);
  }
  
  /* This routine will take an expression which we are replacing with
--- 6210,6217 ----
      }
  
    /* Show the world what we've found.  */
!   if (rtl_dump_file && pre_ldst_mems != NULL)
!     print_ldst_list (rtl_dump_file);
  }
  
  /* This routine will take an expression which we are replacing with
*************** update_ld_motion_stores (expr)
*** 6255,6267 ****
  	  if (expr->reaching_reg == src)
  	    continue;
  	  
! 	  if (gcse_file)
  	    {
! 	      fprintf (gcse_file, "PRE:  store updated with reaching reg ");
! 	      print_rtl (gcse_file, expr->reaching_reg);
! 	      fprintf (gcse_file, ":\n	");
! 	      print_inline_rtx (gcse_file, insn, 8);
! 	      fprintf (gcse_file, "\n");
  	    }
  	  
  	  copy = gen_move_insn ( reg, SET_SRC (pat));
--- 6251,6263 ----
  	  if (expr->reaching_reg == src)
  	    continue;
  	  
! 	  if (rtl_dump_file)
  	    {
! 	      fprintf (rtl_dump_file, "PRE:  store updated with reaching reg ");
! 	      print_rtl (rtl_dump_file, expr->reaching_reg);
! 	      fprintf (rtl_dump_file, ":\n	");
! 	      print_inline_rtx (rtl_dump_file, insn, 8);
! 	      fprintf (rtl_dump_file, "\n");
  	    }
  	  
  	  copy = gen_move_insn ( reg, SET_SRC (pat));
*************** build_store_vectors () 
*** 6813,6819 ****
  						   BASIC_BLOCK (j), FALSE))
  			  {
  			    SET_BIT (ae_kill[j], ptr->index);
! 			    if (!TEST_BIT (ae_gen[j], ptr->index))
  			      RESET_BIT (transp[j], ptr->index);
  			  }
  		      }
--- 6809,6816 ----
  						   BASIC_BLOCK (j), FALSE))
  			  {
  			    SET_BIT (ae_kill[j], ptr->index);
! 			    if (!TEST_BIT (ae_gen[j], ptr->index) 
! 				|| !TEST_BIT (st_antloc[j], ptr->index))
  			      RESET_BIT (transp[j], ptr->index);
  			  }
  		      }
*************** build_store_vectors () 
*** 6836,6842 ****
  			    /* It's not okay, so it's killed and maybe
  			       not transparent */
  			    SET_BIT (ae_kill[j], ptr->index);
! 			    if (!TEST_BIT (ae_gen[j], ptr->index))
  			      {
  				RESET_BIT (transp[j], ptr->index);
  			      }
--- 6833,6840 ----
  			    /* It's not okay, so it's killed and maybe
  			       not transparent */
  			    SET_BIT (ae_kill[j], ptr->index);
! 			    if (!TEST_BIT (ae_gen[j], ptr->index)
! 				|| !TEST_BIT (st_antloc[j], ptr->index))
  			      {
  				RESET_BIT (transp[j], ptr->index);
  			      }
*************** build_store_vectors () 
*** 6848,6854 ****
  						BASIC_BLOCK (j), FALSE))
  			  {
  			    SET_BIT (ae_kill[j], ptr->index);
! 			    if (!TEST_BIT (ae_gen[j], ptr->index))
  			      {
  				RESET_BIT (transp[j], ptr->index);
  			      }
--- 6846,6853 ----
  						BASIC_BLOCK (j), FALSE))
  			  {
  			    SET_BIT (ae_kill[j], ptr->index);
! 			    if (!TEST_BIT (ae_gen[j], ptr->index)
! 				|| !TEST_BIT (st_antloc[j], ptr->index))
  			      {
  				RESET_BIT (transp[j], ptr->index);
  			      }
*************** build_store_vectors () 
*** 6869,6875 ****
  					  BASIC_BLOCK (j), FALSE))
  		    {
  		      SET_BIT (ae_kill[j], ptr->index);
! 		      if (!TEST_BIT (ae_gen[j], ptr->index))
  			{
  			  RESET_BIT (transp[j], ptr->index);
  			}
--- 6868,6875 ----
  					  BASIC_BLOCK (j), FALSE))
  		    {
  		      SET_BIT (ae_kill[j], ptr->index);
! 		      if (!TEST_BIT (ae_gen[j], ptr->index)
! 			  || !TEST_BIT (st_antloc[j], ptr->index))
  			{
  			  RESET_BIT (transp[j], ptr->index);
  			}
Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.373.2.3
diff -c -3 -p -w -B -b -r1.373.2.3 flow.c
*** flow.c	2001/07/17 21:40:46	1.373.2.3
--- flow.c	2001/07/27 17:58:29
*************** propagate_block (bb, live, local_set, co
*** 5283,5290 ****
      }
  
    /* Scan the block an insn at a time from end to beginning.  */
! 
!   for (insn = bb->end;; insn = prev)
      {
        /* If this is a call to `setjmp' et al, warn if any
  	 non-volatile datum is live.  */
--- 5283,5290 ----
      }
  
    /* Scan the block an insn at a time from end to beginning.  */
!   prev = bb->end;
!   for (insn = bb->end; prev; insn = prev)
      {
        /* If this is a call to `setjmp' et al, warn if any
  	 non-volatile datum is live.  */
Index: regclass.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/regclass.c,v
retrieving revision 1.111.2.3
diff -c -3 -p -w -B -b -r1.111.2.3 regclass.c
*** regclass.c	2001/07/17 21:41:18	1.111.2.3
--- regclass.c	2001/07/27 17:58:31
*************** reg_scan_mark_refs (x, insn, note_flag, 
*** 2435,2441 ****
--- 2435,2444 ----
  
        if (GET_CODE (dest) == REG
  	  && REGNO (dest) >= min_regno)
+       {
  	REG_N_SETS (REGNO (dest))++;
+ 	REG_N_REFS (REGNO (dest))++;
+       }
  
        /* If this is setting a pseudo from another pseudo or the sum of a
  	 pseudo and a constant integer and the other pseudo is known to be
Index: toplev.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.418.2.7
diff -c -3 -p -w -B -b -r1.418.2.7 toplev.c
*** toplev.c	2001/07/20 04:01:33	1.418.2.7
--- toplev.c	2001/07/27 17:58:36
*************** rest_of_compilation (decl)
*** 3059,3065 ****
  
        find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
        cleanup_cfg (CLEANUP_EXPENSIVE);
!       tem = gcse_main (insns, rtl_dump_file);
  
        save_csb = flag_cse_skip_blocks;
        save_cfj = flag_cse_follow_jumps;
--- 3059,3065 ----
  
        find_basic_blocks (insns, max_reg_num (), rtl_dump_file);
        cleanup_cfg (CLEANUP_EXPENSIVE);
!       tem = gcse_main (insns);
  
        save_csb = flag_cse_skip_blocks;
        save_cfj = flag_cse_follow_jumps;
Index: rtl.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/rtl.h,v
retrieving revision 1.240.2.5
diff -c -3 -p -w -B -b -r1.240.2.5 rtl.h
*** rtl.h	2001/07/25 19:45:29	1.240.2.5
--- rtl.h	2001/07/27 17:58:38
*************** extern rtx expand_mult_highpart		PARAMS 
*** 1850,1856 ****
  
  /* In gcse.c */
  #ifdef BUFSIZ
! extern int gcse_main			PARAMS ((rtx, FILE *));
  extern int store_motion			PARAMS ((void));
  #endif
  
--- 1850,1856 ----
  
  /* In gcse.c */
  #ifdef BUFSIZ
! extern int gcse_main			PARAMS ((rtx));
  extern int store_motion			PARAMS ((void));
  #endif
  

-- 
"I put contact lenses in my dog's eyes.  They had little pictures
of cats on them.  Then I took one out and he ran around in
circles.
"-Steven Wright


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