HomePhabricator

llvm.coro.id.async lowering: Parameterize how-to restore the current's…

Authored by aschwaighofer on Nov 2 2020, 9:37 AM.

Description

llvm.coro.id.async lowering: Parameterize how-to restore the current's continutation context and restart the pipeline after splitting

The llvm.coro.suspend.async intrinsic takes a function pointer as its
argument that describes how-to restore the current continuation's
context from the context argument of the continuation function. Before
we assumed that the current context can be restored by loading from the
context arguments first pointer field (first_arg->caller_context).

This allows for defining suspension points that reuse the current
context for example.

Also:

llvm.coro.id.async lowering: Add llvm.coro.preprare.async intrinsic

Blocks inlining until after the async coroutine was split.

Also, change the async function pointer's context size position

struct async_function_pointer {
  uint32_t relative_function_pointer_to_async_impl;
  uint32_t context_size;
}

And make the position of the async context argument configurable. The
position is specified by the llvm.coro.id.async intrinsic.

rdar://70097093

Differential Revision: https://reviews.llvm.org/D90783