summaryrefslogtreecommitdiff
path: root/compiler/GHC/CmmToAsm/Config.hs
blob: 1ed66f47d31c87ab1d0b9743749f7194cab7a61f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
-- | Native code generator configuration
module GHC.CmmToAsm.Config
   ( NCGConfig(..)
   , ncgWordWidth
   , platformWordWidth
   )
where

import GhcPrelude
import GHC.Platform
import GHC.Cmm.Type (Width(..))

-- | Native code generator configuration
data NCGConfig = NCGConfig
   { ncgPlatform            :: !Platform    -- ^ Target platform
   , ncgProcAlignment       :: !(Maybe Int) -- ^ Mandatory proc alignment
   , ncgDebugLevel          :: !Int         -- ^ Debug level
   , ncgExternalDynamicRefs :: !Bool        -- ^ Generate code to link against dynamic libraries
   , ncgPIC                 :: !Bool        -- ^ Enable Position-Independent Code
   , ncgSplitSections       :: !Bool        -- ^ Split sections
   , ncgSpillPreallocSize   :: !Int         -- ^ Size in bytes of the pre-allocated spill space on the C stack
   , ncgRegsIterative       :: !Bool
   , ncgAsmLinting          :: !Bool        -- ^ Perform ASM linting pass
   , ncgDumpRegAllocStages  :: !Bool
   , ncgDumpAsmStats        :: !Bool
   , ncgDumpAsmConflicts    :: !Bool
   }

-- | Return Word size
ncgWordWidth :: NCGConfig -> Width
ncgWordWidth config = platformWordWidth (ncgPlatform config)

-- | Return Word size
platformWordWidth :: Platform -> Width
platformWordWidth platform = case platformWordSize platform of
   PW4 -> W32
   PW8 -> W64