module Futhark.Compiler.Config
  ( FutharkConfig (..),
    newFutharkConfig,
    Verbosity (..),
  )
where

import Futhark.IR
import Futhark.Pipeline

-- | The compiler configuration.  This only contains options related
-- to core compiler functionality, such as reading the initial program
-- and running passes.  Options related to code generation are handled
-- elsewhere.
data FutharkConfig = FutharkConfig
  { FutharkConfig -> (Verbosity, Maybe FilePath)
futharkVerbose :: (Verbosity, Maybe FilePath),
    -- | Warn if True.
    FutharkConfig -> Bool
futharkWarn :: Bool,
    -- | If true, error on any warnings.
    FutharkConfig -> Bool
futharkWerror :: Bool,
    -- | If True, ignore @unsafe@.
    FutharkConfig -> Bool
futharkSafe :: Bool,
    -- | Additional functions that should be exposed as entry points.
    FutharkConfig -> [Name]
futharkEntryPoints :: [Name],
    -- | If false, disable type-checking
    FutharkConfig -> Bool
futharkTypeCheck :: Bool
  }

-- | The default compiler configuration.
newFutharkConfig :: FutharkConfig
newFutharkConfig :: FutharkConfig
newFutharkConfig =
  FutharkConfig :: (Verbosity, Maybe FilePath)
-> Bool -> Bool -> Bool -> [Name] -> Bool -> FutharkConfig
FutharkConfig
    { futharkVerbose :: (Verbosity, Maybe FilePath)
futharkVerbose = (Verbosity
NotVerbose, Maybe FilePath
forall a. Maybe a
Nothing),
      futharkWarn :: Bool
futharkWarn = Bool
True,
      futharkWerror :: Bool
futharkWerror = Bool
False,
      futharkSafe :: Bool
futharkSafe = Bool
False,
      futharkEntryPoints :: [Name]
futharkEntryPoints = [],
      futharkTypeCheck :: Bool
futharkTypeCheck = Bool
True
    }