Currently needsStackRealignment returns false if canRealignStack returns false. This means that the behavior of needsStackRealignment does not correspond to it's name and description; a function might need stack realignment, but if it is not possible then this function returns false. Furthermore, needsStackRealignment is not virtual and therefore some backends have made use of canRealignStack to indicate whether a function needs stack realignment.
This patch attempts to clarify the situation by separating them:
- Make needsStackRealignment virtual so that backends can override it
- Override needsStackRealignment rather than canRealignStack in SIRegisterInfo
- Update some call sites of needsStackRealignment (where backend tests were failing). Some of these may not be necessary.
This change will make it easier in a future change to handle the case where we need to realign the stack but can't do so (for example when the register allocator creates an aligned spill after the frame pointer has been eliminated).