2019-12-26 13:37:10 +01:00
|
|
|
use crate::prelude::*;
|
|
|
|
|
|
|
|
mod stack2reg;
|
|
|
|
|
|
|
|
pub fn optimize_function<'tcx>(
|
|
|
|
tcx: TyCtxt<'tcx>,
|
|
|
|
instance: Instance<'tcx>,
|
2019-12-28 12:41:03 +01:00
|
|
|
ctx: &mut Context,
|
2019-12-26 13:37:10 +01:00
|
|
|
clif_comments: &mut crate::pretty_clif::CommentWriter,
|
|
|
|
) {
|
2019-12-31 16:43:24 +01:00
|
|
|
if tcx.sess.opts.optimize == rustc_session::config::OptLevel::No {
|
|
|
|
return; // FIXME classify optimizations over opt levels
|
|
|
|
}
|
2019-12-31 15:26:58 +01:00
|
|
|
self::stack2reg::optimize_function(ctx, clif_comments, instance);
|
2019-12-26 13:37:10 +01:00
|
|
|
#[cfg(debug_assertions)]
|
2019-12-28 12:41:03 +01:00
|
|
|
crate::pretty_clif::write_clif_file(tcx, "stack2reg", instance, &ctx.func, &*clif_comments, None);
|
|
|
|
crate::base::verify_func(tcx, &*clif_comments, &ctx.func);
|
2019-12-26 13:37:10 +01:00
|
|
|
}
|