refactor(joinir): Phase 287 P5 - Stages facade re-export

This commit is contained in:
2025-12-27 13:14:45 +09:00
parent ad5b6085c1
commit 8774bf2fde
5 changed files with 27 additions and 7 deletions

View File

@ -26,12 +26,12 @@ use std::collections::BTreeSet;
// Phase 287 P3: Import 3-stage pipeline functions
use super::rewriter::helpers::is_skippable_continuation;
use super::rewriter::stages::scan::scan_blocks;
use super::rewriter::stages::plan::plan_rewrites;
use super::rewriter::stages::apply::apply_rewrites;
use super::rewriter::rewrite_context::RewriteContext;
use super::contract_checks;
// Phase 287 P5: Unified import through stages facade (SSOT)
use super::rewriter::stages::{scan_blocks, plan_rewrites, apply_rewrites};
/// Phase 4: Merge ALL functions and rewrite instructions
///

View File

@ -43,6 +43,9 @@ use crate::mir::join_ir::lowering::{
/// - Block addition (lines 1738-1751)
/// - Boundary injection (lines 1755-1857)
/// - Context updates (carrier_inputs, exit_phi_inputs)
///
/// # Phase 287 P5: Re-exported through stages/mod.rs
/// Access via stages::{apply_rewrites} for unified API.
pub(in crate::mir::builder::control_flow::joinir::merge) fn apply_rewrites(
builder: &mut MirBuilder,
blocks: RewrittenBlocks,

View File

@ -7,8 +7,19 @@
//! 1. **Scan**: Read-only analysis to identify what needs rewriting
//! 2. **Plan**: Transform scan plan into concrete rewritten blocks
//! 3. **Apply**: Apply rewritten blocks to MirBuilder
//!
//! # Phase 287 P5: Facade Pattern (Re-export SSOT)
//!
//! Stage functions are re-exported through this module for unified API access.
//! Implementation files use `pub(super)` visibility, keeping this module as the
//! single entry point for the pipeline.
// Make sub-modules visible to parent's parent (merge/ level) for instruction_rewriter.rs access
pub(in crate::mir::builder::control_flow::joinir::merge) mod scan;
pub(in crate::mir::builder::control_flow::joinir::merge) mod plan;
pub(in crate::mir::builder::control_flow::joinir::merge) mod apply;
// Module declarations (implementation files)
mod scan;
mod plan;
mod apply;
// Phase 287 P5: Re-export stage functions (facade pattern)
pub(in crate::mir::builder::control_flow::joinir::merge) use scan::scan_blocks;
pub(in crate::mir::builder::control_flow::joinir::merge) use plan::plan_rewrites;
pub(in crate::mir::builder::control_flow::joinir::merge) use apply::apply_rewrites;

View File

@ -56,6 +56,9 @@ mod terminator_rewrite;
/// - First pass: instruction filtering (lines 581-760)
/// - Terminator conversion (lines 1163-1435)
/// - Span synchronization (lines 1436-1452)
///
/// # Phase 287 P5: Re-exported through stages/mod.rs
/// Access via stages::{plan_rewrites} for unified API.
pub(in crate::mir::builder::control_flow::joinir::merge) fn plan_rewrites(
_plan: RewritePlan,
mir_module: &MirModule,

View File

@ -28,6 +28,9 @@ use std::collections::BTreeMap;
/// - Parameter bindings to generate
///
/// This is a READ-ONLY operation - no mutations, just analysis.
///
/// # Phase 287 P5: Re-exported through stages/mod.rs
/// Access via stages::{scan_blocks} for unified API.
pub(in crate::mir::builder::control_flow::joinir::merge) fn scan_blocks(
mir_module: &MirModule,
remapper: &JoinIrIdRemapper,