diff options
| author | Keith Wyss <wyssman@gmail.com> | 2018-04-17 21:30:29 +0000 |
|---|---|---|
| committer | Keith Wyss <wyssman@gmail.com> | 2018-04-17 21:30:29 +0000 |
| commit | 3d86823f3d22296f2eb9883d1b84d3fa90c73054 (patch) | |
| tree | 2c87f661865944f396fa3bf06d86a854897c88d1 /llvm/test | |
| parent | adb092e0aefc7da8fe68d5b49f0e61ae68d8f595 (diff) | |
| download | bcm5719-llvm-3d86823f3d22296f2eb9883d1b84d3fa90c73054.tar.gz bcm5719-llvm-3d86823f3d22296f2eb9883d1b84d3fa90c73054.zip | |
[XRay] Typed event logging intrinsic
Summary:
Add an LLVM intrinsic for type discriminated event logging with XRay.
Similar to the existing intrinsic for custom events, but also accepts
a type tag argument to allow plugins to be aware of different types
and semantically interpret logged events they know about without
choking on those they don't.
Relies on a symbol defined in compiler-rt patch D43668. I may wait
to submit before I can see demo everything working together including
a still to come clang patch.
Reviewers: dberris, pelikan, eizan, rSerge, timshen
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D45633
llvm-svn: 330219
Diffstat (limited to 'llvm/test')
| -rw-r--r-- | llvm/test/CodeGen/X86/xray-custom-log.ll | 4 | ||||
| -rw-r--r-- | llvm/test/CodeGen/X86/xray-typed-event-log.ll | 45 |
2 files changed, 47 insertions, 2 deletions
diff --git a/llvm/test/CodeGen/X86/xray-custom-log.ll b/llvm/test/CodeGen/X86/xray-custom-log.ll index 7abf7e29c62..023dd338f2f 100644 --- a/llvm/test/CodeGen/X86/xray-custom-log.ll +++ b/llvm/test/CodeGen/X86/xray-custom-log.ll @@ -11,8 +11,8 @@ define i32 @fn() nounwind noinline uwtable "function-instrument"="xray-always" { ; CHECK-LABEL: Lxray_event_sled_0: ; CHECK: .byte 0xeb, 0x0f ; CHECK-NEXT: pushq %rdi - ; CHECK-NEXT: movq {{.*}}, %rdi ; CHECK-NEXT: pushq %rsi + ; CHECK-NEXT: movq {{.*}}, %rdi ; CHECK-NEXT: movq {{.*}}, %rsi ; CHECK-NEXT: callq __xray_CustomEvent ; CHECK-NEXT: popq %rsi @@ -21,8 +21,8 @@ define i32 @fn() nounwind noinline uwtable "function-instrument"="xray-always" { ; PIC-LABEL: Lxray_event_sled_0: ; PIC: .byte 0xeb, 0x0f ; PIC-NEXT: pushq %rdi - ; PIC-NEXT: movq {{.*}}, %rdi ; PIC-NEXT: pushq %rsi + ; PIC-NEXT: movq {{.*}}, %rdi ; PIC-NEXT: movq {{.*}}, %rsi ; PIC-NEXT: callq __xray_CustomEvent@PLT ; PIC-NEXT: popq %rsi diff --git a/llvm/test/CodeGen/X86/xray-typed-event-log.ll b/llvm/test/CodeGen/X86/xray-typed-event-log.ll new file mode 100644 index 00000000000..cbdcce9e9cf --- /dev/null +++ b/llvm/test/CodeGen/X86/xray-typed-event-log.ll @@ -0,0 +1,45 @@ +; RUN: llc -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu < %s | FileCheck %s +; RUN: llc -filetype=asm -o - -mtriple=x86_64-unknown-linux-gnu \ +; RUN: -relocation-model=pic < %s | FileCheck %s -check-prefix=PIC + +define i32 @fn() nounwind noinline uwtable "function-instrument"="xray-always" { + %eventptr = alloca i8 + %eventsize = alloca i32 + %eventtype = alloca i16 + store i16 6, i16* %eventtype + %type = load i16, i16* %eventtype + store i32 3, i32* %eventsize + %val = load i32, i32* %eventsize + call void @llvm.xray.typedevent(i16 %type, i8* %eventptr, i32 %val) + ; CHECK-LABEL: Lxray_typed_event_sled_0: + ; CHECK: .byte 0xeb, 0x14 + ; CHECK-NEXT: pushq %rdi + ; CHECK-NEXT: pushq %rsi + ; CHECK-NEXT: pushq %rdx + ; CHECK-NEXT: movq {{.*}}, %rdi + ; CHECK-NEXT: movq {{.*}}, %rsi + ; CHECK-NEXT: movq {{.*}}, %rdx + ; CHECK-NEXT: callq __xray_TypedEvent + ; CHECK-NEXT: popq %rdx + ; CHECK-NEXT: popq %rsi + ; CHECK-NEXT: popq %rdi + + ; PIC-LABEL: Lxray_typed_event_sled_0: + ; PIC: .byte 0xeb, 0x14 + ; PIC-NEXT: pushq %rdi + ; PIC-NEXT: pushq %rsi + ; PIC-NEXT: pushq %rdx + ; PIC-NEXT: movq {{.*}}, %rdi + ; PIC-NEXT: movq {{.*}}, %rsi + ; PIC-NEXT: movq {{.*}}, %rdx + ; PIC-NEXT: callq __xray_TypedEvent@PLT + ; PIC-NEXT: popq %rdx + ; PIC-NEXT: popq %rsi + ; PIC-NEXT: popq %rdi + ret i32 0 +} +; CHECK-LABEL: xray_instr_map +; CHECK-LABEL: Lxray_sleds_start0: +; CHECK: .quad {{.*}}xray_typed_event_sled_0 + +declare void @llvm.xray.typedevent(i16, i8*, i32) |

