Support plugging external profilers into the Cranelift timing infrastructure (#5749)

* Remove no-std code for cranelift_codegen::timings

no-std mode isn't supported by Cranelift anymore

* Simplify define_passes macro

* Add egraph opt timings

* Replace the add_to_current api with PassTimes::add

* Omit a couple of unused time measurements

* Reduce divergence between run and run_passes a bit

* Introduce a Profiler trait

This allows plugging in external profilers into the Cranelift profiling
framework.

* Add Pass::description method

* Remove duplicate usage of the compile pass timing

* Rustfmt
This commit is contained in:
bjorn3
2023-03-10 20:33:56 +01:00
committed by GitHub
parent 0751cba6e2
commit 108f7917c8
5 changed files with 181 additions and 181 deletions

View File

@@ -213,7 +213,6 @@ impl Context {
///
/// Returns information about the function's code and read-only data.
pub fn compile(&mut self, isa: &dyn TargetIsa) -> CompileResult<&CompiledCode> {
let _tt = timing::compile();
let stencil = self.compile_stencil(isa).map_err(|error| CompileError {
inner: error,
func: &self.func,
@@ -379,6 +378,8 @@ impl Context {
/// Run optimizations via the egraph infrastructure.
pub fn egraph_pass(&mut self) -> CodegenResult<()> {
let _tt = timing::egraph();
trace!(
"About to optimize with egraph phase:\n{}",
self.func.display()