alexcrichton transferred Issue #21:
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: Nov 22 2024 at 16:03 UTC