This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] ira: Respect HARD_REGNO_CALL_PART_CLOBBERED
- From: "Andreas Krebbel" <krebbel at linux dot vnet dot ibm dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: vmakarov at redhat dot com
- Date: Thu, 21 Oct 2010 19:14:57 +0200
- Subject: [PATCH] ira: Respect HARD_REGNO_CALL_PART_CLOBBERED
Hi,
I see 64 bit registers live across a function call although
HARD_REGNO_CALL_PART_CLOBBERED states that it is partially clobbered.
The attached patch records conflicts between allocnos and the
registers what fixes the problem for me.
Bootstrapped with s390x and s390 (--with-zarch). The second option
actually makes use of the HARD_REGNO_CALL_PART_CLOBBERED macro.
Ok for 4.5 and mainline?
Bye,
-Andreas-
2010-10-21 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
* ira-lives.c (process_bb_node_lives): Record conflicts for call
saved hard regs if they might get partially clobbered.
GCC 4.5:
Index: gcc/ira-lives.c
===================================================================
*** gcc/ira-lives.c.orig
--- gcc/ira-lives.c
*************** process_bb_node_lives (ira_loop_tree_nod
*** 1056,1061 ****
--- 1056,1063 ----
if (call_p)
{
+ int reg;
+
last_call_num++;
/* The current set of live allocnos are live across the call. */
EXECUTE_IF_SET_IN_SPARSESET (allocnos_live, i)
*************** process_bb_node_lives (ira_loop_tree_nod
*** 1072,1077 ****
--- 1074,1090 ----
/* Mark it as saved at the next call. */
allocno_saved_at_call[i] = last_call_num + 1;
ALLOCNO_CALLS_CROSSED_NUM (a)++;
+
+ /* Allocnos bigger than the saved part of call saved
+ regs must conflict with them. */
+ for (reg = 0; reg < FIRST_PSEUDO_REGISTER; reg++)
+ if (!call_used_regs[reg]
+ && HARD_REGNO_CALL_PART_CLOBBERED (reg, a->mode))
+ {
+ SET_HARD_REG_BIT (ALLOCNO_CONFLICT_HARD_REGS (a), reg);
+ SET_HARD_REG_BIT (ALLOCNO_TOTAL_CONFLICT_HARD_REGS (a), reg);
+ }
+
/* Don't allocate allocnos that cross setjmps or any
call, if this function receives a nonlocal
goto. */
GCC mainline:
Index: gcc/ira-lives.c
===================================================================
*** gcc/ira-lives.c.orig
--- gcc/ira-lives.c
*************** process_bb_node_lives (ira_loop_tree_nod
*** 1169,1174 ****
--- 1169,1185 ----
ira_object_t obj = ira_object_id_map[i];
ira_allocno_t a = OBJECT_ALLOCNO (obj);
int num = ALLOCNO_NUM (a);
+ int reg;
+
+ /* Allocnos bigger than the saved part of call saved
+ regs must conflict with them. */
+ for (reg = 0; reg < FIRST_PSEUDO_REGISTER; reg++)
+ if (!call_used_regs[reg]
+ && HARD_REGNO_CALL_PART_CLOBBERED (reg, obj->allocno->mode))
+ {
+ SET_HARD_REG_BIT (OBJECT_CONFLICT_HARD_REGS (obj), reg);
+ SET_HARD_REG_BIT (OBJECT_TOTAL_CONFLICT_HARD_REGS (obj), reg);
+ }
/* Don't allocate allocnos that cross setjmps or any
call, if this function receives a nonlocal