Manages the default compilation pipeline of Mim programs using plugins.
lam extern _default_compile []: %compile.Pipeline =
let nullptr = %compile.nullptr_pass;
let nullphase = %compile.single_pass_phase nullptr;
%compile.pipe
nullphase
(%compile.single_pass_phase (%compile.scalarize_pass nullptr))
(%compile.single_pass_phase %compile.eta_red_pass)
(%compile.single_pass_phase (%compile.tail_rec_elim_pass nullptr))
(%compile.single_pass_phase (plugin_cond_pass (%compile.regex_plugin, %regex.lower_regex)))
// optimize
(%compile.pass_phase
(%compile.combine_pass_list (⊤:Nat)
(
optimization_pass_list,
%compile.pass_list
(plugin_cond_pass (%compile.affine_plugin, %affine.lower_for_pass)),
mem_opt_pass_list
))
)
(plugin_cond_phase
(%compile.autodiff_plugin,
%compile.combined_phase
(%compile.phase_list
(%compile.single_pass_phase %autodiff.ad_eval_pass)
// optimization_phase
(%compile.single_pass_phase %autodiff.ad_zero_pass))))
(plugin_cond_phase (%compile.direct_plugin, direct_phases))
(plugin_cond_phase
(%compile.matrix_plugin,
%compile.combined_phase
(%compile.phase_list
matrix_lower_phase
(plugin_cond_phase (%compile.direct_plugin, direct_phases))
(plugin_cond_phase (%compile.affine_plugin, %compile.single_pass_phase %affine.lower_for_pass)))))
(%compile.single_pass_phase %compile.internal_cleanup_pass)
(plugin_cond_phase (%compile.clos_plugin, clos_phases))
(%compile.single_pass_phase %compile.lam_spec_pass)
(plugin_cond_phase (%compile.autodiff_plugin, ad_cleanup_phase))
// CodeGenPrep
(%compile.pass_phase
(%compile.combine_pass_list (⊤:Nat)
(
%compile.pass_list
%compile.ret_wrap_pass,
// mem
%compile.pass_list
%mem.remem_elim_pass
%mem.alloc2malloc_pass,
%compile.pass_list
(plugin_cond_pass (%compile.refly_plugin, %refly.remove_dbg_perm_pass))
))
);