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]

[ira] removing priority coloring and making the mixed algorithm usage by default


 This patch mostly removes priority coloring (I don't think it is
worth to be used), makes the mixed algorithm by default (instead of the
regional one).

2007-12-17 Vladimir Makarov <vmakarov@redhat.com>

	* doc/invoke.texi (fira-algoirthm): Remove prioirity coloring.
	Make mixed the default.

* flags.h (ira_algorithm): Remove IRA_ALGORITHM_PRIORITY.

	* ira-color.c (priority_coloring):  Remove.
	(do_coloring): Don't call priority_coloring.

* opts.c (common_handle_option): Remove priority coloring option.

	* toplev.c (flag_ira_algorithm): Assign IRA_ALGORITHM_MIXED.
	
	* ira-build.c (check_and_add_conflicts, ira_flattening): Increase
	threshold for internal_flag_ira_verbose.
	

Index: doc/invoke.texi
===================================================================
--- doc/invoke.texi	(revision 131016)
+++ doc/invoke.texi	(working copy)
@@ -5534,17 +5534,15 @@ allocator (@acronym{IRA}) for the regist
 @item -fira-algorithm=@var{algorithm}
 Use specified algorithm for the integrated register allocator.  The
 @var{algorithm} argument should be one of @code{regional}, @code{CB},
-@code{mixed} or @code{priority}.  The second algorithm specifies
-Chaitin-Briggs coloring, the fourth one specifies Chow's priority
-based coloring, the first one which is the default specifies regional
-coloring based on Chaitin-Briggs coloring, and the third one specifies
-a mix of Chaitin-Briggs and regional algorithms where loops with small
-register pressure are ignored.  The first algorithm is the best for
-the generated code quality especially for machines with small or
-moderate size register set, the second one is faster and generates
-decent code and the smallest size code, the priority-based one is the
-fastest one, and the mixed algorithm can give the best result in some
-cases.
+or @code{mixed}.  The second algorithm specifies Chaitin-Briggs
+coloring, the first one specifies regional coloring based on
+Chaitin-Briggs coloring, and the third one which is the default
+specifies a mix of Chaitin-Briggs and regional algorithms where loops
+with small register pressure are ignored.  The first algorithm can
+give best result for machines with small size and irregular register
+set, the second one is faster and generates decent code and the
+smallest size code, and the mixed algorithm usually give the best
+results in most cases and for most architectures.
 
 @item -fira-coalescing
 @opindex fira-coalescing
Index: flags.h
===================================================================
--- flags.h	(revision 131016)
+++ flags.h	(working copy)
@@ -225,8 +225,7 @@ extern int flag_dump_rtl_in_asm;
 enum ira_algorithm {
   IRA_ALGORITHM_REGIONAL,
   IRA_ALGORITHM_CB,
-  IRA_ALGORITHM_MIXED,
-  IRA_ALGORITHM_PRIORITY
+  IRA_ALGORITHM_MIXED
 };
 
 extern enum ira_algorithm flag_ira_algorithm;
Index: toplev.c
===================================================================
--- toplev.c	(revision 131016)
+++ toplev.c	(working copy)
@@ -306,7 +306,7 @@ enum tls_model flag_tls_default = TLS_MO
 
 /* Set the default algorithm for the integrated register allocator.  */
 
-enum ira_algorithm flag_ira_algorithm = IRA_ALGORITHM_REGIONAL;
+enum ira_algorithm flag_ira_algorithm = IRA_ALGORITHM_MIXED;
 
 /* Set the default value for -fira-verbose.  */
 
Index: ira-color.c
===================================================================
--- ira-color.c	(revision 131016)
+++ ira-color.c	(working copy)
@@ -69,7 +69,6 @@ static void print_loop_title (loop_tree_
 static void color_pass (loop_tree_node_t);
 static int allocno_priority_compare_func (const void *, const void *);
 static void finish_allocno_priorities (void);
-static void priority_coloring (void);
 static void start_allocno_priorities (allocno_t *, int);
 static void do_coloring (void);
 
@@ -1413,58 +1412,6 @@ finish_allocno_priorities (void)
   ira_free (allocno_priorities);
 }
 
-/* The function implements Chow's prioity-based coloring.  */
-static void
-priority_coloring (void)
-{
-  int i, hard_regs_num;
-  allocno_t a;
-
-  processed_coalesced_allocno_bitmap = ira_allocate_bitmap ();
-  memcpy (sorted_allocnos, allocnos, allocnos_num * sizeof (allocno_t));
-  for (i = 0; i < allocnos_num; i++)
-    {
-      bitmap_set_bit (coloring_allocno_bitmap, i);
-      a = allocnos [i];
-      hard_regs_num = class_hard_regs_num [ALLOCNO_COVER_CLASS (a)];
-      if (hard_regs_num == 0)
-	continue;
-      memcpy (ALLOCNO_UPDATED_HARD_REG_COSTS (a),
-	      ALLOCNO_HARD_REG_COSTS (a), sizeof (int) * hard_regs_num);
-      memcpy (ALLOCNO_UPDATED_CONFLICT_HARD_REG_COSTS (a),
-	      ALLOCNO_CONFLICT_HARD_REG_COSTS (a),
-	      sizeof (int) * hard_regs_num);
-    }
-  bitmap_copy (consideration_allocno_bitmap, coloring_allocno_bitmap);
-  start_allocno_priorities (sorted_allocnos, allocnos_num);
-  qsort (sorted_allocnos, allocnos_num, sizeof (allocno_t),
-	 allocno_priority_compare_func);
-  finish_allocno_priorities ();
-  for (i = 0; i < allocnos_num; i++)
-    {
-      a = sorted_allocnos [i];
-      if (internal_flag_ira_verbose > 3 && ira_dump_file != NULL)
-	{
-	  fprintf (ira_dump_file, "      ");
-	  print_expanded_allocno (a);
-	  fprintf (ira_dump_file, "  -- ");
-	}
-      if (assign_hard_reg (a, FALSE))
-	{
-	  if (internal_flag_ira_verbose > 3 && ira_dump_file != NULL)
-	    fprintf (ira_dump_file, "assign reg %d\n",
-		     ALLOCNO_HARD_REGNO (a));
-	}
-      else
-	{
-	  if (internal_flag_ira_verbose > 3 && ira_dump_file != NULL)
-	    fprintf (ira_dump_file, "spill\n");
-	}
-      ALLOCNO_IN_GRAPH_P (a) = TRUE;
-    }
-  ira_free_bitmap (processed_coalesced_allocno_bitmap);
-}
-
 /* The function initialized common data for cloring and calls
    functions to do Chaitin-Briggs, regional, and Chow's priority-based
    coloring.  */
@@ -1474,15 +1421,10 @@ do_coloring (void)
   coloring_allocno_bitmap = ira_allocate_bitmap ();
   consideration_allocno_bitmap = ira_allocate_bitmap ();
 
-  if (flag_ira_algorithm == IRA_ALGORITHM_PRIORITY)
-    priority_coloring ();
-  else
-    {
-      if (internal_flag_ira_verbose > 0 && ira_dump_file != NULL)
-	fprintf (ira_dump_file, "\n**** Allocnos coloring:\n\n");
-      
-      traverse_loop_tree (FALSE, ira_loop_tree_root, color_pass, NULL);
-    }
+  if (internal_flag_ira_verbose > 0 && ira_dump_file != NULL)
+    fprintf (ira_dump_file, "\n**** Allocnos coloring:\n\n");
+  
+  traverse_loop_tree (FALSE, ira_loop_tree_root, color_pass, NULL);
 
   if (internal_flag_ira_verbose > 1 && ira_dump_file != NULL)
     print_disposition (ira_dump_file);
Index: opts.c
===================================================================
--- opts.c	(revision 131016)
+++ opts.c	(working copy)
@@ -1730,8 +1730,6 @@ common_handle_option (size_t scode, cons
 	flag_ira_algorithm = IRA_ALGORITHM_CB;
       else if (!strcmp (arg, "mixed"))
 	flag_ira_algorithm = IRA_ALGORITHM_MIXED;
-      else if (!strcmp (arg, "priority"))
-	flag_ira_algorithm = IRA_ALGORITHM_PRIORITY;
       else
 	warning (0, "unknown ira algorithm \"%s\"", arg);
       break;
Index: ira-build.c
===================================================================
--- ira-build.c	(revision 131016)
+++ ira-build.c	(working copy)
@@ -1419,7 +1419,7 @@ check_and_add_conflicts (allocno_t a, al
 	  ira_assert (allocno_conflict_index (a, conflict_a) < 0);
 	  add_to_allocno_conflict_vec (conflict_a, a);
 	  add_to_allocno_conflict_vec (a, conflict_a);
-	  if (internal_flag_ira_verbose > 3 && ira_dump_file != NULL)
+	  if (internal_flag_ira_verbose > 4 && ira_dump_file != NULL)
 	    fprintf (ira_dump_file,
 		     "      Add underlying conflict a%dr%d-a%dr%d\n",
 		     ALLOCNO_NUM (a), REGNO (ALLOCNO_REG (a)),
@@ -1529,7 +1529,7 @@ ira_flattening (int max_regno_before_emi
 	    }
 	  if (REGNO (ALLOCNO_REG (a)) == REGNO (ALLOCNO_REG (father_a)))
 	    {
-	      if (internal_flag_ira_verbose > 3 && ira_dump_file != NULL)
+	      if (internal_flag_ira_verbose > 4 && ira_dump_file != NULL)
 		{
 		  fprintf (ira_dump_file,
 			   "      Moving ranges of a%dr%d to a%dr%d: ",
@@ -1588,7 +1588,7 @@ ira_flattening (int max_regno_before_emi
 		 a parent) or a child of grandparent.  */
 	      for (first = a;;)
 		{
-		  if (internal_flag_ira_verbose > 3 && ira_dump_file != NULL)
+		  if (internal_flag_ira_verbose > 4 && ira_dump_file != NULL)
 		    {
 		      fprintf
 			(ira_dump_file,
@@ -1636,7 +1636,7 @@ ira_flattening (int max_regno_before_emi
       if (ALLOCNO_CAP_MEMBER (cp->first) != NULL
 	  || ALLOCNO_CAP_MEMBER (cp->second) != NULL)
 	{
-	  if (internal_flag_ira_verbose > 3 && ira_dump_file != NULL)
+	  if (internal_flag_ira_verbose > 4 && ira_dump_file != NULL)
 	    fprintf
 	      (ira_dump_file, "      Remove cp%d:%c%dr%d-%c%dr%d\n",
 	       cp->num, ALLOCNO_CAP_MEMBER (cp->first) != NULL ? 'c' : 'a',
@@ -1671,7 +1671,7 @@ ira_flattening (int max_regno_before_emi
       else
 	{
 	  cp->loop_tree_node = NULL;
-	  if (internal_flag_ira_verbose > 3 && ira_dump_file != NULL)
+	  if (internal_flag_ira_verbose > 4 && ira_dump_file != NULL)
 	    fprintf (ira_dump_file, "      Remove cp%d:a%dr%d-a%dr%d\n",
 		     cp->num, ALLOCNO_NUM (cp->first),
 		     REGNO (ALLOCNO_REG (cp->first)), ALLOCNO_NUM (cp->second),
@@ -1733,7 +1733,7 @@ ira_flattening (int max_regno_before_emi
       if (ALLOCNO_LOOP_TREE_NODE (a) != ira_loop_tree_root
 	  || ALLOCNO_CAP_MEMBER (a) != NULL)
 	{
-	  if (internal_flag_ira_verbose > 3 && ira_dump_file != NULL)
+	  if (internal_flag_ira_verbose > 4 && ira_dump_file != NULL)
 	    fprintf (ira_dump_file, "      Remove a%dr%d\n",
 		     ALLOCNO_NUM (a), REGNO (ALLOCNO_REG (a)));
 	  finish_allocno (a);
@@ -1750,7 +1750,7 @@ ira_flattening (int max_regno_before_emi
 	    allocno_vec [k++] = conflict_a;
 	  else
 	    {
-	      if (internal_flag_ira_verbose > 3 && ira_dump_file != NULL)
+	      if (internal_flag_ira_verbose > 4 && ira_dump_file != NULL)
 		fprintf (ira_dump_file,
 			 "      Remove conflict a%dr%d - a%dr%d\n",
 			 ALLOCNO_NUM (a), REGNO (ALLOCNO_REG (a)),
@@ -1766,7 +1766,7 @@ ira_flattening (int max_regno_before_emi
 	  free++;
 	  continue;
 	}
-      if (internal_flag_ira_verbose > 3 && ira_dump_file != NULL)
+      if (internal_flag_ira_verbose > 4 && ira_dump_file != NULL)
 	fprintf (ira_dump_file, "      Enumerate a%dr%d to a%d\n",
 		 ALLOCNO_NUM (a), REGNO (ALLOCNO_REG (a)), free);
       ALLOCNO_NUM (a) = free;
@@ -1795,7 +1795,7 @@ ira_flattening (int max_regno_before_emi
 	  free++;
 	  continue;
 	}
-      if (internal_flag_ira_verbose > 3 && ira_dump_file != NULL)
+      if (internal_flag_ira_verbose > 4 && ira_dump_file != NULL)
 	fprintf (ira_dump_file,
 		 "      Enumerate cp%d to cp%d\n", cp->num, free);
       cp->num = free;
@@ -1824,7 +1824,7 @@ ira_flattening (int max_regno_before_emi
 		{
 		  if (allocno_conflict_index (a, conflict_a) < 0)
 		    {
-		      if (internal_flag_ira_verbose > 3
+		      if (internal_flag_ira_verbose > 4
 			  && ira_dump_file != NULL)
 			fprintf
 			  (ira_dump_file,
@@ -1836,7 +1836,7 @@ ira_flattening (int max_regno_before_emi
 		    }
 		  if (allocno_conflict_index (conflict_a, a) < 0)
 		    {
-		      if (internal_flag_ira_verbose > 3
+		      if (internal_flag_ira_verbose > 4
 			  && ira_dump_file != NULL)
 			fprintf
 			  (ira_dump_file,

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