I find that the ramp function of coroutine whose initial_suspend is always_suspend (Let me call it “init-suspend-coroutine”)
would be very simple. Normally it would only contain one basic block. And all of the codes in the coroutine body would be
in the resume function of coroutine.
For the ramp function of coroutine whose initial_suspend isn’t always_suspend (Let me call it “init-no-suspend-coroutine”),
it may be large and it may contain the codes in the coroutine body. It may cause the size of codes be multiple of the original
size. And the large ramp function is harder to inline and harder to be elided.
I want to make the ramp function for init-no-suspend-coroutine keep the same formal with the init-suspend-coroutine.
My plan is to insert a fake suspend in the front of initial_suspend in the CodeGen phase of clang and in the llvm part, we can
insert a tail call to the resume function so the control flow would remain with the original.
Does any one have any suggestion?