-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement the prolog inline stack probe. #35
Conversation
This change enables use of the inline stack probe within the method prolog, for cases where the local frame size exceeds 4096 bytes. The existing alloca code is extended to handle the prolog case by allowing precoloring of the various virtual registers to RCX and RDX, saving/restoring RCX/RDX around the entire probe sequence. For now the save/restore is done via push/pop; if this proves to be not viable long term we can try and get them into the caller-supplied save area. Upstream frame-gen logic is generalized to handle the case where the in-prolog check creates control flow and hence changes the "current" basic block. Responsibilty for marking the added MachineInstrs as frame setup is moved to the expansions themselves.
@pgavlin PTAL. Once this is in I can un-exclude 9 tests from the basic LLILC test suite. |
Also this closes #23. |
// Call __chkstk, __chkstk_ms, __alloca, or expand inline. | ||
MachineInstr *NextInstr = emitStackProbe(MF, *MBB, MBBI, DL, true); | ||
MBBI = NextInstr; | ||
MBB = NextInstr->getParent(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of changing MBB
to a MachineBasicBlock*
, why not just dereference NextInstr->getParent()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand your suggestion. MBB needs to be updated here somehow.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nevermind, I see why you've done what you've done now. Ignore this comment.
LGTM. |
CI failure looks unrelated. |
Implement the prolog inline stack probe.
This change enables use of the inline stack probe within the method prolog, for cases where the local frame size exceeds 4096 bytes. The existing alloca code is extended to handle the prolog case by allowing precoloring of the various virtual registers to RCX and RDX, saving/restoring RCX/RDX around the entire probe sequence. For now the save/restore is done via push/pop; if this proves to be not viable long term we can try and get them into the caller-supplied save area.
Upstream frame-gen logic is generalized to handle the case where the in-prolog check creates control flow and hence changes the "current" basic block. Responsibilty for marking the added MachineInstrs as frame setup is moved to the expansions themselves.