[PATCH] D98638: [RFC][Coroutine] Force stack allocation after await_suspend() call
    Xun Li via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Tue Mar 16 22:35:59 PDT 2021
    
    
  
lxfind added a comment.
> Then if we want to put the result of the await_suspend in the stack, I think we can do it under CodeGen part only. It should be easy to judge the return type of await_suspend and create a call to llvm.coro.forcestack to the return value of await_suspend.
We probably could, but it would be very very tedious. 
During CodeGen, we only have the AST that's calling __builtin_coro_resume, which we will call Emit as a whole.
So we need to manually match the AST 2 levels down to find the await_suspend call, get its name, and then walk through the emitted IR to find a call with the same name, and then find the tmp that's used to store the return value of the call, and then emit llvm.coro.forcestack.
Repository:
  rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D98638/new/
https://reviews.llvm.org/D98638
    
    
More information about the llvm-commits
mailing list