diff options
author | Sylvain Henry <sylvain@haskus.fr> | 2020-03-31 12:38:56 +0200 |
---|---|---|
committer | Sylvain Henry <sylvain@haskus.fr> | 2020-07-31 19:32:09 +0200 |
commit | 56a7c19337c5b2aa21d521a6d7c965174ec8379b (patch) | |
tree | d280483bcf3e2c34d1761b0dc9ec09b863026073 /compiler/GHC/HsToCore/Coverage.hs | |
parent | 380638a33691ba43fdcd2e18bca636750e5f66f1 (diff) | |
download | haskell-56a7c19337c5b2aa21d521a6d7c965174ec8379b.tar.gz |
Refactor CLabel pretty-printing
Pretty-printing CLabel relies on sdocWithDynFlags that we want to remove
(#10143, #17957). It uses it to query the backend and the platform.
This patch exposes Clabel ppr functions specialised for each backend so
that backend code can directly use them.
Diffstat (limited to 'compiler/GHC/HsToCore/Coverage.hs')
-rw-r--r-- | compiler/GHC/HsToCore/Coverage.hs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/GHC/HsToCore/Coverage.hs b/compiler/GHC/HsToCore/Coverage.hs index b52b4ac209..fefbf2b707 100644 --- a/compiler/GHC/HsToCore/Coverage.hs +++ b/compiler/GHC/HsToCore/Coverage.hs @@ -1315,9 +1315,9 @@ static void hpc_init_Main(void) hs_hpc_module("Main",8,1150288664,_hpc_tickboxes_Main_hpc);} -} -hpcInitCode :: Module -> HpcInfo -> SDoc -hpcInitCode _ (NoHpcInfo {}) = Outputable.empty -hpcInitCode this_mod (HpcInfo tickCount hashNo) +hpcInitCode :: DynFlags -> Module -> HpcInfo -> SDoc +hpcInitCode _ _ (NoHpcInfo {}) = Outputable.empty +hpcInitCode dflags this_mod (HpcInfo tickCount hashNo) = vcat [ text "static void hpc_init_" <> ppr this_mod <> text "(void) __attribute__((constructor));" @@ -1335,7 +1335,9 @@ hpcInitCode this_mod (HpcInfo tickCount hashNo) ]) ] where - tickboxes = ppr (mkHpcTicksLabel $ this_mod) + platform = targetPlatform dflags + bcknd = backend dflags + tickboxes = pprCLabel bcknd platform (mkHpcTicksLabel $ this_mod) module_name = hcat (map (text.charToC) $ BS.unpack $ bytesFS (moduleNameFS (moduleName this_mod))) |