+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
@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
@end smallexample
@end defmac
+@hook TARGET_IRA_CHANGE_PSEUDO_ALLOCNO_CLASS
+
@hook TARGET_LRA_P
@hook TARGET_REGISTER_PRIORITY
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
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)
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,
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)
{
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);