Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions crates/filament/src/ir_passes/bundle_elim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ impl Visitor for BundleElim {
"bundle-elim"
}

fn flag() -> Option<utils::CompBool> {
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(
Expand Down
9 changes: 8 additions & 1 deletion crates/filament/src/ir_passes/mono/monomorphize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);

Expand Down
12 changes: 12 additions & 0 deletions crates/filament/src/ir_visitor/visitor.rs
Original file line number Diff line number Diff line change
@@ -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)]
Expand Down Expand Up @@ -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<utils::CompBool> {
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.
Expand Down Expand Up @@ -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);
}

Expand Down
6 changes: 6 additions & 0 deletions crates/utils/src/attr/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};
Expand Down
Loading