brintos

brintos / llvm-project-archived public Read only

0
0
Text · 8.4 KiB · 62388a4 Raw
156 lines · plain
1; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj -function-sections -o %t -experimental-debug-variable-locations=true < %s2; RUN: llvm-dwarfdump -v -debug-info -debug-loclists %t | \3; RUN:   FileCheck %s --check-prefixes=CHECK,DWARF324 5; RUN: llc -mtriple=x86_64-pc-mingw -filetype=obj -function-sections -o %t -experimental-debug-variable-locations=true < %s6; RUN: llvm-dwarfdump -v -debug-info -debug-loclists %t | \7; RUN:   FileCheck %s --check-prefixes=CHECK,DWARF328 9; RUN: llc -dwarf64 -mtriple=x86_64-pc-linux -filetype=obj -function-sections -o %t -experimental-debug-variable-locations=true < %s10; RUN: llvm-dwarfdump -v -debug-info -debug-loclists %t | \11; RUN:   FileCheck %s --check-prefixes=CHECK,DWARF6412 13; RUN: llc -dwarf-version=5 -split-dwarf-file=foo.dwo -mtriple=x86_64-pc-linux -filetype=obj -function-sections -o %t -experimental-debug-variable-locations=true < %s14; RUN: llvm-dwarfdump -v -debug-info -debug-loclists %t | \15; RUN:   FileCheck %s --check-prefixes=DWO,DWO3216 17; RUN: llc -dwarf-version=5 -split-dwarf-file=foo.dwo -mtriple=x86_64-pc-mingw -filetype=obj -function-sections -o %t -experimental-debug-variable-locations=true < %s18; RUN: llvm-dwarfdump -v -debug-info -debug-loclists %t | \19; RUN:   FileCheck %s --check-prefixes=DWO,DWO3220 21; RUN: llc -dwarf64 -dwarf-version=5 -split-dwarf-file=foo.dwo -mtriple=x86_64-pc-linux -filetype=obj -function-sections -o %t -experimental-debug-variable-locations=true < %s22; RUN: llvm-dwarfdump -v -debug-info -debug-loclists %t | \23; RUN:   FileCheck %s --check-prefixes=DWO,DWO6424 25; CHECK:        DW_TAG_variable26; DWARF32-NEXT:   DW_AT_location [DW_FORM_loclistx]   (indexed (0x0) loclist = 0x00000018:27; DWARF64-NEXT:   DW_AT_location [DW_FORM_loclistx]   (indexed (0x0) loclist = 0x0000002c:28; CHECK-NEXT:       [0x0000000000000000, 0x0000000000000003) ".text{{[.$]}}_Z2f1ii": DW_OP_consts +5, DW_OP_stack_value)29; CHECK-NEXT:     DW_AT_name {{.*}} "x"30 31; CHECK:        DW_TAG_variable32; DWARF32-NEXT:   DW_AT_location [DW_FORM_loclistx]   (indexed (0x1) loclist = 0x00000020:33; DWARF64-NEXT:   DW_AT_location [DW_FORM_loclistx]   (indexed (0x1) loclist = 0x00000034:34; CHECK-NEXT:       [0x0000000000000000, 0x0000000000000003) ".text{{[.$]}}_Z2f1ii": DW_OP_consts +3, DW_OP_stack_value35; CHECK-NEXT:       [0x0000000000000003, 0x0000000000000004) ".text{{[.$]}}_Z2f1ii": DW_OP_consts +4, DW_OP_stack_value)36; CHECK-NEXT:     DW_AT_name {{.*}} "y"37 38; CHECK:        DW_TAG_variable39; DWARF32-NEXT:   DW_AT_location [DW_FORM_loclistx]   (indexed (0x2) loclist = 0x00000031:40; DWARF64-NEXT:   DW_AT_location [DW_FORM_loclistx]	(indexed (0x2) loclist = 0x00000045:41; CHECK-NEXT:       [0x0000000000000003, 0x0000000000000004) ".text{{[.$]}}_Z2f1ii": DW_OP_reg0 RAX)42; CHECK-NEXT:     DW_AT_name {{.*}} "r"43 44; CHECK:        .debug_loclists contents:45; DWARF32-NEXT: 0x00000000: locations list header: length = 0x00000035, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x0000000346; DWARF64-NEXT: 0x00000000: locations list header: length = 0x0000000000000041, format = DWARF64, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x0000000347 48; DWO:      .debug_loclists.dwo contents:49; DWO32-NEXT: 0x00000000: locations list header: length = 0x00000035, format = DWARF32, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x0000000350; DWO64-NEXT: 0x00000000: locations list header: length = 0x0000000000000041, format = DWARF64, version = 0x0005, addr_size = 0x08, seg_size = 0x00, offset_entry_count = 0x0000000351 52; CHECK-NEXT:   offsets: [53; DWARF32-NEXT: 0x0000000c => 0x0000001854; DWARF32-NEXT: 0x00000014 => 0x0000002055; DWARF32-NEXT: 0x00000025 => 0x0000003156; DWARF64-NEXT: 0x0000000000000018 => 0x0000002c57; DWARF64-NEXT: 0x0000000000000020 => 0x0000003458; DWARF64-NEXT: 0x0000000000000031 => 0x0000004559; CHECK-NEXT:   ]60 61; DWARF32-NEXT: 0x00000018:62; DWARF64-NEXT: 0x0000002c:63 64; Show that startx_length can be used when the address range starts at the start of the function.65 66; CHECK-NEXT:             DW_LLE_startx_length (0x0000000000000000, 0x0000000000000003): DW_OP_consts +5, DW_OP_stack_value67; CHECK-NEXT:             DW_LLE_end_of_list   ()68 69; Don't use startx_length if there's more than one entry, because the shared70; base address will be useful for both the range that does start at the start of71; the function, and the one that doesn't.72 73; DWARF32:      0x00000020:74; DWARF64:      0x00000034:75 76; CHECK-NEXT:             DW_LLE_base_addressx (0x0000000000000000)77; CHECK-NEXT:             DW_LLE_offset_pair   (0x0000000000000000, 0x0000000000000003): DW_OP_consts +3, DW_OP_stack_value78; CHECK-NEXT:             DW_LLE_offset_pair   (0x0000000000000003, 0x0000000000000004): DW_OP_consts +4, DW_OP_stack_value79; CHECK-NEXT:             DW_LLE_end_of_list   ()80 81; And use a base address when the range doesn't start at an existing/useful82; address in the pool.83 84; DWARF32:      0x00000031:85; DWARF64:      0x00000045:86; CHECK-NEXT:             DW_LLE_base_addressx (0x0000000000000000)87; CHECK-NEXT:             DW_LLE_offset_pair   (0x0000000000000003, 0x0000000000000004): DW_OP_reg0 RAX88; CHECK-NEXT:             DW_LLE_end_of_list   ()89 90; Built with clang -O3 -ffunction-sections from source:91; 92; int f1(int i, int j) {93;   int x = 5;94;   int y = 3;95;   int r = i + j;96;   int undef;97;   x = undef;98;   y = 4;99;   return r;100; }101; void f2() {102; }103 104; Function Attrs: norecurse nounwind readnone uwtable105define dso_local i32 @_Z2f1ii(i32 %i, i32 %j) local_unnamed_addr !dbg !7 {106entry:107  call void @llvm.dbg.value(metadata i32 %i, metadata !12, metadata !DIExpression()), !dbg !18108  call void @llvm.dbg.value(metadata i32 %j, metadata !13, metadata !DIExpression()), !dbg !18109  call void @llvm.dbg.value(metadata i32 5, metadata !14, metadata !DIExpression()), !dbg !18110  call void @llvm.dbg.value(metadata i32 3, metadata !15, metadata !DIExpression()), !dbg !18111  %add = add nsw i32 %j, %i, !dbg !19112  call void @llvm.dbg.value(metadata i32 %add, metadata !16, metadata !DIExpression()), !dbg !18113  call void @llvm.dbg.value(metadata i32 undef, metadata !14, metadata !DIExpression()), !dbg !18114  call void @llvm.dbg.value(metadata i32 4, metadata !15, metadata !DIExpression()), !dbg !18115  ret i32 %add, !dbg !20116}117 118; Function Attrs: norecurse nounwind readnone uwtable119define dso_local void @_Z2f2v() local_unnamed_addr !dbg !21 {120entry:121  ret void, !dbg !24122}123 124; Function Attrs: nounwind readnone speculatable willreturn125declare void @llvm.dbg.value(metadata, metadata, metadata)126 127!llvm.dbg.cu = !{!0}128!llvm.module.flags = !{!3, !4, !5}129!llvm.ident = !{!6}130 131!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 10.0.0 (trunk 374581) (llvm/trunk 374579)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)132!1 = !DIFile(filename: "loc2.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch", checksumkind: CSK_MD5, checksum: "91e0069c680e2a63f4f885ec93f5d07e")133!2 = !{}134!3 = !{i32 2, !"Dwarf Version", i32 5}135!4 = !{i32 2, !"Debug Info Version", i32 3}136!5 = !{i32 1, !"wchar_size", i32 4}137!6 = !{!"clang version 10.0.0 (trunk 374581) (llvm/trunk 374579)"}138!7 = distinct !DISubprogram(name: "f1", linkageName: "_Z2f1ii", scope: !1, file: !1, line: 1, type: !8, scopeLine: 1, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)139!8 = !DISubroutineType(types: !9)140!9 = !{!10, !10, !10}141!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)142!11 = !{!12, !13, !14, !15, !16, !17}143!12 = !DILocalVariable(name: "i", arg: 1, scope: !7, file: !1, line: 1, type: !10)144!13 = !DILocalVariable(name: "j", arg: 2, scope: !7, file: !1, line: 1, type: !10)145!14 = !DILocalVariable(name: "x", scope: !7, file: !1, line: 2, type: !10)146!15 = !DILocalVariable(name: "y", scope: !7, file: !1, line: 3, type: !10)147!16 = !DILocalVariable(name: "r", scope: !7, file: !1, line: 4, type: !10)148!17 = !DILocalVariable(name: "undef", scope: !7, file: !1, line: 5, type: !10)149!18 = !DILocation(line: 0, scope: !7)150!19 = !DILocation(line: 4, column: 13, scope: !7)151!20 = !DILocation(line: 8, column: 3, scope: !7)152!21 = distinct !DISubprogram(name: "f2", linkageName: "_Z2f2v", scope: !1, file: !1, line: 10, type: !22, scopeLine: 10, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)153!22 = !DISubroutineType(types: !23)154!23 = !{null}155!24 = !DILocation(line: 11, column: 1, scope: !21)156