Skip to content

Commit

Permalink
add proper bundle param infos (#468)
Browse files Browse the repository at this point in the history
  • Loading branch information
UnsignedByte authored Oct 17, 2024
1 parent 43e0a10 commit 2fe2b31
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions crates/filament/src/ir_passes/mono/monosig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,35 +514,32 @@ impl MonoSig {
/// corresponding index
fn bundle_params(
&mut self,
_underlying: &UnderlyingComp,
_pass: &mut Monomorphize,
underlying: &UnderlyingComp,
pass: &mut Monomorphize,
params: &[Underlying<ir::Param>],
port: Base<ir::Port>,
) -> Vec<Base<ir::Param>> {
let info = self.base.add(ir::Info::empty()).get();
let mono_owner = ir::ParamOwner::Bundle(port.get());

if let Some(new_params) = self.bundle_param_map.get(&port) {
return new_params
.iter()
.map(|&new_param_idx| {
let new_param = self.base.get_mut(new_param_idx);
new_param.owner = mono_owner.clone();
new_param.info = info;
new_param_idx
})
.collect_vec();
if self.bundle_param_map.get(&port).is_some() {
unreachable!("port {} already has bundle params", port.get());
};

let mono_params = params
.iter()
.map(|old_param| {
.map(|old_pidx| {
let mono_param = ir::Param {
owner: mono_owner.clone(),
info,
info: self
.info(
underlying,
pass,
underlying.get(*old_pidx).info.ul(),
)
.get(),
};
let new_idx = self.base.add(mono_param);
self.param_map.push(*old_param, new_idx);
self.param_map.push(*old_pidx, new_idx);
new_idx
})
.collect_vec();
Expand Down Expand Up @@ -866,7 +863,6 @@ impl MonoSig {
range: range.clone(), // placeholder
};

self.bundle_param_map.insert(new_port, mono_idxs);
let mono_width = self.expr(underlying, width.ul(), pass);
mono_liveness.lens = lens
.iter()
Expand Down

0 comments on commit 2fe2b31

Please sign in to comment.