Building on NetBSD/VAX 10.0_RC1, Summary(?)
emu <[email protected]>
| Newsgroups | gmane.os.netbsd.ports.vax |
|---|---|
| Message-ID | <[email protected]> |
I think we get more attention on a VAX again, as it seems to be usable again, so I just did a cut&paste of two emails on our latest thread to get the machines working again. Thanks again to Greg & Kalvis (for sharing the details), and for sure to a lot of others for working on it!!! Also attached to this email is the patch from Kalvis again, so it is easier to find ... On 2023-12-07 22:39, Kalvis Duckmanton wrote: > Hi all, > > I *think* I've worked out what the 'reload' pass has done when > compiling this test case, though I'm not sure that I understand it > well enough to be able to explain it properly. > I'm not yet sure what the cause is, but I have noticed that the output > from g++'s 'reload' pass isn't correct. > What seems to have happened is that the instructions to push argument > 3 have inherited the output reload of --%sp into %r1 from the > instructions pushing argument 5, but GCC hasn't noted that the pushl > $0 for argument 4 has also changed %sp so the output reload can't be > reused. > > There's a block of code in gcc/reload1.c which does invalidate old > output reloads; the attached patch adds to this block to invalidate a > reload of an output register if the output register is a reference to > memory using an autoincrement or autodecrement addressing mode. > > With the patch applied, I've been able to compile the test case using > the resulting native compiler, and a native build of NetBSD hasn't > failed yet, which is promising. I have not applied any workarounds to > sancov.c or to tree-switch-conversion.c, and I'm also compiling GCC > with the default optimisation level (-O2; I haven't applied any of > Matthew's changes mentioned earlier). > > I've also applied this change to a copy of GCC 10.5.0 from upstream > and on amd64 at least there was no change to the regression test > results so I don't think this introduces any regressions. > > I'm curious to know if this will work for anyone else. > > cheers > > kalvis > > On 2023-12-12 19:54, Greg Oster wrote: > > You don't need to get gcc12 -- You can just use the gcc that is with > the sources you fetch above. Grab the patch that Kalvis posted on Dec > 7, and patch the source. > >> Get is from PKGSRC first & install, than start a "build.sh -V >> HAVE_GCC12"? > > Just use regular 'build.sh' - no need to specify a different compiler > once the compiler sources are patched... e.g.: > > cd /u1/builds/build1/src/ > sh ./build.sh -U -u -m vax -D /u1/builds/build1/install/vax \ > -R /u1/builds/build1/release > > if your sources are in /u1/builds/build1/src/. (My build line is > actually: > > sh ./build.sh -U -u -m vax -j 2 -V MAKECONF=/u1/builds/mk.conf \ > -D /u1/builds/build3/install/vax -R /u1/builds/build3/release > > as the build line gets generated and run by a different script...) > > You'll want to have a healthy amount of swapspace setup... right now > I'd suggest 512MB or better. And set your shell limts to something like: > > cputime unlimited > filesize unlimited > datasize 524288 kbytes > stacksize 8192 kbytes > coredumpsize 0 kbytes > memoryuse 58296 kbytes > memorylocked 19432 kbytes > maxproc 148 > maxthread 2048 > openfiles 548 > sbsize unlimited > vmemoryuse 524288 kbytes > > (which I do with this, in csh: > limit maxproc unlimited > limit datasize unlimited > limit stacksize unlimited > limit coredumpsize 0 > limit openfiles unlimited > limit vmemoryuse unlimited > ) > > If you don't bump the default limits up building certain files will > fail... with '-j 2' I needed over 512MB to get the build to not fail - > 1024MB seems better... > > Later... > > Greg Oster >
gcc-reload1-invalidate-address-reload.patch
(text/plain, 1.6 KB)
diff --git a/external/gpl3/gcc.old/dist/gcc/reload1.c b/external/gpl3/gcc.old/dist/gcc/reload1.c
index 88f4727d5453..8d481071a12b 100644
--- a/external/gpl3/gcc.old/dist/gcc/reload1.c
+++ b/external/gpl3/gcc.old/dist/gcc/reload1.c
@@ -8377,6 +8377,43 @@ emit_reload_insns (class insn_chain *chain)
reg_last_reload_reg[out_regno + k] = 0;
}
}
+
+#if AUTO_INC_DEC /* XXX KD */
+ /* Where an output register might be reloaded, and it is a
+ memory reference, and the address is auto-incremented, any
+ previously reloaded copy of the address must be
+ invalidated. */
+ if (i < 0
+ && rld[r].out != 0
+ && MEM_P (rld[r].out))
+ {
+ rtx out = XEXP (rld[r].out, 0); /* address expression */
+ enum rtx_code code = GET_CODE (out);
+
+ if (code != POST_INC && code != POST_DEC
+ && code != PRE_INC && code != PRE_DEC)
+ {
+ /* do nothing */
+ }
+ else
+ {
+ int out_regno = REGNO (XEXP (out, 0));
+ machine_mode mode = GET_MODE (XEXP (out, 0));
+
+ /* for the moment, handle only the case where out_regno
+ is a hardware register */
+
+ if (HARD_REGISTER_NUM_P (out_regno))
+ {
+ int k, out_nregs = hard_regno_nregs (out_regno, mode);
+
+ for (k = 0; k < out_nregs; k++)
+ reg_last_reload_reg[out_regno + k] = 0;
+ }
+ }
+ }
+#endif /* AUTO_INC_DEC */ /* XXX KD */
+
}
reg_reloaded_dead |= reg_reloaded_died;
}