diff options
| author | Dean Michael Berris <dberris@google.com> | 2017-03-06 06:48:56 +0000 |
|---|---|---|
| committer | Dean Michael Berris <dberris@google.com> | 2017-03-06 06:48:56 +0000 |
| commit | 7e8eea429f16c8a36befb9e2ea3c0fbf9a33f283 (patch) | |
| tree | d15da9d8f8569c24d535c520cde284a06d66b51c /llvm/lib/CodeGen | |
| parent | a97f927fcb35d6481f50a5900faa6d22c68dcf1c (diff) | |
| download | bcm5719-llvm-7e8eea429f16c8a36befb9e2ea3c0fbf9a33f283.tar.gz bcm5719-llvm-7e8eea429f16c8a36befb9e2ea3c0fbf9a33f283.zip | |
[XRay] Allow logging the first argument of a function call.
Summary:
Functions with the "xray-log-args" attribute will have a special XRay sled kind
emitted, for compiler-rt to copy any call arguments to your logging handler.
For practical and performance reasons, only the first argument is supported, and
only up to 64 bits.
Reviewers: dberris
Reviewed By: dberris
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D29702
llvm-svn: 296998
Diffstat (limited to 'llvm/lib/CodeGen')
| -rw-r--r-- | llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index b8a8a999c42..7099065a638 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -2756,8 +2756,11 @@ void AsmPrinter::recordSled(MCSymbol *Sled, const MachineInstr &MI, SledKind Kind) { auto Fn = MI.getParent()->getParent()->getFunction(); auto Attr = Fn->getFnAttribute("function-instrument"); + bool LogArgs = Fn->hasFnAttribute("xray-log-args"); bool AlwaysInstrument = Attr.isStringAttribute() && Attr.getValueAsString() == "xray-always"; + if (Kind == SledKind::FUNCTION_ENTER && LogArgs) + Kind = SledKind::LOG_ARGS_ENTER; Sleds.emplace_back( XRayFunctionEntry{ Sled, CurrentFnSym, Kind, AlwaysInstrument, Fn }); } |

