This is a continuation of the previous work (f3cb8c7c) where we moved ModIface generation after code generation (after Cmm transformations are done, before final code generation). This allowed updating interface files with the code gen info. The information would then be available to importing modules.
However because it didn't update ModDetails (used by batch mode) the information was only available to importing modules in one-shot mode (an oversight).
With this patch we generate ModIface and ModDetails at the same place, allowing updating/generating both with the code gen info.
This reverts some of the changes in f3cb8c7c as they're no longer needed. Specifically PartialModIface stuff is now gone; we keep the parts we need in ModGuts for ModDetails and ModIface generation in the new type CgModGuts. CgModGuts is basically ModGuts but lacking
- mg_loc :: SrcSpan
- mg_rules :: [CoreRule]
- mg_binds :: CoreProgram
- mg_foreign :: ForeignStubs
- mg_foreign_files :: [(ForeignSrcLang, FilePath)]
- mg_modBreaks :: Maybe ModBreaks
- mg_inst_env :: InstEnv
- mg_fam_inst_env :: FamInstEnv
mg_binds part is especially important to keep the residency low.
Note to reviewers
Important bits are:
- HscTypes.hs: new type CgModGuts and new fields in CgGuts
- TidyPgm.hs: tidyProgram now only returns CgGuts (previously CgGuts + ModDetails)
- MkIface.hs: mkIface now returns ModIface + ModDetails (previously only ModIface)
Rest is just plumbing.