summaryrefslogtreecommitdiff
path: root/compiler/GHC/Utils/Asm.hs
diff options
context:
space:
mode:
authorSylvain Henry <sylvain@haskus.fr>2020-04-20 16:54:38 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2020-04-26 13:55:14 -0400
commitaf332442123878c1b61d236dce46418efcbe8750 (patch)
treeec4b332843cdd4fedb4aa60b11b7b8dba82a0764 /compiler/GHC/Utils/Asm.hs
parentb0fbfc7582fb81314dc28a056536737fb5eeaa6e (diff)
downloadhaskell-af332442123878c1b61d236dce46418efcbe8750.tar.gz
Modules: Utils and Data (#13009)
Update Haddock submodule Metric Increase: haddock.compiler
Diffstat (limited to 'compiler/GHC/Utils/Asm.hs')
-rw-r--r--compiler/GHC/Utils/Asm.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/compiler/GHC/Utils/Asm.hs b/compiler/GHC/Utils/Asm.hs
new file mode 100644
index 0000000000..5b8b209f5e
--- /dev/null
+++ b/compiler/GHC/Utils/Asm.hs
@@ -0,0 +1,21 @@
+-- | Various utilities used in generating assembler.
+--
+-- These are used not only by the native code generator, but also by the
+-- GHC.Driver.Pipeline
+module GHC.Utils.Asm
+ ( sectionType
+ ) where
+
+import GHC.Prelude
+
+import GHC.Platform
+import GHC.Utils.Outputable
+
+-- | Generate a section type (e.g. @\@progbits@). See #13937.
+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