phase29ao(p0): add coreplan composer scaffold
This commit is contained in:
57
src/mir/builder/control_flow/plan/composer/mod.rs
Normal file
57
src/mir/builder/control_flow/plan/composer/mod.rs
Normal file
@ -0,0 +1,57 @@
|
||||
//! Phase 29ao P0: CorePlan composer scaffold (CanonicalLoopFacts -> CorePlan)
|
||||
|
||||
use super::CorePlan;
|
||||
use crate::mir::builder::control_flow::plan::facts::skeleton_facts::SkeletonKind;
|
||||
use crate::mir::builder::control_flow::plan::normalize::CanonicalLoopFacts;
|
||||
use crate::mir::builder::control_flow::plan::planner::Freeze;
|
||||
|
||||
#[allow(dead_code)]
|
||||
pub(in crate::mir::builder) fn try_compose_core_plan_from_canonical_facts(
|
||||
facts: &CanonicalLoopFacts,
|
||||
) -> Result<Option<CorePlan>, Freeze> {
|
||||
debug_assert!(
|
||||
matches!(facts.skeleton_kind, SkeletonKind::Loop),
|
||||
"composer expects Loop skeleton facts only"
|
||||
);
|
||||
Ok(None)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::try_compose_core_plan_from_canonical_facts;
|
||||
use crate::mir::builder::control_flow::plan::facts::feature_facts::LoopFeatureFacts;
|
||||
use crate::mir::builder::control_flow::plan::facts::loop_facts::LoopFacts;
|
||||
use crate::mir::builder::control_flow::plan::facts::scan_shapes::{
|
||||
ConditionShape, StepShape,
|
||||
};
|
||||
use crate::mir::builder::control_flow::plan::facts::skeleton_facts::{
|
||||
SkeletonFacts, SkeletonKind,
|
||||
};
|
||||
use crate::mir::builder::control_flow::plan::normalize::canonicalize_loop_facts;
|
||||
|
||||
#[test]
|
||||
fn composer_scaffold_returns_none() {
|
||||
let facts = LoopFacts {
|
||||
condition_shape: ConditionShape::Unknown,
|
||||
step_shape: StepShape::Unknown,
|
||||
skeleton: SkeletonFacts {
|
||||
kind: SkeletonKind::Loop,
|
||||
},
|
||||
features: LoopFeatureFacts::default(),
|
||||
scan_with_init: None,
|
||||
split_scan: None,
|
||||
pattern1_simplewhile: None,
|
||||
pattern3_ifphi: None,
|
||||
pattern4_continue: None,
|
||||
pattern5_infinite_early_exit: None,
|
||||
pattern8_bool_predicate_scan: None,
|
||||
pattern9_accum_const_loop: None,
|
||||
pattern2_break: None,
|
||||
pattern2_loopbodylocal: None,
|
||||
};
|
||||
let canonical = canonicalize_loop_facts(facts);
|
||||
let composed =
|
||||
try_compose_core_plan_from_canonical_facts(&canonical).expect("Ok");
|
||||
assert!(composed.is_none());
|
||||
}
|
||||
}
|
||||
@ -35,6 +35,8 @@ pub(in crate::mir::builder) mod verifier;
|
||||
pub(in crate::mir::builder) mod facts;
|
||||
pub(in crate::mir::builder) mod normalize;
|
||||
pub(in crate::mir::builder) mod planner;
|
||||
// Phase 29ao P0: CorePlan composer scaffold (unused)
|
||||
pub(in crate::mir::builder) mod composer;
|
||||
pub(in crate::mir::builder) mod emit;
|
||||
// Phase 29ai P6: Extractors moved into plan layer
|
||||
pub(in crate::mir::builder) mod extractors;
|
||||
|
||||
Reference in New Issue
Block a user