diff --git a/crates/filament/src/ir_passes/bundle_elim.rs b/crates/filament/src/ir_passes/bundle_elim.rs index 6e529a88..20f55fc4 100644 --- a/crates/filament/src/ir_passes/bundle_elim.rs +++ b/crates/filament/src/ir_passes/bundle_elim.rs @@ -259,6 +259,10 @@ impl Visitor for BundleElim { "bundle-elim" } + fn flag() -> Option { + Some(utils::CompBool::BundleLess) + } + /// Compiles a connect command by breaking it into multiple simple connect commands /// Also eliminates local ports by storing their source bindings in the pass. fn connect( diff --git a/crates/filament/src/ir_passes/mono/monomorphize.rs b/crates/filament/src/ir_passes/mono/monomorphize.rs index 35416b13..031cfe8b 100644 --- a/crates/filament/src/ir_passes/mono/monomorphize.rs +++ b/crates/filament/src/ir_passes/mono/monomorphize.rs @@ -4,6 +4,7 @@ use super::{ }; use fil_gen as fgen; use fil_ir::{self as ir, Ctx, IndexStore}; +use fil_utils::{self as utils, AttrCtx}; use ir::{AddCtx, EntryPoint}; use itertools::Itertools; use std::collections::HashMap; @@ -255,13 +256,19 @@ impl Monomorphize<'_> { // the component whose signature we want to monomorphize // Monomorphize the sig - let mono_comp = MonoDeferred::new( + let mut mono_comp = MonoDeferred::new( UnderlyingComp::new(self.old.get(comp.idx())), self, monosig, ) .comp(); + mono_comp.attrs.set( + utils::CompBool::Monomorphic, + true, + utils::GPosIdx::UNKNOWN, + ); + let new_comp = self.ctx.add(mono_comp).base(); self.processed.insert(n_ck, new_comp); diff --git a/crates/filament/src/ir_visitor/visitor.rs b/crates/filament/src/ir_visitor/visitor.rs index ffd99059..6ff271f4 100644 --- a/crates/filament/src/ir_visitor/visitor.rs +++ b/crates/filament/src/ir_visitor/visitor.rs @@ -1,5 +1,7 @@ use crate::cmdline; use fil_ir::{self as ir, Ctx, MutCtx}; +use fil_utils::{self as utils, AttrCtx, GPosIdx}; + #[must_use] #[derive(PartialEq, Eq)] @@ -115,6 +117,12 @@ where /// The user visible name for the pass fn name() -> &'static str; + /// Flag associated with this component + /// Used to track whether a component has been transformed by this pass + fn flag() -> Option { + None + } + #[must_use] /// Executed after the visitor has visited all the components. /// If the return value is `Some`, the number is treated as an error code. @@ -307,6 +315,10 @@ where } data.comp.cmds.extend(cmds); + if let Some(flag) = Self::flag() { + data.comp.attrs.set(flag, true, GPosIdx::UNKNOWN); + } + self.end(&mut data); } diff --git a/crates/utils/src/attr/types.rs b/crates/utils/src/attr/types.rs index 90231f5a..5fe55099 100644 --- a/crates/utils/src/attr/types.rs +++ b/crates/utils/src/attr/types.rs @@ -9,6 +9,12 @@ attr_set! { /// Use a counter based FSM design CounterFSM: "counter_fsm", }; + priv { + /// This component is monomorphic + Monomorphic, + /// Bundles have been eliminated + BundleLess, + }; }; numeric {}; float {};