summaryrefslogtreecommitdiff
path: root/compiler/GHC/CmmToAsm/Config.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/CmmToAsm/Config.hs')
-rw-r--r--compiler/GHC/CmmToAsm/Config.hs32
1 files changed, 32 insertions, 0 deletions
diff --git a/compiler/GHC/CmmToAsm/Config.hs b/compiler/GHC/CmmToAsm/Config.hs
new file mode 100644
index 0000000000..2df3655948
--- /dev/null
+++ b/compiler/GHC/CmmToAsm/Config.hs
@@ -0,0 +1,32 @@
+-- | Native code generator configuration
+module GHC.CmmToAsm.Config
+ ( NCGConfig(..)
+ , ncgWordWidth
+ )
+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 = case platformWordSize (ncgPlatform config) of
+ PW4 -> W32
+ PW8 -> W64