[XRay] Custom event logging intrinsic
This patch introduces an LLVM intrinsic and a target opcode for custom event
logging in XRay. Initially, its use case will be to allow users of XRay to log
some type of string ("poor man's printf"). The target opcode compiles to a noop
sled large enough to enable calling through to a runtime-determined relative
function call. At runtime, when X-Ray is enabled, the sled is replaced by
compiler-rt with a trampoline to the logic for creating the custom log entries.
Future patches will implement the compiler-rt parts and clang-side support for
emitting the IR corresponding to this intrinsic.
Reviewers: timshen, dberris
Subscribers: igorb, pelikan, rSerge, timshen, echristo, dberris, llvm-commits
Differential Revision: https://reviews.llvm.org/D27503
llvm-svn: 302405
2017-05-08 13:45:21 +08:00
|
|
|
; RUN: llc -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s
|
|
|
|
|
|
|
|
define i32 @fn() nounwind noinline uwtable "function-instrument"="xray-always" {
|
|
|
|
%eventptr = alloca i8
|
|
|
|
%eventsize = alloca i32
|
|
|
|
store i32 3, i32* %eventsize
|
|
|
|
%val = load i32, i32* %eventsize
|
|
|
|
call void @llvm.xray.customevent(i8* %eventptr, i32 %val)
|
|
|
|
; CHECK-LABEL: Lxray_event_sled_0:
|
2017-08-31 23:17:17 +08:00
|
|
|
; CHECK-NEXT: .ascii "\353\024
|
|
|
|
; CHECK-NEXT: pushq %rax
|
[XRay] Custom event logging intrinsic
This patch introduces an LLVM intrinsic and a target opcode for custom event
logging in XRay. Initially, its use case will be to allow users of XRay to log
some type of string ("poor man's printf"). The target opcode compiles to a noop
sled large enough to enable calling through to a runtime-determined relative
function call. At runtime, when X-Ray is enabled, the sled is replaced by
compiler-rt with a trampoline to the logic for creating the custom log entries.
Future patches will implement the compiler-rt parts and clang-side support for
emitting the IR corresponding to this intrinsic.
Reviewers: timshen, dberris
Subscribers: igorb, pelikan, rSerge, timshen, echristo, dberris, llvm-commits
Differential Revision: https://reviews.llvm.org/D27503
llvm-svn: 302405
2017-05-08 13:45:21 +08:00
|
|
|
; CHECK-NEXT: movq {{.*}}, %rdi
|
|
|
|
; CHECK-NEXT: movq {{.*}}, %rsi
|
2017-08-31 23:17:17 +08:00
|
|
|
; CHECK-NEXT: movabsq $__xray_CustomEvent, %rax
|
|
|
|
; CHECK-NEXT: callq *%rax
|
|
|
|
; CHECK-NEXT: popq %rax
|
[XRay] Custom event logging intrinsic
This patch introduces an LLVM intrinsic and a target opcode for custom event
logging in XRay. Initially, its use case will be to allow users of XRay to log
some type of string ("poor man's printf"). The target opcode compiles to a noop
sled large enough to enable calling through to a runtime-determined relative
function call. At runtime, when X-Ray is enabled, the sled is replaced by
compiler-rt with a trampoline to the logic for creating the custom log entries.
Future patches will implement the compiler-rt parts and clang-side support for
emitting the IR corresponding to this intrinsic.
Reviewers: timshen, dberris
Subscribers: igorb, pelikan, rSerge, timshen, echristo, dberris, llvm-commits
Differential Revision: https://reviews.llvm.org/D27503
llvm-svn: 302405
2017-05-08 13:45:21 +08:00
|
|
|
ret i32 0
|
|
|
|
}
|
2017-08-31 23:17:17 +08:00
|
|
|
; CHECK: .section {{.*}}xray_instr_map
|
2017-06-21 14:39:42 +08:00
|
|
|
; CHECK-LABEL: Lxray_sleds_start0:
|
[XRay] Custom event logging intrinsic
This patch introduces an LLVM intrinsic and a target opcode for custom event
logging in XRay. Initially, its use case will be to allow users of XRay to log
some type of string ("poor man's printf"). The target opcode compiles to a noop
sled large enough to enable calling through to a runtime-determined relative
function call. At runtime, when X-Ray is enabled, the sled is replaced by
compiler-rt with a trampoline to the logic for creating the custom log entries.
Future patches will implement the compiler-rt parts and clang-side support for
emitting the IR corresponding to this intrinsic.
Reviewers: timshen, dberris
Subscribers: igorb, pelikan, rSerge, timshen, echristo, dberris, llvm-commits
Differential Revision: https://reviews.llvm.org/D27503
llvm-svn: 302405
2017-05-08 13:45:21 +08:00
|
|
|
; CHECK: .quad {{.*}}xray_event_sled_0
|
|
|
|
|
|
|
|
declare void @llvm.xray.customevent(i8*, i32)
|