Skip to content
This repository has been archived by the owner on Jun 15, 2024. It is now read-only.

Commit

Permalink
fix: Conditional free on return
Browse files Browse the repository at this point in the history
  • Loading branch information
06Games committed Jun 13, 2024
1 parent aacafa0 commit 0f86203
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion generation_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ def gen_return(instruction):
erreur(f"Incorrect return type expected {typeStr(expectedType)} got {typeStr(returnType)}")
arm_instruction("pop", "{r2}", comment="Return value")
removed = tableSymboles.symbolsToFree(2)
arm_instruction("add", "sp", f"#{len(removed)*4}")
if len(removed) > 0:
arm_instruction("add", "sp", f"#{len(removed)*4}")
arm_instruction("pop", "{fp, pc}")


Expand Down

0 comments on commit 0f86203

Please sign in to comment.