jameysharp commented on issue #1022:
These days Cranelift has no support for stack-slot alignment so I think this old Cretonne issue is no longer relevant. There is now an issue for adding alignment support back in (#6716) which might benefit from looking at this issue but I don't think this old issue needs further discussion.
jameysharp closed issue #1022:
Stack slots can be defined with an explicit alignment, but the alignment can also be left out, and Cretonne "will pick an appropriate alignment for the stack slot based on its size and access patterns".
We should:
- Clarify exactly what this means in the documentation. In particular, make it clear that the alignment can depend on the target ISA and OS.
- Implement an optional alignment field on
StackSlotData
.- Implement the alignment inference algorithm.
The alignment inference algorithm needs to consider:
- The function's incoming stack pointer alignment guarantees. If any stack slots are more aligned than the incoming stack pointer, dynamic stack realignment is required. We want to avoid that.
- The
stack_load
andstack_store
instructions accessing a stack slot will have a preferred alignment that depends on the target ISA.- Explicitly aligned stack slots may force a dynamic stack realignment anyway. In that case, there's no reason to bound the inferred alignment.
A
TargetISA
method that returns the preferred alignment for accessing a given type seems appropriate.
Last updated: Dec 23 2024 at 13:07 UTC