[PATCH] D91098: [coro] Async coroutines: Allow more than 3 arguments in the dispatch function

Arnold Schwaighofer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 11 07:07:45 PST 2020


aschwaighofer added a comment.

Yes, frontend is expected to emit a thunk that models the tail call to the function at the suspend point. This prevents code moving in between the tail call and return before coroutine splitting and allows for specifying how to perform the call (e.g pointer authentication).

  define internal hidden void @__suspend_dispatch_3.1(i8* %0, %task* %1, %executor* %2, %context* %3)  {
  entry:
    %4 = bitcast i8* %0 to void (%task*, %executor*, %context*)*
    tail call swiftcc void %4(%task* %1, %executor* %2, %context* %3)
    ret void
  }
  
  define linkonce_odr hidden i8* @__resume_project_context(i8* %0) {
  entry:
    %1 = bitcast i8* %0 to i8**
    %2 = load i8*, i8** %1, align 8
    ret i8* %2
  }
  
  %resume_func = call i8* @llvm.coro.async.resume()
  %24 = call { i8*, i8*, i8* } (i8*, i8*, ...) @llvm.coro.suspend.async(
    i8* %resume_func, 
    i8* bitcast (i8* (i8*)* @__resume_project_context to i8*), 
    i8* bitcast (void (i8*, %task*, %executor*, %context*)* @__suspend_dispatch_3.1 to i8*), 
    i8* %fun_ptr, %task* %0, %executor* %1, %context* %22)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D91098/new/

https://reviews.llvm.org/D91098



More information about the llvm-commits mailing list