1 ; RUN: llc -mtriple=x86_64 < %s | FileCheck %s
2 ; RUN: llc -mtriple=x86_64 -relocation-model=pic < %s | FileCheck %s --check-prefix=PIC
4 ; RUN: llc -mtriple=x86_64 -filetype=obj %s -o %t
5 ; RUN: llvm-dwarfdump %t | FileCheck %s --check-prefix=DBG
7 define i32 @customevent() nounwind "function-instrument"="xray-always" !dbg !1 {
9 %eventsize = alloca i64
10 store i64 3, ptr %eventsize
11 %val = load i64, ptr %eventsize
12 call void @llvm.xray.customevent(ptr %eventptr, i64 %val), !dbg !8
13 ; CHECK-LABEL: Lxray_event_sled_0:
14 ; CHECK: .byte 0xeb, 0x0f
15 ; CHECK-NEXT: pushq %rdi
16 ; CHECK-NEXT: pushq %rsi
17 ; CHECK-NEXT: movq %rcx, %rdi
18 ; CHECK-NEXT: movq %rax, %rsi
19 ; CHECK-NEXT: callq __xray_CustomEvent
20 ; CHECK-NEXT: popq %rsi
21 ; CHECK-NEXT: popq %rdi
23 ; PIC-LABEL: Lxray_event_sled_0:
24 ; PIC: .byte 0xeb, 0x0f
25 ; PIC-NEXT: pushq %rdi
26 ; PIC-NEXT: pushq %rsi
27 ; PIC-NEXT: movq %rcx, %rdi
28 ; PIC-NEXT: movq %rax, %rsi
29 ; PIC-NEXT: callq __xray_CustomEvent@PLT
34 ; CHECK-LABEL: xray_instr_map
35 ; CHECK-LABEL: Lxray_sleds_start0:
36 ; CHECK: .quad {{.*}}xray_event_sled_0
38 define i32 @typedevent() nounwind "function-instrument"="xray-always" !dbg !2 {
40 %eventsize = alloca i64
41 %eventtype = alloca i64
42 store i64 6, ptr %eventtype
43 %type = load i64, ptr %eventtype
44 store i64 3, ptr %eventsize
45 %val = load i64, ptr %eventsize
46 call void @llvm.xray.typedevent(i64 %type, ptr %eventptr, i64 %val), !dbg !9
47 ; CHECK-LABEL: Lxray_typed_event_sled_0:
48 ; CHECK: .byte 0xeb, 0x14
49 ; CHECK-NEXT: pushq %rdi
50 ; CHECK-NEXT: pushq %rsi
51 ; CHECK-NEXT: pushq %rdx
52 ; CHECK-NEXT: movq %rdx, %rdi
53 ; CHECK-NEXT: movq %rcx, %rsi
54 ; CHECK-NEXT: movq %rax, %rdx
55 ; CHECK-NEXT: callq __xray_TypedEvent
56 ; CHECK-NEXT: popq %rdx
57 ; CHECK-NEXT: popq %rsi
58 ; CHECK-NEXT: popq %rdi
60 ; PIC-LABEL: Lxray_typed_event_sled_0:
61 ; PIC: .byte 0xeb, 0x14
62 ; PIC-NEXT: pushq %rdi
63 ; PIC-NEXT: pushq %rsi
64 ; PIC-NEXT: pushq %rdx
65 ; PIC-NEXT: movq %rdx, %rdi
66 ; PIC-NEXT: movq %rcx, %rsi
67 ; PIC-NEXT: movq %rax, %rdx
68 ; PIC-NEXT: callq __xray_TypedEvent@PLT
74 ; CHECK-LABEL: xray_instr_map
75 ; CHECK-LABEL: Lxray_sleds_start1:
76 ; CHECK: .quad {{.*}}xray_typed_event_sled_0
78 declare void @llvm.xray.customevent(ptr, i64)
79 declare void @llvm.xray.typedevent(i64, ptr, i64)
81 ;; Construct call site entries for PATCHABLE_EVENT_CALL.
82 ; DBG: DW_TAG_subprogram
83 ; DBG: DW_TAG_call_site
84 ; DBG-NEXT: DW_AT_call_target (DW_OP_reg{{.*}})
85 ; DBG-NEXT: DW_AT_call_return_pc
87 ; DBG: DW_TAG_subprogram
88 ; DBG: DW_TAG_call_site
89 ; DBG-NEXT: DW_AT_call_target (DW_OP_reg{{.*}})
90 ; DBG-NEXT: DW_AT_call_return_pc
93 !llvm.module.flags = !{!10, !11}
95 !1 = distinct !DISubprogram(name: "customevent", scope: !3, file: !3, line: 1, type: !4, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7)
96 !2 = distinct !DISubprogram(name: "typedevent", scope: !3, file: !3, line: 3, type: !4, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7)
97 !3 = !DIFile(filename: "a.c", directory: "/tmp")
98 !4 = !DISubroutineType(types: !5)
100 !6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
101 !7 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 12.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)
102 !8 = !DILocation(line: 2, column: 3, scope: !1)
103 !9 = !DILocation(line: 4, column: 3, scope: !2)
105 !10 = !{i32 7, !"Dwarf Version", i32 5}
106 !11 = !{i32 2, !"Debug Info Version", i32 3}