[LLVMdev] RFC: New Exception Handling Proposal
Bill Wendling
wendling at apple.com
Tue Nov 24 13:25:06 PST 2009
On Nov 18, 2009, at 2:22 PM, Bill Wendling wrote:
> Throw: A New Instruction
> ------------------------
>
> The `unwind' instruction has no semantic meaning outside of an
> exception
> context. I propose removing it as an instruction, and replacing it
> with a new,
> more descriptively named instruction called `throw'. The `throw'
> instruction
> would take the exception object as its only parameter. Its semantic
> would be to
> throw that exception object. Essentially, rethrowing that exception.
>
> Syntax:
>
> throw i8* %eh_ptr
>
>
Addendum: It was pointed out to me in a private email that this new
"throw" instruction may not be useful. If you have two functions being
merged into the same module, but both with different instructions to
do the actual "throw", then this instruction as described here won't
work. There's the possibility of adding a function parameter to this,
but that obviates this new instruction (why not emit a direct call
instead?). The function may be added to the function type, similar to
the personality function. But that's even more baggage on the function
type.
There would only be a marginal conceptual win, which isn't enough to
warrant a new instruction.
-bw
More information about the llvm-dev
mailing list