2020-09-23 15:13:49 +02:00
|
|
|
//! Various optimizations specific to cg_clif
|
|
|
|
|
2021-07-03 14:28:53 +02:00
|
|
|
use cranelift_codegen::isa::TargetIsa;
|
|
|
|
|
2019-12-26 13:37:10 +01:00
|
|
|
use crate::prelude::*;
|
|
|
|
|
2020-08-30 13:02:53 +02:00
|
|
|
pub(crate) mod peephole;
|
2019-12-26 13:37:10 +01:00
|
|
|
|
2020-03-27 12:14:45 +01:00
|
|
|
pub(crate) fn optimize_function<'tcx>(
|
2019-12-26 13:37:10 +01:00
|
|
|
tcx: TyCtxt<'tcx>,
|
2021-07-03 14:28:53 +02:00
|
|
|
isa: &dyn TargetIsa,
|
2020-08-28 12:26:52 +02:00
|
|
|
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,
|
|
|
|
) {
|
2021-03-31 12:34:01 +02:00
|
|
|
// FIXME classify optimizations over opt levels once we have more
|
|
|
|
|
2021-07-03 14:28:53 +02:00
|
|
|
crate::pretty_clif::write_clif_file(tcx, "preopt", isa, instance, &ctx, &*clif_comments);
|
2019-12-28 12:41:03 +01:00
|
|
|
crate::base::verify_func(tcx, &*clif_comments, &ctx.func);
|
2019-12-26 13:37:10 +01:00
|
|
|
}
|