uweigand opened issue #4425:
In implementing SIMD support for s390x, I had to support vector registers that are defined as partially callee-saved by ABI. This is the same situation that already exists on AArch64, and I used the same method: removing Call instructions from consideration when computing function-wide clobbers via the
is_included_in_clobbers
callback.This works in general, but there is one unexpected issue. On s390x, calls work by loading the return address into a "link register", which the callee will use to return back to the caller. This means of course that the call instruction clobbers that link register - so if the caller later has to return to its caller, it will need the original value of the link register at function entry, and therefore has to save/restore it.
This used to work fine since the link register is marked as "defined" by the call instruction. However, once call instructions are ignored via
is_included_in_clobbers
, that definition of the link register is also ignored. I would have expected that only the clobbers of the call instruction would be ignored - but the current implementation ignores the instruction completely.Now, I can work around this by implicitly considering the link register clobbered in any non-leaf routine. But this seems a bit awkward. Any thoughts?
FYI @cfallin
akirilov-arm commented on issue #4425:
Now, I can work around this by implicitly considering the link register clobbered in any non-leaf routine. But this seems a bit awkward. Any thoughts?
The 64-bit Arm architecture works in pretty much the same way with respect to the link register, and that is the solution that has been chosen.
akirilov-arm labeled issue #4425:
In implementing SIMD support for s390x, I had to support vector registers that are defined as partially callee-saved by ABI. This is the same situation that already exists on AArch64, and I used the same method: removing Call instructions from consideration when computing function-wide clobbers via the
is_included_in_clobbers
callback.This works in general, but there is one unexpected issue. On s390x, calls work by loading the return address into a "link register", which the callee will use to return back to the caller. This means of course that the call instruction clobbers that link register - so if the caller later has to return to its caller, it will need the original value of the link register at function entry, and therefore has to save/restore it.
This used to work fine since the link register is marked as "defined" by the call instruction. However, once call instructions are ignored via
is_included_in_clobbers
, that definition of the link register is also ignored. I would have expected that only the clobbers of the call instruction would be ignored - but the current implementation ignores the instruction completely.Now, I can work around this by implicitly considering the link register clobbered in any non-leaf routine. But this seems a bit awkward. Any thoughts?
FYI @cfallin
akirilov-arm labeled issue #4425:
In implementing SIMD support for s390x, I had to support vector registers that are defined as partially callee-saved by ABI. This is the same situation that already exists on AArch64, and I used the same method: removing Call instructions from consideration when computing function-wide clobbers via the
is_included_in_clobbers
callback.This works in general, but there is one unexpected issue. On s390x, calls work by loading the return address into a "link register", which the callee will use to return back to the caller. This means of course that the call instruction clobbers that link register - so if the caller later has to return to its caller, it will need the original value of the link register at function entry, and therefore has to save/restore it.
This used to work fine since the link register is marked as "defined" by the call instruction. However, once call instructions are ignored via
is_included_in_clobbers
, that definition of the link register is also ignored. I would have expected that only the clobbers of the call instruction would be ignored - but the current implementation ignores the instruction completely.Now, I can work around this by implicitly considering the link register clobbered in any non-leaf routine. But this seems a bit awkward. Any thoughts?
FYI @cfallin
akirilov-arm labeled issue #4425:
In implementing SIMD support for s390x, I had to support vector registers that are defined as partially callee-saved by ABI. This is the same situation that already exists on AArch64, and I used the same method: removing Call instructions from consideration when computing function-wide clobbers via the
is_included_in_clobbers
callback.This works in general, but there is one unexpected issue. On s390x, calls work by loading the return address into a "link register", which the callee will use to return back to the caller. This means of course that the call instruction clobbers that link register - so if the caller later has to return to its caller, it will need the original value of the link register at function entry, and therefore has to save/restore it.
This used to work fine since the link register is marked as "defined" by the call instruction. However, once call instructions are ignored via
is_included_in_clobbers
, that definition of the link register is also ignored. I would have expected that only the clobbers of the call instruction would be ignored - but the current implementation ignores the instruction completely.Now, I can work around this by implicitly considering the link register clobbered in any non-leaf routine. But this seems a bit awkward. Any thoughts?
FYI @cfallin
uweigand commented on issue #4425:
OK, given we need to special-case the link register anyway to support preserve_frame_pointers (https://github.com/bytecodealliance/wasmtime/pull/4477), I think this is fine after all. Closing this issue now.
uweigand closed issue #4425:
In implementing SIMD support for s390x, I had to support vector registers that are defined as partially callee-saved by ABI. This is the same situation that already exists on AArch64, and I used the same method: removing Call instructions from consideration when computing function-wide clobbers via the
is_included_in_clobbers
callback.This works in general, but there is one unexpected issue. On s390x, calls work by loading the return address into a "link register", which the callee will use to return back to the caller. This means of course that the call instruction clobbers that link register - so if the caller later has to return to its caller, it will need the original value of the link register at function entry, and therefore has to save/restore it.
This used to work fine since the link register is marked as "defined" by the call instruction. However, once call instructions are ignored via
is_included_in_clobbers
, that definition of the link register is also ignored. I would have expected that only the clobbers of the call instruction would be ignored - but the current implementation ignores the instruction completely.Now, I can work around this by implicitly considering the link register clobbered in any non-leaf routine. But this seems a bit awkward. Any thoughts?
FYI @cfallin
Last updated: Dec 23 2024 at 13:07 UTC