mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-13 04:30:23 +00:00
e56023a059
Finish off PR23080 by renaming the debug info IR constructs from `MD*` to `DI*`. The last of the `DIDescriptor` classes were deleted in r235356, and the last of the related typedefs removed in r235413, so this has all baked for about a week. Note: If you have out-of-tree code (like a frontend), I recommend that you get everything compiling and tests passing with the *previous* commit before updating to this one. It'll be easier to keep track of what code is using the `DIDescriptor` hierarchy and what you've already updated, and I think you're extremely unlikely to insert bugs. YMMV of course. Back to *this* commit: I did this using the rename-md-di-nodes.sh upgrade script I've attached to PR23080 (both code and testcases) and filtered through clang-format-diff.py. I edited the tests for test/Assembler/invalid-generic-debug-node-*.ll by hand since the columns were off-by-three. It should work on your out-of-tree testcases (and code, if you've followed the advice in the previous paragraph). Some of the tests are in badly named files now (e.g., test/Assembler/invalid-mdcompositetype-missing-tag.ll should be 'dicompositetype'); I'll come back and move the files in a follow-up commit. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236120 91177308-0d34-0410-b5e6-96231b3b80d8
154 lines
6.6 KiB
LLVM
154 lines
6.6 KiB
LLVM
; RUN: llc %s -filetype=obj -O0 -mtriple=i386-unknown-linux-gnu -dwarf-version=4 -o %t
|
|
; RUN: llvm-dwarfdump %t | FileCheck %s
|
|
|
|
; From the code:
|
|
|
|
; debug-loc-offset1.cc
|
|
; int bar (int b) {
|
|
; return b+4;
|
|
; }
|
|
|
|
; debug-loc-offset2.cc
|
|
; struct A {
|
|
; int var;
|
|
; virtual char foo();
|
|
; };
|
|
|
|
; void baz(struct A a) {
|
|
; int z = 2;
|
|
; if (a.var > 2)
|
|
; z++;
|
|
; if (a.foo() == 'a')
|
|
; z++;
|
|
; }
|
|
|
|
; Compiled separately for i386-pc-linux-gnu and linked together.
|
|
; This ensures that we have multiple compile units so that we can verify that
|
|
; debug_loc entries are relative to the low_pc of the CU. The loc entry for
|
|
; the byval argument in foo.cpp is in the second CU and so should have
|
|
; an offset relative to that CU rather than from the beginning of the text
|
|
; section.
|
|
|
|
; Checking that we have two compile units with two sets of high/lo_pc.
|
|
; CHECK: .debug_info contents
|
|
; CHECK: DW_TAG_compile_unit
|
|
; CHECK: DW_AT_low_pc
|
|
; CHECK: DW_AT_high_pc
|
|
|
|
; CHECK: DW_TAG_compile_unit
|
|
; CHECK: DW_AT_low_pc
|
|
; CHECK: DW_AT_high_pc
|
|
|
|
; CHECK: DW_TAG_subprogram
|
|
; CHECK-NOT: DW_TAG
|
|
; CHECK: DW_AT_linkage_name [DW_FORM_strp]{{.*}}"_Z3baz1A"
|
|
; CHECK-NOT: {{DW_TAG|NULL}}
|
|
; CHECK: DW_TAG_formal_parameter
|
|
; CHECK-NOT: DW_TAG
|
|
; CHECK: DW_AT_location [DW_FORM_sec_offset] (0x00000000)
|
|
; CHECK-NOT: DW_TAG
|
|
; CHECK: DW_AT_name [DW_FORM_strp]{{.*}}"a"
|
|
|
|
; CHECK: DW_TAG_variable
|
|
; CHECK: DW_AT_location [DW_FORM_exprloc]
|
|
; CHECK-NOT: DW_AT_location
|
|
|
|
; CHECK: .debug_loc contents:
|
|
; CHECK: 0x00000000: Beginning address offset: 0x0000000000000000
|
|
; CHECK: Ending address offset: 0x0000000000000017
|
|
|
|
%struct.A = type { i32 (...)**, i32 }
|
|
|
|
; Function Attrs: nounwind
|
|
define i32 @_Z3bari(i32 %b) #0 {
|
|
entry:
|
|
%b.addr = alloca i32, align 4
|
|
store i32 %b, i32* %b.addr, align 4
|
|
call void @llvm.dbg.declare(metadata i32* %b.addr, metadata !21, metadata !DIExpression()), !dbg !22
|
|
%0 = load i32, i32* %b.addr, align 4, !dbg !23
|
|
%add = add nsw i32 %0, 4, !dbg !23
|
|
ret i32 %add, !dbg !23
|
|
}
|
|
|
|
; Function Attrs: nounwind readnone
|
|
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
|
|
|
|
define void @_Z3baz1A(%struct.A* %a) #2 {
|
|
entry:
|
|
%z = alloca i32, align 4
|
|
call void @llvm.dbg.declare(metadata %struct.A* %a, metadata !24, metadata !DIExpression(DW_OP_deref)), !dbg !25
|
|
call void @llvm.dbg.declare(metadata i32* %z, metadata !26, metadata !DIExpression()), !dbg !27
|
|
store i32 2, i32* %z, align 4, !dbg !27
|
|
%var = getelementptr inbounds %struct.A, %struct.A* %a, i32 0, i32 1, !dbg !28
|
|
%0 = load i32, i32* %var, align 4, !dbg !28
|
|
%cmp = icmp sgt i32 %0, 2, !dbg !28
|
|
br i1 %cmp, label %if.then, label %if.end, !dbg !28
|
|
|
|
if.then: ; preds = %entry
|
|
%1 = load i32, i32* %z, align 4, !dbg !30
|
|
%inc = add nsw i32 %1, 1, !dbg !30
|
|
store i32 %inc, i32* %z, align 4, !dbg !30
|
|
br label %if.end, !dbg !30
|
|
|
|
if.end: ; preds = %if.then, %entry
|
|
%call = call signext i8 @_ZN1A3fooEv(%struct.A* %a), !dbg !31
|
|
%conv = sext i8 %call to i32, !dbg !31
|
|
%cmp1 = icmp eq i32 %conv, 97, !dbg !31
|
|
br i1 %cmp1, label %if.then2, label %if.end4, !dbg !31
|
|
|
|
if.then2: ; preds = %if.end
|
|
%2 = load i32, i32* %z, align 4, !dbg !33
|
|
%inc3 = add nsw i32 %2, 1, !dbg !33
|
|
store i32 %inc3, i32* %z, align 4, !dbg !33
|
|
br label %if.end4, !dbg !33
|
|
|
|
if.end4: ; preds = %if.then2, %if.end
|
|
ret void, !dbg !34
|
|
}
|
|
|
|
declare signext i8 @_ZN1A3fooEv(%struct.A*) #2
|
|
|
|
attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
|
attributes #1 = { nounwind readnone }
|
|
attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
|
|
|
!llvm.dbg.cu = !{!0, !9}
|
|
!llvm.module.flags = !{!18, !19}
|
|
!llvm.ident = !{!20, !20}
|
|
|
|
!0 = !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 (210479)", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2)
|
|
!1 = !DIFile(filename: "debug-loc-offset1.cc", directory: "/llvm_cmake_gcc")
|
|
!2 = !{}
|
|
!3 = !{!4}
|
|
!4 = !DISubprogram(name: "bar", linkageName: "_Z3bari", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 1, file: !1, scope: !5, type: !6, function: i32 (i32)* @_Z3bari, variables: !2)
|
|
!5 = !DIFile(filename: "debug-loc-offset1.cc", directory: "/llvm_cmake_gcc")
|
|
!6 = !DISubroutineType(types: !7)
|
|
!7 = !{!8, !8}
|
|
!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
|
!9 = !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 (210479)", isOptimized: false, emissionKind: 1, file: !10, enums: !2, retainedTypes: !11, subprograms: !13, globals: !2, imports: !2)
|
|
!10 = !DIFile(filename: "debug-loc-offset2.cc", directory: "/llvm_cmake_gcc")
|
|
!11 = !{!12}
|
|
!12 = !DICompositeType(tag: DW_TAG_structure_type, name: "A", line: 1, flags: DIFlagFwdDecl, file: !10, identifier: "_ZTS1A")
|
|
!13 = !{!14}
|
|
!14 = !DISubprogram(name: "baz", linkageName: "_Z3baz1A", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 6, file: !10, scope: !15, type: !16, function: void (%struct.A*)* @_Z3baz1A, variables: !2)
|
|
!15 = !DIFile(filename: "debug-loc-offset2.cc", directory: "/llvm_cmake_gcc")
|
|
!16 = !DISubroutineType(types: !17)
|
|
!17 = !{null, !12}
|
|
!18 = !{i32 2, !"Dwarf Version", i32 4}
|
|
!19 = !{i32 2, !"Debug Info Version", i32 3}
|
|
!20 = !{!"clang version 3.5.0 (210479)"}
|
|
!21 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "b", line: 1, arg: 1, scope: !4, file: !5, type: !8)
|
|
!22 = !DILocation(line: 1, scope: !4)
|
|
!23 = !DILocation(line: 2, scope: !4)
|
|
!24 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "a", line: 6, arg: 1, scope: !14, file: !15, type: !"_ZTS1A")
|
|
!25 = !DILocation(line: 6, scope: !14)
|
|
!26 = !DILocalVariable(tag: DW_TAG_auto_variable, name: "z", line: 7, scope: !14, file: !15, type: !8)
|
|
!27 = !DILocation(line: 7, scope: !14)
|
|
!28 = !DILocation(line: 8, scope: !29)
|
|
!29 = distinct !DILexicalBlock(line: 8, column: 0, file: !10, scope: !14)
|
|
!30 = !DILocation(line: 9, scope: !29)
|
|
!31 = !DILocation(line: 10, scope: !32)
|
|
!32 = distinct !DILexicalBlock(line: 10, column: 0, file: !10, scope: !14)
|
|
!33 = !DILocation(line: 11, scope: !32)
|
|
!34 = !DILocation(line: 12, scope: !14)
|