Add a prepare_pch_save target hook

Mike Stump mikestump@comcast.net
Sun Dec 4 16:53:00 GMT 2011


On Dec 4, 2011, at 4:02 AM, Richard Sandiford <rdsandiford@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 pch file can have that directive in it to put the compiler into that mode, with all the resulting state that mode entails.  Now, if you store that one bit into the pch file, say, via a GTY int flag, then on reload, you can examine that flag, and enter that state.  Bear in mind, this 'slows' pch load time.



More information about the Gcc-patches mailing list