[PATCH] D22603: [coroutines] Part 1 of N: Documentation

Gor Nishanov via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 20 21:03:34 PDT 2016


GorNishanov added a comment.

In https://reviews.llvm.org/D22603#490604, @majnemer wrote:

> Out of curiosity, what lead you to use tokens for `coro.save` and `coro.suspend`?


I was looking for other examples where two intrinsics or instructions are linked together. They used tokens as  means to link them, so I chose this model.

For example, catchpad - catchret pair, or gc_statepoint - gc_result.

Besides, the only purpose of return value of coro.save is to give it to matching coro.suspend. It does not have any other meaning, besides providing a facility of linking those two intrinsics together.


================
Comment at: docs/Coroutines.rst:658
@@ +657,3 @@
+
+      declare <type>* @llvm.coro.promise.p0<type>(i8* <handle>)
+
----------------
majnemer wrote:
> Why not return i8* ?  Bitcasting the i8* seems nicer unless we expect the result to be in another LLVM address space.
If I change the intrinsic to 

```
  declare i8* @llvm.coro.promise.p0<type>(i8* <handle>)
```
It will no longer be considered overloaded, and getIntrinsicID() will return 0=not_intrinsic for it.


https://reviews.llvm.org/D22603





More information about the llvm-commits mailing list