never executed always true always false
    1 -- | Native code generator configuration
    2 module GHC.CmmToAsm.Config
    3    ( NCGConfig(..)
    4    , ncgWordWidth
    5    , ncgSpillPreallocSize
    6    , platformWordWidth
    7    )
    8 where
    9 
   10 import GHC.Prelude
   11 import GHC.Platform
   12 import GHC.Cmm.Type (Width(..))
   13 import GHC.CmmToAsm.CFG.Weight
   14 import GHC.Unit.Module (Module)
   15 import GHC.Utils.Outputable
   16 
   17 -- | Native code generator configuration
   18 data NCGConfig = NCGConfig
   19    { ncgPlatform              :: !Platform        -- ^ Target platform
   20    , ncgAsmContext            :: !SDocContext     -- ^ Context for ASM code generation
   21    , ncgThisModule            :: !Module          -- ^ The name of the module we are currently compiling
   22    , ncgProcAlignment         :: !(Maybe Int)     -- ^ Mandatory proc alignment
   23    , ncgExternalDynamicRefs   :: !Bool            -- ^ Generate code to link against dynamic libraries
   24    , ncgPIC                   :: !Bool            -- ^ Enable Position-Independent Code
   25    , ncgInlineThresholdMemcpy :: !Word            -- ^ If inlining `memcpy` produces less than this threshold (in pseudo-instruction unit), do it
   26    , ncgInlineThresholdMemset :: !Word            -- ^ Ditto for `memset`
   27    , ncgSplitSections         :: !Bool            -- ^ Split sections
   28    , ncgRegsIterative         :: !Bool
   29    , ncgRegsGraph             :: !Bool
   30    , ncgAsmLinting            :: !Bool            -- ^ Perform ASM linting pass
   31    , ncgDoConstantFolding     :: !Bool            -- ^ Perform CMM constant folding
   32    , ncgSseVersion            :: Maybe SseVersion -- ^ (x86) SSE instructions
   33    , ncgBmiVersion            :: Maybe BmiVersion -- ^ (x86) BMI instructions
   34    , ncgDumpRegAllocStages    :: !Bool
   35    , ncgDumpAsmStats          :: !Bool
   36    , ncgDumpAsmConflicts      :: !Bool
   37    , ncgCfgWeights            :: !Weights         -- ^ CFG edge weights
   38    , ncgCfgBlockLayout        :: !Bool            -- ^ Use CFG based block layout algorithm
   39    , ncgCfgWeightlessLayout   :: !Bool            -- ^ Layout based on last instruction per block.
   40    , ncgDwarfEnabled          :: !Bool            -- ^ Enable Dwarf generation
   41    , ncgDwarfUnwindings       :: !Bool            -- ^ Enable unwindings
   42    , ncgDwarfStripBlockInfo   :: !Bool            -- ^ Strip out block information from generated Dwarf
   43    , ncgExposeInternalSymbols :: !Bool            -- ^ Expose symbol table entries for internal symbols
   44    , ncgDwarfSourceNotes      :: !Bool            -- ^ Enable GHC-specific source note DIEs
   45    , ncgCmmStaticPred         :: !Bool            -- ^ Enable static control-flow prediction
   46    , ncgEnableShortcutting    :: !Bool            -- ^ Enable shortcutting (don't jump to blocks only containing a jump)
   47    , ncgComputeUnwinding      :: !Bool            -- ^ Compute block unwinding tables
   48    , ncgEnableDeadCodeElimination :: !Bool        -- ^ Whether to enable the dead-code elimination
   49    }
   50 
   51 -- | Return Word size
   52 ncgWordWidth :: NCGConfig -> Width
   53 ncgWordWidth config = platformWordWidth (ncgPlatform config)
   54 
   55 -- | Size in bytes of the pre-allocated spill space on the C stack
   56 ncgSpillPreallocSize :: NCGConfig -> Int
   57 ncgSpillPreallocSize config = pc_RESERVED_C_STACK_BYTES (platformConstants (ncgPlatform config))
   58 
   59 -- | Return Word size
   60 platformWordWidth :: Platform -> Width
   61 platformWordWidth platform = case platformWordSize platform of
   62    PW4 -> W32
   63    PW8 -> W64