This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[RFA]: Fix a problem in merge_assigned_reloads
- To: gcc-patches at gcc dot gnu dot org
- Subject: [RFA]: Fix a problem in merge_assigned_reloads
- From: Stephane Carrez <Stephane dot Carrez at worldnet dot fr>
- Date: Mon, 09 Jul 2001 22:37:04 +0200
Hi!
There is a problem in merge_assigned_reloads. When a reload is
merged and its type is changed to RELOAD_OTHER, then we do:
/* If this is now RELOAD_OTHER, look for any reloads that load
parts of this operand and set them to RELOAD_FOR_OTHER_ADDRESS
if they were for inputs, RELOAD_OTHER for outputs. Note that
this test is equivalent to looking for reloads for this operand
number. */
if (rld[i].when_needed == RELOAD_OTHER)
for (j = 0; j < n_reloads; j++)
if (rld[j].in != 0
&& rld[i].when_needed != RELOAD_OTHER
&& reg_overlap_mentioned_for_reload_p (rld[j].in,
rld[i].in))
rld[j].when_needed
= ((rld[i].when_needed == RELOAD_FOR_INPUT_ADDRESS
|| rld[i].when_needed == RELOAD_FOR_INPADDR_ADDRESS)
? RELOAD_FOR_OTHER_ADDRESS : RELOAD_OTHER);
But the code that handle this is using the wrong index: it uses 'i'
which refers to the merged reload (RELOAD_OTHER) instead of 'j'.
(If you look carefully, you'll see this piece of code does nothing at all)
The result is that I end up in a wrong order for the reloads (HC11 port)
For example, I obtained:
Reload 0: reload_in (HI) = (reg/f:HI 9 *_.frame)
A_REGS, RELOAD_FOR_OPERAND_ADDRESS (opnum = 0)
reload_in_reg: (reg/f:HI 9 *_.frame)
reload_reg_rtx: (reg:HI 2 y)
Reload 1: reload_in (HI) = (mem:HI (plus:HI (reg/f:HI 9 *_.frame)
(const_int 11 [0xb])) 6)
A_REGS, RELOAD_OTHER (opnum = 0), can't combine
reload_in_reg: (reg/v/f:HI 58)
reload_reg_rtx: (reg:HI 8 z)
...(more reloads removed)
Here, reload 1 was merged and set to RELOAD_OTHER, and since it has a
reload (0), that reload should be changed to RELOAD_OTHER. This is what
the piece of code above is supposed to do.
The patch below fixes the piece of code by using the good index.
Can you approve or integrate this patch in 3_0 and 3_1?
Thanks,
Stephane
2001-07-09 Stephane Carrez <Stephane.Carrez@worldnet.fr>
* reload1.c (merge_assigned_reloads): After a RELOAD_OTHER merge,
fix the setting of the reloads of that reload to RELOAD_FOR_OTHER_ADDRESS.
Index: reload1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload1.c,v
retrieving revision 1.255.4.11
diff -u -p -r1.255.4.11 reload1.c
--- reload1.c 2001/06/06 03:31:21 1.255.4.11
+++ reload1.c 2001/07/09 20:30:18
@@ -6073,12 +6073,12 @@ merge_assigned_reloads (insn)
if (rld[i].when_needed == RELOAD_OTHER)
for (j = 0; j < n_reloads; j++)
if (rld[j].in != 0
- && rld[i].when_needed != RELOAD_OTHER
+ && rld[j].when_needed != RELOAD_OTHER
&& reg_overlap_mentioned_for_reload_p (rld[j].in,
rld[i].in))
rld[j].when_needed
- = ((rld[i].when_needed == RELOAD_FOR_INPUT_ADDRESS
- || rld[i].when_needed == RELOAD_FOR_INPADDR_ADDRESS)
+ = ((rld[j].when_needed == RELOAD_FOR_INPUT_ADDRESS
+ || rld[j].when_needed == RELOAD_FOR_INPADDR_ADDRESS)
? RELOAD_FOR_OTHER_ADDRESS : RELOAD_OTHER);
}
}