totalspectrum / spin2cpp

Tool to convert Parallax Propeller Spin code to PASM, C++ or C
Other
46 stars 17 forks source link

Move only variables whose address is actually taken to stack #442

Closed Wuerfel21 closed 5 months ago

Wuerfel21 commented 7 months ago

(For C and BASIC only)

Haven't super-tested this, but this chops a couple Kbytes off the libc / FatFs driver.

It also still allocates the same size stack frame, so that should perhaps be fixed still.

totalspectrum commented 5 months ago

I've merged this manually. I changed the name of the Spin memory optimization option to -Ospin-relax-memory because in my mind it loosens the memory requirements for Spin rather than making them stricter, but I guess that's a matter of opinion. Thanks for this contribution!

Wuerfel21 commented 5 months ago

Ahh nice.

Do you have any idea how to fix the stack frames ending up with unused slots? I think that happens somewhere outside the backends, I recall the BC backend being able to just grab the offsets.