[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
Tue Nov 13 15:08:49 PST 2018


jdoerfert created this revision.
jdoerfert added reviewers: hfinkel, reames, chandlerc.
Herald added subscribers: jfb, bollu, mgorny.

  An abstract call site is a wrapper that allows to treat direct,
  indirect, and callback calls the same. If an abstract call site
  represents a direct or indirect call site it behaves like a stripped
  down version of a normal call site object. The abstract call site can
  also represent a callback call, thus the fact that the initially
  called function (=broker) may invoke a third one (=callback callee).
  In this case, the abstract call side hides the middle man, hence the
  broker function. The result is a representation of the callback call,
  inside the broker, but in the context of the original instruction.
  
  There are up to three functions involved when we talk about callback
  call sites. The caller (1), which invokes the broker function. The
  broker function (2), that may or may not invoke the callee. And
  finally the callee (3), which is the target of the callback call.
  
  The abstract call site will handle the mapping from parameters to
  arguments depending on the semantic of the broker function. However,
  it is important to note that the mapping is often partial. Thus, some
  arguments of the call/invoke instruction are mapped to parameters of
  the callee while others are not.

IPConstantPropagation

  To showcase how abstract call sites enable optimization of callback
  calls alongside direct and indirect calls, the (currently unused)
  inter-procedural constant propagation pass (IPConstantPropagation) was
  modified. Through minimal changes, mostly concerning dealing with the
  partial mapping of callbacks, inter-procedural constant propagation
  was enabled for callbacks.

Known Broker Functions

  With this commit two known broker functions that invoke a callback are
  identified by their name. While this is not the perfect way to handle
  known broker functions, it should suffice for now.

For motivation and additional information please see the corresponding
talk (slides/video)

  https://llvm.org/devmtg/2018-10/talk-abstracts.html#talk20

as well as the LCPC paper

  http://compilers.cs.uni-saarland.de/people/doerfert/par_opt_lcpc18.pdf


Repository:
  rL LLVM

https://reviews.llvm.org/D54498

Files:
  include/llvm/IR/CallSite.h
  lib/IR/AbstractCallSite.cpp
  lib/IR/CMakeLists.txt
  lib/Transforms/IPO/IPConstantPropagation.cpp
  test/Transforms/IPConstantProp/openmp_parallel_for.ll
  test/Transforms/IPConstantProp/pthreads.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54498.173942.patch
Type: text/x-patch
Size: 20425 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181113/304cec25/attachment.bin>


More information about the llvm-commits mailing list