Is there a calling convention that forces no callee saved registers? Is that what CallConv::Cold
? I'm calling into something that can't guarantee it won't clobber callee saved registers, and instead of brute force spilling all callee save regs, it would be better to make the caller do that since it knows which of them are live.
Currently Cold
doesn't do anything different, but we could implement an "all-caller-saved" convention; I'm happy to point to the relevant bits (basically cranelift/codegen/src/{machinst/abi.rs,isa/*/abi.rs}) if you want to take a crack at this
@fitzgen (he/him) has recently been working on making the tail-call convention have no callee-saved registers, and while you likely wouldn't want to use that convention since it does other things, that work should demonstrate how to do what you want. I don't see that Nick has pushed that branch anywhere yet though.
slight aside: I think we should consider making fast
have no callee-save registers, and cold
having no caller-save registers
I haven't pushed my WIP branch for the tail
calling convention anywhere yet, I've become distracted with fuzz bugs. can do that soon
This is my WIP work to make all registers callee-save on the tail
calling convention: https://github.com/bytecodealliance/wasmtime/commit/f9a9c5a8ae1618928b9208dab2e718e0209a91db
Note that I've only implemented it for x64 and aarch64 so far, no riscv64 or s390x yet.
Ok, thanks for the pointers, I might take a look
Last updated: Nov 22 2024 at 16:03 UTC