re PR rtl-optimization/65862 ([MIPS] IRA/LRA issue: integers spilled to floating-point registers)

2015-05-14  Vladimir Makarov  <vmakarov@redhat.com>

	PR rtl-optimization/65862
	* target.def (ira_change_pseudo_allocno_class): New hook.
	* targhooks.c (default_ira_change_pseudo_allocno_class): Default
	value of the hook.
	* targhooks.h (default_ira_change_pseudo_allocno_class): New
	extern
	* doc/tm.texi.in (TARGET_IRA_CHANGE_PSEUDO_ALLOCNO_CLASS): Add the
	hook.
	* ira-costs.c (find_costs_and_classes): Call the hook and change
	classes when it is necessary.
	* doc/tm.texi: Update.

From-SVN: r223202
This commit is contained in:
Vladimir Makarov 2015-05-14 20:40:44 +00:00 committed by Vladimir Makarov
parent f226d22967
commit 5074a1f86a
7 changed files with 54 additions and 1 deletions

View File

@ -1,3 +1,17 @@
2015-05-14 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/65862
* target.def (ira_change_pseudo_allocno_class): New hook.
* targhooks.c (default_ira_change_pseudo_allocno_class): Default
value of the hook.
* targhooks.h (default_ira_change_pseudo_allocno_class): New
extern
* doc/tm.texi.in (TARGET_IRA_CHANGE_PSEUDO_ALLOCNO_CLASS): Add the
hook.
* ira-costs.c (find_costs_and_classes): Call the hook and change
classes when it is necessary.
* doc/tm.texi: Update.
2015-05-14 Alexander Monakov <amonakov@ispras.ru>
* config/i386/i386.md (sibcall_memory): Check that register with

View File

@ -2837,6 +2837,13 @@ as below:
@end smallexample
@end defmac
@deftypefn {Target Hook} reg_class_t TARGET_IRA_CHANGE_PSEUDO_ALLOCNO_CLASS (int, @var{reg_class_t})
A target hook which can change allocno class for given pseudo from
allocno class calculated by IRA.
The default version of this target hook always returns given class.
@end deftypefn
@deftypefn {Target Hook} bool TARGET_LRA_P (void)
A target hook which returns true if we use LRA instead of reload pass. It means that LRA was ported to the target. The default version of this target hook returns always false.
@end deftypefn

View File

@ -2475,6 +2475,8 @@ as below:
@end smallexample
@end defmac
@hook TARGET_IRA_CHANGE_PSEUDO_ALLOCNO_CLASS
@hook TARGET_LRA_P
@hook TARGET_REGISTER_PRIORITY

View File

@ -1636,7 +1636,7 @@ find_costs_and_classes (FILE *dump_file)
int i, k, start, max_cost_classes_num;
int pass;
basic_block bb;
enum reg_class *regno_best_class;
enum reg_class *regno_best_class, new_class;
init_recog ();
regno_best_class
@ -1878,6 +1878,18 @@ find_costs_and_classes (FILE *dump_file)
ira_assert (regno_aclass[i] != NO_REGS
&& ira_reg_allocno_class_p[regno_aclass[i]]);
}
if ((new_class
= (reg_class) (targetm.ira_change_pseudo_allocno_class
(i, regno_aclass[i]))) != regno_aclass[i])
{
regno_aclass[i] = new_class;
if (hard_reg_set_subset_p (reg_class_contents[new_class],
reg_class_contents[best]))
best = new_class;
if (hard_reg_set_subset_p (reg_class_contents[new_class],
reg_class_contents[alt_class]))
alt_class = new_class;
}
if (pass == flag_expensive_optimizations)
{
if (best_cost > i_mem_cost)

View File

@ -4763,6 +4763,16 @@ This is currently used only by the C and C++ front ends.",
tree, (tree type, tree expr),
hook_tree_tree_tree_null)
/* Change pseudo allocno class calculated by IRA. */
DEFHOOK
(ira_change_pseudo_allocno_class,
"A target hook which can change allocno class for given pseudo from\n\
allocno class calculated by IRA.\n\
\n\
The default version of this target hook always returns given class.",
reg_class_t, (int, reg_class_t),
default_ira_change_pseudo_allocno_class)
/* Return true if we use LRA instead of reload. */
DEFHOOK
(lra_p,

View File

@ -914,6 +914,13 @@ default_branch_target_register_class (void)
return NO_REGS;
}
reg_class_t
default_ira_change_pseudo_allocno_class (int regno ATTRIBUTE_UNUSED,
reg_class_t cl)
{
return cl;
}
extern bool
default_lra_p (void)
{

View File

@ -140,6 +140,7 @@ extern rtx default_static_chain (const_tree, bool);
extern void default_trampoline_init (rtx, tree, rtx);
extern int default_return_pops_args (tree, tree, int);
extern reg_class_t default_branch_target_register_class (void);
extern reg_class_t default_ira_change_pseudo_allocno_class (int, reg_class_t);
extern bool default_lra_p (void);
extern int default_register_priority (int);
extern bool default_register_usage_leveling_p (void);