#include "insn-config.h"
#include "recog.h"
#include "diagnostic-core.h"
-#include "toplev.h"
#include "params.h"
#include "df.h"
#include "sparseset.h"
{
int i;
unsigned int j;
- enum reg_class cover_class;
+ enum reg_class aclass;
int object_set_words, allocated_words_num, conflict_bit_vec_words_num;
live_range_t r;
ira_allocno_t allocno;
= ((OBJECT_MAX (obj) - OBJECT_MIN (obj) + IRA_INT_BITS)
/ IRA_INT_BITS);
allocated_words_num += conflict_bit_vec_words_num;
- if ((unsigned long long) allocated_words_num * sizeof (IRA_INT_TYPE)
- > (unsigned long long) IRA_MAX_CONFLICT_TABLE_SIZE * 1024 * 1024)
+ if ((unsigned HOST_WIDEST_INT) allocated_words_num * sizeof (IRA_INT_TYPE)
+ > (unsigned HOST_WIDEST_INT) IRA_MAX_CONFLICT_TABLE_SIZE * 1024 * 1024)
{
if (internal_flag_ira_verbose > 0 && ira_dump_file != NULL)
fprintf
gcc_assert (id < ira_objects_num);
- cover_class = ALLOCNO_COVER_CLASS (allocno);
+ aclass = ALLOCNO_CLASS (allocno);
sparseset_set_bit (objects_live, id);
EXECUTE_IF_SET_IN_SPARSESET (objects_live, j)
{
ira_object_t live_obj = ira_object_id_map[j];
ira_allocno_t live_a = OBJECT_ALLOCNO (live_obj);
- enum reg_class live_cover_class = ALLOCNO_COVER_CLASS (live_a);
+ enum reg_class live_aclass = ALLOCNO_CLASS (live_a);
- if (ira_reg_classes_intersect_p[cover_class][live_cover_class]
+ if (ira_reg_classes_intersect_p[aclass][live_aclass]
/* Don't set up conflict for the allocno with itself. */
&& live_a != allocno)
{
the lowest order words. */
ira_object_t obj1 = ALLOCNO_OBJECT (a1, 0);
ira_object_t obj2 = ALLOCNO_OBJECT (a2, 0);
+
return OBJECTS_CONFLICT_P (obj1, obj2);
}
static bool
commutative_constraint_p (const char *str)
{
+ int curr_alt, c;
bool ignore_p;
- int c;
- for (ignore_p = false;;)
+ for (ignore_p = false, curr_alt = 0;;)
{
c = *str;
if (c == '\0')
break;
str += CONSTRAINT_LEN (c, str);
- if (c == '#')
+ if (c == '#' || !recog_data.alternative_enabled_p[curr_alt])
ignore_p = true;
else if (c == ',')
- ignore_p = false;
+ {
+ curr_alt++;
+ ignore_p = false;
+ }
else if (! ignore_p)
{
/* Usually `%' is the first constraint character but the
c = *str;
if (c == '\0')
break;
- if (c == '#')
+ if (c == '#' || !recog_data.alternative_enabled_p[curr_alt])
ignore_p = true;
else if (c == ',')
{
int allocno_preferenced_hard_regno, cost, index, offset1, offset2;
bool only_regs_p;
ira_allocno_t a;
- enum reg_class rclass, cover_class;
+ reg_class_t rclass, aclass;
enum machine_mode mode;
ira_copy_t cp;
{
ira_allocno_t a1 = ira_curr_regno_allocno_map[REGNO (reg1)];
ira_allocno_t a2 = ira_curr_regno_allocno_map[REGNO (reg2)];
+
if (!allocnos_conflict_for_copy_p (a1, a2) && offset1 == offset2)
{
cp = ira_add_allocno_copy (a1, a2, freq, constraint_p, insn,
return false;
}
- if (! IN_RANGE (allocno_preferenced_hard_regno, 0, FIRST_PSEUDO_REGISTER - 1))
+ if (! IN_RANGE (allocno_preferenced_hard_regno,
+ 0, FIRST_PSEUDO_REGISTER - 1))
/* Can not be tied. */
return false;
rclass = REGNO_REG_CLASS (allocno_preferenced_hard_regno);
mode = ALLOCNO_MODE (a);
- cover_class = ALLOCNO_COVER_CLASS (a);
+ aclass = ALLOCNO_CLASS (a);
if (only_regs_p && insn != NULL_RTX
- && reg_class_size[rclass] <= (unsigned) CLASS_MAX_NREGS (rclass, mode))
+ && reg_class_size[rclass] <= ira_reg_class_max_nregs [rclass][mode])
/* It is already taken into account in ira-costs.c. */
return false;
- index = ira_class_hard_reg_index[cover_class][allocno_preferenced_hard_regno];
+ index = ira_class_hard_reg_index[aclass][allocno_preferenced_hard_regno];
if (index < 0)
- /* Can not be tied. It is not in the cover class. */
+ /* Can not be tied. It is not in the allocno class. */
return false;
+ ira_init_register_move_cost_if_necessary (mode);
if (HARD_REGISTER_P (reg1))
- cost = ira_get_register_move_cost (mode, cover_class, rclass) * freq;
+ cost = ira_register_move_cost[mode][aclass][rclass] * freq;
else
- cost = ira_get_register_move_cost (mode, rclass, cover_class) * freq;
+ cost = ira_register_move_cost[mode][rclass][aclass] * freq;
do
{
ira_allocate_and_set_costs
- (&ALLOCNO_HARD_REG_COSTS (a), cover_class,
- ALLOCNO_COVER_CLASS_COST (a));
+ (&ALLOCNO_HARD_REG_COSTS (a), aclass,
+ ALLOCNO_CLASS_COST (a));
ira_allocate_and_set_costs
- (&ALLOCNO_CONFLICT_HARD_REG_COSTS (a), cover_class, 0);
+ (&ALLOCNO_CONFLICT_HARD_REG_COSTS (a), aclass, 0);
ALLOCNO_HARD_REG_COSTS (a)[index] -= cost;
ALLOCNO_CONFLICT_HARD_REG_COSTS (a)[index] -= cost;
- if (ALLOCNO_HARD_REG_COSTS (a)[index] < ALLOCNO_COVER_CLASS_COST (a))
- ALLOCNO_COVER_CLASS_COST (a) = ALLOCNO_HARD_REG_COSTS (a)[index];
+ if (ALLOCNO_HARD_REG_COSTS (a)[index] < ALLOCNO_CLASS_COST (a))
+ ALLOCNO_CLASS_COST (a) = ALLOCNO_HARD_REG_COSTS (a)[index];
a = ira_parent_or_cap_allocno (a);
}
while (a != NULL);
? SET_SRC (set)
: SUBREG_REG (SET_SRC (set))) != NULL_RTX)
{
- process_regs_for_copy (SET_DEST (set), SET_SRC (set), false, insn, freq);
+ process_regs_for_copy (SET_DEST (set), SET_SRC (set),
+ false, insn, freq);
return;
}
/* Fast check of possibility of constraint or shuffle copies. If
ira_allocno_t a = OBJECT_ALLOCNO (obj);
IRA_INT_TYPE *object_conflicts;
minmax_set_iterator asi;
+ int parent_min, parent_max ATTRIBUTE_UNUSED;
object_conflicts = conflicts[OBJECT_CONFLICT_ID (obj)];
px = 0;
{
ira_object_t another_obj = ira_object_id_map[i];
ira_allocno_t another_a = OBJECT_ALLOCNO (obj);
+
ira_assert (ira_reg_classes_intersect_p
- [ALLOCNO_COVER_CLASS (a)][ALLOCNO_COVER_CLASS (another_a)]);
+ [ALLOCNO_CLASS (a)][ALLOCNO_CLASS (another_a)]);
collected_conflict_objects[px++] = another_obj;
}
if (ira_conflict_vector_profitable_p (obj, px))
else
{
int conflict_bit_vec_words_num;
+
OBJECT_CONFLICT_ARRAY (obj) = object_conflicts;
if (OBJECT_MAX (obj) < OBJECT_MIN (obj))
conflict_bit_vec_words_num = 0;
parent_a = ira_parent_or_cap_allocno (a);
if (parent_a == NULL)
return;
- ira_assert (ALLOCNO_COVER_CLASS (a) == ALLOCNO_COVER_CLASS (parent_a));
+ ira_assert (ALLOCNO_CLASS (a) == ALLOCNO_CLASS (parent_a));
ira_assert (ALLOCNO_NUM_OBJECTS (a) == ALLOCNO_NUM_OBJECTS (parent_a));
parent_obj = ALLOCNO_OBJECT (parent_a, OBJECT_SUBWORD (obj));
parent_num = OBJECT_CONFLICT_ID (parent_obj);
+ parent_min = OBJECT_MIN (parent_obj);
+ parent_max = OBJECT_MAX (parent_obj);
FOR_EACH_BIT_IN_MINMAX_SET (object_conflicts,
OBJECT_MIN (obj), OBJECT_MAX (obj), i, asi)
{
int another_word = OBJECT_SUBWORD (another_obj);
ira_assert (ira_reg_classes_intersect_p
- [ALLOCNO_COVER_CLASS (a)][ALLOCNO_COVER_CLASS (another_a)]);
+ [ALLOCNO_CLASS (a)][ALLOCNO_CLASS (another_a)]);
another_parent_a = ira_parent_or_cap_allocno (another_a);
if (another_parent_a == NULL)
continue;
ira_assert (ALLOCNO_NUM (another_parent_a) >= 0);
- ira_assert (ALLOCNO_COVER_CLASS (another_a)
- == ALLOCNO_COVER_CLASS (another_parent_a));
+ ira_assert (ALLOCNO_CLASS (another_a)
+ == ALLOCNO_CLASS (another_parent_a));
ira_assert (ALLOCNO_NUM_OBJECTS (another_a)
== ALLOCNO_NUM_OBJECTS (another_parent_a));
SET_MINMAX_SET_BIT (conflicts[parent_num],
OBJECT_CONFLICT_ID (ALLOCNO_OBJECT (another_parent_a,
- another_word)),
- OBJECT_MIN (parent_obj),
- OBJECT_MAX (parent_obj));
+ another_word)),
+ parent_min, parent_max);
}
}
if ((bb = ALLOCNO_LOOP_TREE_NODE (a)->bb) != NULL)
fprintf (file, "b%d", bb->index);
else
- fprintf (file, "l%d", ALLOCNO_LOOP_TREE_NODE (a)->loop->num);
+ fprintf (file, "l%d", ALLOCNO_LOOP_TREE_NODE (a)->loop_num);
putc (')', file);
}
fprintf (file, ",b%d", bb->index);
else
fprintf (file, ",l%d",
- ALLOCNO_LOOP_TREE_NODE (conflict_a)->loop->num);
+ ALLOCNO_LOOP_TREE_NODE (conflict_a)->loop_num);
putc (')', file);
}
}
COPY_HARD_REG_SET (conflicting_hard_regs, OBJECT_TOTAL_CONFLICT_HARD_REGS (obj));
AND_COMPL_HARD_REG_SET (conflicting_hard_regs, ira_no_alloc_regs);
AND_HARD_REG_SET (conflicting_hard_regs,
- reg_class_contents[ALLOCNO_COVER_CLASS (a)]);
+ reg_class_contents[ALLOCNO_CLASS (a)]);
print_hard_reg_set (file, "\n;; total conflict hard regs:",
conflicting_hard_regs);
COPY_HARD_REG_SET (conflicting_hard_regs, OBJECT_CONFLICT_HARD_REGS (obj));
AND_COMPL_HARD_REG_SET (conflicting_hard_regs, ira_no_alloc_regs);
AND_HARD_REG_SET (conflicting_hard_regs,
- reg_class_contents[ALLOCNO_COVER_CLASS (a)]);
+ reg_class_contents[ALLOCNO_CLASS (a)]);
print_hard_reg_set (file, ";; conflict hard regs:",
conflicting_hard_regs);
putc ('\n', file);
void
ira_build_conflicts (void)
{
+ enum reg_class base;
ira_allocno_t a;
ira_allocno_iterator ai;
HARD_REG_SET temp_hard_reg_set;
ira_free (conflicts);
}
}
- if (! targetm.class_likely_spilled_p (base_reg_class (VOIDmode, ADDRESS,
- SCRATCH)))
+ base = base_reg_class (VOIDmode, ADDR_SPACE_GENERIC, ADDRESS, SCRATCH);
+ if (! targetm.class_likely_spilled_p (base))
CLEAR_HARD_REG_SET (temp_hard_reg_set);
else
{
- COPY_HARD_REG_SET (temp_hard_reg_set,
- reg_class_contents[base_reg_class (VOIDmode, ADDRESS, SCRATCH)]);
+ COPY_HARD_REG_SET (temp_hard_reg_set, reg_class_contents[base]);
AND_COMPL_HARD_REG_SET (temp_hard_reg_set, ira_no_alloc_regs);
AND_HARD_REG_SET (temp_hard_reg_set, call_used_reg_set);
}
FOR_EACH_ALLOCNO (a, ai)
{
int i, n = ALLOCNO_NUM_OBJECTS (a);
+
for (i = 0; i < n; i++)
{
ira_object_t obj = ALLOCNO_OBJECT (a, i);
IOR_HARD_REG_SET (OBJECT_CONFLICT_HARD_REGS (obj),
temp_hard_reg_set);
}
+
+ if (ALLOCNO_CALLS_CROSSED_NUM (a) != 0)
+ {
+ int regno;
+
+ /* Allocnos bigger than the saved part of call saved
+ regs must conflict with them. */
+ for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
+ if (!TEST_HARD_REG_BIT (call_used_reg_set, regno)
+ && HARD_REGNO_CALL_PART_CLOBBERED (regno,
+ obj->allocno->mode))
+ {
+ SET_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), regno);
+ SET_HARD_REG_BIT (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj),
+ regno);
+ }
+ }
}
}
if (optimize && ira_conflicts_p