This is the mail archive of the
mailing list for the GCC project.
[0/27] Putting target-dependent global state into switchable structures
- From: Richard Sandiford <rdsandiford at googlemail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 04 Jul 2010 22:51:54 +0100
- Subject: [0/27] Putting target-dependent global state into switchable structures
This series of patches implements the idea described here:
There didn't seem to be any strong opposition to the idea itself,
but using a .def file wasn't too popular. I've now reworked the
patches to avoid that.
I've tried to stick to the following principles, which are supposed
to help preserve some modularity:
(1) Variables that are defined in .h files should continue to be defined
in those same .h files.
(2) There should be no new dependencies between GCC .h files. (The only
new dependency between non-GCC .h files is that libfuncs.h now
depends on hashtab.h.)
(3) Pass-specific static variables should be defined in pass-specific
.h files. Only the pass .c files and the main target-globals.c file
should need to include this .h file.
(4) Static variables for general infrastructure can go in
target structures related to that general infrastructure.
The "#define foo (...->x_foo)" line should stay in the .c
file _unless_ the value is both (a) generally useful and
(b) initialised up-front by target_reinit rather than
lazily on first use.
That's not to say the way we divide things up now is perfect. I'd just
like to keep any refactoring decisions separate from this series, which is
simply trying to speed up something that we already do. It would certainly
be possible to move definitions around later if that seems worthwhile.
The series is divided into three parts. The first part goes through
each variable under the control of target_reinit and puts it in a
target structure. The second part goes through some pieces that
target_reinit misses but shouldn't miss. The third part makes
the MIPS port use the new infrastructure for switching MIPS16 mode
on and off.
In an attempt to reduce the amount of spam I'm generating, I'll just
post the first few patches of the series now. If there are any
objections to the way those patches are implemented, the same comments
would likely apply to the rest.
Bootstrapped & regression-tested on x86_64-linux-gnu. Also tested
on mipsisa64-elfoabi with -mflip-mips16.