[PATCH] D54498: AbstractCallSite -- A unified interface for (in)direct and callback calls

Johannes Doerfert via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 14 12:28:01 PST 2018


jdoerfert added a comment.

In https://reviews.llvm.org/D54498#1298768, @bollu wrote:

> Thanks for the answer! That clears up a lot.
>
> So, I believe the main difference between the `pthread` example and the one that I have is that of mutual recursion: I will often have mutual recursion between the `trampoline` and the `f_i`, which usually complicates inter-procedural analysis (as far as I understand?)


For you example, the front-end should emit something along the lines of the following for each `push_call(...); trampoline();` sequence:

   void abstract_trampoline(token, continuation) {
      push_call(token);
      trampoline();
   }
  
    
  //   push_call(IS_ODD);
  //   trampoline();
  // is replaced by:
  abstract_trampoline(IS_ODD, is_odd);
   

You can then specify that `abstract_trampoline` has callback behavior and that the second argument is the callee of the callback.
Afterwards, all IPOs enabled to handle abstract call sites will work and the best thing is, you code is **actually valid** all the time.
When we do this, and the other expansion I described for `pthreads_create`, we want a late inliner pass to remove these function but as there is
nothing to clean up we should not have much trouble doing that.


Repository:
  rL LLVM

https://reviews.llvm.org/D54498





More information about the llvm-commits mailing list