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

[MIR] MSVC SEH unwind handling #31600

Merged
merged 2 commits into from
Feb 18, 2016
Merged

[MIR] MSVC SEH unwind handling #31600

merged 2 commits into from
Feb 18, 2016

Conversation

nagisa
Copy link
Member

@nagisa nagisa commented Feb 12, 2016

r? @alexcrichton for the translator changes and @nikomatsakis for the no-landing-pads pass.

The pass removes the unwind branch of each terminator, thus moving the responsibility of handling
the -Z no-landing-pads flag to a small self-contained pass… instead of polluting the translator.
fn make_landing_pad(&mut self,
cleanup: BlockAndBuilder<'bcx, 'tcx>)
-> BlockAndBuilder<'bcx, 'tcx>
{
if base::wants_msvc_seh(cleanup.sess()) {
return cleanup;
}
// FIXME(#30941) this doesn't handle msvc-style exceptions
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this comment can be removed now?

@alexcrichton
Copy link
Member

The SEH translation feels a little ad-hoc here with some sprinklings here and there, but otherwise doesn't seem obviously wrong to met at least! LLVM's verifier pass is pretty strict with the cleanuppad/cleanupret instructions now so if this passes there then it's likely correct

@alexcrichton
Copy link
Member

r? @nikomatsakis

@@ -148,6 +148,10 @@ impl<'a, 'm, 'tcx> Visitor<'tcx> for InnerDump<'a,'m,'tcx> {

match build_mir(Cx::new(&infcx), implicit_arg_tys, id, span, decl, body) {
Ok(mut mir) => {
// FIXME: This should run later rather than earlier (since this is supposed to be a
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem like a FIXME necessarily. Once we are done with type-checking and other things, the MIR is basically ripe for optimization in any order, and taking into account codegen options seems legit.

@nagisa
Copy link
Member Author

nagisa commented Feb 17, 2016

nits addressed.

// except according to those terms.

//! This pass removes the unwind branch of all the terminators when the no-landing-pads option is
//! specified.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fairly nifty btw. =)

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Feb 18, 2016

📌 Commit 1752615 has been approved by nikomatsakis

@bors
Copy link
Contributor

bors commented Feb 18, 2016

⌛ Testing commit 1752615 with merge de366b5...

bors added a commit that referenced this pull request Feb 18, 2016
r? @alexcrichton for the translator changes and @nikomatsakis for the no-landing-pads pass.
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.

5 participants