more general tree walking algorightm was needed (probably)
Signed-off-by: Jakub Doka <jakub.doka2@gmail.com>
This commit is contained in:
parent
7837eeb90d
commit
6fba7da782
|
@ -643,7 +643,7 @@ impl TokenKind {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy, Debug)]
|
||||||
enum PLoc {
|
enum PLoc {
|
||||||
Reg(Reg, u16),
|
Reg(Reg, u16),
|
||||||
WideReg(Reg, u16),
|
WideReg(Reg, u16),
|
||||||
|
|
|
@ -121,9 +121,10 @@ impl HbvmBackend {
|
||||||
|| nodes.is_hard_zero(allc)
|
|| nodes.is_hard_zero(allc)
|
||||||
|| allc == MEM
|
|| allc == MEM
|
||||||
|| matches!(node.kind, Kind::Loop | Kind::Region),
|
|| matches!(node.kind, Kind::Loop | Kind::Region),
|
||||||
"{nid} {:?}\n{allc} {:?}",
|
"{nid} {:?}\n{allc} {:?} {}",
|
||||||
nodes[nid],
|
nodes[nid],
|
||||||
nodes[allc]
|
nodes[allc],
|
||||||
|
ty::Display::new(tys, files, nodes[allc].ty)
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -712,10 +713,6 @@ impl Nodes {
|
||||||
);
|
);
|
||||||
self[user].inputs.iter().position(|&v| v == val).is_some_and(|v| v < 3)
|
self[user].inputs.iter().position(|&v| v == val).is_some_and(|v| v < 3)
|
||||||
}
|
}
|
||||||
//Kind::Call { .. } => {
|
|
||||||
// self[val].kind != Kind::Load
|
|
||||||
// || matches!(types.parama(self[val].ty).0, Some(PLoc::Ref(..)))
|
|
||||||
//}
|
|
||||||
Kind::Load => self[user].inputs[2] != val,
|
Kind::Load => self[user].inputs[2] != val,
|
||||||
_ => self[user].inputs[0] != val || self[user].inputs[1..].contains(&val),
|
_ => self[user].inputs[0] != val || self[user].inputs[1..].contains(&val),
|
||||||
}
|
}
|
||||||
|
@ -761,19 +758,22 @@ impl Nodes {
|
||||||
return None.into_iter().flatten();
|
return None.into_iter().flatten();
|
||||||
}
|
}
|
||||||
|
|
||||||
Some(
|
let mut uses = vec![];
|
||||||
self[nid]
|
let mut to_expand = vec![nid];
|
||||||
.outputs
|
while let Some(exp) = to_expand.pop() {
|
||||||
.iter()
|
for &o in self[exp].outputs.iter() {
|
||||||
.filter(move |&&n| self.is_data_dep(nid, n, types))
|
if !self.is_data_dep(exp, o, types) {
|
||||||
.map(move |n| self.this_or_delegates(nid, n))
|
continue;
|
||||||
.flat_map(|(p, ls)| ls.iter().map(move |l| (p, l)))
|
}
|
||||||
.filter(|&(o, &n)| self.is_data_dep(o, n, types))
|
if self.is_unlocked(o) {
|
||||||
.map(|(p, &n)| (self.use_block_of(p, n), n))
|
uses.push((self.use_block_of(exp, o), o));
|
||||||
.inspect(|&(_, n)| debug_assert!(self.is_unlocked(n))),
|
} else {
|
||||||
)
|
to_expand.push(o);
|
||||||
.into_iter()
|
}
|
||||||
.flatten()
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Some(uses).into_iter().flatten()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue