summaryrefslogtreecommitdiff
path: root/compiler/utils/AsmUtils.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/utils/AsmUtils.hs')
-rw-r--r--compiler/utils/AsmUtils.hs18
1 files changed, 18 insertions, 0 deletions
diff --git a/compiler/utils/AsmUtils.hs b/compiler/utils/AsmUtils.hs
new file mode 100644
index 0000000000..55f9d6d551
--- /dev/null
+++ b/compiler/utils/AsmUtils.hs
@@ -0,0 +1,18 @@
+-- | Various utilities used in generating assembler.
+--
+-- These are used not only by the native code generator, but also by the
+-- "DriverPipeline".
+module AsmUtils
+ ( sectionType
+ ) where
+
+import Platform
+import Outputable
+
+-- | Generate a section type (e.g. @\@progbits@). See #13937.
+sectionType :: String -- ^ section type
+ -> SDoc -- ^ pretty assembler fragment
+sectionType ty = sdocWithPlatform $ \platform ->
+ case platformArch platform of
+ ArchARM{} -> char '%' <> text ty
+ _ -> char '@' <> text ty