- getSplitUniqSupplyMn 'r' `thenMn` \ rn_uniqs -> -- renamer
- getSplitUniqSupplyMn 't' `thenMn` \ tc_uniqs -> -- typechecker
- getSplitUniqSupplyMn 'd' `thenMn` \ ds_uniqs -> -- desugarer
- getSplitUniqSupplyMn 's' `thenMn` \ sm_uniqs -> -- core-to-core simplifier
- getSplitUniqSupplyMn 'c' `thenMn` \ c2s_uniqs -> -- core-to-stg
- getSplitUniqSupplyMn 'g' `thenMn` \ st_uniqs -> -- stg-to-stg passes
- getSplitUniqSupplyMn 'f' `thenMn` \ fl_uniqs -> -- absC flattener
- getSplitUniqSupplyMn 'n' `thenMn` \ ncg_uniqs -> -- native-code generator
-
- -- ******* RENAMER
- show_pass "Renamer" `thenMn_`
-
- case builtinNameInfo
- of { (init_val_lookup_fn, init_tc_lookup_fn) ->
-
- case (renameModule (init_val_lookup_fn, init_tc_lookup_fn)
- absyn_tree
- rn_uniqs)
- of { (mod4, import_names, final_name_funs, rn_errs_bag) ->
+ mkSplitUniqSupply 'r' >>= \ rn_uniqs -> -- renamer
+ mkSplitUniqSupply 'a' >>= \ tc_uniqs -> -- typechecker
+ mkSplitUniqSupply 'd' >>= \ ds_uniqs -> -- desugarer
+ mkSplitUniqSupply 'r' >>= \ ru_uniqs -> -- rules
+ mkSplitUniqSupply 'c' >>= \ c2s_uniqs -> -- core-to-stg
+ mkSplitUniqSupply 'u' >>= \ tidy_uniqs -> -- tidy up
+ mkSplitUniqSupply 'g' >>= \ st_uniqs -> -- stg-to-stg passes
+ mkSplitUniqSupply 'n' >>= \ ncg_uniqs -> -- native-code generator
+
+ -------------------------- Rename ----------------
+ show_pass "Renamer" >>
+ _scc_ "Renamer"
+
+ renameModule rn_uniqs rdr_module >>= \ maybe_rn_stuff ->
+ case maybe_rn_stuff of {
+ Nothing -> -- Hurrah! Renamer reckons that there's no need to
+ -- go any further
+ reportCompile mod_name "Compilation NOT required!" >>
+ return ();
+
+ Just (this_mod, rn_mod, iface_file_stuff, rn_name_supply, imported_modules) ->
+ -- Oh well, we've got to recompile for real
+
+
+ -------------------------- Start interface file ----------------
+ -- Safely past renaming: we can start the interface file:
+ -- (the iface file is produced incrementally, as we have
+ -- the information that we need...; we use "iface<blah>")
+ -- "endIface" finishes the job.
+ startIface this_mod iface_file_stuff >>= \ if_handle ->
+
+
+ -------------------------- Typechecking ----------------
+ show_pass "TypeCheck" >>
+ _scc_ "TypeCheck"
+ typecheckModule tc_uniqs rn_name_supply
+ iface_file_stuff rn_mod >>= \ maybe_tc_stuff ->
+ case maybe_tc_stuff of {
+ Nothing -> ghcExit 1; -- Type checker failed
+
+ Just (tc_results@(TcResults {tc_tycons = local_tycons,
+ tc_classes = local_classes,
+ tc_insts = inst_info })) ->
+
+
+ -------------------------- Desugaring ----------------
+ _scc_ "DeSugar"
+ deSugar this_mod ds_uniqs tc_results >>= \ (desugared, rules, h_code, c_code) ->
+
+
+ -------------------------- Main Core-language transformations ----------------
+ _scc_ "Core2Core"
+ core2core core_cmds desugared rules >>= \ (simplified, imp_rule_ids) ->
+
+ -- Do the final tidy-up
+ tidyCorePgm tidy_uniqs this_mod
+ simplified imp_rule_ids >>= \ (tidy_binds, tidy_imp_rule_ids) ->
+
+
+ -------------------------- Convert to STG code -------------------------------
+ show_pass "Core2Stg" >>
+ _scc_ "Core2Stg"