This is the first patch in the coroutine series. It contains the documentation for the coroutine intrinsics and their usage.
Details
- Reviewers
- None
Diff Detail
Event Timeline
docs/Coroutines.rst | ||
---|---|---|
110 | Shouldn't the first branch target be %cleanup, instead of %coro.return? |
docs/Coroutines.rst | ||
---|---|---|
110 | coro.fork is currently specified so that: I think you are right. It would be better to flip the meaning of true and false, so that normal branch is the first, and alternative is the second, same as coro.suspend and similar to invoke instruction. Also, I was looking for a better name for coro.fork. Do you think coro.start would work better? |
docs/Coroutines.rst | ||
---|---|---|
110 | My comment was related to the fact that the normal continuation branch should not skip the cleanup step (since the frame was allocated before, it needs to be deallocated). As for the name, yes, coro.start() or perhaps coro.first() sounds better. |
docs/Coroutines.rst | ||
---|---|---|
110 | coro.fork does not represent a suspend point. It is mostly there to indicate where to go when coroutine hits its very first suspend (while still running by the caller of 'f'). An alternative representation is to get rid of coro.fork altogether and replace coro.suspend with a terminator instruction with three possible successors. Namely: corosuspend [final] [save %token] to label %return.block resume label %resume cleanup label %cleanup corosuspend is lowered as follows: in 'f': corosuspend is replaced with `br %return.block` in 'f.resume': add a new entry block with a switch jumping to all resume blocks corosuspend is replaced with `ret void` in 'f.destroy': add a new entry block with a switch jumping to all cleanup blocks corosuspend is replaced with `ret void` (though this is not necessary since all corosuspends will be unreachable in the f.destroy and will be thrown out by SimplifyCFG I think this makes understanding of the model clearer. The only negative side |
Updated to match the latest RFC:
http://lists.llvm.org/pipermail/llvm-dev/2016-July/102133.html
I started an official review of the llvm-commits:
https://reviews.llvm.org/D22603
I added the Python example.
I also added it to this review, so that it is easy to see what changed.
Please comment on https://reviews.llvm.org/D22603, not on this one.
Shouldn't the first branch target be %cleanup, instead of %coro.return?