Patchwork [lra] patch to fix ppc bootstrap after last merge

login
register
mail settings
Submitter Vladimir Makarov
Date Aug. 3, 2012, 8:45 p.m.
Message ID <501C385C.4080107@redhat.com>
Download mbox | patch
Permalink /patch/175045/
State New
Headers show

Comments

Vladimir Makarov - Aug. 3, 2012, 8:45 p.m.
The following patch fixes a bug occuring during the ppc bootstrap.

The patch was successfully bootstrapped on x86/x86-64 and ppc.

Committed as rev. 190133.

2012-08-03  Vladimir Makarov <vmakarov@redhat.com>

         * lra-assign.c (find_hard_regno_for): Check paradoxical subregs.

Patch

Index: lra-assigns.c
===================================================================
--- lra-assigns.c	(revision 190127)
+++ lra-assigns.c	(working copy)
@@ -307,7 +307,7 @@  find_hard_regno_for (int regno, int *cos
   int hr, conflict_hr, nregs;
   enum machine_mode biggest_mode;
   unsigned int k, conflict_regno;
-  int val;
+  int val, biggest_nregs, nregs_diff;
   enum reg_class rclass;
   bitmap_iterator bi;
   bool *rclass_intersect_p;
@@ -435,6 +435,10 @@  find_hard_regno_for (int regno, int *cos
   lra_assert (rclass != NO_REGS);
   rclass_size = ira_class_hard_regs_num[rclass];
   best_hard_regno = -1;
+  hard_regno = ira_class_hard_regs[rclass][0];
+  biggest_nregs = hard_regno_nregs[hard_regno][biggest_mode];
+  nregs_diff = (biggest_nregs
+                - hard_regno_nregs[hard_regno][PSEUDO_REGNO_MODE (regno)]);
   for (i = 0; i < rclass_size; i++)
     {
       if (try_only_hard_regno >= 0)
@@ -447,7 +451,17 @@  find_hard_regno_for (int regno, int *cos
 	  /* We can not use prohibited_class_mode_regs because it is
 	     defined not for all classes.  */
 	  && HARD_REGNO_MODE_OK (hard_regno, PSEUDO_REGNO_MODE (regno))
-	  && ! TEST_HARD_REG_BIT (impossible_start_hard_regs, hard_regno))
+	  && ! TEST_HARD_REG_BIT (impossible_start_hard_regs, hard_regno)
+	  && (nregs_diff == 0
+#ifdef WORDS_BIG_ENDIAN
+	      || (hard_regno - nregs_diff >= 0
+		  && TEST_HARD_REG_BIT (reg_class_contents[rclass],
+					hard_regno - nregs_diff))
+#else
+	      || TEST_HARD_REG_BIT (reg_class_contents[rclass],
+				    hard_regno + nregs_diff)
+#endif
+	      ))
 	{
 	  if (hard_regno_costs_check[hard_regno]
 	      != curr_hard_regno_costs_check)