brintos

brintos / llvm-project-archived public Read only

0
0
Text · 5.5 KiB · 0f949f4 Raw
117 lines · plain
1# RUN: llc -mtriple aarch64-linux-gnu -emit-call-site-info -debug-entry-values -start-before=aarch64-asm-printer -filetype=obj -o - %s \2# RUN:     | llvm-dwarfdump - | FileCheck %s --implicit-check-not=DW_TAG_GNU_call_site_parameter3#4# Based on the following C reproducer:5#6#   extern void call(long, long, long);7#   extern long global;8#9#   long foo() {10#     long local = global;11#     call(local + 123, local - 456, local + 789);12#     return local;13#   }14 15--- |16  target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"17  target triple = "aarch64"18 19  @global = external dso_local local_unnamed_addr global i64, align 820 21  define dso_local i64 @foo() local_unnamed_addr !dbg !12 {22  entry:23    %0 = load i64, ptr @global, align 8, !dbg !1724    call void @llvm.dbg.value(metadata i64 %0, metadata !16, metadata !DIExpression()), !dbg !1725    %add = add nsw i64 %0, 123, !dbg !1726    %sub = add nsw i64 %0, -456, !dbg !1727    %add1 = add nsw i64 %0, 789, !dbg !1728    call void @call(i64 %add, i64 %sub, i64 %add1), !dbg !1729    ret i64 %0, !dbg !1730  }31 32  declare !dbg !4 dso_local void @call(i64, i64, i64) local_unnamed_addr33 34  declare void @llvm.dbg.value(metadata, metadata, metadata)35 36  !llvm.dbg.cu = !{!0}37  !llvm.module.flags = !{!8, !9, !10}38  !llvm.ident = !{!11}39 40  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, splitDebugInlining: false, nameTableKind: None)41  !1 = !DIFile(filename: "dbgcall-site-expr-chain.c", directory: "/")42  !2 = !{}43  !3 = !{!4}44  !4 = !DISubprogram(name: "call", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)45  !5 = !DISubroutineType(types: !6)46  !6 = !{null, !7, !7, !7}47  !7 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed)48  !8 = !{i32 7, !"Dwarf Version", i32 4}49  !9 = !{i32 2, !"Debug Info Version", i32 3}50  !10 = !{i32 1, !"wchar_size", i32 4}51  !11 = !{!"clang version 11.0.0 "}52  !12 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 5, type: !13, scopeLine: 5, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !15)53  !13 = !DISubroutineType(types: !14)54  !14 = !{!7}55  !15 = !{!16}56  !16 = !DILocalVariable(name: "local", scope: !12, file: !1, line: 6, type: !7)57  !17 = !DILocation(line: 6, scope: !12)58 59...60---61name:            foo62tracksRegLiveness: true63stack:64  - { id: 0, type: spill-slot, offset: -16, size: 8, alignment: 16, callee-saved-register: '$x19' }65  - { id: 1, type: spill-slot, offset: -24, size: 8, alignment: 8, callee-saved-register: '$lr' }66  - { id: 2, type: spill-slot, offset: -32, size: 8, alignment: 8, callee-saved-register: '$fp' }67callSites:68  - { bb: 0, offset: 17, fwdArgRegs:69      - { arg: 0, reg: '$x0' }70      - { arg: 1, reg: '$x1' }71      - { arg: 2, reg: '$x2' } }72body:             |73  bb.0.entry:74    liveins: $lr, $x1975 76    early-clobber $sp = frame-setup STPXpre $fp, killed $lr, $sp, -4 :: (store (s64) into %stack.2), (store (s64) into %stack.1)77    frame-setup STRXui killed $x19, $sp, 2 :: (store (s64) into %stack.0)78    $fp = frame-setup ADDXri $sp, 0, 079    frame-setup CFI_INSTRUCTION def_cfa $w29, 3280    frame-setup CFI_INSTRUCTION offset $w19, -16, debug-location !1781    frame-setup CFI_INSTRUCTION offset $w30, -24, debug-location !1782    frame-setup CFI_INSTRUCTION offset $w29, -32, debug-location !1783    renamable $x8 = ADRP target-flags(aarch64-page) @global, debug-location !1784    renamable $x19 = LDRXui killed renamable $x8, target-flags(aarch64-pageoff, aarch64-nc) @global, debug-location !17 :: (dereferenceable load (s64) from @global)85    DBG_VALUE $x19, $noreg, !16, !DIExpression(), debug-location !1786    renamable $x0 = nsw ADDXri renamable $x19, 100, 0, debug-location !1787    renamable $x8 = nsw SUBXri renamable $x19, 406, 0, debug-location !1788    renamable $x0 = nsw ADDXri renamable $x0, 23, 0, debug-location !1789    renamable $x1 = nsw SUBXri renamable $x8, 50, 0, debug-location !1790    renamable $x2 = nsw ADDXri renamable $x19, 700, 0, debug-location !1791    renamable $x2 = nsw ADDXri renamable $x2, 9, 0, debug-location !1792    renamable $x2 = nsw ADDXri renamable $x2, 80, 0, debug-location !1793    BL @call, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $x0, implicit killed $x1, implicit killed $x2, implicit-def $sp, debug-location !1794    $x0 = ORRXrs $xzr, killed $x19, 0, debug-location !1795    $x19 = frame-destroy LDRXui $sp, 2, debug-location !17 :: (load (s64) from %stack.0)96    early-clobber $sp, $fp, $lr = frame-destroy LDPXpost $sp, 4, debug-location !17 :: (load (s64) from %stack.2), (load (s64) from %stack.1)97    RET undef $lr, implicit killed $x0, debug-location !1798 99...100 101# Verify that call site entries are emitted for all three parameters.102#103# The MIR has been hand-modified to build up the call site values using chains104# of ADDXri/SUBXri instructions instead of a single instruction per parameter.105 106# CHECK: DW_TAG_GNU_call_site_parameter107# CHECK-NEXT: DW_AT_location (DW_OP_reg2 W2)108# CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_breg19 W19+789)109 110# CHECK: DW_TAG_GNU_call_site_parameter111# CHECK-NEXT: DW_AT_location (DW_OP_reg1 W1)112# CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_breg19 W19-406, DW_OP_constu 0x32, DW_OP_minus)113 114# CHECK: DW_TAG_GNU_call_site_parameter115# CHECK-NEXT: DW_AT_location (DW_OP_reg0 W0)116# CHECK-NEXT: DW_AT_GNU_call_site_value (DW_OP_breg19 W19+123)117