From 9aaa7e4784a08e2564f771ee1ee01252da3334d0 Mon Sep 17 00:00:00 2001
From: Hans-Peter Nilsson <hp@axis.com>
Date: Fri, 10 Jun 2011 14:20:44 +0000
Subject: [PATCH] ira-costs.c: Remove #ifdefs on dead
 FORBIDDEN_INC_DEC_CLASSES.

	* ira-costs.c: Remove #ifdefs on dead FORBIDDEN_INC_DEC_CLASSES.
	Adjust comments.
	* system.h (FORBIDDEN_INC_DEC_CLASSES): Poison.

From-SVN: r174908
---
 gcc/ChangeLog   |  6 ++++++
 gcc/ira-costs.c | 56 ++++++-------------------------------------------
 gcc/system.h    |  2 +-
 3 files changed, 13 insertions(+), 51 deletions(-)

diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 09d9d1c4872c..dc2e04ac1e9e 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2011-06-10  Hans-Peter Nilsson  <hp@axis.com>
+
+	* ira-costs.c: Remove #ifdefs on dead FORBIDDEN_INC_DEC_CLASSES.
+	Adjust comments.
+	* system.h (FORBIDDEN_INC_DEC_CLASSES): Poison.
+
 2011-06-10  Jan Hubicka  <jh@suse.cz>
 
 	* ipa-cp.c (ipcp_process_devirtualization_opportunities):
diff --git a/gcc/ira-costs.c b/gcc/ira-costs.c
index 1dbb5a734602..da14089f913b 100644
--- a/gcc/ira-costs.c
+++ b/gcc/ira-costs.c
@@ -46,15 +46,9 @@ static bool pseudo_classes_defined_p = false;
 /* TRUE if we work with allocnos.  Otherwise we work with pseudos.  */
 static bool allocno_p;
 
-/* Number of elements in arrays `in_inc_dec' and `costs'.  */
+/* Number of elements in array `costs'.  */
 static int cost_elements_num;
 
-#ifdef FORBIDDEN_INC_DEC_CLASSES
-/* Indexed by n, is TRUE if allocno or pseudo with number N is used in
-   an auto-inc or auto-dec context.  */
-static bool *in_inc_dec;
-#endif
-
 /* The `costs' struct records the cost of using hard registers of each
    class considered for the calculation and of using memory for each
    allocno or pseudo.  */
@@ -1135,13 +1129,7 @@ record_address_regs (enum machine_mode mode, rtx x, int context,
     case PRE_DEC:
       /* Double the importance of an allocno that is incremented or
 	 decremented, since it would take two extra insns if it ends
-	 up in the wrong place.  If the operand is a pseudo-register,
-	 show it is being used in an INC_DEC context.  */
-#ifdef FORBIDDEN_INC_DEC_CLASSES
-      if (REG_P (XEXP (x, 0))
-	  && REGNO (XEXP (x, 0)) >= FIRST_PSEUDO_REGISTER)
-	in_inc_dec[COST_INDEX (REGNO (XEXP (x, 0)))] = true;
-#endif
+	 up in the wrong place.  */
       record_address_regs (mode, XEXP (x, 0), 0, code, SCRATCH, 2 * scale);
       break;
 
@@ -1380,9 +1368,6 @@ print_allocno_costs (FILE *f)
 	{
 	  rclass = cost_classes[k];
 	  if (contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (regno)]
-#ifdef FORBIDDEN_INC_DEC_CLASSES
-	      && (! in_inc_dec[i] || ! forbidden_inc_dec_class[rclass])
-#endif
 #ifdef CANNOT_CHANGE_MODE_CLASS
 	      && ! invalid_mode_change_p (regno, (enum reg_class) rclass)
 #endif
@@ -1425,9 +1410,6 @@ print_pseudo_costs (FILE *f)
 	{
 	  rclass = cost_classes[k];
 	  if (contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (regno)]
-#ifdef FORBIDDEN_INC_DEC_CLASSES
-	      && (! in_inc_dec[regno] || ! forbidden_inc_dec_class[rclass])
-#endif
 #ifdef CANNOT_CHANGE_MODE_CLASS
 	      && ! invalid_mode_change_p (regno, (enum reg_class) rclass)
 #endif
@@ -1477,9 +1459,6 @@ find_costs_and_classes (FILE *dump_file)
   enum reg_class *regno_best_class;
 
   init_recog ();
-#ifdef FORBIDDEN_INC_DEC_CLASSES
-  in_inc_dec = ira_allocate (sizeof (bool) * cost_elements_num);
-#endif /* FORBIDDEN_INC_DEC_CLASSES */
   regno_best_class
     = (enum reg_class *) ira_allocate (max_reg_num ()
 				       * sizeof (enum reg_class));
@@ -1544,9 +1523,6 @@ find_costs_and_classes (FILE *dump_file)
       /* Zero out our accumulation of the cost of each class for each
 	 allocno.  */
       memset (costs, 0, cost_elements_num * struct_costs_size);
-#ifdef FORBIDDEN_INC_DEC_CLASSES
-      memset (in_inc_dec, 0, cost_elements_num * sizeof (bool));
-#endif
 
       if (allocno_p)
 	{
@@ -1578,9 +1554,6 @@ find_costs_and_classes (FILE *dump_file)
 	  ira_loop_tree_node_t parent;
 	  int best_cost, allocno_cost;
 	  enum reg_class best, alt_class;
-#ifdef FORBIDDEN_INC_DEC_CLASSES
-	  int inc_dec_p = false;
-#endif
 	  cost_classes_t cost_classes_ptr = regno_cost_classes[i];
 	  enum reg_class *cost_classes = cost_classes_ptr->classes;
 	  int *i_costs = temp_costs->cost;
@@ -1591,9 +1564,6 @@ find_costs_and_classes (FILE *dump_file)
 	    {
 	      if (regno_reg_rtx[i] == NULL_RTX)
 		continue;
-#ifdef FORBIDDEN_INC_DEC_CLASSES
-	      inc_dec_p = in_inc_dec[i];
-#endif
 	      memcpy (temp_costs, COSTS (costs, i), struct_costs_size);
 	      i_mem_cost = temp_costs->mem_cost;
 	    }
@@ -1659,10 +1629,6 @@ find_costs_and_classes (FILE *dump_file)
 		    i_mem_cost = INT_MAX;
 		  else
 		    i_mem_cost += add_cost;
-#ifdef FORBIDDEN_INC_DEC_CLASSES
-		  if (in_inc_dec[a_num])
-		    inc_dec_p = true;
-#endif
 		}
 	    }
 	  if (equiv_savings < 0)
@@ -1682,12 +1648,9 @@ find_costs_and_classes (FILE *dump_file)
 	  for (k = 0; k < cost_classes_ptr->num; k++)
 	    {
 	      rclass = cost_classes[k];
-	      /* Ignore classes that are too small for this operand or
-		 invalid for an operand that was auto-incremented.  */
+	      /* Ignore classes that are too small or invalid for this
+		 operand.  */
 	      if (! contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (i)]
-#ifdef FORBIDDEN_INC_DEC_CLASSES
-		  || (inc_dec_p && forbidden_inc_dec_class[rclass])
-#endif
 #ifdef CANNOT_CHANGE_MODE_CLASS
 		  || invalid_mode_change_p (i, (enum reg_class) rclass)
 #endif
@@ -1760,13 +1723,9 @@ find_costs_and_classes (FILE *dump_file)
 		      rclass = cost_classes[k];
 		      if (! ira_class_subset_p[rclass][regno_aclass[i]])
 			continue;
-		      /* Ignore classes that are too small for this
-			 operand or invalid for an operand that was
-			 auto-incremented.  */
+		      /* Ignore classes that are too small or invalid
+			 for this operand.  */
 		      if (! contains_reg_of_mode[rclass][PSEUDO_REGNO_MODE (i)]
-#ifdef FORBIDDEN_INC_DEC_CLASSES
-			  || (inc_dec_p && forbidden_inc_dec_class[rclass])
-#endif
 #ifdef CANNOT_CHANGE_MODE_CLASS
 			  || invalid_mode_change_p (i, (enum reg_class) rclass)
 #endif
@@ -1813,9 +1772,6 @@ find_costs_and_classes (FILE *dump_file)
 	}
     }
   ira_free (regno_best_class);
-#ifdef FORBIDDEN_INC_DEC_CLASSES
-  ira_free (in_inc_dec);
-#endif
 }
 
 
diff --git a/gcc/system.h b/gcc/system.h
index 70c006a6100f..d95b95054435 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -827,7 +827,7 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN;
 	USING_SVR4_H SVR4_ASM_SPEC FUNCTION_ARG FUNCTION_ARG_ADVANCE	   \
 	FUNCTION_INCOMING_ARG IRA_COVER_CLASSES TARGET_VERSION		   \
 	MACHINE_TYPE TARGET_HAS_TARGETCM ASM_OUTPUT_BSS			   \
-	SETJMP_VIA_SAVE_AREA
+	SETJMP_VIA_SAVE_AREA FORBIDDEN_INC_DEC_CLASSES
 
 /* Hooks that are no longer used.  */
  #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE	\
-- 
GitLab