feat(joinir): Phase 213-2 Step 2-2 & 2-3 Data structure extensions

Extended PatternPipelineContext and CarrierUpdateInfo for Pattern 3 AST-based generalization.

Changes:
1. PatternPipelineContext:
   - Added loop_condition: Option<ASTNode>
   - Added loop_body: Option<Vec<ASTNode>>
   - Added loop_update_summary: Option<LoopUpdateSummary>
   - Updated build_pattern_context() for Pattern 3

2. CarrierUpdateInfo:
   - Added then_expr: Option<ASTNode>
   - Added else_expr: Option<ASTNode>
   - Updated analyze_loop_updates() with None defaults

Status: Phase 213-2 Steps 2-2 & 2-3 complete
Next: Create Pattern3IfAnalyzer to extract if statement and populate update summary
This commit is contained in:
nyash-codex
2025-12-10 00:01:53 +09:00
parent 577b5b01d5
commit d7805e5974
138 changed files with 3529 additions and 378 deletions

View File

@ -103,6 +103,7 @@ impl CaseALoweringShape {
/// * `features` - LoopFeatures (structure-based, name-agnostic)
/// * `carrier_count` - Number of carrier variables from LoopScopeShape
/// * `has_progress_carrier` - Whether progress carrier exists
#[allow(dead_code)]
pub fn detect_from_features(
features: &crate::mir::loop_pattern_detection::LoopFeatures,
carrier_count: usize,
@ -165,6 +166,7 @@ impl CaseALoweringShape {
///
/// # Returns
/// More precise CaseALoweringShape classification
#[allow(dead_code)]
pub fn detect_with_carrier_name(
features: &crate::mir::loop_pattern_detection::LoopFeatures,
carrier_count: usize,
@ -271,6 +273,7 @@ impl CaseALoweringShape {
///
/// ArrayAccumulation パターンは通常:
/// - より意味のある名前 ('result', 'items', 'defs' など)
#[allow(dead_code)]
fn is_typical_index_name(name: &str) -> bool {
matches!(
name,
@ -285,6 +288,7 @@ impl CaseALoweringShape {
since = "Phase 170-A",
note = "Use detect_from_features() with LoopFeatures instead"
)]
#[allow(dead_code)]
pub fn detect(scope: &super::shape::LoopScopeShape) -> Self {
// Construct minimal LoopFeatures from LoopScopeShape
// Note: This loses some information (has_break, has_continue not available)
@ -313,6 +317,7 @@ impl CaseALoweringShape {
}
/// Is this a recognized lowering shape?
#[allow(dead_code)]
pub fn is_recognized(&self) -> bool {
!matches!(self, CaseALoweringShape::NotCaseA | CaseALoweringShape::Generic)
}

View File

@ -73,6 +73,7 @@ impl LoopVarClass {
#[derive(Debug, Clone)]
pub(crate) struct LoopScopeShape {
pub header: BasicBlockId,
#[allow(dead_code)]
pub body: BasicBlockId,
pub latch: BasicBlockId,
pub exit: BasicBlockId,

View File

@ -81,11 +81,13 @@ impl LoopStructuralAnalysis {
/// - 出口グループ数の確認
/// - 非局所 exit の有無確認
/// - 出口先ブロックの取得
#[allow(dead_code)]
pub fn exit_analysis(&self) -> &ExitAnalysis {
&self.exit_analysis
}
/// progress_carrier の有無
#[allow(dead_code)]
pub fn has_progress_carrier(&self) -> bool {
self.has_progress_carrier
}