This intrinsic can be used to extract a pointer to the exception caught by
a given catchpad. Its argument has token type and must be a catchpad.
Also clarify ExtendingLLVM documentation regarding overloaded intrinsics.
Differential D12533
[WinEH] Add llvm.eh.exceptionpointer intrinsic JosephTremoulet on Sep 1 2015, 8:57 AM. Authored by
Details This intrinsic can be used to extract a pointer to the exception caught by Also clarify ExtendingLLVM documentation regarding overloaded intrinsics.
Diff Detail Event TimelineComment Actions This seems like it's kind of splitting the difference between extracttoken and specific intrinsics. Based on your proposal, I was envisioning having a family of intrinsics like: declare i32 @llvm.eh.exceptioncode(token) declare i8* @llvm.eh.exceptioninfo(token) ; I guess this is for SEH filters only, which we don't have yet... declare i8 @llvm.eh.abnormaltermination(token) declare i32 @llvm.eh.exceptionstate(token) Then we don't need the llvm_any_ty mangling, and the IR seems more readable. What use cases do you have for the additional parameters to padparam? If the extra parameters are used like an enum, where the backend has to switch on it and use custom code for different cases, then I think individual intrinsics are the way to go. If the extra parameters are more like an index into a list of register parameters (RCX, RDX, R8, R9, ...) or an index into argument stack slots, then llvm.eh.padparam seems like a reasonable approach. We should also see what Sanjoy needs for GC. Comment Actions Yes, it was ironic that eh.padparam ended up with the fully-general signature. That was simply an attempt to match the "look-and-feel" of the other EH operators/intrinsics, which are typically abstracted over the personality function.
I wasn't planning on using any in LLILC (the only extraction I need is to get an exception pointer from a catchpad), I just included them in the opcode signature to give flexibility for other personalities.
I agree with that view. I was imagining an outer switch on personality function, and that the selector arguments if used would likely index into a parameter list. I'm certainly not wedded to keeping padparam this general. The specific signature that I need is exception_aggr addrspace(1)* @llvm.eh.intrinsicname() (or I could get by with i8 addrspace(1)* @llvm.eh.intrinsicname() and bitcasts). I guess for my specific case intrinsicname would be get_clr_exception or something. If you'd prefer that, let me know what you think the name should be and whether you want any of the ones you listed included in this patch, and I'll be happy to change it. Comment Actions I guess the addressspace(1) thing has to be baked into the signature for you, so we can't get by with i8* @llvm.eh.exceptionpointer(token) and addresspacecast. How about making it llvm_any_ty and using i8 addressspace(1) * @llvm.eh.exceptionpointer.p1i8(token)? Comment Actions
I can do something along those lines, sure. Two questions:
Comment Actions Sounds good.
If/when we add SEH filter funclets, we'll need separate constructs for exception_info() and exception_code(). In anticipation, we should probably use llvm.eh.exceptioncode for the SEH code. Comment Actions I've made the updates per your suggestion (unless I've misunderstood the suggestion... :]). Comment Actions We'd eventually (i.e. I cannot commit to a timeframe right now) change I expect the end result for the gc_relocate and gc_result
|
Should there be a verifier rule checking that only catchpads feed into this intrinsic?