]> granicus.if.org Git - clang/commit
[XRay] Add __xray_customeevent(...) as a clang-supported builtin
authorDean Michael Berris <dberris@google.com>
Tue, 9 May 2017 00:45:40 +0000 (00:45 +0000)
committerDean Michael Berris <dberris@google.com>
Tue, 9 May 2017 00:45:40 +0000 (00:45 +0000)
commit5a83b3867c31a5a87c1d938bcb107a8d7a36bfd7
tree2985f36df09cb93a18e63efaae6b89ac6d705144
parenta4e6a18c0f27fa88ab403ba530f45f4a780a6601
[XRay] Add __xray_customeevent(...) as a clang-supported builtin

Summary:
We define the `__xray_customeevent` builtin that gets translated to
IR calls to the correct intrinsic. The default implementation of this is
a no-op function. The codegen side of this follows the following logic:

- When `-fxray-instrument` is not provided in the driver, we elide all
calls to `__xray_customevent`.
- When `-fxray-instrument` is enabled and a function is marked as "never
instrumented", we elide all calls to `__xray_customevent` in that
function; if either marked as "always instrumented" or subject to
threshold-based instrumentation, we emit a call to the
`llvm.xray.customevent` intrinsic from LLVM for each
`__xray_customevent` occurrence in the function.

This change depends on D27503 (to land in LLVM first).

Reviewers: echristo, rsmith

Subscribers: mehdi_amini, pelikan, lrl, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302492 91177308-0d34-0410-b5e6-96231b3b80d8
include/clang/Basic/Builtins.def
lib/CodeGen/CGBuiltin.cpp
test/CodeGen/xray-customevent.cpp [new file with mode: 0644]