<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
span.EmailStyle17
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">Thanks, Reid. These are good points.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">So I guess that does take us back to something more like my original proposal.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I like your suggestion of having some kind of “eh.actions” intrinsic to represent the outlining rather than the extension to landingpad that I had proposed.
I was just working on something like that in conjunction with my second alternative idea.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">What I’d really like is to have the “eh.actions” intrinsic take a shape that makes it really easy to construct the .xdata table directly from these calls.
As I think I mentioned in my original post, I think I have any idea for how to reconstruct functionally correct eh states (at least for synchronous EH purposes) from the invoke and landingpad instructions. I would like to continue, as in my original proposal,
limiting the unwind representations to those that are unique to a given landing pad. I think with enough documentation I can make that seem sensible.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">I’ll start working on a revised proposal. Let me know if you have any more solid ideas.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D">-Andy<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Reid Kleckner [mailto:rnk@google.com]
<br>
<b>Sent:</b> Tuesday, January 27, 2015 11:24 AM<br>
<b>To:</b> Kaylor, Andrew<br>
<b>Cc:</b> Bataev, Alexey; Reid Kleckner (reid@kleckner.net); LLVM Developers Mailing List; Anton Korobeynikov; Kreitzer, David L<br>
<b>Subject:</b> Re: [LLVMdev] RFC: Native Windows C++ exception handling<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">My original reply got stuck in llvmdev moderation (it hit the 100K limit!), so I'm resending without reply context.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif";color:#222222;background:white">-------</span><o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif";color:#222222;background:white"><o:p> </o:p></span></p>
</div>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif";color:#222222;background:white">Thanks, your explanation of the .xdata tables in terms of EH states makes a lot of sense to me.</span><o:p></o:p></p>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">I have a few concerns about your new EH proposal, though.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">1. If we number the EH states in the frontend, we will have to renumber them during inlining. This isn't insurmountable, but seems like a design weakness.
The major motivation for using the @llvm.eh.typeid.for intrinsic is to delay numbering the catch clauses until codegen, which is after inlining. Honestly, we should consider lowering @llvm.eh.typeid.for during EH preparation so that we can try forming a 'switch'
in IR instead of a series of conditional branches.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">Reminds me of <a href="http://llvm.org/PR20300" target="_blank"><span style="color:#1155CC">http://llvm.org/PR20300</span></a>, which is a similar EH
preparation improvement I want to do.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">2. Without the invoke instruction and accompanying landing pad, the IR has a lot of implicit control flow. Without explicit control flow, we can't promote
allocas to SSA values, which LLVM basically requires before any real optimization can begin. Consider this example:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">int x = g();<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">try { <br>
f();<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">} catch (int) {<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> x++; // use x as input and output<br>
}<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">return x;<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">Today we will promote 'x' to values like this:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">entry:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> %x = call i32 @g()<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> invoke @f() to label %ret unwind label %lpad<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">lpad:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> landingpad ...<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> ; elided EH dispatch, assume selector is for 'int'<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> %x1 = add i32 %x, 1<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> br label %ret<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">ret:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> %x = phi i32 [%x, %entry ], [%x1, %lpad]<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">In your IR example, it looks like the control flow edge from 'call void @_Z14do_inner_thingv' to the catch handler code comes at the end of the function
prior to the return.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">How would you change it if there was an assignment of a variable like 'x' before and after the call and a load of 'x' in the catch handlers? I don't think
we can do correct phi insertion on the CFG as written.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">3. Ultimately, the explicit state setting intrinsics will be lowered out and we will need to form the ip2state table. Unfortunately, bracketed intrinsics
aren't quite enough to recover the natural scoping of the source program, which is something we've seen with @llvm.lifetime.start / end. What should the backend do if it sees control flow like this?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">bb0:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> call void @llvm.eh.setehstate(i32 0)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> br label %bb3<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">bb1:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222;background:white"> call void @llvm.eh.setehstate(i32 2)</span><span style="font-family:"Arial","sans-serif";color:#222222"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222;background:white"> br label %bb3</span><span style="font-family:"Arial","sans-serif";color:#222222"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">bb3:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> invoke void @do_something() ; Which EH state are we in?<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">We could establish IR rules that such join points need to reset the EH state, but then we have to go and teach optimizers about it. It's basically a no-IR-modifications
version of labelling each BB with an unwind label, which is something that's been proposed before more directly: <a href="http://llvm.org/PR1269" target="_blank"><span style="color:#1155CC">http://llvm.org/PR1269</span></a>.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">Personally, I think we could make this change to LLVM IR, but at a great cost. Implicit EH control flow would open up a completely new class of bugs in
LLVM optimizers that doesn't exist today. Most LLVM hackers working on optimizations that I talk to *REALLY* don't want to carry the burden of implicit control flow. However, my coworkers may be biased, because exceptions are banned in most settings here at
Google.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">Anyway, unless we go all the way and make the EH state a first class IR construct, I feel like @llvm.eh.state imposes too many restrictions on IR transformations.
What happens if I reorder the BBs? Consider that MBB placement happens very late, and is guided primarily by branch probability, not source order.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">--------<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><br>
So, to attempt to address this, I think maybe we can go back to something like your first proposal.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">I continue to think that the right thing to do is to emit the Itanium-style landingpads from the frontend, and transform the control flow into something
more table-like after optimizations. If we do things this way we don't have to teach the middle-end to reason about new constructs like @llvm.eh.state.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">I propose that the preparation pass does all the outlining and removes all the landing pad code. It will leave behind the landingpad instruction and a
call to an intrinsic (@llvm.eh.actions()) that lists the handlers and handler types in the order that they need to run.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">To preserve the structure of the CFG, the actions intrinsic will return an i8* that will feed into an indirectbr terminator.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">Similar to SjLj, SSA values live across the landing pad entrances and exits will be demoted to stack allocations. Unlike SjLj, to allow access from outlined
landing pad code, the stack memory will be part of the @llvm.frameallocate block.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">Here's how _Z4testv would look after preparation:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">define void @_Z4testv() #0 {<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">entry:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> %frame_alloc = call i8* @llvm.frameallocate(i32 2)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> %capture_block = bitcast i8* %frame_alloc to %captures._Z4testv*<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> %outer = getelementptr %captures._Z4testv* %capture_block, i32 0, i32 0<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> %inner = getelementptr %captures._Z4testv* %capture_block, i32 0, i32 1<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> invoke void @_ZN5OuterC1Ev(%struct.Outer* %outer)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> to label %invoke.cont unwind label %lpad<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">invoke.cont: ; preds = %entry<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> invoke void @_ZN5InnerC1Ev(%struct.Inner* %inner)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> to label %invoke.cont2 unwind label %lpad1<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">invoke.cont2: ; preds = %invoke.cont<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> invoke void @_Z14do_inner_thingv()<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> to label %invoke.cont4 unwind label %lpad3<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">invoke.cont4: ; preds = %invoke.cont2<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> invoke void @_ZN5InnerD1Ev(%struct.Inner* %inner)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> to label %try.cont unwind label %lpad1<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">try.cont: ; preds = %invoke.cont4, %invoke.cont8<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> invoke void @_ZN5OuterD1Ev(%struct.Outer* %outer)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> to label %try.cont19 unwind label %lpad<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">try.cont19: ; preds = %try.cont, %invoke.cont17<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> call void @_Z10keep_goingv()<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> ret void<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">lpad: ; preds = %try.cont, %entry<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> %0 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> catch i8* bitcast (i8** @_ZTIf to i8*)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> %recover = call i8* (...)* @llvm.eh.actions(<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> i32 1, i8* bitcast (i8** @_ZTIf to i8*), void (i8*, i8*)* @catch_float)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> indirectbr i8* %recover, [label %try.cont], [label %try.cont19]<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">lpad1: ; preds = %invoke.cont4, %invoke.cont<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> %3 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> cleanup<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> catch i8* bitcast (i8** @_ZTIi to i8*)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> catch i8* bitcast (i8** @_ZTIf to i8*)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> %recover1 = call i8* (...)* @llvm.eh.actions(<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> i32 1, i8* bitcast (i8** @_ZTIi to i8*), void (i8*, i8*)* @catch_int,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> i32 0, i8* null, void (i8*, i8*)* @dtor_outer,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> i32 2, i8* bitcast (i8** @_ZTIf to i8*), void (i8*, i8*)* @catch_float)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> indirectbr i8* %recover1, [label %try.cont], [label %try.cont19]<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">lpad3: ; preds = %invoke.cont2<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> %6 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> cleanup<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> catch i8* bitcast (i8** @_ZTIi to i8*)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> catch i8* bitcast (i8** @_ZTIf to i8*)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> %recover2 = call i8* (...)* @llvm.eh.actions(<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> i32 0, i8* null, void (i8*, i8*)* @dtor_inner,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> i32 1, i8* bitcast (i8** @_ZTIi to i8*), void (i8*, i8*)* @catch_int,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> i32 0, i8* null, void (i8*, i8*)* @dtor_outer,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> i32 2, i8* bitcast (i8** @_ZTIf to i8*), void (i8*, i8*)* @catch_float)<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"> indirectbr i8* %recover2, [label %try.cont], [label %try.cont19]<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">}<o:p></o:p></span></p>
</div>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">One issue is that I'm not sure how to catch a "float" exception thrown by handle_int(). I'll have to think about that.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">It's also not clear to me that we need to have the i32 selector in @llvm.eh.actions. We need a way to distinguish between catch-all (traditionally i8*
null) and a cleanup. We could just use some other constant like 'i8* inttoptr (i32 1 to i8*)' and make that the cleanup sentinel.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="background:white"><span style="font-family:"Arial","sans-serif";color:#222222">I think there are still issues here, like how to actually implement this transform, but I'm going to hit send now and keep thinking. :)<o:p></o:p></span></p>
</div>
</div>
</div>
</body>
</html>