diff options
| author | Dean Michael Berris <dberris@google.com> | 2018-04-13 02:31:58 +0000 |
|---|---|---|
| committer | Dean Michael Berris <dberris@google.com> | 2018-04-13 02:31:58 +0000 |
| commit | a50e57f11bc27237bfa967fdc2835b0941972f9b (patch) | |
| tree | 66969eed2bc247986197bf300324ba865a44b543 /lib/CodeGen/CodeGenFunction.cpp | |
| parent | 5610ca6099a9f08e56556fd9e4d7a980da2fcd88 (diff) | |
| download | clang-a50e57f11bc27237bfa967fdc2835b0941972f9b.tar.gz | |
[XRay][clang] Add flag to choose instrumentation bundles
Summary:
This change addresses http://llvm.org/PR36926 by allowing users to pick
which instrumentation bundles to use, when instrumenting with XRay. In
particular, the flag `-fxray-instrumentation-bundle=` has four valid
values:
- `all`: the default, emits all instrumentation kinds
- `none`: equivalent to -fnoxray-instrument
- `function`: emits the entry/exit instrumentation
- `custom`: emits the custom event instrumentation
These can be combined either as comma-separated values, or as
repeated flag values.
Reviewers: echristo, kpw, eizan, pelikan
Reviewed By: pelikan
Subscribers: mgorny, cfe-commits
Differential Revision: https://reviews.llvm.org/D44970
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@329985 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.cpp')
| -rw-r--r-- | lib/CodeGen/CodeGenFunction.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index 57b1c4b4db..5367c2adde 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -468,7 +468,10 @@ bool CodeGenFunction::ShouldXRayInstrumentFunction() const { /// AlwaysEmitXRayCustomEvents - Return true if we should emit IR for calls to /// the __xray_customevent(...) builin calls, when doing XRay instrumentation. bool CodeGenFunction::AlwaysEmitXRayCustomEvents() const { - return CGM.getCodeGenOpts().XRayAlwaysEmitCustomEvents; + return CGM.getCodeGenOpts().XRayInstrumentFunctions && + (CGM.getCodeGenOpts().XRayAlwaysEmitCustomEvents || + CGM.getCodeGenOpts().XRayInstrumentationBundle.Mask == + XRayInstrKind::Custom); } llvm::Constant * @@ -900,7 +903,9 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, } // Apply xray attributes to the function (as a string, for now) - bool InstrumentXray = ShouldXRayInstrumentFunction(); + bool InstrumentXray = ShouldXRayInstrumentFunction() && + CGM.getCodeGenOpts().XRayInstrumentationBundle.has( + XRayInstrKind::Function); if (D && InstrumentXray) { if (const auto *XRayAttr = D->getAttr<XRayInstrumentAttr>()) { if (XRayAttr->alwaysXRayInstrument()) |
