Skip to content
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

Merged
merged 1 commit into from
May 2, 2015

Conversation

AndyAyersMS
Copy link
Member

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.

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.
@AndyAyersMS
Copy link
Member Author

@pgavlin PTAL.

Once this is in I can un-exclude 9 tests from the basic LLILC test suite.

@AndyAyersMS
Copy link
Member Author

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();
Copy link
Contributor

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()?

Copy link
Member Author

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.

Copy link
Contributor

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.

@pgavlin
Copy link
Contributor

pgavlin commented May 1, 2015

LGTM.

@AndyAyersMS
Copy link
Member Author

CI failure looks unrelated.

AndyAyersMS added a commit that referenced this pull request May 2, 2015
Implement the prolog inline stack probe.
@AndyAyersMS AndyAyersMS merged commit 2ea252f into microsoft:MS May 2, 2015
@AndyAyersMS AndyAyersMS deleted the PrologChkStk branch May 2, 2015 00:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants