Add flags that allow for optional inclusion of stack frame info tables and info tables with defaulted source locations in the info table map

Closed Finley McIlwaine requested to merge wip/t23702 into master

Fixes #23702 (closed)

Introduces -finfo-table-map-with-stack and -finfo-table-map-with-fallback flags, implied by -finfo-table-map. Respectively, these flags result in the inclusion of STACK info tables and info tables for which no provenance exists in the program source in the info table map. The negative versions of these flags (-fno-info-table-map-with-stack, -fno-info-table-map-with-fallback) are useful for reducing the size of build results with info table profiling information.

In testing on the Agda codebase, omitting STACK and fallback tables shrunk build results by about 10% (118M down to 105M). This was tested by running

cabal build Agda:exe:agda --ghc-options="-Wno-x-partial -Wno-deprecations -finfo-table-map

and then

du -hc dist-newstyle/build/aarch64-osx/ghc-9.9.20230720/Agda-2.6.4/build/**/*.o

then repeating with -fno-info-table-map-with-stack and -fno-info-table-map-with-fallback.

This MR also significantly refactors the construction of the info table map, and derives an Ord instance for CmmInfoTable so it could be used as a key in a Data.Map.Map.

Edited by Finley McIlwaine

Merge request reports