+-------------------- Stuff for new code gen ---------------------
+
+tryNewCodeGen :: HscEnv -> Module -> [TyCon] -> [Module]
+ -> CollectedCCs
+ -> [(StgBinding,[(Id,[Id])])]
+ -> HpcInfo
+ -> IO [Cmm]
+tryNewCodeGen hsc_env this_mod data_tycons imported_mods
+ cost_centre_info stg_binds hpc_info
+ | not (dopt Opt_TryNewCodeGen (hsc_dflags hsc_env))
+ = return []
+ | otherwise
+ = do { let dflags = hsc_dflags hsc_env
+ ; prog <- StgCmm.codeGen dflags this_mod data_tycons imported_mods
+ cost_centre_info stg_binds hpc_info
+ ; dumpIfSet_dyn dflags Opt_D_dump_cmmz "Cmm produced by new codegen"
+ (pprCmms prog)
+
+ ; prog <- return $ map (runTx $ runCmmOpts cmmCfgOptsZ) prog
+ -- Control flow optimisation
+
+ ; prog <- mapM (protoCmmCPSZ hsc_env) prog
+ -- The main CPS conversion
+
+ ; prog <- return $ map (runTx $ runCmmOpts cmmCfgOptsZ) prog
+ -- Control flow optimisation, again
+
+ ; dumpIfSet_dyn dflags Opt_D_dump_cmmz "New Cmm"
+ (pprCmms prog)
+
+ ; return $ map cmmOfZgraph prog }
+
+