Improve infer and transforms

This commit is contained in:
UditDey
2026-09-16 07:32:04 +00:00
parent 5d687e308e
commit 1a36873812
8 changed files with 303 additions and 78 deletions
+5 -5
View File
@@ -2,7 +2,7 @@ mod basic_block;
use crate::{
flatten::FlatFn,
libqjs::parse::{AtomRef, ClosureVar, ImmOperand, Instr, JsValue, opcodes::OpCode},
libqjs::parse::{AtomRef, ImmOperand, Instr, JsValue, opcodes::OpCode},
};
pub use basic_block::BasicBlock;
@@ -109,7 +109,7 @@ fn walk_block(
let mut out_instr = RegInstr {
dsts: vec![],
op: instr.op,
imm: instr.imm_operands,
imm: instr.imm,
args: vec![],
};
@@ -184,7 +184,7 @@ fn extra_pops(instr: &Instr) -> usize {
OpCode::Call1 => 1,
OpCode::Call2 => 2,
OpCode::Call3 => 3,
_ => match instr.imm_operands {
_ => match instr.imm {
ImmOperand::Npop(npop) => npop as usize,
ImmOperand::NpopU16 { npop, .. } => npop as usize,
_ => 0,
@@ -199,7 +199,7 @@ fn is_local_read(instr: &Instr) -> Option<usize> {
OpCode::GetLoc2 => Some(2),
OpCode::GetLoc3 => Some(3),
OpCode::GetLoc | OpCode::GetLoc8 | OpCode::GetLocCheck => match instr.imm_operands {
OpCode::GetLoc | OpCode::GetLoc8 | OpCode::GetLocCheck => match instr.imm {
ImmOperand::Loc(k) => Some(k as usize),
_ => unreachable!(),
},
@@ -220,7 +220,7 @@ fn is_local_write(instr: &Instr) -> Option<usize> {
| OpCode::PutLocCheck
| OpCode::PutLocCheckInit
| OpCode::SetLoc
| OpCode::SetLoc8 => match instr.imm_operands {
| OpCode::SetLoc8 => match instr.imm {
ImmOperand::Loc(k) => Some(k as usize),
_ => unreachable!(),
},