• Christoph Mallon's avatar
    ia32: Do not accidently lose the stack frame. · 123e854f
    Christoph Mallon authored
    Consider a function with frame pointer relative addressing, where the only users of the stack are the Returns.
    Still space for values might be allocated on the stack.
    To prevent this, during prologue construction the IncSP was kept, if it had at most one user.
    If there are multiple returns, then there was more than one user, so the IncSP is not kept.
    Then during epilogue construction these uses are replaced by movl %ebp, %esp/leave.
    This renders the allocation of the frame unused and it vanishes.
    So memory below the stack pointer is accessed.
    Now first construct the epilogues.
    Then, when the prologue is constructed afterwards, we know whether the IncSP is unused and needs to be kept.
    Still this is a hack.
    The correct solution would be, that IncSP produces memory, so memory operations accessing stack slots use this memory.