{-# LANGUAGE FlexibleContexts #-}
module Futhark.Pass.Simplify
  ( simplify
  , simplifySOACS
  , simplifyKernels
  , simplifyExplicitMemory
  )
  where

import qualified Futhark.Representation.SOACS as R
import qualified Futhark.Representation.SOACS.Simplify as R
import qualified Futhark.Representation.Kernels as R
import qualified Futhark.Representation.Kernels.Simplify as R
import qualified Futhark.Representation.ExplicitMemory as R
import qualified Futhark.Representation.ExplicitMemory.Simplify as R

import Futhark.Pass
import Futhark.Representation.AST.Syntax

simplify :: (Prog lore -> PassM (Prog lore))
         -> Pass lore lore
simplify :: (Prog lore -> PassM (Prog lore)) -> Pass lore lore
simplify = String
-> String -> (Prog lore -> PassM (Prog lore)) -> Pass lore lore
forall fromlore tolore.
String
-> String
-> (Prog fromlore -> PassM (Prog tolore))
-> Pass fromlore tolore
Pass String
"simplify" String
"Perform simple enabling optimisations."

simplifySOACS :: Pass R.SOACS R.SOACS
simplifySOACS :: Pass SOACS SOACS
simplifySOACS = (Prog SOACS -> PassM (Prog SOACS)) -> Pass SOACS SOACS
forall lore. (Prog lore -> PassM (Prog lore)) -> Pass lore lore
simplify Prog SOACS -> PassM (Prog SOACS)
R.simplifySOACS

simplifyKernels :: Pass R.Kernels R.Kernels
simplifyKernels :: Pass Kernels Kernels
simplifyKernels = (Prog Kernels -> PassM (Prog Kernels)) -> Pass Kernels Kernels
forall lore. (Prog lore -> PassM (Prog lore)) -> Pass lore lore
simplify Prog Kernels -> PassM (Prog Kernels)
R.simplifyKernels

simplifyExplicitMemory :: Pass R.ExplicitMemory R.ExplicitMemory
simplifyExplicitMemory :: Pass ExplicitMemory ExplicitMemory
simplifyExplicitMemory = (Prog ExplicitMemory -> PassM (Prog ExplicitMemory))
-> Pass ExplicitMemory ExplicitMemory
forall lore. (Prog lore -> PassM (Prog lore)) -> Pass lore lore
simplify Prog ExplicitMemory -> PassM (Prog ExplicitMemory)
R.simplifyExplicitMemory