• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: llc -emit-call-site-info -start-before=livedebugvalues -filetype=obj -o - %s \
2# RUN:     | llvm-dwarfdump - | FileCheck %s --implicit-check-not=DW_TAG_GNU_call_site_parameter
3
4--- |
5  target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
6  target triple = "x86_64-unknown-linux-gnu"
7
8  ; Function Attrs: nounwind uwtable
9  define void @foo() #0 !dbg !12 {
10  entry:
11    call void @call(i32 123, i32 undef), !dbg !15
12    ret void, !dbg !16
13  }
14
15  declare !dbg !4 void @call(i32, i32)
16
17  attributes #0 = { nounwind uwtable }
18
19  !llvm.dbg.cu = !{!0}
20  !llvm.module.flags = !{!8, !9, !10}
21  !llvm.ident = !{!11}
22
23  !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)
24  !1 = !DIFile(filename: "clobber.c", directory: "/")
25  !2 = !{}
26  !3 = !{!4}
27  !4 = !DISubprogram(name: "call", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
28  !5 = !DISubroutineType(types: !6)
29  !6 = !{null, !7, !7}
30  !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
31  !8 = !{i32 7, !"Dwarf Version", i32 4}
32  !9 = !{i32 2, !"Debug Info Version", i32 3}
33  !10 = !{i32 1, !"wchar_size", i32 4}
34  !11 = !{!"clang version 11.0.0"}
35  !12 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !13, scopeLine: 3, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
36  !13 = !DISubroutineType(types: !14)
37  !14 = !{null}
38  !15 = !DILocation(line: 5, scope: !12)
39  !16 = !DILocation(line: 6, scope: !12)
40
41...
42---
43name:            foo
44callSites:
45  - { bb: 0, offset: 4, fwdArgRegs:
46      - { arg: 0, reg: '$edi' }
47      - { arg: 1, reg: '$esi' } }
48body:             |
49  bb.0.entry:
50    frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp
51    CFI_INSTRUCTION def_cfa_offset 16
52    $esi = MOV32ri 123, debug-location !15
53    $edi = MOV32rr $esi, implicit-def $esi, debug-location !15
54    CALL64pcrel32 @call, csr_64, implicit $rsp, implicit $ssp, implicit killed $edi, implicit undef $esi, implicit-def $rsp, implicit-def $ssp, debug-location !15
55    $rax = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !16
56    CFI_INSTRUCTION def_cfa_offset 8, debug-location !16
57    RETQ debug-location !16
58
59...
60
61# In this test an implicit-def has been added to the MOV32rr instruction to
62# simulate a situation where one instruction defines two call site worklist
63# registers, and where we end up with one of the registers being described by
64# the previous value of the other register that is clobbered by this
65# instruction.
66#
67# In this reproducer we should end up with only one call site entry, with that
68# being for $rdi.
69#
70# This test uses an implicit CHECK-NOT to verify that only one call site
71# parameter entry is emitted.
72#
73# A somewhat more realistic scenario would for example be the following in a
74# made-up ISA:
75#
76# $r1 = mv 123
77# $r0, $r1 = mvri $r1, <undescribable value>
78# call @foo, $r0, $r1
79
80# CHECK: DW_TAG_GNU_call_site_parameter
81# CHECK-NEXT: DW_AT_location	(DW_OP_reg5 RDI)
82# CHECK-NEXT: DW_AT_GNU_call_site_value	(DW_OP_constu 0x7b)
83