diff --git a/libs/@local/hashql/compiletest/src/suite/mir_pass_transform_administrative_reduction.rs b/libs/@local/hashql/compiletest/src/suite/mir_pass_transform_administrative_reduction.rs index cc1f17983cb..35c352154c8 100644 --- a/libs/@local/hashql/compiletest/src/suite/mir_pass_transform_administrative_reduction.rs +++ b/libs/@local/hashql/compiletest/src/suite/mir_pass_transform_administrative_reduction.rs @@ -3,6 +3,7 @@ use std::io::Write as _; use hashql_ast::node::expr::Expr; use hashql_core::{ heap::{Heap, Scratch}, + id::IdVec, r#type::environment::Environment, }; use hashql_diagnostics::DiagnosticIssues; @@ -11,7 +12,9 @@ use hashql_mir::{ context::MirContext, def::{DefId, DefIdSlice, DefIdVec}, intern::Interner, - pass::{Changed, GlobalTransformPass as _, transform::AdministrativeReduction}, + pass::{ + Changed, GlobalTransformPass as _, GlobalTransformState, transform::AdministrativeReduction, + }, }; use super::{ @@ -43,7 +46,12 @@ pub(crate) fn mir_pass_transform_administrative_reduction<'heap>( }; let mut pass = AdministrativeReduction::new_in(&mut scratch); - let _: Changed = pass.run(&mut context, &mut bodies); + let mut changed = IdVec::from_domain(Changed::No, &bodies); + let _: Changed = pass.run( + &mut context, + &mut GlobalTransformState::new(&mut changed), + &mut bodies, + ); process_issues(diagnostics, context.diagnostics)?; Ok((root, bodies, scratch)) diff --git a/libs/@local/hashql/compiletest/src/suite/mir_pass_transform_pre_inlining.rs b/libs/@local/hashql/compiletest/src/suite/mir_pass_transform_pre_inlining.rs new file mode 100644 index 00000000000..904f54d7799 --- /dev/null +++ b/libs/@local/hashql/compiletest/src/suite/mir_pass_transform_pre_inlining.rs @@ -0,0 +1,276 @@ +use std::io::{self, Write as _}; + +use hashql_ast::node::expr::Expr; +use hashql_core::{ + heap::{Heap, Scratch}, + r#type::environment::Environment, +}; +use hashql_diagnostics::DiagnosticIssues; +use hashql_mir::{ + body::Body, + context::MirContext, + def::{DefId, DefIdSlice, DefIdVec}, + intern::Interner, + pass::{Changed, GlobalTransformPass as _, GlobalTransformState, transform::PreInlining}, +}; + +use super::{RunContext, Suite, SuiteDiagnostic, common::process_issues, mir_reify::mir_reify}; +use crate::suite::{ + common::Header, + mir_reify::{d2_output_enabled, mir_format_d2, mir_format_text, mir_spawn_d2}, +}; + +#[derive(Debug, Copy, Clone, PartialEq, Eq)] +pub(crate) struct Stage { + id: &'static str, + title: &'static str, +} + +pub(crate) struct RenderContext<'env, 'heap> { + pub heap: &'heap Heap, + pub env: &'env Environment<'heap>, + pub stage: Stage, + pub root: DefId, +} + +pub(crate) trait MirRenderer { + fn render<'heap>( + &mut self, + context: &mut RenderContext<'_, 'heap>, + bodies: &DefIdSlice
>, + ); +} + +impl