updated warning patch to reload1.c for ELIMINABLE_REGS missing inits
Kaveh R. Ghazi
ghazi@caip.rutgers.edu
Fri Oct 30 07:01:00 GMT 1998
This patch supercedes my previous change to reload1.c. It fixes
missing initializer warnings for both cases where ELIMINABLE_REGS is
defined and not defined. (My previous patch only handled when it was
undefined.) It uses the same strategy employed to fix similar warnings
from gcc.c and EXTRA_SPECS.
BTW, I'm submitting this since a notation on the announcement
page regarding Bernd's code donation appeared, I'm assuming the hold on
changes to reload1.c is lifted.
Okay to install?
--Kaveh
Fri Oct 30 09:39:47 1998 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* reload1.c (ELIMINABLE_REGS, NUM_ELIMINABLE_REGS): Introduce an
intermediate structure which has exactly the members provided by
ELIMINABLE_REGS. Define NUM_ELIMINABLE_REGS in terms of the
static intermediate structure.
(init_elim_table): Xmalloc() `reg_eliminate', and initialize it
from the intermediate structure. Do the same analogous fix in
the case where ELIMINABLE_REGS is not defined.
--- egcs-CVS19981028/gcc/reload1.c~ Wed Oct 28 21:16:16 1998
+++ egcs-CVS19981028/gcc/reload1.c Thu Oct 29 13:11:28 1998
@@ -290,7 +290,7 @@
in favor of another. If there is more than one way of eliminating a
particular register, the most preferred should be specified first. */
-static struct elim_table
+struct elim_table
{
int from; /* Register number to be eliminated. */
int to; /* Register number used as replacement. */
@@ -308,7 +308,17 @@
register corresponding to a pseudo
assigned to the reg to be eliminated. */
rtx to_rtx; /* REG rtx for the replacement. */
-} reg_eliminate[] =
+};
+
+static struct elim_table * reg_eliminate = 0;
+
+/* This is an intermediate structure to initialize the table. It has
+ exactly the members provided by ELIMINABLE_REGS. */
+static struct elim_table_1
+{
+ int from;
+ int to;
+} reg_eliminate_1[] =
/* If a set of eliminable registers was specified, define the table from it.
Otherwise, default to the normal case of the frame pointer being
@@ -320,7 +330,7 @@
{{ FRAME_POINTER_REGNUM, STACK_POINTER_REGNUM}};
#endif
-#define NUM_ELIMINABLE_REGS (sizeof reg_eliminate / sizeof reg_eliminate[0])
+#define NUM_ELIMINABLE_REGS (sizeof reg_eliminate_1/sizeof reg_eliminate_1[0])
/* Record the number of pending eliminations that have an offset not equal
to their initial offset. If non-zero, we use a new copy of each
@@ -3589,7 +3599,18 @@
init_elim_table ()
{
struct elim_table *ep;
+#ifdef ELIMINABLE_REGS
+ struct elim_table_1 *ep1;
+#endif
+ if (!reg_eliminate)
+ {
+ reg_eliminate = (struct elim_table *)
+ xmalloc(sizeof(struct elim_table) * NUM_ELIMINABLE_REGS);
+ bzero ((PTR) reg_eliminate,
+ sizeof(struct elim_table) * NUM_ELIMINABLE_REGS);
+ }
+
/* Does this function require a frame pointer? */
frame_pointer_needed = (! flag_omit_frame_pointer
@@ -3607,13 +3628,18 @@
num_eliminable = 0;
#ifdef ELIMINABLE_REGS
- for (ep = reg_eliminate; ep < ®_eliminate[NUM_ELIMINABLE_REGS]; ep++)
+ for (ep = reg_eliminate, ep1 = reg_eliminate_1;
+ ep < ®_eliminate[NUM_ELIMINABLE_REGS]; ep++, ep1++)
{
+ ep->from = ep1->from;
+ ep->to = ep1->to;
ep->can_eliminate = ep->can_eliminate_previous
= (CAN_ELIMINATE (ep->from, ep->to)
&& ! (ep->to == STACK_POINTER_REGNUM && frame_pointer_needed));
}
#else
+ reg_eliminate[0].from = reg_eliminate_1[0].from;
+ reg_eliminate[0].to = reg_eliminate_1[0].to;
reg_eliminate[0].can_eliminate = reg_eliminate[0].can_eliminate_previous
= ! frame_pointer_needed;
#endif
More information about the Gcc-patches
mailing list