mirror of
https://github.com/imjasonh/nescript
synced 2026-07-18 14:45:58 +00:00
IR codegen: scroll, debug.log, debug.assert
Adds Scroll / DebugLog / DebugAssert variants to IrOp, wires them into the IR lowering, optimizer liveness tracking, and IR codegen. Scroll emits two PPU $2005 writes; debug statements emit writes to $4800 when IrCodeGen::with_debug(true) is set, stripped otherwise. These were the last feature gaps versus the AST codegen path, so IR codegen is now a full replacement. https://claude.ai/code/session_01W6eQFStA66EuMKHUFo2rx3
This commit is contained in:
parent
8a6441071e
commit
d609b77cd7
5 changed files with 162 additions and 6 deletions
|
|
@ -310,16 +310,21 @@ impl LoweringContext {
|
|||
let arg_temps: Vec<_> = args.iter().map(|a| self.lower_expr(a)).collect();
|
||||
self.emit(IrOp::Call(None, name.clone(), arg_temps));
|
||||
}
|
||||
Statement::Scroll(_, _, _) => {
|
||||
// TODO: implement scroll hardware writes
|
||||
Statement::Scroll(x_expr, y_expr, _) => {
|
||||
let x = self.lower_expr(x_expr);
|
||||
let y = self.lower_expr(y_expr);
|
||||
self.emit(IrOp::Scroll(x, y));
|
||||
}
|
||||
Statement::LoadBackground(_, _) | Statement::SetPalette(_, _) => {
|
||||
// TODO: implement in asset pipeline
|
||||
}
|
||||
Statement::DebugLog(_, _) | Statement::DebugAssert(_, _) => {
|
||||
// Debug statements don't produce IR ops in release mode.
|
||||
// In debug mode, the AST-based codegen handles them directly
|
||||
// (IR codegen path for debug is a future enhancement).
|
||||
Statement::DebugLog(args, _) => {
|
||||
let temps: Vec<_> = args.iter().map(|a| self.lower_expr(a)).collect();
|
||||
self.emit(IrOp::DebugLog(temps));
|
||||
}
|
||||
Statement::DebugAssert(cond, _) => {
|
||||
let t = self.lower_expr(cond);
|
||||
self.emit(IrOp::DebugAssert(t));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue