]> granicus.if.org Git - clang/commit
Emit !callback metadata and introduce the callback attribute
authorJohannes Doerfert <doerfert@cs.uni-saarland.de>
Sat, 19 Jan 2019 05:36:54 +0000 (05:36 +0000)
committerJohannes Doerfert <doerfert@cs.uni-saarland.de>
Sat, 19 Jan 2019 05:36:54 +0000 (05:36 +0000)
commit64cdc6a98b87b75a9e7b88a45870ee88c4169ee1
treedd9eac698c7ed117868d794ce584abd4acbc8c41
parente6604f101fb09ae6fa05da0d4df230493e48579f
Emit !callback metadata and introduce the callback attribute

  With commit r351627, LLVM gained the ability to apply (existing) IPO
  optimizations on indirections through callbacks, or transitive calls.
  The general idea is that we use an abstraction to hide the middle man
  and represent the callback call in the context of the initial caller.
  It is described in more detail in the commit message of the LLVM patch
  r351627, the llvm::AbstractCallSite class description, and the
  language reference section on callback-metadata.

  This commit enables clang to emit !callback metadata that is
  understood by LLVM. It does so in three different cases:
    1) For known broker functions declarations that are directly
       generated, e.g., __kmpc_fork_call for the OpenMP pragma parallel.
    2) For known broker functions that are identified by their name and
       source location through the builtin detection, e.g.,
       pthread_create from the POSIX thread API.
    3) For user annotated functions that carry the "callback(callee, ...)"
       attribute. The attribute has to include the name, or index, of
       the callback callee and how the passed arguments can be
       identified (as many as the callback callee has). See the callback
       attribute documentation for detailed information.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@351629 91177308-0d34-0410-b5e6-96231b3b80d8
26 files changed:
include/clang/AST/ASTContext.h
include/clang/Basic/Attr.td
include/clang/Basic/AttrDocs.td
include/clang/Basic/Builtins.def
include/clang/Basic/Builtins.h
include/clang/Basic/DiagnosticSemaKinds.td
lib/AST/ASTContext.cpp
lib/Basic/Builtins.cpp
lib/CodeGen/CGOpenMPRuntime.cpp
lib/CodeGen/CodeGenModule.cpp
lib/Parse/ParseDecl.cpp
lib/Sema/SemaDecl.cpp
lib/Sema/SemaDeclAttr.cpp
test/Analysis/retain-release.m
test/CodeGen/attr-callback.c [new file with mode: 0644]
test/CodeGen/callback_annotated.c [new file with mode: 0644]
test/CodeGen/callback_openmp.c [new file with mode: 0644]
test/CodeGen/callback_pthread_create.c [new file with mode: 0644]
test/CodeGenCXX/attr-callback.cpp [new file with mode: 0644]
test/Misc/pragma-attribute-supported-attributes-list.test
test/OpenMP/parallel_codegen.cpp
test/Sema/attr-callback-broken.c [new file with mode: 0644]
test/Sema/attr-callback.c [new file with mode: 0644]
test/SemaCXX/attr-callback-broken.cpp [new file with mode: 0644]
test/SemaCXX/attr-callback.cpp [new file with mode: 0644]
utils/TableGen/ClangAttrEmitter.cpp