fix: add opSize back in to stack

This commit is contained in:
2025-03-01 02:07:45 +00:00
parent 3b723392a7
commit ae52fa653c
5 changed files with 293 additions and 2 deletions

View File

@@ -23,7 +23,7 @@ class Stack {
/** Push an expression onto the stack. */
def push(expr: mw.Expr, src: Register): AsmLine = {
stack += expr -> StackValue(src.size, sizeBytes)
stack += expr -> StackValue(expr.ty.size, sizeBytes)
Push(src)
}
@@ -81,7 +81,7 @@ class Stack {
/** Get an MemLocation for a variable in the stack. */
def accessVar(ident: mw.Ident): MemLocation =
MemLocation(RSP, sizeBytes - stack(ident).bottom)
MemLocation(RSP, sizeBytes - stack(ident).bottom, opSize = Some(stack(ident).size))
def contains(ident: mw.Ident): Boolean = stack.contains(ident)
def head: MemLocation = MemLocation(RSP, opSize = Some(stack.last._2.size))