summaryrefslogtreecommitdiff
path: root/compiler/utils/AsmUtils.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-03-01 16:37:59 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-03-15 10:57:10 -0400
commit2e82465fff5851f00449131fdc8bacd3ca95f90f (patch)
treecb8c8f57b1c1bf9950c514d91286b3a5463778f4 /compiler/utils/AsmUtils.hs
parentdd6ffe6be742cf3ec98406704fef53ad86cc1560 (diff)
downloadhaskell-2e82465fff5851f00449131fdc8bacd3ca95f90f.tar.gz
Refactor CmmToAsm (disentangle DynFlags)
This patch disentangles a bit more DynFlags from the native code generator (CmmToAsm). In more details: - add a new NCGConfig datatype in GHC.CmmToAsm.Config which contains the configuration of a native code generation session - explicitly pass NCGConfig/Platform arguments when necessary - as a consequence `sdocWithPlatform` is gone and there are only a few `sdocWithDynFlags` left - remove the use of `unsafeGlobalDynFlags` from GHC.CmmToAsm.CFG - remove `sdocDebugLevel` (now we pass the debug level via NCGConfig) There are still some places where DynFlags is used, especially because of pretty-printing (CLabel), because of Cmm helpers (such as `cmmExprType`) and because of `Outputable` instance for the instructions. These are left for future refactoring as this patch is already big.
Diffstat (limited to 'compiler/utils/AsmUtils.hs')
-rw-r--r--compiler/utils/AsmUtils.hs7
1 files changed, 4 insertions, 3 deletions
diff --git a/compiler/utils/AsmUtils.hs b/compiler/utils/AsmUtils.hs
index 591b53dc31..d3393d71e2 100644
--- a/compiler/utils/AsmUtils.hs
+++ b/compiler/utils/AsmUtils.hs
@@ -12,9 +12,10 @@ import GHC.Platform
import Outputable
-- | Generate a section type (e.g. @\@progbits@). See #13937.
-sectionType :: String -- ^ section type
- -> SDoc -- ^ pretty assembler fragment
-sectionType ty = sdocWithPlatform $ \platform ->
+sectionType :: Platform -- ^ Target platform
+ -> String -- ^ section type
+ -> SDoc -- ^ pretty assembler fragment
+sectionType platform ty =
case platformArch platform of
ArchARM{} -> char '%' <> text ty
_ -> char '@' <> text ty