[PATCH] D43744: [WebAssembly] Fix rethrow's argument type

Heejin Ahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 9 16:47:25 PST 2018


aheejin planned changes to this revision.
aheejin added a comment.

Turns out it's not even a nullref or tablegen problem. (I mean, for rethrow instruction selection here. We certainly need nullref in wasm.)

What does it mean that we have a nullref value? Every `MachineOperand` should either be a register or an immediate. `except_ref` value cannot be an immediate, so it should be in a register.

Making a fake physical register, using it as an operand to `rethrow` in instruction selection, and registering it as a function live-in does not work, because PrepareForLivenessIntervals pass, which creates `IMPLICIT_DEF` for reg uses without defs, runs after ReplacePhysRegs pass. So we wouldn't even be able to know that was once a live-in physical register.

So we somehow have to put nullref, or whatever value, in a register ourselves. To do that, here should be a way to create it. At this point what we need is not even a nullref, because it is now actually irrelevant. The only thing we need is how we create some value. That is dependent on where we put `rethrow` instruction. If we put that in a library function, that means `ARGUMENT_type` instructions will take care of it. If we put that with `catch` instruction, that will take care of it, but in this case `rethrow` instruction without a catch will be invalid. For the prototype, I was not gonna put `rethrow` within a library function because that's easier and we don't need to figure out how to pass `except_ref` as arguments. So, in this case, to land this, we need instruction selection patch that creates this value as well. But I marked the isel patch as "Changes Planned" for now because we are likely to change that patch if we use WinEH.

So, conclusion, it looks like we should put off landing this as well.


Repository:
  rL LLVM

https://reviews.llvm.org/D43744





More information about the llvm-commits mailing list