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]
Other format: [Raw text]

[PATCH] Make IRA use current_loops and loop_optimizer_init


The following gets rid of ira_loops (ok, without touching all uses
yet but with a #define - I'll finish this if you are ok with it
in general).

Bootstrap and regtest running on x86_64-unknown-linux-gnu.

Ok for trunk for the IRA parts?  (well, given I search & replace
uses of ira_loops)

Thanks,
Richard.

2013-02-07  Richard Biener  <rguenther@suse.de>

	* cfgloop.c (verify_loop_structure): Properly handle
	a loop exiting to another loop header.
	* ira-int.h (ira_loops): Remove.
	* ira.c (ira_loops): Remove.
	(ira): Use loop_optimizer_init and loop_optimizer_finalize.
	(do_reload): Use loop_optimizer_finalize.

Index: gcc/cfgloop.c
===================================================================
*** gcc/cfgloop.c	(revision 195846)
--- gcc/cfgloop.c	(working copy)
*************** verify_loop_structure (void)
*** 1542,1548 ****
  		eloops++;
  
  	      for (loop = bb->loop_father;
! 		   loop != e->dest->loop_father;
  		   loop = loop_outer (loop))
  		{
  		  eloops--;
--- 1542,1553 ----
  		eloops++;
  
  	      for (loop = bb->loop_father;
! 		   loop != e->dest->loop_father
! 		   /* When a loop exit is also an entry edge which
! 		      can happen when avoiding CFG manipulations
! 		      then the last loop exited is the outer loop
! 		      of the loop entered.  */
! 		   && loop != loop_outer (e->dest->loop_father);
  		   loop = loop_outer (loop))
  		{
  		  eloops--;
Index: gcc/ira-int.h
===================================================================
*** gcc/ira-int.h	(revision 195846)
--- gcc/ira-int.h	(working copy)
*************** along with GCC; see the file COPYING3.
*** 48,54 ****
     ? (freq * REG_FREQ_MAX / BB_FREQ_MAX) : 1)
  
  /* All natural loops.  */
! extern struct loops ira_loops;
  
  /* A modified value of flag `-fira-verbose' used internally.  */
  extern int internal_flag_ira_verbose;
--- 48,54 ----
     ? (freq * REG_FREQ_MAX / BB_FREQ_MAX) : 1)
  
  /* All natural loops.  */
! #define ira_loops (*current_loops)
  
  /* A modified value of flag `-fira-verbose' used internally.  */
  extern int internal_flag_ira_verbose;
Index: gcc/ira.c
===================================================================
*** gcc/ira.c	(revision 195846)
--- gcc/ira.c	(working copy)
*************** allocate_initial_values (void)
*** 4338,4346 ****
     function.  */
  bool ira_use_lra_p;
  
- /* All natural loops.  */
- struct loops ira_loops;
- 
  /* True if we have allocno conflicts.  It is false for non-optimized
     mode or when the conflict table is too big.  */
  bool ira_conflicts_p;
--- 4338,4343 ----
*************** ira (FILE *f)
*** 4464,4474 ****
  
    ira_assert (current_loops == NULL);
    if (flag_ira_region == IRA_REGION_ALL || flag_ira_region == IRA_REGION_MIXED)
!     {
!       flow_loops_find (&ira_loops);
!       current_loops = &ira_loops;
!       record_loop_exits ();
!     }
  
    if (internal_flag_ira_verbose > 0 && ira_dump_file != NULL)
      fprintf (ira_dump_file, "Building IRA IR\n");
--- 4461,4467 ----
  
    ira_assert (current_loops == NULL);
    if (flag_ira_region == IRA_REGION_ALL || flag_ira_region == IRA_REGION_MIXED)
!     loop_optimizer_init (AVOID_CFG_MODIFICATIONS | LOOPS_HAVE_RECORDED_EXITS);
  
    if (internal_flag_ira_verbose > 0 && ira_dump_file != NULL)
      fprintf (ira_dump_file, "Building IRA IR\n");
*************** ira (FILE *f)
*** 4526,4536 ****
  	  /* ??? Rebuild the loop tree, but why?  Does the loop tree
  	     change if new insns were generated?  Can that be handled
  	     by updating the loop tree incrementally?  */
! 	  release_recorded_exits ();
! 	  flow_loops_free (&ira_loops);
! 	  flow_loops_find (&ira_loops);
! 	  current_loops = &ira_loops;
! 	  record_loop_exits ();
  
  	  if (! ira_use_lra_p)
  	    {
--- 4519,4527 ----
  	  /* ??? Rebuild the loop tree, but why?  Does the loop tree
  	     change if new insns were generated?  Can that be handled
  	     by updating the loop tree incrementally?  */
! 	  loop_optimizer_finalize ();
! 	  loop_optimizer_init (AVOID_CFG_MODIFICATIONS
! 			       | LOOPS_HAVE_RECORDED_EXITS);
  
  	  if (! ira_use_lra_p)
  	    {
*************** do_reload (void)
*** 4607,4614 ****
      {
        if (current_loops != NULL)
  	{
! 	  release_recorded_exits ();
! 	  flow_loops_free (&ira_loops);
  	  free_dominance_info (CDI_DOMINATORS);
  	}
        FOR_ALL_BB (bb)
--- 4598,4604 ----
      {
        if (current_loops != NULL)
  	{
! 	  loop_optimizer_finalize ();
  	  free_dominance_info (CDI_DOMINATORS);
  	}
        FOR_ALL_BB (bb)
*************** do_reload (void)
*** 4657,4664 ****
        ira_destroy ();
        if (current_loops != NULL)
  	{
! 	  release_recorded_exits ();
! 	  flow_loops_free (&ira_loops);
  	  free_dominance_info (CDI_DOMINATORS);
  	}
        FOR_ALL_BB (bb)
--- 4647,4653 ----
        ira_destroy ();
        if (current_loops != NULL)
  	{
! 	  loop_optimizer_finalize ();
  	  free_dominance_info (CDI_DOMINATORS);
  	}
        FOR_ALL_BB (bb)


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