mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-08 06:32:24 +00:00
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
107 lines
3.7 KiB
LLVM
107 lines
3.7 KiB
LLVM
; RUN: llc -O1 -filetype=obj -o - %s | llvm-dwarfdump -debug-dump=all - | FileCheck %s
|
|
; Generated with -O1 from:
|
|
; int f1();
|
|
; void f2(int*);
|
|
; int f3(int);
|
|
;
|
|
; int foo() {
|
|
; int i = 3;
|
|
; f3(i);
|
|
; i = 7;
|
|
; i = f1();
|
|
; f2(&i);
|
|
; return 0;
|
|
; }
|
|
;
|
|
; Test that we generate valid debug info for optimized code,
|
|
; particularly variables that are described as constants and passed
|
|
; by reference.
|
|
; rdar://problem/14874886
|
|
;
|
|
; CHECK: .debug_info contents:
|
|
; CHECK: DW_TAG_variable
|
|
; CHECK-NOT: DW_TAG
|
|
; CHECK: DW_AT_location [DW_FORM_data4] ([[LOC:.*]])
|
|
; CHECK-NOT: DW_TAG
|
|
; CHECK: DW_AT_name{{.*}}"i"
|
|
; CHECK: .debug_loc contents:
|
|
; CHECK: [[LOC]]:
|
|
; consts 0x00000003
|
|
; CHECK: Beginning address offset: 0x0000000000000{{.*}}
|
|
; CHECK: Ending address offset: [[C1:.*]]
|
|
; CHECK: Location description: 11 03
|
|
; consts 0x00000007
|
|
; CHECK: Beginning address offset: [[C1]]
|
|
; CHECK: Ending address offset: [[C2:.*]]
|
|
; CHECK: Location description: 11 07
|
|
; rax, piece 0x00000004
|
|
; CHECK: Beginning address offset: [[C2]]
|
|
; CHECK: Ending address offset: [[R1:.*]]
|
|
; CHECK: Location description: 50 93 04
|
|
; rdi+0
|
|
; CHECK: Beginning address offset: [[R1]]
|
|
; CHECK: Ending address offset: [[R2:.*]]
|
|
; CHECK: Location description: 75 00
|
|
;
|
|
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
|
target triple = "x86_64-apple-macosx10.9.0"
|
|
|
|
; Function Attrs: nounwind ssp uwtable
|
|
define i32 @foo() #0 {
|
|
entry:
|
|
%i = alloca i32, align 4
|
|
call void @llvm.dbg.value(metadata i32 3, i64 0, metadata !10, metadata !MDExpression()), !dbg !15
|
|
%call = call i32 @f3(i32 3) #3, !dbg !16
|
|
call void @llvm.dbg.value(metadata i32 7, i64 0, metadata !10, metadata !MDExpression()), !dbg !18
|
|
%call1 = call i32 (...)* @f1() #3, !dbg !19
|
|
call void @llvm.dbg.value(metadata i32 %call1, i64 0, metadata !10, metadata !MDExpression()), !dbg !19
|
|
store i32 %call1, i32* %i, align 4, !dbg !19, !tbaa !20
|
|
call void @llvm.dbg.value(metadata i32* %i, i64 0, metadata !10, metadata !MDExpression()), !dbg !24
|
|
call void @f2(i32* %i) #3, !dbg !24
|
|
ret i32 0, !dbg !25
|
|
}
|
|
|
|
declare i32 @f3(i32)
|
|
|
|
declare i32 @f1(...)
|
|
|
|
declare void @f2(i32*)
|
|
|
|
; Function Attrs: nounwind readnone
|
|
declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2
|
|
|
|
attributes #0 = { nounwind ssp uwtable }
|
|
attributes #2 = { nounwind readnone }
|
|
attributes #3 = { nounwind }
|
|
|
|
!llvm.dbg.cu = !{!0}
|
|
!llvm.module.flags = !{!11, !12}
|
|
!llvm.ident = !{!13}
|
|
|
|
!0 = !MDCompileUnit(language: DW_LANG_C99, producer: "clang version 3.5.0 ", isOptimized: true, emissionKind: 1, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2)
|
|
!1 = !MDFile(filename: "dbg-value-const-byref.c", directory: "")
|
|
!2 = !{}
|
|
!3 = !{!4}
|
|
!4 = !MDSubprogram(name: "foo", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, scopeLine: 5, file: !1, scope: !5, type: !6, function: i32 ()* @foo, variables: !9)
|
|
!5 = !MDFile(filename: "dbg-value-const-byref.c", directory: "")
|
|
!6 = !MDSubroutineType(types: !7)
|
|
!7 = !{!8}
|
|
!8 = !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
|
!9 = !{!10}
|
|
!10 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "i", line: 6, scope: !4, file: !5, type: !8)
|
|
!11 = !{i32 2, !"Dwarf Version", i32 2}
|
|
!12 = !{i32 1, !"Debug Info Version", i32 3}
|
|
!13 = !{!"clang version 3.5.0 "}
|
|
!14 = !{i32 3}
|
|
!15 = !MDLocation(line: 6, scope: !4)
|
|
!16 = !MDLocation(line: 7, scope: !4)
|
|
!17 = !{i32 7}
|
|
!18 = !MDLocation(line: 8, scope: !4)
|
|
!19 = !MDLocation(line: 9, scope: !4)
|
|
!20 = !{!21, !21, i64 0}
|
|
!21 = !{!"int", !22, i64 0}
|
|
!22 = !{!"omnipotent char", !23, i64 0}
|
|
!23 = !{!"Simple C/C++ TBAA"}
|
|
!24 = !MDLocation(line: 10, scope: !4)
|
|
!25 = !MDLocation(line: 11, scope: !4)
|