bugfixes
This commit is contained in:
parent
b76e7758b7
commit
ce09169375
|
@ -56,6 +56,10 @@ struct BlockVisitor<'a, V: Visitor> {
|
||||||
}
|
}
|
||||||
impl<'a, V: Visitor> BlockVisitor<'a, V> {
|
impl<'a, V: Visitor> BlockVisitor<'a, V> {
|
||||||
fn new(body: &'a FunctionBody, trees: &'a Trees, visitor: V) -> Self {
|
fn new(body: &'a FunctionBody, trees: &'a Trees, visitor: V) -> Self {
|
||||||
|
log::trace!(
|
||||||
|
"localify: running on:\n{}",
|
||||||
|
body.display_verbose("| ", None)
|
||||||
|
);
|
||||||
Self {
|
Self {
|
||||||
body,
|
body,
|
||||||
trees,
|
trees,
|
||||||
|
@ -70,6 +74,9 @@ impl<'a, V: Visitor> BlockVisitor<'a, V> {
|
||||||
self.visitor.pre_term();
|
self.visitor.pre_term();
|
||||||
|
|
||||||
for &inst in self.body.blocks[block].insts.iter().rev() {
|
for &inst in self.body.blocks[block].insts.iter().rev() {
|
||||||
|
if self.trees.owner.contains_key(&inst) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
self.visitor.post_inst(inst);
|
self.visitor.post_inst(inst);
|
||||||
self.visit_inst(inst, /* root = */ true);
|
self.visit_inst(inst, /* root = */ true);
|
||||||
self.visitor.pre_inst(inst);
|
self.visitor.pre_inst(inst);
|
||||||
|
@ -223,7 +230,7 @@ impl<'a> Context<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.points = point;
|
self.points = point + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn allocate(&mut self) {
|
fn allocate(&mut self) {
|
||||||
|
|
|
@ -204,6 +204,7 @@ impl<'a> WasmFuncBackend<'a> {
|
||||||
match &self.body.values[value] {
|
match &self.body.values[value] {
|
||||||
&ValueDef::Operator(ref op, ref args, ref tys) => {
|
&ValueDef::Operator(ref op, ref args, ref tys) => {
|
||||||
for &arg in &args[..] {
|
for &arg in &args[..] {
|
||||||
|
let arg = self.body.resolve_alias(arg);
|
||||||
if self.trees.owner.contains_key(&arg) {
|
if self.trees.owner.contains_key(&arg) {
|
||||||
log::trace!(" -> arg {} is owned", arg);
|
log::trace!(" -> arg {} is owned", arg);
|
||||||
self.lower_inst(arg, /* root = */ false, func);
|
self.lower_inst(arg, /* root = */ false, func);
|
||||||
|
|
Loading…
Reference in a new issue