{-# LANGUAGE TypeFamilies #-} {-# LANGUAGE FlexibleContexts #-} module Futhark.Pass.FirstOrderTransform ( firstOrderTransform ) where import Futhark.Transform.FirstOrderTransform (FirstOrderLore, transformFunDef, transformStms) import Futhark.Representation.SOACS (SOACS, scopeOf) import Futhark.Pass firstOrderTransform :: FirstOrderLore lore => Pass SOACS lore firstOrderTransform :: Pass SOACS lore firstOrderTransform = String -> String -> (Prog SOACS -> PassM (Prog lore)) -> Pass SOACS lore forall fromlore tolore. String -> String -> (Prog fromlore -> PassM (Prog tolore)) -> Pass fromlore tolore Pass String "first order transform" String "Transform all SOACs to for-loops." ((Prog SOACS -> PassM (Prog lore)) -> Pass SOACS lore) -> (Prog SOACS -> PassM (Prog lore)) -> Pass SOACS lore forall a b. (a -> b) -> a -> b $ (Stms SOACS -> PassM (Stms lore)) -> (Stms lore -> FunDef SOACS -> PassM (FunDef lore)) -> Prog SOACS -> PassM (Prog lore) forall fromlore tolore. (Stms fromlore -> PassM (Stms tolore)) -> (Stms tolore -> FunDef fromlore -> PassM (FunDef tolore)) -> Prog fromlore -> PassM (Prog tolore) intraproceduralTransformationWithConsts Stms SOACS -> PassM (Stms lore) forall (m :: * -> *) tolore. (MonadFreshNames m, FirstOrderLore tolore) => Stms SOACS -> m (Stms tolore) transformStms (Scope lore -> FunDef SOACS -> PassM (FunDef lore) forall (m :: * -> *) tolore. (MonadFreshNames m, FirstOrderLore tolore) => Scope tolore -> FunDef SOACS -> m (FunDef tolore) transformFunDef (Scope lore -> FunDef SOACS -> PassM (FunDef lore)) -> (Stms lore -> Scope lore) -> Stms lore -> FunDef SOACS -> PassM (FunDef lore) forall b c a. (b -> c) -> (a -> b) -> a -> c . Stms lore -> Scope lore forall lore a. Scoped lore a => a -> Scope lore scopeOf)