+optionallyConvertAndOrCPS :: DynFlags -> [Cmm] -> IO [Cmm]
+optionallyConvertAndOrCPS dflags cmms =
+ do -------- Optionally convert to and from zipper ------
+ cmms <- if dopt Opt_ConvertToZipCfgAndBack dflags
+ then mapM (testCmmConversion dflags) cmms
+ else return cmms
+ --------- Optionally convert to CPS (MDA) -----------
+ cmms <- if not (dopt Opt_ConvertToZipCfgAndBack dflags) &&
+ dopt Opt_RunCPSZ dflags
+ then cmmCPS dflags cmms
+ else return cmms
+ return cmms
+
+
+testCmmConversion :: DynFlags -> Cmm -> IO Cmm
+testCmmConversion dflags cmm =
+ do showPass dflags "CmmToCmm"
+ dumpIfSet_dyn dflags Opt_D_dump_cvt_cmm "C-- pre-conversion" (ppr cmm)
+ --continuationC <- cmmCPS dflags abstractC >>= cmmToRawCmm
+ us <- mkSplitUniqSupply 'C'
+ let cfopts = runTx $ runCmmOpts cmmCfgOptsZ
+ let cvtm = do g <- cmmToZgraph cmm
+ return $ cfopts g
+ let zgraph = initUs_ us cvtm
+ cps_zgraph <- protoCmmCPSZ dflags zgraph
+ let chosen_graph = if dopt Opt_RunCPSZ dflags then cps_zgraph else zgraph
+ dumpIfSet_dyn dflags Opt_D_dump_cmmz "C-- Zipper Graph" (ppr chosen_graph)
+ showPass dflags "Convert from Z back to Cmm"
+ let cvt = cmmOfZgraph $ cfopts $ chosen_graph
+ dumpIfSet_dyn dflags Opt_D_dump_cvt_cmm "C-- post-conversion" (ppr cvt)
+ return cvt
+ -- return cmm -- don't use the conversion
+
+myParseModule :: DynFlags -> FilePath -> Maybe StringBuffer
+ -> IO (Either ErrMsg (Located (HsModule RdrName)))