This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] find_reloads_address() needs reference to MEM, not NULL[Repost]


<<I posted this a week ago, and since then the 3.2 branch has stabilized to the point that I can run
bootstraps on a SPARC box.>>


If find_reloads_address() is called with a NULL second parameter, it is unable to invoke the LEGITIMIZE_RELOAD_ADDRESS macro.

There are three places where reload creates a MEM and calls find_reloads_address passing NULL
instead of a reference to that MEM. In each of those three places, a port that has a limited stack
displacement offset, or has NO offsetable addressing modes can run into trouble if it depends on
LEGITIMIZE_RELOAD_ADDRESS fixing things up.

Here's a patch that is used in the IP2K (a machine with only a byte displacement off the SP), and
in an unreleased port to an ASIC chip with no offsettable addressing modes. In both ports, without
this patch, REG+OFFSET addresses end up not getting reloaded correctly. It's been running without
problem on those two ports for over a year.

SPARC bootstraps successfully with this patch.


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

31-May-2002 Alan Lehotsky <apl@alum.mit.edu>
* reload.c (get_secondary_mem, find_reloads_address, find_reloads_address_1): Pass
reference to MEM to find_reloads_address() so that LEGITIMIZE_RELOAD_ADDRESS can
be called.


Index: reload.c
===================================================================
RCS file: /Volumes/QSM/cvsroot/uberbaum/gcc/reload.c,v
retrieving revision 1.1.1.11
diff -u -p -d -b -r1.1.1.11 reload.c
--- reload.c 2002/03/25 20:38:20 1.1.1.11
+++ reload.c 2002/05/31 13:42:51
@@ -643,7 +643,7 @@ get_secondary_mem (x, mode, opnum, type)
: type == RELOAD_FOR_OUTPUT ? RELOAD_FOR_OUTPUT_ADDRESS
: RELOAD_OTHER);

- find_reloads_address (mode, (rtx*) 0, XEXP (loc, 0), &XEXP (loc, 0),
+ find_reloads_address (mode, &loc, XEXP (loc, 0), &XEXP (loc, 0),
opnum, type, 0, 0);
}

@@ -4575,9 +4575,9 @@ find_reloads_address (mode, memrefloc, a
tem = make_memloc (ad, regno);
if (! strict_memory_address_p (GET_MODE (tem), XEXP (tem, 0)))
{
- find_reloads_address (GET_MODE (tem), (rtx*) 0, XEXP (tem, 0),
- &XEXP (tem, 0), opnum, ADDR_TYPE (type),
- ind_levels, insn);
+ find_reloads_address (GET_MODE (tem), &tem, XEXP (tem, 0),
+ &XEXP (tem, 0), opnum,
+ ADDR_TYPE (type), ind_levels, insn);
}
/* We can avoid a reload if the register's equivalent memory
expression is valid as an indirect memory address.
@@ -5305,7 +5305,7 @@ find_reloads_address_1 (mode, x, context
We can't use ADDR_TYPE (type) here, because we need to
write back the value after reading it, hence we actually
need two registers. */
- find_reloads_address (GET_MODE (tem), 0, XEXP (tem, 0),
+ find_reloads_address (GET_MODE (tem), &tem, XEXP (tem, 0),
&XEXP (tem, 0), opnum,
RELOAD_OTHER,
ind_levels, insn);

--
Quality Software Management
http://home.earthlink.net/~qsmgmt
apl@alum.mit.edu
(978)287-0435 Voice
(978)808-6836 Cell

Software Process Improvement / Management Consulting
Language Design / Compiler Implementation
--
Quality Software Management
http://home.earthlink.net/~qsmgmt
apl@alum.mit.edu
(978)287-0435 Voice
(978)808-6836 Cell

Software Process Improvement / Management Consulting
Language Design / Compiler Implementation



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]