brintos

brintos / llvm-project-archived public Read only

0
0
Text · 4.0 KiB · f4cdc23 Raw
108 lines · plain
1; RUN: llc -mtriple=x86_64 < %s | FileCheck %s2; RUN: llc -mtriple=x86_64 -relocation-model=pic < %s | FileCheck %s --check-prefix=PIC3 4define i32 @customevent() nounwind "function-instrument"="xray-always" !dbg !1 {5    %eventptr = alloca i86    %eventsize = alloca i647    store i64 3, ptr %eventsize8    %val = load i64, ptr %eventsize9    call void @llvm.xray.customevent(ptr %eventptr, i64 %val), !dbg !810    ; CHECK-LABEL: Lxray_event_sled_0:11    ; CHECK:       .byte 0xeb, 0x0f12    ; CHECK-NEXT:  pushq %rdi13    ; CHECK-NEXT:  pushq %rsi14    ; CHECK-NEXT:  movq %rcx, %rdi15    ; CHECK-NEXT:  movq %rax, %rsi16    ; CHECK-NEXT:  callq __xray_CustomEvent17    ; CHECK-NEXT:  popq %rsi18    ; CHECK-NEXT:  popq %rdi19 20    ; PIC-LABEL: Lxray_event_sled_0:21    ; PIC:       .byte 0xeb, 0x0f22    ; PIC-NEXT:  pushq %rdi23    ; PIC-NEXT:  pushq %rsi24    ; PIC-NEXT:  movq %rcx, %rdi25    ; PIC-NEXT:  movq %rax, %rsi26    ; PIC-NEXT:  callq __xray_CustomEvent@PLT27    ; PIC-NEXT:  popq %rsi28    ; PIC-NEXT:  popq %rdi29    ret i32 030}31; CHECK-LABEL: xray_instr_map32; CHECK-LABEL: Lxray_sleds_start0:33; CHECK:       .quad {{.*}}xray_event_sled_034 35define i32 @typedevent() nounwind "function-instrument"="xray-always" !dbg !2 {36    %eventptr = alloca i837    %eventsize = alloca i6438    %eventtype = alloca i6439    store i64 6, ptr %eventtype40    %type = load i64, ptr %eventtype41    store i64 3, ptr %eventsize42    %val = load i64, ptr %eventsize43    call void @llvm.xray.typedevent(i64 %type, ptr %eventptr, i64 %val), !dbg !944    ; CHECK-LABEL: Lxray_typed_event_sled_0:45    ; CHECK:       .byte 0xeb, 0x1446    ; CHECK-NEXT:  pushq %rdi47    ; CHECK-NEXT:  pushq %rsi48    ; CHECK-NEXT:  pushq %rdx49    ; CHECK-NEXT:  movq %rdx, %rdi50    ; CHECK-NEXT:  movq %rcx, %rsi51    ; CHECK-NEXT:  movq %rax, %rdx52    ; CHECK-NEXT:  callq __xray_TypedEvent53    ; CHECK-NEXT:  popq %rdx54    ; CHECK-NEXT:  popq %rsi55    ; CHECK-NEXT:  popq %rdi56 57    ; PIC-LABEL: Lxray_typed_event_sled_0:58    ; PIC:       .byte 0xeb, 0x1459    ; PIC-NEXT:  pushq %rdi60    ; PIC-NEXT:  pushq %rsi61    ; PIC-NEXT:  pushq %rdx62    ; PIC-NEXT:  movq %rdx, %rdi63    ; PIC-NEXT:  movq %rcx, %rsi64    ; PIC-NEXT:  movq %rax, %rdx65    ; PIC-NEXT:  callq __xray_TypedEvent@PLT66    ; PIC-NEXT:  popq %rdx67    ; PIC-NEXT:  popq %rsi68    ; PIC-NEXT:  popq %rdi69    ret i32 070}71; CHECK-LABEL: xray_instr_map72; CHECK-LABEL: Lxray_sleds_start1:73; CHECK:       .quad {{.*}}xray_typed_event_sled_074 75; Verify that custom event calls are done with proper stack alignment,76; even in leaf functions.77@leaf_func.event_id = internal constant i32 1, align 478define void @leaf_func() "function-instrument"="xray-always" "frame-pointer"="none" nounwind {79  ; CHECK-LABEL: leaf_func:80  ; CHECK-NEXT:  .Lfunc_begin2:81  ; CHECK:         pushq %rax82  ; CHECK:         movl $leaf_func.event_id, %eax83  ; CHECK-NEXT:    movl $4, %ecx84  ; CHECK-NEXT:    .p2align 185  ; CHECK-NEXT:  .Lxray_event_sled_1:86  call void @llvm.xray.customevent(ptr @leaf_func.event_id, i64 4)87  ret void88}89 90declare void @llvm.xray.customevent(ptr, i64)91declare void @llvm.xray.typedevent(i64, ptr, i64)92 93!llvm.dbg.cu = !{!7}94!llvm.module.flags = !{!10, !11}95 96!1 = distinct !DISubprogram(name: "customevent", scope: !3, file: !3, line: 1, type: !4, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7)97!2 = distinct !DISubprogram(name: "typedevent", scope: !3, file: !3, line: 3, type: !4, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !7)98!3 = !DIFile(filename: "a.c", directory: "/tmp")99!4 = !DISubroutineType(types: !5)100!5 = !{!6}101!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)102!7 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 12.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)103!8 = !DILocation(line: 2, column: 3, scope: !1)104!9 = !DILocation(line: 4, column: 3, scope: !2)105 106!10 = !{i32 7, !"Dwarf Version", i32 5}107!11 = !{i32 2, !"Debug Info Version", i32 3}108