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
   { NCGConfig -> Platform
ncgPlatform              :: !Platform        
   , NCGConfig -> SDocContext
ncgAsmContext            :: !SDocContext     
   , NCGConfig -> Module
ncgThisModule            :: !Module          
   , NCGConfig -> Maybe Int
ncgProcAlignment         :: !(Maybe Int)     
   , NCGConfig -> Bool
ncgExternalDynamicRefs   :: !Bool            
   , NCGConfig -> Bool
ncgPIC                   :: !Bool            
   , NCGConfig -> Word
ncgInlineThresholdMemcpy :: !Word            
   , NCGConfig -> Word
ncgInlineThresholdMemset :: !Word            
   , NCGConfig -> Bool
ncgSplitSections         :: !Bool            
   , NCGConfig -> Bool
ncgRegsIterative         :: !Bool
   , NCGConfig -> Bool
ncgAsmLinting            :: !Bool            
   , NCGConfig -> Bool
ncgDoConstantFolding     :: !Bool            
   , NCGConfig -> Maybe SseVersion
ncgSseVersion            :: Maybe SseVersion 
   , NCGConfig -> Maybe BmiVersion
ncgBmiVersion            :: Maybe BmiVersion 
   , NCGConfig -> Bool
ncgDumpRegAllocStages    :: !Bool
   , NCGConfig -> Bool
ncgDumpAsmStats          :: !Bool
   , NCGConfig -> Bool
ncgDumpAsmConflicts      :: !Bool
   , NCGConfig -> Weights
ncgCfgWeights            :: !Weights         
   , NCGConfig -> Bool
ncgCfgBlockLayout        :: !Bool            
   , NCGConfig -> Bool
ncgCfgWeightlessLayout   :: !Bool            
   , NCGConfig -> Bool
ncgDwarfEnabled          :: !Bool            
   , NCGConfig -> Bool
ncgDwarfUnwindings       :: !Bool            
   , NCGConfig -> Bool
ncgDwarfStripBlockInfo   :: !Bool            
   , NCGConfig -> Bool
ncgExposeInternalSymbols :: !Bool            
   , NCGConfig -> Bool
ncgDwarfSourceNotes      :: !Bool            
   }
ncgWordWidth :: NCGConfig -> Width
ncgWordWidth :: NCGConfig -> Width
ncgWordWidth NCGConfig
config = Platform -> Width
platformWordWidth (NCGConfig -> Platform
ncgPlatform NCGConfig
config)
ncgSpillPreallocSize :: NCGConfig -> Int
ncgSpillPreallocSize :: NCGConfig -> Int
ncgSpillPreallocSize NCGConfig
config = PlatformConstants -> Int
pc_RESERVED_C_STACK_BYTES (Platform -> PlatformConstants
platformConstants (NCGConfig -> Platform
ncgPlatform NCGConfig
config))
platformWordWidth :: Platform -> Width
platformWordWidth :: Platform -> Width
platformWordWidth Platform
platform = case Platform -> PlatformWordSize
platformWordSize Platform
platform of
   PlatformWordSize
PW4 -> Width
W32
   PlatformWordSize
PW8 -> Width
W64