cowgol icon indicating copy to clipboard operation
cowgol copied to clipboard

All values are written back to memory even when they're unused

Open davidgiven opened this issue 7 years ago • 2 comments

There's no way to mark a variable as being killed, i.e. that the value will never be read from again; this means the code generator always has to write them back to memory when the register gets flushed even if it's a waste.

The easy fix (of adding a KILL iop for doing this) is problematic because some iops flush all registers --- consider BEQ.

But annotating the iops themselves is hard because temporaries only get freed after the iop is emitted.

davidgiven avatar Mar 03 '18 11:03 davidgiven

This is partially implemented; KILL iops are ignored for comparisons and branches. It's had a small effect on code size only, which was a bit disappointing.

davidgiven avatar Mar 04 '18 11:03 davidgiven