Commit 9140d27b by Bernd Schmidt Committed by Bernd Schmidt

ira-int.h (struct live_range): Rename allocno member to object and change type to ira_object_t.

	* 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.

From-SVN: r162167
parent a49ae217
......@@ -85,6 +85,47 @@
dealing with objects.
* ira.c (ira_bad_reload_regno_1): Adjusted for dealing with objects.
* 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.
2010-07-13 Joern Rennecke <joern.rennecke@embecosm.com>
PR other/44874
......
......@@ -94,14 +94,16 @@ static VEC(ira_allocno_t,heap) *removed_splay_allocno_vec;
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
......@@ -2511,8 +2513,9 @@ slot_coalesced_allocno_live_ranges_intersect_p (ira_allocno_t allocno, int n)
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;
......@@ -2533,9 +2536,10 @@ setup_slot_coalesced_allocno_live_ranges (ira_allocno_t allocno)
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;
......@@ -2606,8 +2610,7 @@ coalesce_spill_slots (ira_allocno_t *spilled_coalesced_allocnos, int num)
}
}
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;
}
......@@ -3271,7 +3274,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);
......@@ -3298,7 +3301,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]);
......
......@@ -133,8 +133,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);
......@@ -161,8 +161,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));
}
}
......
......@@ -960,11 +960,11 @@ add_range_and_copies_from_move_list (move_t list, ira_loop_tree_node_t node,
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 (move_t list, ira_loop_tree_node_t node,
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 (move_t list, ira_loop_tree_node_t node,
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,
......
......@@ -202,7 +202,7 @@ extern ira_loop_tree_node_t ira_loop_nodes;
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'). */
......@@ -935,13 +935,13 @@ extern bool ira_conflict_vector_profitable_p (ira_object_t, int);
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);
......
......@@ -113,8 +113,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);
......@@ -122,9 +122,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. */
......@@ -140,9 +139,10 @@ update_allocno_pressure_excess_length (ira_allocno_t a)
(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);
......@@ -155,9 +155,9 @@ update_allocno_pressure_excess_length (ira_allocno_t a)
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);
......@@ -1160,7 +1160,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;
......@@ -1189,22 +1190,21 @@ remove_some_program_points_and_update_live_ranges (void)
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)
......@@ -1216,14 +1216,13 @@ remove_some_program_points_and_update_live_ranges (void)
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);
}
......@@ -1247,8 +1246,9 @@ ira_debug_live_range_list (live_range_t r)
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. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment