Add flags to always write and read codegen-related pragmas from interfaces
As discussed at GHC call a few weeks ago: it'd be good to have two new flags: (names subject to change)
- -fwrite-codegen-pragmas
- -fread-codegen-pragmas
For writing codegen pragmas to the interface files and reading them when loading, even in -O0 or with -fignore-interface-pragmas/-fomit-interface-pragmas.
(Codegen pragmas are currently only the CafInfos, with #17004 (closed)/!2842 (closed) we'll have one more pragma for LFInfos)
Motivation: These pragmas (at least CafInfos, not sure about LFInfos) actually cause generating less code, which reduces compiler allocations in some cases (as observed in !2847 (comment 259112)). Not sure if allocating less causes shorter compile times, but it's possible that they do. It'd be good to have a flag to experiment with this.
The disadvantage is that with these flags there will be more cases where interface of an imported module changes, so there will be more recompilations. It's possible that shorter compile times buy us more than we lose by extra recompilations.
(Easy task, marking as newcomer)