mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-18 13:34:04 +00:00
b056aa798d
Move the specialized metadata nodes for the new debug info hierarchy into place, finishing off PR22464. I've done bootstraps (and all that) and I'm confident this commit is NFC as far as DWARF output is concerned. Let me know if I'm wrong :). The code changes are fairly mechanical: - Bumped the "Debug Info Version". - `DIBuilder` now creates the appropriate subclass of `MDNode`. - Subclasses of DIDescriptor now expect to hold their "MD" counterparts (e.g., `DIBasicType` expects `MDBasicType`). - Deleted a ton of dead code in `AsmWriter.cpp` and `DebugInfo.cpp` for printing comments. - Big update to LangRef to describe the nodes in the new hierarchy. Feel free to make it better. Testcase changes are enormous. There's an accompanying clang commit on its way. If you have out-of-tree debug info testcases, I just broke your build. - `upgrade-specialized-nodes.sh` is attached to PR22564. I used it to update all the IR testcases. - Unfortunately I failed to find way to script the updates to CHECK lines, so I updated all of these by hand. This was fairly painful, since the old CHECKs are difficult to reason about. That's one of the benefits of the new hierarchy. This work isn't quite finished, BTW. The `DIDescriptor` subclasses are almost empty wrappers, but not quite: they still have loose casting checks (see the `RETURN_FROM_RAW()` macro). Once they're completely gutted, I'll rename the "MD" classes to "DI" and kill the wrappers. I also expect to make a few schema changes now that it's easier to reason about everything. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@231082 91177308-0d34-0410-b5e6-96231b3b80d8
119 lines
5.7 KiB
LLVM
119 lines
5.7 KiB
LLVM
; REQUIRES: object-emission
|
|
;
|
|
; RUN: llc -mtriple=x86_64-unknown-linux-gnu -O0 -filetype=obj < %s > %t
|
|
; RUN: llvm-dwarfdump %t | FileCheck %s
|
|
|
|
; Test case derived from compiling the following source with clang -g:
|
|
;
|
|
; namespace pr14763 {
|
|
; struct foo {
|
|
; foo(const foo&);
|
|
; };
|
|
;
|
|
; foo func(foo f) {
|
|
; return f; // reference 'f' for now because otherwise we hit another bug
|
|
; }
|
|
;
|
|
; void sink(void*);
|
|
;
|
|
; void func2(bool b, foo g) {
|
|
; if (b)
|
|
; sink(&g); // reference 'f' for now because otherwise we hit another bug
|
|
; }
|
|
; }
|
|
|
|
; CHECK: debug_info contents
|
|
; 0x74 is DW_OP_breg4, showing that the parameter is accessed indirectly
|
|
; (with a zero offset) from the register parameter
|
|
; CHECK: DW_AT_location{{.*}}(<0x0{{.}}> 74 00
|
|
; CHECK-NOT: DW_TAG
|
|
; CHECK: DW_AT_name{{.*}} = "f"
|
|
|
|
; CHECK: DW_AT_location{{.*}}([[G_LOC:0x[0-9]*]])
|
|
; CHECK-NOT: DW_TAG
|
|
; CHECK: DW_AT_name{{.*}} = "g"
|
|
; CHECK: debug_loc contents
|
|
; CHECK-NEXT: [[G_LOC]]: Beginning
|
|
; CHECK-NEXT: Ending
|
|
; CHECK-NEXT: Location description: 74 00
|
|
|
|
%"struct.pr14763::foo" = type { i8 }
|
|
|
|
; Function Attrs: uwtable
|
|
define void @_ZN7pr147634funcENS_3fooE(%"struct.pr14763::foo"* noalias sret %agg.result, %"struct.pr14763::foo"* %f) #0 {
|
|
entry:
|
|
call void @llvm.dbg.declare(metadata %"struct.pr14763::foo"* %f, metadata !22, metadata !MDExpression(DW_OP_deref)), !dbg !24
|
|
call void @_ZN7pr147633fooC1ERKS0_(%"struct.pr14763::foo"* %agg.result, %"struct.pr14763::foo"* %f), !dbg !25
|
|
ret void, !dbg !25
|
|
}
|
|
|
|
; Function Attrs: nounwind readnone
|
|
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
|
|
|
|
declare void @_ZN7pr147633fooC1ERKS0_(%"struct.pr14763::foo"*, %"struct.pr14763::foo"*) #2
|
|
|
|
; Function Attrs: uwtable
|
|
define void @_ZN7pr147635func2EbNS_3fooE(i1 zeroext %b, %"struct.pr14763::foo"* %g) #0 {
|
|
entry:
|
|
%b.addr = alloca i8, align 1
|
|
%frombool = zext i1 %b to i8
|
|
store i8 %frombool, i8* %b.addr, align 1
|
|
call void @llvm.dbg.declare(metadata i8* %b.addr, metadata !26, metadata !MDExpression()), !dbg !27
|
|
call void @llvm.dbg.declare(metadata %"struct.pr14763::foo"* %g, metadata !28, metadata !MDExpression(DW_OP_deref)), !dbg !27
|
|
%0 = load i8, i8* %b.addr, align 1, !dbg !29
|
|
%tobool = trunc i8 %0 to i1, !dbg !29
|
|
br i1 %tobool, label %if.then, label %if.end, !dbg !29
|
|
|
|
if.then: ; preds = %entry
|
|
%1 = bitcast %"struct.pr14763::foo"* %g to i8*, !dbg !31
|
|
call void @_ZN7pr147634sinkEPv(i8* %1), !dbg !31
|
|
br label %if.end, !dbg !31
|
|
|
|
if.end: ; preds = %if.then, %entry
|
|
ret void, !dbg !32
|
|
}
|
|
|
|
declare void @_ZN7pr147634sinkEPv(i8*) #2
|
|
|
|
attributes #0 = { uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "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"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
|
|
|
!llvm.dbg.cu = !{!0}
|
|
!llvm.module.flags = !{!21, !33}
|
|
|
|
!0 = !MDCompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 ", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2)
|
|
!1 = !MDFile(filename: "pass.cpp", directory: "/tmp")
|
|
!2 = !{}
|
|
!3 = !{!4, !17}
|
|
!4 = !MDSubprogram(name: "func", linkageName: "_ZN7pr147634funcENS_3fooE", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 6, file: !1, scope: !5, type: !6, function: void (%"struct.pr14763::foo"*, %"struct.pr14763::foo"*)* @_ZN7pr147634funcENS_3fooE, variables: !2)
|
|
!5 = !MDNamespace(name: "pr14763", line: 1, file: !1, scope: null)
|
|
!6 = !MDSubroutineType(types: !7)
|
|
!7 = !{!8, !8}
|
|
!8 = !MDCompositeType(tag: DW_TAG_structure_type, name: "foo", line: 2, size: 8, align: 8, file: !1, scope: !5, elements: !9)
|
|
!9 = !{!10}
|
|
!10 = !MDSubprogram(name: "foo", line: 3, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !1, scope: !8, type: !11, variables: !16)
|
|
!11 = !MDSubroutineType(types: !12)
|
|
!12 = !{null, !13, !14}
|
|
!13 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !8)
|
|
!14 = !MDDerivedType(tag: DW_TAG_reference_type, baseType: !15)
|
|
!15 = !MDDerivedType(tag: DW_TAG_const_type, baseType: !8)
|
|
!16 = !{i32 786468}
|
|
!17 = !MDSubprogram(name: "func2", linkageName: "_ZN7pr147635func2EbNS_3fooE", line: 12, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 12, file: !1, scope: !5, type: !18, function: void (i1, %"struct.pr14763::foo"*)* @_ZN7pr147635func2EbNS_3fooE, variables: !2)
|
|
!18 = !MDSubroutineType(types: !19)
|
|
!19 = !{null, !20, !8}
|
|
!20 = !MDBasicType(tag: DW_TAG_base_type, name: "bool", size: 8, align: 8, encoding: DW_ATE_boolean)
|
|
!21 = !{i32 2, !"Dwarf Version", i32 3}
|
|
!22 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "f", line: 6, arg: 1, scope: !4, file: !23, type: !8)
|
|
!23 = !MDFile(filename: "pass.cpp", directory: "/tmp")
|
|
!24 = !MDLocation(line: 6, scope: !4)
|
|
!25 = !MDLocation(line: 7, scope: !4)
|
|
!26 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "b", line: 12, arg: 1, scope: !17, file: !23, type: !20)
|
|
!27 = !MDLocation(line: 12, scope: !17)
|
|
!28 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "g", line: 12, arg: 2, scope: !17, file: !23, type: !8)
|
|
!29 = !MDLocation(line: 13, scope: !30)
|
|
!30 = distinct !MDLexicalBlock(line: 13, column: 0, file: !1, scope: !17)
|
|
!31 = !MDLocation(line: 14, scope: !30)
|
|
!32 = !MDLocation(line: 15, scope: !17)
|
|
!33 = !{i32 1, !"Debug Info Version", i32 3}
|