FiloSottile/edwards25519

avo doesn't know that `BP` is callee-saved

Yawning opened this issue · 5 comments

The avo-generated assembly is using BP as a general purpose register without saving/restoring it, which isn't allowed. Since you've ran into this once before, I assume it's just an oversight.

At least it's easy enough to fix since there is 1 gp register free.

Yeah, this is a known issue in avo: mmcloughlin/avo#156

For the upstream CL I manually patched the generated assembly to make the TryBots happy, but I hear @mmcloughlin is working on a fix in avo, so if that comes soon enough I might just wait for that here.

Could manually save/restore the register as a workaround. If you don't want to be at the whims of avo's register allocator, or add a stack frame, just use an XMM register.

Yes, working on it. I'm intending to solve it with two changes:

  1. Pass that runs after register allocation that checks whether BP has been used and forces a non-zero frame size (if it's not already).
  2. De-prioritize BP in the register allocator, so it's only used if there is high register pressure.

The first of these is easy. The second is a little more delicate: at the moment the register allocator doesn't have any concept of priority so I'm trying to come up with the cleanest way of implementing it.

If you have thoughts I'd welcome comments on mmcloughlin/avo#156.

The frame pointer issue mmcloughlin/avo#156 should be fixed in latest version of avo, tagged v0.2.0.

Awesome, thank you! Updated and regenerated :)