module GHC.CmmToAsm.Config
( NCGConfig(..)
, ncgWordWidth
, ncgSpillPreallocSize
, platformWordWidth
)
where
import GHC.Prelude
import GHC.Platform
import GHC.Cmm.Type (Width(..))
import GHC.CmmToAsm.CFG.Weight
import GHC.Unit.Module (Module)
import GHC.Utils.Outputable
data NCGConfig = NCGConfig
{ ncgPlatform :: !Platform
, ncgAsmContext :: !SDocContext
, ncgThisModule :: !Module
, ncgProcAlignment :: !(Maybe Int)
, ncgExternalDynamicRefs :: !Bool
, ncgPIC :: !Bool
, ncgInlineThresholdMemcpy :: !Word
, ncgInlineThresholdMemset :: !Word
, ncgSplitSections :: !Bool
, ncgRegsIterative :: !Bool
, ncgAsmLinting :: !Bool
, ncgDoConstantFolding :: !Bool
, ncgSseVersion :: Maybe SseVersion
, ncgBmiVersion :: Maybe BmiVersion
, ncgDumpRegAllocStages :: !Bool
, ncgDumpAsmStats :: !Bool
, ncgDumpAsmConflicts :: !Bool
, ncgCfgWeights :: !Weights
, ncgCfgBlockLayout :: !Bool
, ncgCfgWeightlessLayout :: !Bool
, ncgDwarfEnabled :: !Bool
, ncgDwarfUnwindings :: !Bool
, ncgDwarfStripBlockInfo :: !Bool
, ncgExposeInternalSymbols :: !Bool
, ncgDwarfSourceNotes :: !Bool
}
ncgWordWidth :: NCGConfig -> Width
ncgWordWidth config = platformWordWidth (ncgPlatform config)
ncgSpillPreallocSize :: NCGConfig -> Int
ncgSpillPreallocSize config = pc_RESERVED_C_STACK_BYTES (platformConstants (ncgPlatform config))
platformWordWidth :: Platform -> Width
platformWordWidth platform = case platformWordSize platform of
PW4 -> W32
PW8 -> W64