From: Richard Henderson <richard@atheist.tamu.edu>
Subject: Re: gcc: Internal compiler error: program cc1 got fatal signal 6
Date: Thu, 2 May 1996 11:26:53 -0500 (CDT) [thread overview]
Message-ID: <m0uF1DS-0001pfC@atheist.tamu.edu> (raw)
In-Reply-To: <3186527a.28880263@mail.eunet.ch>
The bug that Francois reported is fixed in the most recent
gcc snapshot, but I was thinking that that does the rest of
you very little good.
I spent some time trying to isolate the change that fixed
the problem, but for naught. The patch below does fix the
problem, but is not aesthetically pleasing as it simply
patches reload.c all the way up to the most recent snapshot.
Enjoy.
r~
--- reload.c.orig Mon Mar 25 20:30:39 1996
+++ reload.c Mon Apr 22 21:51:15 1996
@@ -1,5 +1,5 @@
/* Search an insn for pseudo regs that must be in hard regs and are not.
- Copyright (C) 1987, 88, 89, 92, 93, 94, 1995 Free Software Foundation, Inc.
+ Copyright (C) 1987, 88, 89, 92-5, 1996 Free Software Foundation, Inc.
This file is part of GNU CC.
@@ -291,6 +291,7 @@
static int push_secondary_reload PROTO((int, rtx, int, int, enum reg_class,
enum machine_mode, enum reload_type,
enum insn_code *));
+static enum reg_class find_valid_class PROTO((enum machine_mode, int));
static int push_reload PROTO((rtx, rtx, rtx *, rtx *, enum reg_class,
enum machine_mode, enum machine_mode,
int, int, int, enum reload_type));
@@ -360,6 +361,9 @@
/* If X is a paradoxical SUBREG, use the inner value to determine both the
mode and object being reloaded. */
if (GET_CODE (x) == SUBREG
+#ifdef CLASS_CANNOT_CHANGE_SIZE
+ && reload_class != CLASS_CANNOT_CHANGE_SIZE
+#endif
&& (GET_MODE_SIZE (GET_MODE (x))
> GET_MODE_SIZE (GET_MODE (SUBREG_REG (x)))))
{
@@ -688,6 +692,38 @@
}
#endif /* SECONDARY_MEMORY_NEEDED */
\f
+/* Find the largest class for which every register number plus N is valid in
+ M1 (if in range). Abort if no such class exists. */
+
+static enum reg_class
+find_valid_class (m1, n)
+ enum machine_mode m1;
+ int n;
+{
+ int class;
+ int regno;
+ enum reg_class best_class;
+ int best_size = 0;
+
+ for (class = 1; class < N_REG_CLASSES; class++)
+ {
+ int bad = 0;
+ for (regno = 0; regno < FIRST_PSEUDO_REGISTER && ! bad; regno++)
+ if (TEST_HARD_REG_BIT (reg_class_contents[class], regno)
+ && TEST_HARD_REG_BIT (reg_class_contents[class], regno + n)
+ && ! HARD_REGNO_MODE_OK (regno + n, m1))
+ bad = 1;
+
+ if (! bad && reg_class_size[class] > best_size)
+ best_class = class, best_size = reg_class_size[class];
+ }
+
+ if (best_size == 0)
+ abort ();
+
+ return best_class;
+}
+\f
/* Record one reload that needs to be performed.
IN is an rtx saying where the data are to be found before this instruction.
OUT says where they must be stored after the instruction.
@@ -890,17 +926,23 @@
However, we must reload the inner reg *as well as* the subreg in
that case. */
+ /* Similar issue for (SUBREG constant ...) if it was not handled by the
+ code above. This can happen if SUBREG_WORD != 0. */
+
if (in != 0 && GET_CODE (in) == SUBREG
- && GET_CODE (SUBREG_REG (in)) == REG
- && REGNO (SUBREG_REG (in)) < FIRST_PSEUDO_REGISTER
- && (! HARD_REGNO_MODE_OK (REGNO (SUBREG_REG (in)), inmode)
- || (GET_MODE_SIZE (inmode) <= UNITS_PER_WORD
- && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (in)))
- > UNITS_PER_WORD)
- && ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (in)))
- / UNITS_PER_WORD)
- != HARD_REGNO_NREGS (REGNO (SUBREG_REG (in)),
- GET_MODE (SUBREG_REG (in)))))))
+ && (CONSTANT_P (SUBREG_REG (in))
+ || (GET_CODE (SUBREG_REG (in)) == REG
+ && REGNO (SUBREG_REG (in)) < FIRST_PSEUDO_REGISTER
+ && (! HARD_REGNO_MODE_OK (REGNO (SUBREG_REG (in))
+ + SUBREG_WORD (in),
+ inmode)
+ || (GET_MODE_SIZE (inmode) <= UNITS_PER_WORD
+ && (GET_MODE_SIZE (GET_MODE (SUBREG_REG (in)))
+ > UNITS_PER_WORD)
+ && ((GET_MODE_SIZE (GET_MODE (SUBREG_REG (in)))
+ / UNITS_PER_WORD)
+ != HARD_REGNO_NREGS (REGNO (SUBREG_REG (in)),
+ GET_MODE (SUBREG_REG (in)))))))))
{
/* This relies on the fact that emit_reload_insns outputs the
instructions for input reloads of type RELOAD_OTHER in the same
@@ -908,11 +950,11 @@
RELOAD_OTHER, we are guaranteed that this inner reload will be
output before the outer reload. */
push_reload (SUBREG_REG (in), NULL_RTX, &SUBREG_REG (in), NULL_PTR,
- GENERAL_REGS, VOIDmode, VOIDmode, 0, 0, opnum, type);
+ find_valid_class (inmode, SUBREG_WORD (in)),
+ VOIDmode, VOIDmode, 0, 0, opnum, type);
dont_remove_subreg = 1;
}
-
/* Similarly for paradoxical and problematical SUBREGs on the output.
Note that there is no reason we need worry about the previous value
of SUBREG_REG (out); even if wider than out,
@@ -981,7 +1023,8 @@
if (out != 0 && GET_CODE (out) == SUBREG
&& GET_CODE (SUBREG_REG (out)) == REG
&& REGNO (SUBREG_REG (out)) < FIRST_PSEUDO_REGISTER
- && (! HARD_REGNO_MODE_OK (REGNO (SUBREG_REG (out)), outmode)
+ && (! HARD_REGNO_MODE_OK (REGNO (SUBREG_REG (out)) + SUBREG_WORD (out),
+ outmode)
|| (GET_MODE_SIZE (outmode) <= UNITS_PER_WORD
&& (GET_MODE_SIZE (GET_MODE (SUBREG_REG (out)))
> UNITS_PER_WORD)
@@ -997,7 +1040,9 @@
output after the outer reload. */
dont_remove_subreg = 1;
push_reload (SUBREG_REG (out), SUBREG_REG (out), &SUBREG_REG (out),
- &SUBREG_REG (out), ALL_REGS, VOIDmode, VOIDmode, 0, 0,
+ &SUBREG_REG (out),
+ find_valid_class (outmode, SUBREG_WORD (out)),
+ VOIDmode, VOIDmode, 0, 0,
opnum, RELOAD_OTHER);
}
@@ -1230,9 +1275,13 @@
For example, we may now have both IN and OUT
while the old one may have just one of them. */
- if (inmode != VOIDmode)
+ /* The modes can be different. If they are, we want to reload in
+ the larger mode, so that the value is valid for both modes. */
+ if (inmode != VOIDmode
+ && GET_MODE_SIZE (inmode) > GET_MODE_SIZE (reload_inmode[i]))
reload_inmode[i] = inmode;
- if (outmode != VOIDmode)
+ if (outmode != VOIDmode
+ && GET_MODE_SIZE (outmode) > GET_MODE_SIZE (reload_outmode[i]))
reload_outmode[i] = outmode;
if (in != 0)
reload_in[i] = in;
@@ -5517,7 +5566,7 @@
/* Reject VALUE if it was loaded from GOAL
and is also a register that appears in the address of GOAL. */
- if (goal_mem && value == SET_DEST (PATTERN (where))
+ if (goal_mem && value == SET_DEST (single_set (where))
&& refers_to_regno_for_reload_p (valueno,
(valueno
+ HARD_REGNO_NREGS (valueno, mode)),
@@ -5899,7 +5948,7 @@
fprintf (stderr, ", inc by %d\n", reload_inc[r]);
if (reload_nocombine[r])
- fprintf (stderr, ", can combine", reload_nocombine[r]);
+ fprintf (stderr, ", can't combine", reload_nocombine[r]);
if (reload_secondary_p[r])
fprintf (stderr, ", secondary_reload_p");
next parent reply other threads:[~1996-05-02 16:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <3186527a.28880263@mail.eunet.ch>
1996-05-02 16:26 ` Richard Henderson [this message]
1996-04-27 19:42 gcc: Internal compiler error: program cc1 got fatal signal 6 Francois Jaccard
1996-04-28 4:51 ` Jim Paradis
1996-04-29 14:31 ` Jay Estabrook - Alpha Migration Tools - LINUX Project
1996-04-29 17:58 ` Richard Henderson
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox