Patchwork Patch 8/9: track live ranges for objects

login
register
mail settings
Submitter Bernd Schmidt
Date June 18, 2010, 2:11 p.m.
Message ID <4C1B7E81.2030900@codesourcery.com>
Download mbox | patch
Permalink /patch/56190/
State New
Headers show

Comments

Bernd Schmidt - June 18, 2010, 2:11 p.m.
This moves the remaining piece of conflict information, live ranges, into the
object structure.

       * ira-int.h (struct live_range): Rename allocno member to object and change
       type to ira_object_t.
       (struct ira_object): New member live_ranges.
       (struct ira_allocno): Remove member live_ranges.
       (ALLOCNO_LIVE_RANGES): Remove.
       (OBJECT_LIVE_RANGES): New macro.
       (ira_create_live_range, ira_copy_live_range_list,
       ira_merge_live_range_list, ira_live_ranges_intersect_p,
       ira_finish_live_range, ira_finish_live_range_list): Adjust declarations.
       * ira-build.c (ira_create_object): Initialize live ranges here.
       (ira_create_allocno): Not here.
       (ira_create_live_range): Rename from ira_create_allocno_live_range, arg
       changed to ira_object_t, all callers changed.
       (copy_live_range): Rename from copy_allocno_live_range, all callers
       changed.
       (ira_copy_live_range_list): Rename from ira_copy_allocno_live_range_list,
       all callers changed.
       (ira_merge_live_ranges): Rename from ira_merge_allocno_live_range_list,
       all callers changed.
       (ira_live_ranges_intersect_p): Rename from
       ira_allocno_live_ranges_intersect_p, all callers changed.
       (ira_finish_live_range): Rename from ira_finish_allocno_live_range, all
       callers changed.
       (ira_finish_live_range_list): Rename from
       ira_finish_allocno_live_range_list, all callers changed.
       (change_object_in_range_list): Rename from change_allocno_in_range_list,
       last arg changed to ira_object_t, all callers changed.
       (finish_allocno): Changed to expect live ranges in the allocno's object.
       (move_allocno_live_ranges, copy_allocno_live_ranges,
       update_bad_spill_attribute, setup_min_max_allocno_live_range_point,
       ira_flattening, ira_build): Likewise.
       * ira-color.c (allocnos_have_intersected_live_ranges_p,
       slot_coalesced_allocno_live_ranges_intersect,
       setup_slot_coalesced_allocno_live_ranges, fast_allocation): Likewise.
       * ira-conflicts.c (build_conflict_bit_table): Likewise.
       * ira-emit.c (add_range_and_copies_from_move_list): Likewise.
       * ira-lives.c (make_allocno_born, update_allocno_pressure_excess_length,
       make_allocno_dead, create_start_finish_chains,
       remove_some_program_points_and_update_live_ranges,
       ira_debug_live_range_list): Likewise.
Jeff Law - June 18, 2010, 8:12 p.m.
On 06/18/10 08:11, Bernd Schmidt wrote:

Just a couple nits I noticed in ira-int.h:

>   /* Pointer to structures describing at what program point the
> +     object lives.  We always maintain the list in such way that *the
> +     ranges in the list are not intersected and ordered by decreasing
> +     their program points*.  */
Note the "points*" and "*the".  Looks like a nit you copied from the 
comment for live_ranges.  Please fix at your leisure.

The patch itself is fine,

Thanks,
Jeff

Patch

Index: gcc/ira-build.c
===================================================================
--- gcc.orig/ira-build.c
+++ gcc/ira-build.c
@@ -439,6 +439,7 @@  ira_create_object (ira_allocno_t a)
 			  reg_class_contents[cover_class]);
   OBJECT_MIN (obj) = INT_MAX;
   OBJECT_MAX (obj) = -1;
+  OBJECT_LIVE_RANGES (obj) = NULL;
 
   VEC_safe_push (ira_object_t, heap, ira_object_id_map_vec, obj);
   ira_object_id_map
@@ -508,7 +509,6 @@  ira_create_allocno (int regno, bool cap_
   ALLOCNO_PREV_BUCKET_ALLOCNO (a) = NULL;
   ALLOCNO_FIRST_COALESCED_ALLOCNO (a) = a;
   ALLOCNO_NEXT_COALESCED_ALLOCNO (a) = a;
-  ALLOCNO_LIVE_RANGES (a) = NULL;
 
   VEC_safe_push (ira_allocno_t, heap, allocno_vec, a);
   ira_allocnos = VEC_address (ira_allocno_t, allocno_vec);
@@ -850,13 +850,13 @@  create_cap_allocno (ira_allocno_t a)
 
 /* Create and return allocno live range with given attributes.  */
 live_range_t
-ira_create_allocno_live_range (ira_allocno_t a, int start, int finish,
-			       live_range_t next)
+ira_create_live_range (ira_object_t obj, int start, int finish,
+		       live_range_t next)
 {
   live_range_t p;
 
   p = (live_range_t) pool_alloc (live_range_pool);
-  p->allocno = a;
+  p->object = obj;
   p->start = start;
   p->finish = finish;
   p->next = next;
@@ -865,7 +865,7 @@  ira_create_allocno_live_range (ira_alloc
 
 /* Copy allocno live range R and return the result.  */
 static live_range_t
-copy_allocno_live_range (live_range_t r)
+copy_live_range (live_range_t r)
 {
   live_range_t p;
 
@@ -877,7 +877,7 @@  copy_allocno_live_range (live_range_t r)
 /* Copy allocno live range list given by its head R and return the
    result.  */
 live_range_t
-ira_copy_allocno_live_range_list (live_range_t r)
+ira_copy_live_range_list (live_range_t r)
 {
   live_range_t p, first, last;
 
@@ -885,7 +885,7 @@  ira_copy_allocno_live_range_list (live_r
     return NULL;
   for (first = last = NULL; r != NULL; r = r->next)
     {
-      p = copy_allocno_live_range (r);
+      p = copy_live_range (r);
       if (first == NULL)
 	first = p;
       else
@@ -899,7 +899,7 @@  ira_copy_allocno_live_range_list (live_r
    maintains the order of ranges and tries to minimize number of the
    result ranges.  */
 live_range_t
-ira_merge_allocno_live_ranges (live_range_t r1, live_range_t r2)
+ira_merge_live_ranges (live_range_t r1, live_range_t r2)
 {
   live_range_t first, last, temp;
 
@@ -923,7 +923,7 @@  ira_merge_allocno_live_ranges (live_rang
 	    r1->finish = r2->finish;
 	  temp = r2;
 	  r2 = r2->next;
-	  ira_finish_allocno_live_range (temp);
+	  ira_finish_live_range (temp);
 	  if (r2 == NULL)
 	    {
 	      /* To try to merge with subsequent ranges in r1.  */
@@ -975,7 +975,7 @@  ira_merge_allocno_live_ranges (live_rang
 
 /* Return TRUE if live ranges R1 and R2 intersect.  */
 bool
-ira_allocno_live_ranges_intersect_p (live_range_t r1, live_range_t r2)
+ira_live_ranges_intersect_p (live_range_t r1, live_range_t r2)
 {
   /* Remember the live ranges are always kept ordered.  */
   while (r1 != NULL && r2 != NULL)
@@ -992,21 +992,21 @@  ira_allocno_live_ranges_intersect_p (liv
 
 /* Free allocno live range R.  */
 void
-ira_finish_allocno_live_range (live_range_t r)
+ira_finish_live_range (live_range_t r)
 {
   pool_free (live_range_pool, r);
 }
 
 /* Free list of allocno live ranges starting with R.  */
 void
-ira_finish_allocno_live_range_list (live_range_t r)
+ira_finish_live_range_list (live_range_t r)
 {
   live_range_t next_r;
 
   for (; r != NULL; r = next_r)
     {
       next_r = r->next;
-      ira_finish_allocno_live_range (r);
+      ira_finish_live_range (r);
     }
 }
 
@@ -1033,6 +1033,12 @@  finish_allocno (ira_allocno_t a)
   enum reg_class cover_class = ALLOCNO_COVER_CLASS (a);
   ira_object_t obj = ALLOCNO_OBJECT (a);
 
+  ira_finish_live_range_list (OBJECT_LIVE_RANGES (obj));
+  ira_object_id_map[OBJECT_CONFLICT_ID (obj)] = NULL;
+  if (OBJECT_CONFLICT_ARRAY (obj) != NULL)
+    ira_free (OBJECT_CONFLICT_ARRAY (obj));
+  pool_free (object_pool, obj);
+
   ira_allocnos[ALLOCNO_NUM (a)] = NULL;
   if (ALLOCNO_HARD_REG_COSTS (a) != NULL)
     ira_free_cost_vector (ALLOCNO_HARD_REG_COSTS (a), cover_class);
@@ -1043,13 +1049,7 @@  finish_allocno (ira_allocno_t a)
   if (ALLOCNO_UPDATED_CONFLICT_HARD_REG_COSTS (a) != NULL)
     ira_free_cost_vector (ALLOCNO_UPDATED_CONFLICT_HARD_REG_COSTS (a),
 			  cover_class);
-  ira_finish_allocno_live_range_list (ALLOCNO_LIVE_RANGES (a));
   pool_free (allocno_pool, a);
-
-  ira_object_id_map[OBJECT_CONFLICT_ID (obj)] = NULL;
-  if (OBJECT_CONFLICT_ARRAY (obj) != NULL)
-    ira_free (OBJECT_CONFLICT_ARRAY (obj));
-  pool_free (object_pool, obj);
 }
 
 /* Free the memory allocated for all allocnos.  */
@@ -1695,19 +1695,21 @@  create_allocnos (void)
    will hardly improve the result.  As a result we speed up regional
    register allocation.  */
 
-/* The function changes allocno in range list given by R onto A.  */
+/* The function changes the object in range list given by R to OBJ.  */
 static void
-change_allocno_in_range_list (live_range_t r, ira_allocno_t a)
+change_object_in_range_list (live_range_t r, ira_object_t obj)
 {
   for (; r != NULL; r = r->next)
-    r->allocno = a;
+    r->object = obj;
 }
 
 /* Move all live ranges associated with allocno A to allocno OTHER_A.  */
 static void
 move_allocno_live_ranges (ira_allocno_t from, ira_allocno_t to)
 {
-  live_range_t lr = ALLOCNO_LIVE_RANGES (from);
+  ira_object_t from_obj = ALLOCNO_OBJECT (from);
+  ira_object_t to_obj = ALLOCNO_OBJECT (to);
+  live_range_t lr = OBJECT_LIVE_RANGES (from_obj);
 
   if (internal_flag_ira_verbose > 4 && ira_dump_file != NULL)
     {
@@ -1717,17 +1719,19 @@  move_allocno_live_ranges (ira_allocno_t 
 	       ALLOCNO_NUM (to), ALLOCNO_REGNO (to));
       ira_print_live_range_list (ira_dump_file, lr);
     }
-  change_allocno_in_range_list (lr, to);
-  ALLOCNO_LIVE_RANGES (to)
-    = ira_merge_allocno_live_ranges (lr, ALLOCNO_LIVE_RANGES (to));
-  ALLOCNO_LIVE_RANGES (from) = NULL;
+  change_object_in_range_list (lr, to_obj);
+  OBJECT_LIVE_RANGES (to_obj)
+    = ira_merge_live_ranges (lr, OBJECT_LIVE_RANGES (to_obj));
+  OBJECT_LIVE_RANGES (from_obj) = NULL;
 }
 
 /* Copy all live ranges associated with allocno A to allocno OTHER_A.  */
 static void
 copy_allocno_live_ranges (ira_allocno_t from, ira_allocno_t to)
 {
-  live_range_t lr = ALLOCNO_LIVE_RANGES (from);
+  ira_object_t from_obj = ALLOCNO_OBJECT (from);
+  ira_object_t to_obj = ALLOCNO_OBJECT (to);
+  live_range_t lr = OBJECT_LIVE_RANGES (from_obj);
 
   if (internal_flag_ira_verbose > 4 && ira_dump_file != NULL)
     {
@@ -1737,10 +1741,10 @@  copy_allocno_live_ranges (ira_allocno_t 
 	       ALLOCNO_NUM (to), ALLOCNO_REGNO (to));
       ira_print_live_range_list (ira_dump_file, lr);
     }
-  lr = ira_copy_allocno_live_range_list (lr);
-  change_allocno_in_range_list (lr, to);
-  ALLOCNO_LIVE_RANGES (to)
-    = ira_merge_allocno_live_ranges (lr, ALLOCNO_LIVE_RANGES (to));
+  lr = ira_copy_live_range_list (lr);
+  change_object_in_range_list (lr, to_obj);
+  OBJECT_LIVE_RANGES (to_obj)
+    = ira_merge_live_ranges (lr, OBJECT_LIVE_RANGES (to_obj));
 }
 
 /* Return TRUE if NODE represents a loop with low register
@@ -2200,20 +2204,22 @@  update_bad_spill_attribute (void)
     }
   FOR_EACH_ALLOCNO (a, ai)
     {
+      ira_object_t obj = ALLOCNO_OBJECT (a);
       cover_class = ALLOCNO_COVER_CLASS (a);
       if (cover_class == NO_REGS)
 	continue;
-      for (r = ALLOCNO_LIVE_RANGES (a); r != NULL; r = r->next)
+      for (r = OBJECT_LIVE_RANGES (obj); r != NULL; r = r->next)
 	bitmap_set_bit (&dead_points[cover_class], r->finish);
     }
   FOR_EACH_ALLOCNO (a, ai)
     {
+      ira_object_t obj = ALLOCNO_OBJECT (a);
       cover_class = ALLOCNO_COVER_CLASS (a);
       if (cover_class == NO_REGS)
 	continue;
       if (! ALLOCNO_BAD_SPILL_P (a))
 	continue;
-      for (r = ALLOCNO_LIVE_RANGES (a); r != NULL; r = r->next)
+      for (r = OBJECT_LIVE_RANGES (obj); r != NULL; r = r->next)
 	{
 	  for (i = r->start + 1; i < r->finish; i++)
 	    if (bitmap_bit_p (&dead_points[cover_class], i))
@@ -2246,7 +2252,7 @@  setup_min_max_allocno_live_range_point (
   FOR_EACH_ALLOCNO (a, ai)
     {
       ira_object_t obj = ALLOCNO_OBJECT (a);
-      r = ALLOCNO_LIVE_RANGES (a);
+      r = OBJECT_LIVE_RANGES (obj);
       if (r == NULL)
 	continue;
       OBJECT_MAX (obj) = r->finish;
@@ -2544,7 +2550,7 @@  copy_info_to_removed_store_destinations 
 void
 ira_flattening (int max_regno_before_emit, int ira_max_point_before_emit)
 {
-  int i, j, num;
+  int i, j;
   bool keep_p;
   int hard_regs_num;
   bool new_pseudos_p, merged_p, mem_dest_p;
@@ -2556,7 +2562,6 @@  ira_flattening (int max_regno_before_emi
   live_range_t r;
   ira_allocno_iterator ai;
   ira_copy_iterator ci;
-  sparseset allocnos_live;
 
   regno_top_level_allocno_map
     = (ira_allocno_t *) ira_allocate (max_reg_num () * sizeof (ira_allocno_t));
@@ -2652,48 +2657,48 @@  ira_flattening (int max_regno_before_emi
     ira_rebuild_start_finish_chains ();
   if (new_pseudos_p)
     {
+      sparseset objects_live;
+
       /* Rebuild conflicts.  */
       FOR_EACH_ALLOCNO (a, ai)
 	{
+	  ira_object_t obj = ALLOCNO_OBJECT (a);
 	  if (a != regno_top_level_allocno_map[REGNO (ALLOCNO_REG (a))]
 	      || ALLOCNO_CAP_MEMBER (a) != NULL)
 	    continue;
-	  for (r = ALLOCNO_LIVE_RANGES (a); r != NULL; r = r->next)
-	    ira_assert (r->allocno == a);
-	  clear_conflicts (ALLOCNO_OBJECT (a));
+	  for (r = OBJECT_LIVE_RANGES (obj); r != NULL; r = r->next)
+	    ira_assert (r->object == obj);
+	  clear_conflicts (obj);
 	}
-      allocnos_live = sparseset_alloc (ira_allocnos_num);
+      objects_live = sparseset_alloc (ira_objects_num);
       for (i = 0; i < ira_max_point; i++)
 	{
 	  for (r = ira_start_point_ranges[i]; r != NULL; r = r->start_next)
 	    {
-	      a = r->allocno;
+	      ira_object_t obj = r->object;
+	      a = OBJECT_ALLOCNO (obj);
 	      if (a != regno_top_level_allocno_map[REGNO (ALLOCNO_REG (a))]
 		  || ALLOCNO_CAP_MEMBER (a) != NULL)
 		continue;
-	      num = ALLOCNO_NUM (a);
 	      cover_class = ALLOCNO_COVER_CLASS (a);
-	      sparseset_set_bit (allocnos_live, num);
-	      EXECUTE_IF_SET_IN_SPARSESET (allocnos_live, n)
+	      sparseset_set_bit (objects_live, OBJECT_CONFLICT_ID (obj));
+	      EXECUTE_IF_SET_IN_SPARSESET (objects_live, n)
 		{
-		  ira_allocno_t live_a = ira_allocnos[n];
+		  ira_object_t live_obj = ira_object_id_map[n];
+		  ira_allocno_t live_a = OBJECT_ALLOCNO (live_obj);
+		  enum reg_class live_cover = ALLOCNO_COVER_CLASS (live_a);
 
-		  if (ira_reg_classes_intersect_p
-		      [cover_class][ALLOCNO_COVER_CLASS (live_a)]
+		  if (ira_reg_classes_intersect_p[cover_class][live_cover]
 		      /* Don't set up conflict for the allocno with itself.  */
-		      && num != (int) n)
-		    {
-		      ira_object_t obj = ALLOCNO_OBJECT (a);
-		      ira_object_t live_obj = ALLOCNO_OBJECT (live_a);
-		      ira_add_conflict (obj, live_obj);
-		    }
+		      && live_a != a)
+		    ira_add_conflict (obj, live_obj);
 		}
 	    }
 
 	  for (r = ira_finish_point_ranges[i]; r != NULL; r = r->finish_next)
-	    sparseset_clear_bit (allocnos_live, ALLOCNO_NUM (r->allocno));
+	    sparseset_clear_bit (objects_live, OBJECT_CONFLICT_ID (r->object));
 	}
-      sparseset_free (allocnos_live);
+      sparseset_free (objects_live);
       compress_conflict_vecs ();
     }
   /* Mark some copies for removing and change allocnos in the rest
@@ -2939,7 +2944,8 @@  ira_build (bool loops_p)
 	}
       nr = 0;
       FOR_EACH_ALLOCNO (a, ai)
-	for (r = ALLOCNO_LIVE_RANGES (a); r != NULL; r = r->next)
+	for (r = OBJECT_LIVE_RANGES (ALLOCNO_OBJECT (a)); r != NULL;
+	     r = r->next)
 	  nr++;
       fprintf (ira_dump_file, "  regions=%d, blocks=%d, points=%d\n",
 	       VEC_length (loop_p, ira_loops.larray), n_basic_blocks,
Index: gcc/ira-color.c
===================================================================
--- gcc.orig/ira-color.c
+++ gcc/ira-color.c
@@ -93,14 +93,16 @@  static VEC(ira_allocno_t,heap) *removed_
 static bool
 allocnos_have_intersected_live_ranges_p (ira_allocno_t a1, ira_allocno_t a2)
 {
+  ira_object_t obj1 = ALLOCNO_OBJECT (a1);
+  ira_object_t obj2 = ALLOCNO_OBJECT (a2);
   if (a1 == a2)
     return false;
   if (ALLOCNO_REG (a1) != NULL && ALLOCNO_REG (a2) != NULL
       && (ORIGINAL_REGNO (ALLOCNO_REG (a1))
 	  == ORIGINAL_REGNO (ALLOCNO_REG (a2))))
     return false;
-  return ira_allocno_live_ranges_intersect_p (ALLOCNO_LIVE_RANGES (a1),
-					      ALLOCNO_LIVE_RANGES (a2));
+  return ira_live_ranges_intersect_p (OBJECT_LIVE_RANGES (obj1),
+				      OBJECT_LIVE_RANGES (obj2));
 }
 
 #ifdef ENABLE_IRA_CHECKING
@@ -2510,8 +2512,9 @@  slot_coalesced_allocno_live_ranges_inter
   for (a = ALLOCNO_NEXT_COALESCED_ALLOCNO (allocno);;
        a = ALLOCNO_NEXT_COALESCED_ALLOCNO (a))
     {
-      if (ira_allocno_live_ranges_intersect_p
-	  (slot_coalesced_allocnos_live_ranges[n], ALLOCNO_LIVE_RANGES (a)))
+      ira_object_t obj = ALLOCNO_OBJECT (a);
+      if (ira_live_ranges_intersect_p
+	  (slot_coalesced_allocnos_live_ranges[n], OBJECT_LIVE_RANGES (obj)))
 	return true;
       if (a == allocno)
 	break;
@@ -2532,9 +2535,10 @@  setup_slot_coalesced_allocno_live_ranges
   for (a = ALLOCNO_NEXT_COALESCED_ALLOCNO (allocno);;
        a = ALLOCNO_NEXT_COALESCED_ALLOCNO (a))
     {
-      r = ira_copy_allocno_live_range_list (ALLOCNO_LIVE_RANGES (a));
+      ira_object_t obj = ALLOCNO_OBJECT (a);
+      r = ira_copy_live_range_list (OBJECT_LIVE_RANGES (obj));
       slot_coalesced_allocnos_live_ranges[n]
-	= ira_merge_allocno_live_ranges
+	= ira_merge_live_ranges
 	  (slot_coalesced_allocnos_live_ranges[n], r);
       if (a == allocno)
 	break;
@@ -2605,8 +2609,7 @@  coalesce_spill_slots (ira_allocno_t *spi
 	}
     }
   for (i = 0; i < ira_allocnos_num; i++)
-    ira_finish_allocno_live_range_list
-      (slot_coalesced_allocnos_live_ranges[i]);
+    ira_finish_live_range_list (slot_coalesced_allocnos_live_ranges[i]);
   ira_free (slot_coalesced_allocnos_live_ranges);
   return merged_p;
 }
@@ -3270,7 +3273,7 @@  fast_allocation (void)
       a = sorted_allocnos[i];
       obj = ALLOCNO_OBJECT (a);
       COPY_HARD_REG_SET (conflict_hard_regs, OBJECT_CONFLICT_HARD_REGS (obj));
-      for (r = ALLOCNO_LIVE_RANGES (a); r != NULL; r = r->next)
+      for (r = OBJECT_LIVE_RANGES (obj); r != NULL; r = r->next)
 	for (j =  r->start; j <= r->finish; j++)
 	  IOR_HARD_REG_SET (conflict_hard_regs, used_hard_regs[j]);
       cover_class = ALLOCNO_COVER_CLASS (a);
@@ -3297,7 +3300,7 @@  fast_allocation (void)
 		  (prohibited_class_mode_regs[cover_class][mode], hard_regno)))
 	    continue;
 	  ALLOCNO_HARD_REGNO (a) = hard_regno;
-	  for (r = ALLOCNO_LIVE_RANGES (a); r != NULL; r = r->next)
+	  for (r = OBJECT_LIVE_RANGES (obj); r != NULL; r = r->next)
 	    for (k = r->start; k <= r->finish; k++)
 	      IOR_HARD_REG_SET (used_hard_regs[k],
 				ira_reg_mode_hard_regset[hard_regno][mode]);
Index: gcc/ira-conflicts.c
===================================================================
--- gcc.orig/ira-conflicts.c
+++ gcc/ira-conflicts.c
@@ -132,8 +132,8 @@  build_conflict_bit_table (void)
     {
       for (r = ira_start_point_ranges[i]; r != NULL; r = r->start_next)
 	{
-	  ira_allocno_t allocno = r->allocno;
-	  ira_object_t obj = ALLOCNO_OBJECT (allocno);
+	  ira_object_t obj = r->object;
+	  ira_allocno_t allocno = OBJECT_ALLOCNO (obj);
 	  int id = OBJECT_CONFLICT_ID (obj);
 
 	  cover_class = ALLOCNO_COVER_CLASS (allocno);
@@ -160,8 +160,7 @@  build_conflict_bit_table (void)
 
       for (r = ira_finish_point_ranges[i]; r != NULL; r = r->finish_next)
 	{
-	  ira_allocno_t allocno = r->allocno;
-	  ira_object_t obj = ALLOCNO_OBJECT (allocno);
+	  ira_object_t obj = r->object;
 	  sparseset_clear_bit (objects_live, OBJECT_CONFLICT_ID (obj));
 	}
     }
Index: gcc/ira-emit.c
===================================================================
--- gcc.orig/ira-emit.c
+++ gcc/ira-emit.c
@@ -960,11 +960,11 @@  add_range_and_copies_from_move_list (mov
 		 cp->num, ALLOCNO_NUM (cp->first),
 		 REGNO (ALLOCNO_REG (cp->first)), ALLOCNO_NUM (cp->second),
 		 REGNO (ALLOCNO_REG (cp->second)));
-      r = ALLOCNO_LIVE_RANGES (from);
+      r = OBJECT_LIVE_RANGES (from_obj);
       if (r == NULL || r->finish >= 0)
 	{
-	  ALLOCNO_LIVE_RANGES (from)
-	    = ira_create_allocno_live_range (from, start, ira_max_point, r);
+	  OBJECT_LIVE_RANGES (from_obj)
+	    = ira_create_live_range (from_obj, start, ira_max_point, r);
 	  if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL)
 	    fprintf (ira_dump_file,
 		     "    Adding range [%d..%d] to allocno a%dr%d\n",
@@ -981,14 +981,15 @@  add_range_and_copies_from_move_list (mov
 		     REGNO (ALLOCNO_REG (from)));
 	}
       ira_max_point++;
-      ALLOCNO_LIVE_RANGES (to)
-	= ira_create_allocno_live_range (to, ira_max_point, -1,
-					 ALLOCNO_LIVE_RANGES (to));
+      OBJECT_LIVE_RANGES (to_obj)
+	= ira_create_live_range (to_obj, ira_max_point, -1,
+				 OBJECT_LIVE_RANGES (to_obj));
       ira_max_point++;
     }
   for (move = list; move != NULL; move = move->next)
     {
-      r = ALLOCNO_LIVE_RANGES (move->to);
+      ira_object_t to_obj = ALLOCNO_OBJECT (move->to);
+      r = OBJECT_LIVE_RANGES (to_obj);
       if (r->finish < 0)
 	{
 	  r->finish = ira_max_point - 1;
@@ -1002,12 +1003,15 @@  add_range_and_copies_from_move_list (mov
   EXECUTE_IF_SET_IN_BITMAP (live_through, FIRST_PSEUDO_REGISTER, regno, bi)
     {
       ira_allocno_t to;
+      ira_object_t obj;
       a = node->regno_allocno_map[regno];
-      if ((to = ALLOCNO_MEM_OPTIMIZED_DEST (a)) != NULL)
+      to = ALLOCNO_MEM_OPTIMIZED_DEST (a);
+      if (to != NULL)
 	a = to;
-      ALLOCNO_LIVE_RANGES (a)
-	= ira_create_allocno_live_range (a, start, ira_max_point - 1,
-					 ALLOCNO_LIVE_RANGES (a));
+      obj = ALLOCNO_OBJECT (a);
+      OBJECT_LIVE_RANGES (obj)
+	= ira_create_live_range (obj, start, ira_max_point - 1,
+				 OBJECT_LIVE_RANGES (obj));
       if (internal_flag_ira_verbose > 2 && ira_dump_file != NULL)
 	fprintf
 	  (ira_dump_file,
Index: gcc/ira-int.h
===================================================================
--- gcc.orig/ira-int.h
+++ gcc/ira-int.h
@@ -202,7 +202,7 @@  extern ira_loop_tree_node_t ira_loop_nod
 struct live_range
 {
   /* Allocno whose live range is described by given structure.  */
-  ira_allocno_t allocno;
+  ira_object_t object;
   /* Program point range.  */
   int start, finish;
   /* Next structure describing program points where the allocno
@@ -236,7 +236,12 @@  struct ira_object
      otherwise.  Only objects belonging to allocnos with the
      same cover class are in the vector or in the bit vector.  */
   void *conflicts_array;
-  /* Allocated size of the previous array.  */
+  /* Pointer to structures describing at what program point the
+     object lives.  We always maintain the list in such way that *the
+     ranges in the list are not intersected and ordered by decreasing
+     their program points*.  */
+  live_range_t live_ranges;
+  /* Allocated size of the conflicts array.  */
   unsigned int conflicts_array_size;
   /* A unique number for every instance of this structure which is used
      to represent it in conflict bit vectors.  */
@@ -341,11 +346,6 @@  struct ira_allocno
      list is chained by NEXT_COALESCED_ALLOCNO.  */
   ira_allocno_t first_coalesced_allocno;
   ira_allocno_t next_coalesced_allocno;
-  /* Pointer to structures describing at what program point the
-     allocno lives.  We always maintain the list in such way that *the
-     ranges in the list are not intersected and ordered by decreasing
-     their program points*.  */
-  live_range_t live_ranges;
   /* Pointer to a structure describing conflict information about this
      allocno.  */
   ira_object_t object;
@@ -483,7 +483,6 @@  struct ira_allocno
 #define ALLOCNO_TEMP(A) ((A)->temp)
 #define ALLOCNO_FIRST_COALESCED_ALLOCNO(A) ((A)->first_coalesced_allocno)
 #define ALLOCNO_NEXT_COALESCED_ALLOCNO(A) ((A)->next_coalesced_allocno)
-#define ALLOCNO_LIVE_RANGES(A) ((A)->live_ranges)
 #define ALLOCNO_OBJECT(A) ((A)->object)
 
 #define OBJECT_ALLOCNO(C) ((C)->allocno)
@@ -498,6 +497,7 @@  struct ira_allocno
 #define OBJECT_MIN(C) ((C)->min)
 #define OBJECT_MAX(C) ((C)->max)
 #define OBJECT_CONFLICT_ID(C) ((C)->id)
+#define OBJECT_LIVE_RANGES(C) ((C)->live_ranges)
 
 /* Map regno -> allocnos with given regno (see comments for
    allocno member `next_regno_allocno').  */
@@ -864,13 +864,13 @@  extern bool ira_conflict_vector_profitab
 extern void ira_allocate_conflict_vec (ira_object_t, int);
 extern void ira_allocate_object_conflicts (ira_object_t, int);
 extern void ira_print_expanded_allocno (ira_allocno_t);
-extern live_range_t ira_create_allocno_live_range (ira_allocno_t, int, int,
-						   live_range_t);
-extern live_range_t ira_copy_allocno_live_range_list (live_range_t);
-extern live_range_t ira_merge_allocno_live_ranges (live_range_t, live_range_t);
-extern bool ira_allocno_live_ranges_intersect_p (live_range_t, live_range_t);
-extern void ira_finish_allocno_live_range (live_range_t);
-extern void ira_finish_allocno_live_range_list (live_range_t);
+extern live_range_t ira_create_live_range (ira_object_t, int, int,
+					   live_range_t);
+extern live_range_t ira_copy_live_range_list (live_range_t);
+extern live_range_t ira_merge_live_ranges (live_range_t, live_range_t);
+extern bool ira_live_ranges_intersect_p (live_range_t, live_range_t);
+extern void ira_finish_live_range (live_range_t);
+extern void ira_finish_live_range_list (live_range_t);
 extern void ira_free_allocno_updated_costs (ira_allocno_t);
 extern ira_copy_t ira_create_copy (ira_allocno_t, ira_allocno_t,
 				   int, bool, rtx, ira_loop_tree_node_t);
Index: gcc/ira-lives.c
===================================================================
--- gcc.orig/ira-lives.c
+++ gcc/ira-lives.c
@@ -112,8 +112,8 @@  make_hard_regno_dead (int regno)
 static void
 make_allocno_born (ira_allocno_t a)
 {
-  live_range_t p = ALLOCNO_LIVE_RANGES (a);
   ira_object_t obj = ALLOCNO_OBJECT (a);
+  live_range_t p = OBJECT_LIVE_RANGES (obj);
 
   sparseset_set_bit (allocnos_live, ALLOCNO_NUM (a));
   IOR_HARD_REG_SET (OBJECT_CONFLICT_HARD_REGS (obj), hard_regs_live);
@@ -121,9 +121,8 @@  make_allocno_born (ira_allocno_t a)
 
   if (p == NULL
       || (p->finish != curr_point && p->finish + 1 != curr_point))
-    ALLOCNO_LIVE_RANGES (a)
-      = ira_create_allocno_live_range (a, curr_point, -1,
-				       ALLOCNO_LIVE_RANGES (a));
+    OBJECT_LIVE_RANGES (obj)
+      = ira_create_live_range (obj, curr_point, -1, p);
 }
 
 /* Update ALLOCNO_EXCESS_PRESSURE_POINTS_NUM for allocno A.  */
@@ -139,9 +138,10 @@  update_allocno_pressure_excess_length (i
        (cl = ira_reg_class_super_classes[cover_class][i]) != LIM_REG_CLASSES;
        i++)
     {
+      ira_object_t obj = ALLOCNO_OBJECT (a);
       if (high_pressure_start_point[cl] < 0)
 	continue;
-      p = ALLOCNO_LIVE_RANGES (a);
+      p = OBJECT_LIVE_RANGES (obj);
       ira_assert (p != NULL);
       start = (high_pressure_start_point[cl] > p->start
 	       ? high_pressure_start_point[cl] : p->start);
@@ -154,9 +154,9 @@  update_allocno_pressure_excess_length (i
 static void
 make_allocno_dead (ira_allocno_t a)
 {
-  live_range_t p;
+  ira_object_t obj = ALLOCNO_OBJECT (a);
+  live_range_t p = OBJECT_LIVE_RANGES (obj);
 
-  p = ALLOCNO_LIVE_RANGES (a);
   ira_assert (p != NULL);
   p->finish = curr_point;
   update_allocno_pressure_excess_length (a);
@@ -1159,7 +1159,8 @@  create_start_finish_chains (void)
 	  ira_max_point * sizeof (live_range_t));
   FOR_EACH_ALLOCNO (a, ai)
     {
-      for (r = ALLOCNO_LIVE_RANGES (a); r != NULL; r = r->next)
+      ira_object_t obj = ALLOCNO_OBJECT (a);
+      for (r = OBJECT_LIVE_RANGES (obj); r != NULL; r = r->next)
 	{
 	  r->start_next = ira_start_point_ranges[r->start];
 	  ira_start_point_ranges[r->start] = r;
@@ -1188,22 +1189,21 @@  remove_some_program_points_and_update_li
   unsigned i;
   int n;
   int *map;
-  ira_allocno_t a;
-  ira_allocno_iterator ai;
+  ira_object_t obj;
+  ira_object_iterator oi;
   live_range_t r;
   bitmap born_or_died;
   bitmap_iterator bi;
 
   born_or_died = ira_allocate_bitmap ();
-  FOR_EACH_ALLOCNO (a, ai)
-    {
-      for (r = ALLOCNO_LIVE_RANGES (a); r != NULL; r = r->next)
-	{
-	  ira_assert (r->start <= r->finish);
-	  bitmap_set_bit (born_or_died, r->start);
+  FOR_EACH_OBJECT (obj, oi)
+    for (r = OBJECT_LIVE_RANGES (obj); r != NULL; r = r->next)
+      {
+	ira_assert (r->start <= r->finish);
+	bitmap_set_bit (born_or_died, r->start);
 	  bitmap_set_bit (born_or_died, r->finish);
-	}
-    }
+      }
+
   map = (int *) ira_allocate (sizeof (int) * ira_max_point);
   n = 0;
   EXECUTE_IF_SET_IN_BITMAP(born_or_died, 0, i, bi)
@@ -1215,14 +1215,13 @@  remove_some_program_points_and_update_li
     fprintf (ira_dump_file, "Compressing live ranges: from %d to %d - %d%%\n",
 	     ira_max_point, n, 100 * n / ira_max_point);
   ira_max_point = n;
-  FOR_EACH_ALLOCNO (a, ai)
-    {
-      for (r = ALLOCNO_LIVE_RANGES (a); r != NULL; r = r->next)
-	{
-	  r->start = map[r->start];
-	  r->finish = map[r->finish];
-	}
-    }
+
+  FOR_EACH_OBJECT (obj, oi)
+    for (r = OBJECT_LIVE_RANGES (obj); r != NULL; r = r->next)
+      {
+	r->start = map[r->start];
+	r->finish = map[r->finish];
+      }
   ira_free (map);
 }
 
@@ -1246,8 +1245,9 @@  ira_debug_live_range_list (live_range_t 
 static void
 print_allocno_live_ranges (FILE *f, ira_allocno_t a)
 {
+  ira_object_t obj = ALLOCNO_OBJECT (a);
   fprintf (f, " a%d(r%d):", ALLOCNO_NUM (a), ALLOCNO_REGNO (a));
-  ira_print_live_range_list (f, ALLOCNO_LIVE_RANGES (a));
+  ira_print_live_range_list (f, OBJECT_LIVE_RANGES (obj));
 }
 
 /* Print live ranges of allocno A to stderr.  */