re PR target/64342 (Tests failing when compiled with '-m32 -fpic' after r216154.)
authorVladimir Makarov <vmakarov@redhat.com>
Thu, 5 Mar 2015 19:43:11 +0000 (19:43 +0000)
committerVladimir Makarov <vmakarov@gcc.gnu.org>
Thu, 5 Mar 2015 19:43:11 +0000 (19:43 +0000)
2015-03-05  Vladimir Makarov  <vmakarov@redhat.com>

PR target/64342
* lra-assigns.c (find_hard_regno_for): Rename to
find_hard_regno_for_1.  Add a new parameter.
(find_hard_regno_for): New function using find_hard_regno_for_1.

From-SVN: r221223

gcc/ChangeLog
gcc/lra-assigns.c

index 3ec2d1c726825bd3e172eeb9263737ea6dbce0d1..c4496f5b758a55650ddd101a0fa7c45bfd49126b 100644 (file)
@@ -1,3 +1,10 @@
+2015-03-05  Vladimir Makarov  <vmakarov@redhat.com>
+
+       PR target/64342
+       * lra-assigns.c (find_hard_regno_for): Rename to
+       find_hard_regno_for_1.  Add a new parameter.
+       (find_hard_regno_for): New function using find_hard_regno_for_1.
+
 2015-03-05  Bernd Edlinger  <bernd.edlinger@hotmail.de>
 
        PR rtl-optimization/65067
index 2462af5f1723417846c4af114b94d01f59e55cdd..e19156b32807c9b7a821b3f484da1c917eac44e9 100644 (file)
@@ -491,10 +491,13 @@ adjust_hard_regno_cost (int hard_regno, int incr)
    pseudos in complicated situations where pseudo sizes are different.
 
    If TRY_ONLY_HARD_REGNO >= 0, consider only that hard register,
-   otherwise consider all hard registers in REGNO's class.  */
+   otherwise consider all hard registers in REGNO's class.
+
+   If REGNO_SET is not empty, only hard registers from the set are
+   considered.  */
 static int
-find_hard_regno_for (int regno, int *cost, int try_only_hard_regno,
-                    bool first_p)
+find_hard_regno_for_1 (int regno, int *cost, int try_only_hard_regno,
+                      bool first_p, HARD_REG_SET regno_set)
 {
   HARD_REG_SET conflict_set;
   int best_cost = INT_MAX, best_priority = INT_MIN, best_usage = INT_MAX;
@@ -509,7 +512,13 @@ find_hard_regno_for (int regno, int *cost, int try_only_hard_regno,
   bool *rclass_intersect_p;
   HARD_REG_SET impossible_start_hard_regs, available_regs;
 
-  COPY_HARD_REG_SET (conflict_set, lra_no_alloc_regs);
+  if (hard_reg_set_empty_p (regno_set))
+    COPY_HARD_REG_SET (conflict_set, lra_no_alloc_regs);
+  else
+    {
+      COMPL_HARD_REG_SET (conflict_set, regno_set);
+      IOR_HARD_REG_SET (conflict_set, lra_no_alloc_regs);
+    }
   rclass = regno_allocno_class_array[regno];
   rclass_intersect_p = ira_reg_classes_intersect_p[rclass];
   curr_hard_regno_costs_check++;
@@ -680,6 +689,33 @@ find_hard_regno_for (int regno, int *cost, int try_only_hard_regno,
   return best_hard_regno;
 }
 
+/* A wrapper for find_hard_regno_for_1 (see comments for that function
+   description).  This function tries to find a hard register for
+   preferred class first if it is worth.  */
+static int
+find_hard_regno_for (int regno, int *cost, int try_only_hard_regno, bool first_p)
+{
+  int hard_regno;
+  HARD_REG_SET regno_set;
+
+  /* Only original pseudos can have a different preferred class.  */
+  if (try_only_hard_regno < 0 && regno < lra_new_regno_start)
+    {
+      enum reg_class pref_class = reg_preferred_class (regno);
+      
+      if (regno_allocno_class_array[regno] != pref_class)
+       {
+         hard_regno = find_hard_regno_for_1 (regno, cost, -1, first_p,
+                                             reg_class_contents[pref_class]);
+         if (hard_regno >= 0)
+           return hard_regno;
+       }
+    }
+  CLEAR_HARD_REG_SET (regno_set);
+  return find_hard_regno_for_1 (regno, cost, try_only_hard_regno, first_p,
+                               regno_set);
+}
+
 /* Current value used for checking elements in
    update_hard_regno_preference_check. */
 static int curr_update_hard_regno_preference_check;