right at the moment, LLVM won't align the stack for leaf functions. So, if
stack alignment is 8 bytes, and leaf function has 1 variable of 4 bytes,
the size of frame will be computed as 4 bytes, making stack pointer inside
I've mentioned this before:
but did not pursue the issue back then.
For my target, the stack should be aligned even for leaf functions. In
particular, hardware interrupt can arrive at any time, and stack should be
8-byte aligned at the time of interrupt, otherwise things will break.
I can address this issue by using two tricks together:
1. Calling MachineFrameInfo::setHasCalls in my backend
2. Using the attached patch, so that value of setHasCalls is not reset to
BTW, I've checked other uses of MachineFrameInfo::hasCalls. For example,
PPCRegisterInfo uses it to check if if callee save registers can be stored
in something called "red zone", whatever that is.
I wonder how this relates to interrupts. Say, function X is running.
Interrupt arrives, and the interrupt handlers calls function X again. So, if
that "red zone" is some static memory area, the values there are
overwritten. Am I missing something? Should there be some "interrupts safe"
PrologEpilogInserter.diff (832 Bytes)