Mike Stump <mikest...@comcast.net> writes: > On Dec 4, 2011, at 4:02 AM, Richard Sandiford <rdsandif...@googlemail.com> > wrote: >> A while back I added the target_globals structure, to allow a backend >> to switch between two very different ISA modes without paying the full >> target_reinit penalty each time. This made a huge difference to compile >> time, but had a drawback: the target_globals structure contained both >> GGC and non-GGC data. This meant that secondary target_globals structures >> like mips16_globals couldn't be saved correctly in PCH files. > >> + /* We are called in a context where the current MIPS16 vs. non-MIPS16 >> + setting should be irrelevant. The question then is: which setting >> + makes most sense at load time? >> + >> + The PCH is loaded before the first token is read. We should never >> + have switched into MIPS16 mode by that point, > > If there is any way to say: > > #pragma mips16 > > to globally switch state into mips16 mode, then I believe the patch is > wrong.
The global switching of state happens when we start to compile a function, which means we must have seen a C token. The target_globals state is non-MIPS16 up until then, even if -mips16 is passed on the command line, or if the command line is changed by pragmas. Besides, I think: #pragma GCC optimize ...X... #include "foo.h" breaks the PCH contract if X is incompatible with the flags used at the beginning of the PCH compilation. Richard