summaryrefslogtreecommitdiff
path: root/compiler/GHC/Utils/Asm.hs
blob: 5b8b209f5ea9f3b75b8a8c1fdafc02807e6534fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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