AbstractCallSite -- A unified interface for (in)direct and callback calls
authorJohannes Doerfert <doerfert@cs.uni-saarland.de>
Sat, 19 Jan 2019 05:19:06 +0000 (05:19 +0000)
committerJohannes Doerfert <doerfert@cs.uni-saarland.de>
Sat, 19 Jan 2019 05:19:06 +0000 (05:19 +0000)
commit18251842c6781ddcd74d785da1235593ad7613dc
treebcef2175fdb6918ff3b37c89e3897469496d5ce8
parenta0383d6c1f41b53f64d609d28b6b783c6a0cf9d0
AbstractCallSite -- A unified interface for (in)direct and callback calls

  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 that
  invoked the broker.

  Again, 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
  callback callee. And finally the callback 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. At the same time, arguments of the
  callback callee might be unknown, thus "null" if queried.

  This patch introduces also !callback metadata which describe how a
  callback broker maps from parameters to arguments. This metadata is
  directly created by clang for known broker functions, provided through
  source code attributes by the user, or later deduced by analyses.

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

Differential Revision: https://reviews.llvm.org/D54498

llvm-svn: 351627
llvm/docs/LangRef.rst
llvm/include/llvm/IR/CallSite.h
llvm/include/llvm/IR/LLVMContext.h
llvm/include/llvm/IR/MDBuilder.h
llvm/lib/IR/AbstractCallSite.cpp [new file with mode: 0644]
llvm/lib/IR/CMakeLists.txt
llvm/lib/IR/LLVMContext.cpp
llvm/lib/IR/MDBuilder.cpp
llvm/test/ThinLTO/X86/lazyload_metadata.ll