1; RUN: llc -mtriple=aarch64 < %s | FileCheck %s 2; RUN: llc -mtriple=arm64-apple-darwin < %s | FileCheck %s --check-prefix=MACHO 3; RUN: llc -filetype=obj -mtriple=aarch64 %s -o %t 4; RUN: llvm-dwarfdump -debug-info %t | FileCheck %s --check-prefix=DBG 5 6; MACHO: bl ___xray_CustomEvent 7; MACHO: bl ___xray_CustomEvent 8; MACHO: bl ___xray_TypedEvent 9; MACHO: bl ___xray_TypedEvent 10 11; CHECK-LABEL: customevent: 12; CHECK: Lxray_sled_1: 13; CHECK-NEXT: b #24 // Begin XRay custom event 14; CHECK-NEXT: stp x0, x1, [sp, #-16]! 15; CHECK-NEXT: mov x0, x0 16; CHECK-NEXT: mov x1, x1 17; CHECK-NEXT: bl __xray_CustomEvent 18; CHECK-NEXT: ldp x0, x1, [sp], #16 // End XRay custom event 19; CHECK-NEXT: Ltmp[[#]]: 20; CHECK-NEXT: .loc 0 3 3 // a.c:3:3 21; CHECK-NEXT: Lxray_sled_2: 22; CHECK-NEXT: b #24 // Begin XRay custom event 23; CHECK-NEXT: stp x0, x1, [sp, #-16]! 24; CHECK-NEXT: mov x0, x2 25; CHECK-NEXT: mov x1, x3 26; CHECK-NEXT: bl __xray_CustomEvent 27; CHECK-NEXT: ldp x0, x1, [sp], #16 // End XRay custom event 28; CHECK-NEXT: .Ltmp[[#]]: 29; CHECK-NEXT: .loc 0 4 1 // a.c:4:1 30define void @customevent(ptr nocapture noundef readonly %e1, i64 noundef %s1, ptr nocapture noundef readonly %e2, i64 noundef %s2) "function-instrument"="xray-always" !dbg !11 { 31entry: 32 tail call void @llvm.xray.customevent(ptr %e1, i64 %s1), !dbg !22 33 tail call void @llvm.xray.customevent(ptr %e2, i64 %s2), !dbg !23 34 ret void, !dbg !24 35} 36 37; CHECK: .xword .Lxray_sled_1-.Ltmp[[#]] 38; CHECK-NEXT: .xword .Lfunc_begin0-(.Ltmp[[#]]+8) 39; CHECK-NEXT: .byte 0x04 40; CHECK-NEXT: .byte 0x01 41; CHECK-NEXT: .byte 0x02 42; CHECK-NEXT: .zero 13 43; CHECK: .xword .Lxray_sled_2-.Ltmp[[#]] 44; CHECK-NEXT: .xword .Lfunc_begin0-(.Ltmp[[#]]+8) 45; CHECK-NEXT: .byte 0x04 46; CHECK-NEXT: .byte 0x01 47; CHECK-NEXT: .byte 0x02 48; CHECK-NEXT: .zero 13 49 50; CHECK-LABEL: typedevent: 51; CHECK: .Lxray_sled_5: 52; CHECK-NEXT: b #36 // Begin XRay typed event 53; CHECK-NEXT: stp x0, x1, [sp, #-32]! 54; CHECK-NEXT: str x2, [sp, #16] 55; CHECK-NEXT: mov x0, x0 56; CHECK-NEXT: mov x1, x1 57; CHECK-NEXT: mov x2, x2 58; CHECK-NEXT: bl __xray_TypedEvent 59; CHECK-NEXT: ldr x2, [sp, #16] 60; CHECK-NEXT: ldp x0, x1, [sp], #32 // End XRay typed event 61; CHECK-NEXT: .Ltmp[[#]]: 62; CHECK-NEXT: .loc 0 8 3 // a.c:8:3 63; CHECK-NEXT: .Lxray_sled_6: 64; CHECK-NEXT: b #36 // Begin XRay typed event 65; CHECK-NEXT: stp x0, x1, [sp, #-32]! 66; CHECK-NEXT: str x2, [sp, #16] 67; CHECK-NEXT: mov x0, x2 68; CHECK-NEXT: mov x1, x1 69; CHECK-NEXT: mov x2, x0 70; CHECK-NEXT: bl __xray_TypedEvent 71; CHECK-NEXT: ldr x2, [sp, #16] 72; CHECK-NEXT: ldp x0, x1, [sp], #32 // End XRay typed event 73; CHECK-NEXT: .Ltmp[[#]]: 74; CHECK-NEXT: .loc 0 9 1 // a.c:9:1 75define void @typedevent(i64 noundef %type, ptr nocapture noundef readonly %event, i64 noundef %size) "function-instrument"="xray-always" !dbg !25 { 76entry: 77 tail call void @llvm.xray.typedevent(i64 %type, ptr %event, i64 %size), !dbg !33 78 tail call void @llvm.xray.typedevent(i64 %size, ptr %event, i64 %type), !dbg !34 79 ret void, !dbg !35 80} 81 82; CHECK: .xword .Lxray_sled_5-.Ltmp[[#]] 83; CHECK-NEXT: .xword .Lfunc_begin1-(.Ltmp[[#]]+8) 84; CHECK-NEXT: .byte 0x05 85; CHECK-NEXT: .byte 0x01 86; CHECK-NEXT: .byte 0x02 87; CHECK-NEXT: .zero 13 88; CHECK: .xword .Lxray_sled_6-.Ltmp[[#]] 89; CHECK-NEXT: .xword .Lfunc_begin1-(.Ltmp[[#]]+8) 90; CHECK-NEXT: .byte 0x05 91; CHECK-NEXT: .byte 0x01 92; CHECK-NEXT: .byte 0x02 93; CHECK-NEXT: .zero 13 94 95;; Construct call site entries for PATCHABLE_EVENT_CALL. 96; DBG: DW_TAG_subprogram 97; DBG: DW_AT_name 98; DBG-SAME: ("customevent") 99; DBG: DW_TAG_call_site 100; DBG-NEXT: DW_AT_call_target (DW_OP_reg0 {{.*}}) 101; DBG-NEXT: DW_AT_call_return_pc 102; DBG-EMPTY: 103; DBG: DW_TAG_call_site 104; DBG-NEXT: DW_AT_call_target (DW_OP_reg2 {{.*}}) 105; DBG-NEXT: DW_AT_call_return_pc 106 107declare void @llvm.xray.customevent(ptr, i64) 108declare void @llvm.xray.typedevent(i64, ptr, i64) 109 110!llvm.dbg.cu = !{!0} 111!llvm.module.flags = !{!2, !3} 112!llvm.ident = !{!10} 113 114!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) 115!1 = !DIFile(filename: "a.c", directory: "/tmp") 116!2 = !{i32 7, !"Dwarf Version", i32 5} 117!3 = !{i32 2, !"Debug Info Version", i32 3} 118!10 = !{!"clang version 17.0.0"} 119!11 = distinct !DISubprogram(name: "customevent", scope: !1, file: !1, line: 1, type: !12, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0) 120!12 = !DISubroutineType(types: !13) 121!13 = !{null, !14, !15, !14, !15} 122!14 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: null, size: 64) 123!15 = !DIBasicType(name: "unsigned long", size: 64, encoding: DW_ATE_unsigned) 124!21 = !DILocation(line: 0, scope: !11) 125!22 = !DILocation(line: 2, column: 3, scope: !11) 126!23 = !DILocation(line: 3, column: 3, scope: !11) 127!24 = !DILocation(line: 4, column: 1, scope: !11) 128!25 = distinct !DISubprogram(name: "typedevent", scope: !1, file: !1, line: 6, type: !26, scopeLine: 6, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0) 129!26 = !DISubroutineType(types: !27) 130!27 = !{null, !15, !14, !15} 131!32 = !DILocation(line: 0, scope: !25) 132!33 = !DILocation(line: 7, column: 3, scope: !25) 133!34 = !DILocation(line: 8, column: 3, scope: !25) 134!35 = !DILocation(line: 9, column: 1, scope: !25) 135