[llvm-dev] RFC: LLVM Coroutine Representation, Round 2

Gor Nishanov via llvm-dev llvm-dev at lists.llvm.org
Thu Jul 21 13:39:35 PDT 2016


Hi Vadim:

On Thu, Jul 21, 2016 at 1:08 PM, Vadim Chugunov wrote:

> What I am getting at, is that ideally the parameters/return value of
> generator.send() should become parameters/return value of @f.Resume:
>     define <return type> @f.Resume(%f.Frame* %FramePtr, <input type>
> %Param);

Absolutely! I sketched out this approach and it looks like it can be build on
top of the current model. I have not designed nor implemented it yet and it is
not part of this RFC.

When I get to designing it, I can keep you in the loop if you are interested.

Gor

P.S.

BTW, you would need to have as many f.resume's as you have suspend points.
So that if you have a coroutine that looks like:

  task<void> f(AsyncStream& s) {
    int a = await s.ReadInt();
    float b = await s.ReadFloat();
  }

you would have:

  void f.resume.1(%f.Frame*, i32 result);
  void f.resume.2(%f.Frame*, float result);


More information about the llvm-dev mailing list