brintos

brintos / llvm-project-archived public Read only

0
0
Text · 11.8 KiB · bf04b20 Raw
272 lines · plain
1# RUN: llc -emit-call-site-info -start-before=aarch64-asm-printer -filetype=obj -o - %s | llvm-dwarfdump - | FileCheck %s2 3# Based on the following C reproducer:4#5# extern void call_int(int);6# extern void call_int_int(int, int);7# extern void call_long(long);8# extern int global;9#10# int same_reg(int p) {11#   call_int(p);12#   return 0;13# }14#15# int super_reg(unsigned p) {16#   call_long(p);17#   return 0;18# }19#20# int sub_reg(int p, long q) {21#   call_int_int(q, global);22#   return p;23# }24 25--- |26  target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"27  target triple = "aarch64"28 29  @global = external global i32, align 430 31  ; Function Attrs: noinline nounwind32  define i32 @same_reg(i32 %p) #0 !dbg !19 {33  entry:34    call void @llvm.dbg.value(metadata i32 %p, metadata !23, metadata !DIExpression()), !dbg !2435    tail call void @call_int(i32 %p), !dbg !2536    ret i32 0, !dbg !2637  }38 39  declare !dbg !4 void @call_int(i32)40 41  ; Function Attrs: noinline nounwind42  define i32 @super_reg(i32 %p) #0 !dbg !27 {43  entry:44    call void @llvm.dbg.value(metadata i32 %p, metadata !32, metadata !DIExpression()), !dbg !3345    %conv = zext i32 %p to i64, !dbg !3446    tail call void @call_long(i64 %conv), !dbg !3447    ret i32 0, !dbg !3548  }49 50  declare !dbg !8 void @call_long(i64)51 52  ; Function Attrs: noinline nounwind53  define i32 @sub_reg(i32 returned %p, i64 %q) #0 !dbg !36 {54  entry:55    call void @llvm.dbg.value(metadata i32 %p, metadata !40, metadata !DIExpression()), !dbg !4256    call void @llvm.dbg.value(metadata i64 %q, metadata !41, metadata !DIExpression()), !dbg !4257    %conv = trunc i64 %q to i32, !dbg !4358    %0 = load i32, ptr @global, align 4, !dbg !4359    tail call void @call_int_int(i32 %conv, i32 %0), !dbg !4360    ret i32 %p, !dbg !4461  }62 63  declare !dbg !12 void @call_int_int(i32, i32)64 65  ; Function Attrs: nounwind readnone speculatable willreturn66  declare void @llvm.dbg.value(metadata, metadata, metadata) #167 68  attributes #0 = { noinline nounwind  "frame-pointer"="all" }69  attributes #1 = { nounwind readnone speculatable willreturn }70 71  !llvm.dbg.cu = !{!0}72  !llvm.module.flags = !{!15, !16, !17}73  !llvm.ident = !{!18}74 75  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0 (ssh://gerritmirror.rnd.ki.sw.ericsson.se:29418/flextools/llvm-project.git f76e863b549ddccd5e917e2f3ff50646915654d2)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)76  !1 = !DIFile(filename: "orrxrs.c", directory: "/repo/edasten/llvm-project/llvm")77  !2 = !{}78  !4 = !DISubprogram(name: "call_int", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)79  !5 = !DISubroutineType(types: !6)80  !6 = !{null, !7}81  !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)82  !8 = !DISubprogram(name: "call_long", scope: !1, file: !1, line: 3, type: !9, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)83  !9 = !DISubroutineType(types: !10)84  !10 = !{null, !11}85  !11 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed)86  !12 = !DISubprogram(name: "call_int_int", scope: !1, file: !1, line: 2, type: !13, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)87  !13 = !DISubroutineType(types: !14)88  !14 = !{null, !7, !7}89  !15 = !{i32 2, !"Dwarf Version", i32 4}90  !16 = !{i32 2, !"Debug Info Version", i32 3}91  !17 = !{i32 1, !"wchar_size", i32 4}92  !18 = !{!"clang version 10.0.0 (ssh://gerritmirror.rnd.ki.sw.ericsson.se:29418/flextools/llvm-project.git f76e863b549ddccd5e917e2f3ff50646915654d2)"}93  !19 = distinct !DISubprogram(name: "same_reg", scope: !1, file: !1, line: 6, type: !20, scopeLine: 6, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !22)94  !20 = !DISubroutineType(types: !21)95  !21 = !{!7, !7}96  !22 = !{!23}97  !23 = !DILocalVariable(name: "p", arg: 1, scope: !19, file: !1, line: 6, type: !7)98  !24 = !DILocation(line: 0, scope: !19)99  !25 = !DILocation(line: 7, scope: !19)100  !26 = !DILocation(line: 8, scope: !19)101  !27 = distinct !DISubprogram(name: "super_reg", scope: !1, file: !1, line: 11, type: !28, scopeLine: 11, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !31)102  !28 = !DISubroutineType(types: !29)103  !29 = !{!7, !30}104  !30 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned)105  !31 = !{!32}106  !32 = !DILocalVariable(name: "p", arg: 1, scope: !27, file: !1, line: 11, type: !30)107  !33 = !DILocation(line: 0, scope: !27)108  !34 = !DILocation(line: 12, scope: !27)109  !35 = !DILocation(line: 13, scope: !27)110  !36 = distinct !DISubprogram(name: "sub_reg", scope: !1, file: !1, line: 16, type: !37, scopeLine: 16, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !39)111  !37 = !DISubroutineType(types: !38)112  !38 = !{!7, !7, !11}113  !39 = !{!40, !41}114  !40 = !DILocalVariable(name: "p", arg: 1, scope: !36, file: !1, line: 16, type: !7)115  !41 = !DILocalVariable(name: "q", arg: 2, scope: !36, file: !1, line: 16, type: !11)116  !42 = !DILocation(line: 0, scope: !36)117  !43 = !DILocation(line: 17, scope: !36)118  !44 = !DILocation(line: 18, scope: !36)119 120...121---122name:            same_reg123alignment:       4124tracksRegLiveness: true125liveins:126  - { reg: '$w0' }127frameInfo:128  stackSize:       16129  maxAlignment:    8130  adjustsStack:    true131  hasCalls:        true132  maxCallFrameSize: 0133stack:134  - { id: 0, type: spill-slot, offset: -8, size: 8, alignment: 8, callee-saved-register: '$lr' }135  - { id: 1, type: spill-slot, offset: -16, size: 8, alignment: 8, callee-saved-register: '$fp' }136callSites:137  - { bb: 0, offset: 8, fwdArgRegs:138      - { arg: 0, reg: '$w0' } }139machineFunctionInfo: {}140body:             |141  bb.0.entry:142    liveins: $w0, $lr143 144    DBG_VALUE $w0, $noreg, !23, !DIExpression(), debug-location !24145    DBG_VALUE $w0, $noreg, !23, !DIExpression(), debug-location !24146    DBG_VALUE $w0, $noreg, !23, !DIExpression(), debug-location !24147    early-clobber $sp = frame-setup STPXpre $fp, killed $lr, $sp, -2 :: (store (s64) into %stack.1), (store (s64) into %stack.0)148    $fp = frame-setup ADDXri $sp, 0, 0149    frame-setup CFI_INSTRUCTION def_cfa $w29, 16150    frame-setup CFI_INSTRUCTION offset $w30, -8, debug-location !25151    frame-setup CFI_INSTRUCTION offset $w29, -16, debug-location !25152    BL @call_int, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit-def $sp, debug-location !25153    DBG_VALUE $w0, $noreg, !23, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !24154    $w0 = ORRWrs $wzr, $wzr, 0, debug-location !26155    early-clobber $sp, $fp, $lr = frame-destroy LDPXpost $sp, 2, debug-location !26 :: (load (s64) from %stack.1), (load (s64) from %stack.0)156    RET undef $lr, implicit killed $w0, debug-location !26157 158...159 160# CHECK: DW_TAG_GNU_call_site161# CHECK-NEXT: DW_AT_abstract_origin ({{.*}} "call_int")162#163# CHECK: DW_TAG_GNU_call_site_parameter164# CHECK-NEXT: DW_AT_location      (DW_OP_reg0 W0)165# CHECK-NEXT: DW_AT_GNU_call_site_value   (DW_OP_GNU_entry_value(DW_OP_reg0 W0))166 167---168name:            super_reg169alignment:       4170tracksRegLiveness: true171liveins:172  - { reg: '$w0' }173frameInfo:174  stackSize:       16175  maxAlignment:    8176  adjustsStack:    true177  hasCalls:        true178  maxCallFrameSize: 0179stack:180  - { id: 0, type: spill-slot, offset: -8, size: 8, alignment: 8, callee-saved-register: '$lr' }181  - { id: 1, type: spill-slot, offset: -16, size: 8, alignment: 8, callee-saved-register: '$fp' }182callSites:183  - { bb: 0, offset: 9, fwdArgRegs:184      - { arg: 0, reg: '$x0' } }185machineFunctionInfo: {}186body:             |187  bb.0.entry:188    liveins: $w0, $lr189 190    DBG_VALUE $w0, $noreg, !32, !DIExpression(), debug-location !33191    DBG_VALUE $w0, $noreg, !32, !DIExpression(), debug-location !33192    early-clobber $sp = frame-setup STPXpre $fp, killed $lr, $sp, -2 :: (store (s64) into %stack.1), (store (s64) into %stack.0)193    $fp = frame-setup ADDXri $sp, 0, 0194    frame-setup CFI_INSTRUCTION def_cfa $w29, 16195    frame-setup CFI_INSTRUCTION offset $w30, -8, debug-location !34196    frame-setup CFI_INSTRUCTION offset $w29, -16, debug-location !34197    renamable $w0 = ORRWrs $wzr, killed renamable $w0, 0, implicit-def $x0, debug-location !34198    DBG_VALUE $w0, $noreg, !32, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !33199    BL @call_long, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $x0, implicit-def $sp, debug-location !34200    $w0 = ORRWrs $wzr, $wzr, 0, debug-location !35201    early-clobber $sp, $fp, $lr = frame-destroy LDPXpost $sp, 2, debug-location !35 :: (load (s64) from %stack.1), (load (s64) from %stack.0)202    RET undef $lr, implicit killed $w0, debug-location !35203 204...205 206# CHECK: DW_TAG_GNU_call_site207# CHECK-NEXT: DW_AT_abstract_origin ({{.*}} "call_long")208#209# CHECK: DW_TAG_GNU_call_site_parameter210# CHECK-NEXT: DW_AT_location      (DW_OP_reg0 W0)211# CHECK-NEXT: DW_AT_GNU_call_site_value   (DW_OP_GNU_entry_value(DW_OP_reg0 W0))212 213---214name:            sub_reg215alignment:       4216tracksRegLiveness: true217liveins:218  - { reg: '$w0' }219  - { reg: '$x1' }220frameInfo:221  stackSize:       32222  maxAlignment:    16223  adjustsStack:    true224  hasCalls:        true225  maxCallFrameSize: 0226stack:227  - { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16, callee-saved-register: '$x19' }228  - { id: 1, type: spill-slot, offset: -24, size: 8, alignment: 8, callee-saved-register: '$lr' }229  - { id: 2, type: spill-slot, offset: -32, size: 8, alignment: 8, callee-saved-register: '$fp' }230callSites:231  - { bb: 0, offset: 17, fwdArgRegs:232      - { arg: 0, reg: '$w0' }233      - { arg: 1, reg: '$w1' } }234machineFunctionInfo: {}235body:             |236  bb.0.entry:237    liveins: $w0, $x1, $lr, $x19238 239    DBG_VALUE $w0, $noreg, !40, !DIExpression(), debug-location !42240    DBG_VALUE $x1, $noreg, !41, !DIExpression(), debug-location !42241    early-clobber $sp = frame-setup STPXpre $fp, killed $lr, $sp, -4 :: (store (s64) into %stack.2), (store (s64) into %stack.1)242    frame-setup STRXui killed $x19, $sp, 2 :: (store (s64) into %stack.0)243    $fp = frame-setup ADDXri $sp, 0, 0244    frame-setup CFI_INSTRUCTION def_cfa $w29, 32245    frame-setup CFI_INSTRUCTION offset $w19, -16246    frame-setup CFI_INSTRUCTION offset $w30, -24247    frame-setup CFI_INSTRUCTION offset $w29, -32248    renamable $x9 = ADRP target-flags(aarch64-page) @global, debug-location !43249    $x8 = ORRXrs $xzr, killed $x1, 0250    DBG_VALUE $x8, $noreg, !41, !DIExpression(), debug-location !42251    renamable $w1 = LDRWui killed renamable $x9, target-flags(aarch64-pageoff, aarch64-nc) @global, debug-location !43 :: (dereferenceable load (s32) from @global)252    $w19 = ORRWrs $wzr, killed $w0, 0253    DBG_VALUE $w19, $noreg, !40, !DIExpression(), debug-location !42254    DBG_VALUE $w19, $noreg, !40, !DIExpression(), debug-location !42255    $w0 = ORRWrs $wzr, killed $w8, 0, implicit $x8, debug-location !43256    BL @call_int_int, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit killed $w1, implicit-def $sp, debug-location !43257    DBG_VALUE $x1, $noreg, !41, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !42258    $w0 = ORRWrs $wzr, killed $w19, 0, debug-location !44259    DBG_VALUE $w0, $noreg, !40, !DIExpression(), debug-location !42260    $x19 = frame-destroy LDRXui $sp, 2, debug-location !44 :: (load (s64) from %stack.0)261    early-clobber $sp, $fp, $lr = frame-destroy LDPXpost $sp, 4, debug-location !44 :: (load (s64) from %stack.2), (load (s64) from %stack.1)262    RET undef $lr, implicit killed $w0, debug-location !44263 264...265 266# CHECK: DW_TAG_GNU_call_site267# CHECK-NEXT: DW_AT_abstract_origin ({{.*}} "call_int_int")268#269# CHECK: DW_TAG_GNU_call_site_parameter270# CHECK-NEXT: DW_AT_location      (DW_OP_reg0 W0)271# CHECK-NEXT: DW_AT_GNU_call_site_value   (DW_OP_GNU_entry_value(DW_OP_reg1 W1))272