Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add proper bundle param infos to monomorphize #468

Merged
merged 1 commit into from
Oct 17, 2024
Merged
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
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
Loading