This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
patch to support HARD_REGNO_CALL_PART_CLOBBERED in LRA
- From: Vladimir Makarov <vmakarov at redhat dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 18 Sep 2013 15:16:07 -0400
- Subject: patch to support HARD_REGNO_CALL_PART_CLOBBERED in LRA
- Authentication-results: sourceware.org; auth=none
Yvan Roux working on porting LRA to AARCH64 reported that LRA does not
support macro HARD_REGNO_CALL_PART_CLOBBERED.
Here is the patch implementing such support. Yvan wrote me that the
patch solves the problem (removing some gcc testsuite failures).
The patch was bootstrapped on x86/x86-64.
Committed as rev. 202721.
2013-09-18 Vladimir Makarov <vmakarov@redhat.com>
* lra-constraints.c (need_for_all_save_p): Use macro
HARD_REGNO_CALL_PART_CLOBBERED.
* lra-lives.c (check_pseudos_live_through_calls): Use the macro to
set up pseudo conflict hard regs.
Index: lra-constraints.c
===================================================================
--- lra-constraints.c (revision 202714)
+++ lra-constraints.c (working copy)
@@ -4335,7 +4335,9 @@ need_for_call_save_p (int regno)
return (usage_insns[regno].calls_num < calls_num
&& (overlaps_hard_reg_set_p
(call_used_reg_set,
- PSEUDO_REGNO_MODE (regno), reg_renumber[regno])));
+ PSEUDO_REGNO_MODE (regno), reg_renumber[regno])
+ || HARD_REGNO_CALL_PART_CLOBBERED (reg_renumber[regno],
+ PSEUDO_REGNO_MODE (regno))));
}
/* Global registers occurring in the current EBB. */
Index: lra-lives.c
===================================================================
--- lra-lives.c (revision 202626)
+++ lra-lives.c (working copy)
@@ -457,11 +457,17 @@ lra_setup_reload_pseudo_preferenced_hard
static inline void
check_pseudos_live_through_calls (int regno)
{
+ int hr;
+
if (! sparseset_bit_p (pseudos_live_through_calls, regno))
return;
sparseset_clear_bit (pseudos_live_through_calls, regno);
IOR_HARD_REG_SET (lra_reg_info[regno].conflict_hard_regs,
call_used_reg_set);
+
+ for (hr = 0; hr < FIRST_PSEUDO_REGISTER; hr++)
+ if (HARD_REGNO_CALL_PART_CLOBBERED (hr, PSEUDO_REGNO_MODE (regno)))
+ SET_HARD_REG_BIT (lra_reg_info[regno].conflict_hard_regs, hr);
#ifdef ENABLE_CHECKING
lra_reg_info[regno].call_p = true;
#endif