tansly / congenial-elucidator

A compiler for the xpln programming language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Return address save/restore logic is broken

tansly opened this issue · comments

Return address gets overwritten

Redesign the mechanism:
Treat $ra as a caller saved register. Caller saves it when making a call, restores it when the callee returns. Thus $ra will hold the return address while a function is running.
This way we won't need to save it at every label (thus get rid of the dirty hack) and don't need to restore at return statements.