summaryrefslogtreecommitdiff
path: root/testsuite/tests/regalloc
diff options
context:
space:
mode:
authorMatthew Pickering <matthewtpickering@gmail.com>2020-11-18 11:36:07 +0000
committerMatthew Pickering <matthewtpickering@gmail.com>2021-03-03 19:09:34 +0000
commit4b297979d25740d31241a9000e36068db112545a (patch)
treee2e40fa7922fb4a91125c73fcbae04e7a6a66f73 /testsuite/tests/regalloc
parent8402ea951b31e01a925ca691747d1757eaf31fcc (diff)
downloadhaskell-4b297979d25740d31241a9000e36068db112545a.tar.gz
Add -finfo-table-map which maps info tables to source positions
This new flag embeds a lookup table from the address of an info table to information about that info table. The main interface for consulting the map is the `lookupIPE` C function > InfoProvEnt * lookupIPE(StgInfoTable *info) The `InfoProvEnt` has the following structure: > typedef struct InfoProv_{ > char * table_name; > char * closure_desc; > char * ty_desc; > char * label; > char * module; > char * srcloc; > } InfoProv; > > typedef struct InfoProvEnt_ { > StgInfoTable * info; > InfoProv prov; > struct InfoProvEnt_ *link; > } InfoProvEnt; The source positions are approximated in a similar way to the source positions for DWARF debugging information. They are only approximate but in our experience provide a good enough hint about where the problem might be. It is therefore recommended to use this flag in conjunction with `-g<n>` for more accurate locations. The lookup table is also emitted into the eventlog when it is available as it is intended to be used with the `-hi` profiling mode. Using this flag will significantly increase the size of the resulting object file but only by a factor of 2-3x in our experience.
Diffstat (limited to 'testsuite/tests/regalloc')
-rw-r--r--testsuite/tests/regalloc/regalloc_unit_tests.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/testsuite/tests/regalloc/regalloc_unit_tests.hs b/testsuite/tests/regalloc/regalloc_unit_tests.hs
index afc6fa0fca..cc4dcf7f9b 100644
--- a/testsuite/tests/regalloc/regalloc_unit_tests.hs
+++ b/testsuite/tests/regalloc/regalloc_unit_tests.hs
@@ -46,6 +46,7 @@ import GHC.Driver.Errors
import GHC.Utils.Error
import GHC.Utils.Outputable
import GHC.Types.Basic
+import GHC.Unit.Home
import GHC.Data.Stream as Stream (collect, yield)
@@ -114,7 +115,8 @@ compileCmmForRegAllocStats logger dflags' cmmFile ncgImplF us = do
hscEnv <- newHscEnv dflags
-- parse the cmm file and output any warnings or errors
- (warnings, errors, parsedCmm) <- parseCmmFile dflags (hsc_home_unit hscEnv) cmmFile
+ let fake_mod = mkHomeModule (hsc_home_unit hscEnv) (mkModuleName "fake")
+ (warnings, errors, parsedCmm) <- parseCmmFile dflags fake_mod (hsc_home_unit hscEnv) cmmFile
let warningMsgs = fmap pprWarning warnings
errorMsgs = fmap pprError errors
@@ -122,7 +124,7 @@ compileCmmForRegAllocStats logger dflags' cmmFile ncgImplF us = do
mapM_ (printBagOfErrors logger dflags) [warningMsgs, errorMsgs]
let initTopSRT = emptySRT thisMod
- cmmGroup <- fmap snd $ cmmPipeline hscEnv initTopSRT $ fromJust parsedCmm
+ cmmGroup <- fmap snd $ cmmPipeline hscEnv initTopSRT $ fst $ fromJust parsedCmm
rawCmms <- cmmToRawCmm logger dflags (Stream.yield cmmGroup)