module Parsley.Internal.Opt (module Parsley.Internal.Opt) where

import Data.Ratio ((%))

on, off :: Bool
on :: Bool
on = Bool
True
off :: Bool
off = Bool
False

defaultPrimaryInlineThreshold :: Maybe Rational
defaultPrimaryInlineThreshold :: Maybe Rational
defaultPrimaryInlineThreshold = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Integer
13 forall a. Integral a => a -> a -> Ratio a
% Integer
10 forall a. Num a => a -> a -> a
* {- Occurrence Bias -} Rational
3

defaultSecondaryInlineThreshold :: Maybe Rational
defaultSecondaryInlineThreshold :: Maybe Rational
defaultSecondaryInlineThreshold = forall a. a -> Maybe a
Just forall a b. (a -> b) -> a -> b
$ Integer
13 forall a. Integral a => a -> a -> Ratio a
% Integer
10

data Flags = Flags { Flags -> Bool
lawBasedOptimisations    :: !Bool
                   , Flags -> Bool
termNormalisation        :: !Bool
                   , Flags -> Maybe Rational
primaryInlineThreshold   :: !(Maybe Rational)
                   , Flags -> Maybe Rational
secondaryInlineThreshold :: !(Maybe Rational)
                   -- TODO: merge these together
                   , Flags -> Bool
lengthCheckFactoring     :: !Bool
                   , Flags -> Bool
leadCharFactoring        :: !Bool
                   , Flags -> Bool
factorAheadOfJoins       :: !Bool
                   , Flags -> Bool
reclaimInput             :: !Bool
                   , Flags -> Bool
deduceFailPath           :: !Bool
                   --, closeFreeRegisters       :: !Bool
                   }

none, fast, full :: Flags
none :: Flags
none = Flags { lawBasedOptimisations :: Bool
lawBasedOptimisations    = Bool
off
             , termNormalisation :: Bool
termNormalisation        = Bool
off
             , primaryInlineThreshold :: Maybe Rational
primaryInlineThreshold   = forall a. a -> Maybe a
Just Rational
0
             , secondaryInlineThreshold :: Maybe Rational
secondaryInlineThreshold = forall a. a -> Maybe a
Just Rational
0
             , lengthCheckFactoring :: Bool
lengthCheckFactoring     = Bool
off
             , leadCharFactoring :: Bool
leadCharFactoring        = Bool
off
             , factorAheadOfJoins :: Bool
factorAheadOfJoins       = Bool
off
             , reclaimInput :: Bool
reclaimInput             = Bool
off
             , deduceFailPath :: Bool
deduceFailPath           = Bool
off
             --, closeFreeRegisters       = off
             }
fast :: Flags
fast = Flags
full  --{ }
full :: Flags
full = Flags { lawBasedOptimisations :: Bool
lawBasedOptimisations    = Bool
on
             , termNormalisation :: Bool
termNormalisation        = Bool
on
             , primaryInlineThreshold :: Maybe Rational
primaryInlineThreshold   = Maybe Rational
defaultPrimaryInlineThreshold
             , secondaryInlineThreshold :: Maybe Rational
secondaryInlineThreshold = Maybe Rational
defaultSecondaryInlineThreshold
             , lengthCheckFactoring :: Bool
lengthCheckFactoring     = Bool
on
             , leadCharFactoring :: Bool
leadCharFactoring        = Bool
on
             , factorAheadOfJoins :: Bool
factorAheadOfJoins       = Bool
on
             , reclaimInput :: Bool
reclaimInput             = Bool
on
             , deduceFailPath :: Bool
deduceFailPath           = Bool
on
             --, closeFreeRegisters       = on
             }