aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/AArch64/xray-custom-log.ll
blob: 2432808c7946d0c6ef5096bb5c5cf3b573b26c1a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
; RUN: llc -mtriple=aarch64 < %s | FileCheck %s
; RUN: llc -mtriple=arm64-apple-darwin < %s | FileCheck %s --check-prefix=MACHO

; MACHO:         bl      ___xray_CustomEvent
; MACHO:         bl      ___xray_CustomEvent
; MACHO:         bl      ___xray_TypedEvent
; MACHO:         bl      ___xray_TypedEvent

; CHECK-LABEL: customevent:
; CHECK:       Lxray_sled_1:
; CHECK-NEXT:    b       #24                             // Begin XRay custom event
; CHECK-NEXT:    stp     x0, x1, [sp, #-16]!
; CHECK-NEXT:    mov     x0, x0
; CHECK-NEXT:    mov     x1, x1
; CHECK-NEXT:    bl      __xray_CustomEvent
; CHECK-NEXT:    ldp     x0, x1, [sp], #16               // End XRay custom event
; CHECK-NEXT:  Ltmp[[#]]:
; CHECK-NEXT:    .loc    0 3 3                           // a.c:3:3
; CHECK-NEXT:  Lxray_sled_2:
; CHECK-NEXT:    b       #24                             // Begin XRay custom event
; CHECK-NEXT:    stp     x0, x1, [sp, #-16]!
; CHECK-NEXT:    mov     x0, x2
; CHECK-NEXT:    mov     x1, x3
; CHECK-NEXT:    bl      __xray_CustomEvent
; CHECK-NEXT:    ldp     x0, x1, [sp], #16               // End XRay custom event
; CHECK-NEXT:  .Ltmp[[#]]:
; CHECK-NEXT:    .loc    0 4 1                           // a.c:4:1
define void @customevent(ptr nocapture noundef readonly %e1, i64 noundef %s1, ptr nocapture noundef readonly %e2, i64 noundef %s2) "function-instrument"="xray-always" !dbg !11 {
entry:
  tail call void @llvm.xray.customevent(ptr %e1, i64 %s1), !dbg !22
  tail call void @llvm.xray.customevent(ptr %e2, i64 %s2), !dbg !23
  ret void, !dbg !24
}

; CHECK:         .xword  .Lxray_sled_1-.Ltmp[[#]]
; CHECK-NEXT:    .xword  .Lfunc_begin0-(.Ltmp[[#]]+8)
; CHECK-NEXT:    .byte   0x04
; CHECK-NEXT:    .byte   0x01
; CHECK-NEXT:    .byte   0x02
; CHECK-NEXT:    .zero   13
; CHECK:         .xword  .Lxray_sled_2-.Ltmp[[#]]
; CHECK-NEXT:    .xword  .Lfunc_begin0-(.Ltmp[[#]]+8)
; CHECK-NEXT:    .byte   0x04
; CHECK-NEXT:    .byte   0x01
; CHECK-NEXT:    .byte   0x02
; CHECK-NEXT:    .zero   13

; CHECK-LABEL: typedevent:
; CHECK:       .Lxray_sled_5:
; CHECK-NEXT:    b       #36                             // Begin XRay typed event
; CHECK-NEXT:    stp     x0, x1, [sp, #-32]!
; CHECK-NEXT:    str     x2, [sp, #16]
; CHECK-NEXT:    mov     x0, x0
; CHECK-NEXT:    mov     x1, x1
; CHECK-NEXT:    mov     x2, x2
; CHECK-NEXT:    bl      __xray_TypedEvent
; CHECK-NEXT:    ldr     x2, [sp, #16]
; CHECK-NEXT:    ldp     x0, x1, [sp], #32               // End XRay typed event
; CHECK-NEXT:  .Ltmp[[#]]:
; CHECK-NEXT:    .loc    0 8 3                           // a.c:8:3
; CHECK-NEXT:  .Lxray_sled_6:
; CHECK-NEXT:    b       #36                             // Begin XRay typed event
; CHECK-NEXT:    stp     x0, x1, [sp, #-32]!
; CHECK-NEXT:    str     x2, [sp, #16]
; CHECK-NEXT:    mov     x0, x2
; CHECK-NEXT:    mov     x1, x1
; CHECK-NEXT:    mov     x2, x0
; CHECK-NEXT:    bl      __xray_TypedEvent
; CHECK-NEXT:    ldr     x2, [sp, #16]
; CHECK-NEXT:    ldp     x0, x1, [sp], #32               // End XRay typed event
; CHECK-NEXT:  .Ltmp[[#]]:
; CHECK-NEXT:    .loc    0 9 1                           // a.c:9:1
define void @typedevent(i64 noundef %type, ptr nocapture noundef readonly %event, i64 noundef %size) "function-instrument"="xray-always" !dbg !25 {
entry:
  tail call void @llvm.xray.typedevent(i64 %type, ptr %event, i64 %size), !dbg !33
  tail call void @llvm.xray.typedevent(i64 %size, ptr %event, i64 %type), !dbg !34
  ret void, !dbg !35
}

; CHECK:         .xword  .Lxray_sled_5-.Ltmp[[#]]
; CHECK-NEXT:    .xword  .Lfunc_begin1-(.Ltmp[[#]]+8)
; CHECK-NEXT:    .byte   0x05
; CHECK-NEXT:    .byte   0x01
; CHECK-NEXT:    .byte   0x02
; CHECK-NEXT:    .zero   13
; CHECK:         .xword  .Lxray_sled_6-.Ltmp[[#]]
; CHECK-NEXT:    .xword  .Lfunc_begin1-(.Ltmp[[#]]+8)
; CHECK-NEXT:    .byte   0x05
; CHECK-NEXT:    .byte   0x01
; CHECK-NEXT:    .byte   0x02
; CHECK-NEXT:    .zero   13

declare void @llvm.xray.customevent(ptr, i64)
declare void @llvm.xray.typedevent(i64, ptr, i64)

!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!2, !3}
!llvm.ident = !{!10}

!0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "clang version 17.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, splitDebugInlining: false, nameTableKind: None)
!1 = !DIFile(filename: "a.c", directory: "/tmp")
!2 = !{i32 7, !"Dwarf Version", i32 5}
!3 = !{i32 2, !"Debug Info Version", i32 3}
!10 = !{!"clang version 17.0.0"}
!11 = distinct !DISubprogram(name: "customevent", scope: !1, file: !1, line: 1, type: !12, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)
!12 = !DISubroutineType(types: !13)
!13 = !{null, !14, !15, !14, !15}
!14 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64)
!15 = !DIBasicType(name: "unsigned long", size: 64, encoding: DW_ATE_unsigned)
!21 = !DILocation(line: 0, scope: !11)
!22 = !DILocation(line: 2, column: 3, scope: !11)
!23 = !DILocation(line: 3, column: 3, scope: !11)
!24 = !DILocation(line: 4, column: 1, scope: !11)
!25 = distinct !DISubprogram(name: "typedevent", scope: !1, file: !1, line: 6, type: !26, scopeLine: 6, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0)
!26 = !DISubroutineType(types: !27)
!27 = !{null, !15, !14, !15}
!32 = !DILocation(line: 0, scope: !25)
!33 = !DILocation(line: 7, column: 3, scope: !25)
!34 = !DILocation(line: 8, column: 3, scope: !25)
!35 = !DILocation(line: 9, column: 1, scope: !25)