Remove hard_reg_set_equal_p

Use "x == y" instead of "hard_reg_set_equal_p (x, y)".

2019-09-09  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* hard-reg-set.h (HARD_REG_SET::operator==): New function.
	(HARD_REG_SET::operator!=): Likewise.
	(hard_reg_set_equal_p): Delete.
	* cfgcleanup.c (old_insns_match_p): Use == instead of
	hard_reg_set_equal_p and != instead of !hard_reg_set_equal_p.
	* ira-color.c (allocno_hard_regs_hasher::equal): Likewise.
	(add_allocno_hard_regs_to_forest): Likewise.
	(setup_allocno_available_regs_num): Likewise.
	* ira.c (setup_pressure_classes): Likewise.
	(setup_allocno_and_important_classes): Likewise.
	(setup_reg_class_relations): Likewise.
	* lra-lives.c (process_bb_lives): Likewise.
	* reg-stack.c (change_stack, convert_regs_1): Likewise.

From-SVN: r275534
This commit is contained in:
Richard Sandiford 2019-09-09 17:59:41 +00:00 committed by Richard Sandiford
parent 4897c5aaa7
commit a85796511b
7 changed files with 48 additions and 40 deletions

View file

@ -1,3 +1,19 @@
2019-09-09 Richard Sandiford <richard.sandiford@arm.com>
* hard-reg-set.h (HARD_REG_SET::operator==): New function.
(HARD_REG_SET::operator!=): Likewise.
(hard_reg_set_equal_p): Delete.
* cfgcleanup.c (old_insns_match_p): Use == instead of
hard_reg_set_equal_p and != instead of !hard_reg_set_equal_p.
* ira-color.c (allocno_hard_regs_hasher::equal): Likewise.
(add_allocno_hard_regs_to_forest): Likewise.
(setup_allocno_available_regs_num): Likewise.
* ira.c (setup_pressure_classes): Likewise.
(setup_allocno_and_important_classes): Likewise.
(setup_reg_class_relations): Likewise.
* lra-lives.c (process_bb_lives): Likewise.
* reg-stack.c (change_stack, convert_regs_1): Likewise.
2019-09-09 Richard Sandiford <richard.sandiford@arm.com> 2019-09-09 Richard Sandiford <richard.sandiford@arm.com>
* hard-reg-set.h (IOR_COMPL_HARD_REG_SET): Delete. * hard-reg-set.h (IOR_COMPL_HARD_REG_SET): Delete.

View file

@ -1231,7 +1231,7 @@ old_insns_match_p (int mode ATTRIBUTE_UNUSED, rtx_insn *i1, rtx_insn *i2)
get_call_reg_set_usage (i1, &i1_used, call_used_reg_set); get_call_reg_set_usage (i1, &i1_used, call_used_reg_set);
get_call_reg_set_usage (i2, &i2_used, call_used_reg_set); get_call_reg_set_usage (i2, &i2_used, call_used_reg_set);
if (!hard_reg_set_equal_p (i1_used, i2_used)) if (i1_used != i2_used)
return dir_none; return dir_none;
} }
@ -1265,7 +1265,7 @@ old_insns_match_p (int mode ATTRIBUTE_UNUSED, rtx_insn *i1, rtx_insn *i2)
if (REG_NOTE_KIND (note) == REG_DEAD && STACK_REG_P (XEXP (note, 0))) if (REG_NOTE_KIND (note) == REG_DEAD && STACK_REG_P (XEXP (note, 0)))
SET_HARD_REG_BIT (i2_regset, REGNO (XEXP (note, 0))); SET_HARD_REG_BIT (i2_regset, REGNO (XEXP (note, 0)));
if (!hard_reg_set_equal_p (i1_regset, i2_regset)) if (i1_regset != i2_regset)
return dir_none; return dir_none;
} }
#endif #endif

View file

@ -96,6 +96,21 @@ struct HARD_REG_SET
return *this; return *this;
} }
bool
operator== (const HARD_REG_SET &other) const
{
HARD_REG_ELT_TYPE bad = 0;
for (unsigned int i = 0; i < ARRAY_SIZE (elts); ++i)
bad |= (elts[i] ^ other.elts[i]);
return bad == 0;
}
bool
operator!= (const HARD_REG_SET &other) const
{
return !operator== (other);
}
HARD_REG_ELT_TYPE elts[HARD_REG_SET_LONGS]; HARD_REG_ELT_TYPE elts[HARD_REG_SET_LONGS];
}; };
typedef const HARD_REG_SET &const_hard_reg_set; typedef const HARD_REG_SET &const_hard_reg_set;
@ -129,7 +144,6 @@ struct hard_reg_set_container
Also define: Also define:
hard_reg_set_subset_p (X, Y), which returns true if X is a subset of Y. hard_reg_set_subset_p (X, Y), which returns true if X is a subset of Y.
hard_reg_set_equal_p (X, Y), which returns true if X and Y are equal.
hard_reg_set_intersect_p (X, Y), which returns true if X and Y intersect. hard_reg_set_intersect_p (X, Y), which returns true if X and Y intersect.
hard_reg_set_empty_p (X), which returns true if X is empty. */ hard_reg_set_empty_p (X), which returns true if X is empty. */
@ -153,12 +167,6 @@ hard_reg_set_subset_p (const_hard_reg_set x, const_hard_reg_set y)
return (x & ~y) == HARD_CONST (0); return (x & ~y) == HARD_CONST (0);
} }
static inline bool
hard_reg_set_equal_p (const_hard_reg_set x, const_hard_reg_set y)
{
return x == y;
}
static inline bool static inline bool
hard_reg_set_intersect_p (const_hard_reg_set x, const_hard_reg_set y) hard_reg_set_intersect_p (const_hard_reg_set x, const_hard_reg_set y)
{ {
@ -217,15 +225,6 @@ hard_reg_set_subset_p (const_hard_reg_set x, const_hard_reg_set y)
return bad == 0; return bad == 0;
} }
static inline bool
hard_reg_set_equal_p (const_hard_reg_set x, const_hard_reg_set y)
{
HARD_REG_ELT_TYPE bad = 0;
for (unsigned int i = 0; i < ARRAY_SIZE (x.elts); ++i)
bad |= (x.elts[i] ^ y.elts[i]);
return bad == 0;
}
static inline bool static inline bool
hard_reg_set_intersect_p (const_hard_reg_set x, const_hard_reg_set y) hard_reg_set_intersect_p (const_hard_reg_set x, const_hard_reg_set y)
{ {

View file

@ -218,7 +218,7 @@ inline bool
allocno_hard_regs_hasher::equal (const allocno_hard_regs *hv1, allocno_hard_regs_hasher::equal (const allocno_hard_regs *hv1,
const allocno_hard_regs *hv2) const allocno_hard_regs *hv2)
{ {
return hard_reg_set_equal_p (hv1->set, hv2->set); return hv1->set == hv2->set;
} }
/* Hash table of unique allocno hard registers. */ /* Hash table of unique allocno hard registers. */
@ -371,7 +371,7 @@ add_allocno_hard_regs_to_forest (allocno_hard_regs_node_t *roots,
start = hard_regs_node_vec.length (); start = hard_regs_node_vec.length ();
for (node = *roots; node != NULL; node = node->next) for (node = *roots; node != NULL; node = node->next)
{ {
if (hard_reg_set_equal_p (hv->set, node->hard_regs->set)) if (hv->set == node->hard_regs->set)
return; return;
if (hard_reg_set_subset_p (hv->set, node->hard_regs->set)) if (hard_reg_set_subset_p (hv->set, node->hard_regs->set))
{ {
@ -2688,8 +2688,7 @@ setup_allocno_available_regs_num (ira_allocno_t a)
reg_class_names[aclass], ira_class_hard_regs_num[aclass], n); reg_class_names[aclass], ira_class_hard_regs_num[aclass], n);
print_hard_reg_set (ira_dump_file, data->profitable_hard_regs, false); print_hard_reg_set (ira_dump_file, data->profitable_hard_regs, false);
fprintf (ira_dump_file, ", %snode: ", fprintf (ira_dump_file, ", %snode: ",
hard_reg_set_equal_p (data->profitable_hard_regs, data->profitable_hard_regs == data->hard_regs_node->hard_regs->set
data->hard_regs_node->hard_regs->set)
? "" : "^"); ? "" : "^");
print_hard_reg_set (ira_dump_file, print_hard_reg_set (ira_dump_file,
data->hard_regs_node->hard_regs->set, false); data->hard_regs_node->hard_regs->set, false);

View file

@ -841,8 +841,7 @@ setup_pressure_classes (void)
temp_hard_regset2 = (reg_class_contents[cl2] temp_hard_regset2 = (reg_class_contents[cl2]
& ~no_unit_alloc_regs); & ~no_unit_alloc_regs);
if (hard_reg_set_subset_p (temp_hard_regset, temp_hard_regset2) if (hard_reg_set_subset_p (temp_hard_regset, temp_hard_regset2)
&& (! hard_reg_set_equal_p (temp_hard_regset, && (temp_hard_regset != temp_hard_regset2
temp_hard_regset2)
|| cl2 == (int) GENERAL_REGS)) || cl2 == (int) GENERAL_REGS))
{ {
pressure_classes[curr++] = (enum reg_class) cl2; pressure_classes[curr++] = (enum reg_class) cl2;
@ -850,11 +849,10 @@ setup_pressure_classes (void)
continue; continue;
} }
if (hard_reg_set_subset_p (temp_hard_regset2, temp_hard_regset) if (hard_reg_set_subset_p (temp_hard_regset2, temp_hard_regset)
&& (! hard_reg_set_equal_p (temp_hard_regset2, && (temp_hard_regset2 != temp_hard_regset
temp_hard_regset)
|| cl == (int) GENERAL_REGS)) || cl == (int) GENERAL_REGS))
continue; continue;
if (hard_reg_set_equal_p (temp_hard_regset2, temp_hard_regset)) if (temp_hard_regset2 == temp_hard_regset)
insert_p = false; insert_p = false;
pressure_classes[curr++] = (enum reg_class) cl2; pressure_classes[curr++] = (enum reg_class) cl2;
} }
@ -999,8 +997,7 @@ setup_allocno_and_important_classes (void)
{ {
cl = classes[j]; cl = classes[j];
temp_hard_regset2 = reg_class_contents[cl] & ~no_unit_alloc_regs; temp_hard_regset2 = reg_class_contents[cl] & ~no_unit_alloc_regs;
if (hard_reg_set_equal_p (temp_hard_regset, if (temp_hard_regset == temp_hard_regset2)
temp_hard_regset2))
break; break;
} }
if (j >= n || targetm.additional_allocno_class_p (i)) if (j >= n || targetm.additional_allocno_class_p (i))
@ -1273,7 +1270,7 @@ setup_reg_class_relations (void)
the same, prefer GENERAL_REGS or the the same, prefer GENERAL_REGS or the
smallest class for debugging smallest class for debugging
purposes. */ purposes. */
|| (hard_reg_set_equal_p (temp_hard_regset, temp_set2) || (temp_hard_regset == temp_set2
&& (cl3 == GENERAL_REGS && (cl3 == GENERAL_REGS
|| ((ira_reg_class_intersect[cl1][cl2] || ((ira_reg_class_intersect[cl1][cl2]
!= GENERAL_REGS) != GENERAL_REGS)
@ -1290,7 +1287,7 @@ setup_reg_class_relations (void)
if (! hard_reg_set_subset_p (temp_hard_regset, temp_set2) if (! hard_reg_set_subset_p (temp_hard_regset, temp_set2)
/* Ignore unavailable hard registers and prefer /* Ignore unavailable hard registers and prefer
smallest class for debugging purposes. */ smallest class for debugging purposes. */
|| (hard_reg_set_equal_p (temp_hard_regset, temp_set2) || (temp_hard_regset == temp_set2
&& hard_reg_set_subset_p && hard_reg_set_subset_p
(reg_class_contents[cl3], (reg_class_contents[cl3],
reg_class_contents reg_class_contents
@ -1309,8 +1306,7 @@ setup_reg_class_relations (void)
if (ira_reg_class_subunion[cl1][cl2] == NO_REGS if (ira_reg_class_subunion[cl1][cl2] == NO_REGS
|| (hard_reg_set_subset_p (temp_set2, temp_hard_regset) || (hard_reg_set_subset_p (temp_set2, temp_hard_regset)
&& (! hard_reg_set_equal_p (temp_set2, && (temp_set2 != temp_hard_regset
temp_hard_regset)
|| cl3 == GENERAL_REGS || cl3 == GENERAL_REGS
/* If the allocatable hard register sets are the /* If the allocatable hard register sets are the
same, prefer GENERAL_REGS or the smallest same, prefer GENERAL_REGS or the smallest
@ -1333,8 +1329,7 @@ setup_reg_class_relations (void)
if (ira_reg_class_superunion[cl1][cl2] == NO_REGS if (ira_reg_class_superunion[cl1][cl2] == NO_REGS
|| (hard_reg_set_subset_p (temp_hard_regset, temp_set2) || (hard_reg_set_subset_p (temp_hard_regset, temp_set2)
&& (! hard_reg_set_equal_p (temp_set2, && (temp_set2 != temp_hard_regset
temp_hard_regset)
|| cl3 == GENERAL_REGS || cl3 == GENERAL_REGS
/* If the allocatable hard register sets are the /* If the allocatable hard register sets are the
same, prefer GENERAL_REGS or the smallest same, prefer GENERAL_REGS or the smallest

View file

@ -936,8 +936,8 @@ process_bb_lives (basic_block bb, int &curr_point, bool dead_insn_p)
call_used_reg_set); call_used_reg_set);
bool flush = (! hard_reg_set_empty_p (last_call_used_reg_set) bool flush = (! hard_reg_set_empty_p (last_call_used_reg_set)
&& ( ! hard_reg_set_equal_p (last_call_used_reg_set, && (last_call_used_reg_set
this_call_used_reg_set))) != this_call_used_reg_set))
|| (last_call_insn && ! calls_have_same_clobbers_p || (last_call_insn && ! calls_have_same_clobbers_p
(call_insn, (call_insn,
last_call_insn)); last_call_insn));

View file

@ -2643,7 +2643,7 @@ change_stack (rtx_insn *insn, stack_ptr old, stack_ptr new_stack,
/* By now, the only difference should be the order of the stack, /* By now, the only difference should be the order of the stack,
not their depth or liveliness. */ not their depth or liveliness. */
gcc_assert (hard_reg_set_equal_p (old->reg_set, new_stack->reg_set)); gcc_assert (old->reg_set == new_stack->reg_set);
gcc_assert (old->top == new_stack->top); gcc_assert (old->top == new_stack->top);
/* If the stack is not empty (new_stack->top != -1), loop here emitting /* If the stack is not empty (new_stack->top != -1), loop here emitting
@ -3158,8 +3158,7 @@ convert_regs_1 (basic_block block)
asms, we zapped the instruction itself, but that didn't produce the asms, we zapped the instruction itself, but that didn't produce the
same pattern of register kills as before. */ same pattern of register kills as before. */
gcc_assert (hard_reg_set_equal_p (regstack.reg_set, bi->out_reg_set) gcc_assert (regstack.reg_set == bi->out_reg_set || any_malformed_asm);
|| any_malformed_asm);
bi->stack_out = regstack; bi->stack_out = regstack;
bi->done = true; bi->done = true;