module Data.Array.Repa.Plugin.Pipeline
(vectoriserPipeline)
where
import Data.Array.Repa.Plugin.Pass.Dump
import Data.Array.Repa.Plugin.Pass.Lower
import GhcPlugins
vectoriserPipeline :: [CommandLineOption] -> [CoreToDo] -> [CoreToDo]
vectoriserPipeline options todos
| (before, (simp:after)) <- break isPreSimplifier todos
= before ++ [simp] ++ todoLower options ++ after ++ todoDump options
| otherwise
= todos ++ todoPreSimplifier ++ todoLower options ++ todoDump options
todoPreSimplifier :: [CoreToDo]
todoPreSimplifier
= [ CoreDoSimplify 10
SimplMode
{ sm_names = ["Vectorise", "PreSimplify"]
, sm_phase = InitialPhase
, sm_rules = True
, sm_eta_expand = True
, sm_inline = False
, sm_case_case = False } ]
todoLower :: [CommandLineOption] -> [CoreToDo]
todoLower options
= [ CoreDoPluginPass "Dump" (passDump options "1-dump")
, CoreDoPluginPass "Lower" (passLower options "2-lower") ]
todoDump :: [CommandLineOption] -> [CoreToDo]
todoDump options
= [ CoreDoPluginPass "Dump" (passDump options "3-final") ]
isPreSimplifier :: CoreToDo -> Bool
isPreSimplifier c
= case c of
CoreDoSimplify _ SimplMode { sm_phase = InitialPhase }
-> True
_ -> False