2012-02-24 09:59:08 +08:00
|
|
|
; RUN: llc -mtriple=x86_64-apple-darwin %s -o %t -filetype=obj
|
2013-01-26 05:44:53 +08:00
|
|
|
; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
|
2013-11-22 07:46:41 +08:00
|
|
|
; RUN: llc -mtriple=x86_64-apple-darwin %s -o %t -filetype=obj -dwarf-version=3
|
|
|
|
; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s -check-prefix=DWARF3
|
2012-02-24 09:59:08 +08:00
|
|
|
|
|
|
|
; Checks that we emit debug info for the block variable declare.
|
2014-05-24 05:07:01 +08:00
|
|
|
; CHECK: DW_TAG_subprogram
|
|
|
|
; CHECK: DW_TAG_variable
|
|
|
|
; CHECK: DW_AT_location [DW_FORM_sec_offset]
|
2014-06-14 05:52:33 +08:00
|
|
|
; CHECK: DW_AT_name {{.*}} "block"
|
2012-02-24 09:59:08 +08:00
|
|
|
|
2014-05-24 05:07:01 +08:00
|
|
|
; DWARF3: DW_TAG_subprogram
|
|
|
|
; DWARF3: DW_TAG_variable
|
|
|
|
; DWARF3: DW_AT_location [DW_FORM_data4]
|
2014-06-14 05:52:33 +08:00
|
|
|
; DWARF3: DW_AT_name {{.*}} "block"
|
2013-11-22 07:46:41 +08:00
|
|
|
|
2012-02-24 09:59:08 +08:00
|
|
|
%struct.__block_descriptor = type { i64, i64 }
|
|
|
|
%struct.__block_literal_generic = type { i8*, i32, i32, i8*, %struct.__block_descriptor* }
|
|
|
|
|
Move the complex address expression out of DIVariable and into an extra
argument of the llvm.dbg.declare/llvm.dbg.value intrinsics.
Previously, DIVariable was a variable-length field that has an optional
reference to a Metadata array consisting of a variable number of
complex address expressions. In the case of OpPiece expressions this is
wasting a lot of storage in IR, because when an aggregate type is, e.g.,
SROA'd into all of its n individual members, the IR will contain n copies
of the DIVariable, all alike, only differing in the complex address
reference at the end.
By making the complex address into an extra argument of the
dbg.value/dbg.declare intrinsics, all of the pieces can reference the
same variable and the complex address expressions can be uniqued across
the CU, too.
Down the road, this will allow us to move other flags, such as
"indirection" out of the DIVariable, too.
The new intrinsics look like this:
declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr)
declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr)
This patch adds a new LLVM-local tag to DIExpressions, so we can detect
and pretty-print DIExpression metadata nodes.
What this patch doesn't do:
This patch does not touch the "Indirect" field in DIVariable; but moving
that into the expression would be a natural next step.
http://reviews.llvm.org/D4919
rdar://problem/17994491
Thanks to dblaikie and dexonsmith for reviewing this patch!
Note: I accidentally committed a bogus older version of this patch previously.
llvm-svn: 218787
2014-10-02 02:55:02 +08:00
|
|
|
declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
|
2012-02-24 09:59:08 +08:00
|
|
|
|
|
|
|
define hidden void @__foo_block_invoke_0(i8* %.block_descriptor) uwtable ssp {
|
|
|
|
entry:
|
|
|
|
%exn.slot = alloca i8*
|
|
|
|
%ehselector.slot = alloca i32
|
2014-10-04 04:01:09 +08:00
|
|
|
call void @llvm.dbg.value(metadata !{i8* %.block_descriptor}, i64 0, metadata !39, metadata !{metadata !"0x102"}), !dbg !51
|
2012-02-24 09:59:08 +08:00
|
|
|
%block = bitcast i8* %.block_descriptor to <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, void ()* }>*, !dbg !52
|
Move the complex address expression out of DIVariable and into an extra
argument of the llvm.dbg.declare/llvm.dbg.value intrinsics.
Previously, DIVariable was a variable-length field that has an optional
reference to a Metadata array consisting of a variable number of
complex address expressions. In the case of OpPiece expressions this is
wasting a lot of storage in IR, because when an aggregate type is, e.g.,
SROA'd into all of its n individual members, the IR will contain n copies
of the DIVariable, all alike, only differing in the complex address
reference at the end.
By making the complex address into an extra argument of the
dbg.value/dbg.declare intrinsics, all of the pieces can reference the
same variable and the complex address expressions can be uniqued across
the CU, too.
Down the road, this will allow us to move other flags, such as
"indirection" out of the DIVariable, too.
The new intrinsics look like this:
declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr)
declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr)
This patch adds a new LLVM-local tag to DIExpressions, so we can detect
and pretty-print DIExpression metadata nodes.
What this patch doesn't do:
This patch does not touch the "Indirect" field in DIVariable; but moving
that into the expression would be a natural next step.
http://reviews.llvm.org/D4919
rdar://problem/17994491
Thanks to dblaikie and dexonsmith for reviewing this patch!
Note: I accidentally committed a bogus older version of this patch previously.
llvm-svn: 218787
2014-10-02 02:55:02 +08:00
|
|
|
call void @llvm.dbg.declare(metadata !{<{ i8*, i32, i32, i8*, %struct.__block_descriptor*, void ()* }>* %block}, metadata !53, metadata !65), !dbg !54
|
2012-02-24 09:59:08 +08:00
|
|
|
%block.capture.addr = getelementptr inbounds <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, void ()* }>* %block, i32 0, i32 5, !dbg !55
|
|
|
|
%0 = load void ()** %block.capture.addr, align 8, !dbg !55
|
|
|
|
%block.literal = bitcast void ()* %0 to %struct.__block_literal_generic*, !dbg !55
|
|
|
|
%1 = getelementptr inbounds %struct.__block_literal_generic* %block.literal, i32 0, i32 3, !dbg !55
|
|
|
|
%2 = bitcast %struct.__block_literal_generic* %block.literal to i8*, !dbg !55
|
|
|
|
%3 = load i8** %1, !dbg !55
|
|
|
|
%4 = bitcast i8* %3 to void (i8*)*, !dbg !55
|
|
|
|
invoke void %4(i8* %2)
|
|
|
|
to label %invoke.cont unwind label %lpad, !dbg !55
|
|
|
|
|
|
|
|
invoke.cont: ; preds = %entry
|
|
|
|
br label %eh.cont, !dbg !58
|
|
|
|
|
|
|
|
eh.cont: ; preds = %catch, %invoke.cont
|
|
|
|
ret void, !dbg !61
|
|
|
|
|
|
|
|
lpad: ; preds = %entry
|
|
|
|
%5 = landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__objc_personality_v0 to i8*)
|
|
|
|
catch i8* null, !dbg !55
|
|
|
|
%6 = extractvalue { i8*, i32 } %5, 0, !dbg !55
|
|
|
|
store i8* %6, i8** %exn.slot, !dbg !55
|
|
|
|
%7 = extractvalue { i8*, i32 } %5, 1, !dbg !55
|
|
|
|
store i32 %7, i32* %ehselector.slot, !dbg !55
|
|
|
|
br label %catch, !dbg !55
|
|
|
|
|
|
|
|
catch: ; preds = %lpad
|
|
|
|
%exn = load i8** %exn.slot, !dbg !62
|
|
|
|
%exn.adjusted = call i8* @objc_begin_catch(i8* %exn) nounwind, !dbg !62
|
|
|
|
call void @objc_end_catch(), !dbg !58
|
|
|
|
br label %eh.cont, !dbg !58
|
|
|
|
}
|
|
|
|
|
Move the complex address expression out of DIVariable and into an extra
argument of the llvm.dbg.declare/llvm.dbg.value intrinsics.
Previously, DIVariable was a variable-length field that has an optional
reference to a Metadata array consisting of a variable number of
complex address expressions. In the case of OpPiece expressions this is
wasting a lot of storage in IR, because when an aggregate type is, e.g.,
SROA'd into all of its n individual members, the IR will contain n copies
of the DIVariable, all alike, only differing in the complex address
reference at the end.
By making the complex address into an extra argument of the
dbg.value/dbg.declare intrinsics, all of the pieces can reference the
same variable and the complex address expressions can be uniqued across
the CU, too.
Down the road, this will allow us to move other flags, such as
"indirection" out of the DIVariable, too.
The new intrinsics look like this:
declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr)
declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr)
This patch adds a new LLVM-local tag to DIExpressions, so we can detect
and pretty-print DIExpression metadata nodes.
What this patch doesn't do:
This patch does not touch the "Indirect" field in DIVariable; but moving
that into the expression would be a natural next step.
http://reviews.llvm.org/D4919
rdar://problem/17994491
Thanks to dblaikie and dexonsmith for reviewing this patch!
Note: I accidentally committed a bogus older version of this patch previously.
llvm-svn: 218787
2014-10-02 02:55:02 +08:00
|
|
|
declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
|
2012-02-24 09:59:08 +08:00
|
|
|
|
|
|
|
declare i8* @objc_begin_catch(i8*)
|
|
|
|
|
|
|
|
declare void @objc_end_catch()
|
|
|
|
|
|
|
|
declare i32 @__objc_personality_v0(...)
|
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!0}
|
2013-11-23 05:49:45 +08:00
|
|
|
!llvm.module.flags = !{!35, !36, !37, !38, !64}
|
2012-02-24 09:59:08 +08:00
|
|
|
|
2014-10-04 04:01:09 +08:00
|
|
|
!0 = metadata !{metadata !"0x11\0016\00clang version 3.1 (trunk 151227)\000\00\002\00\001", metadata !63, metadata !1, metadata !1, metadata !3, metadata !1, metadata !1} ; [ DW_TAG_compile_unit ]
|
2014-02-04 09:23:52 +08:00
|
|
|
!1 = metadata !{}
|
2013-02-02 13:56:24 +08:00
|
|
|
!3 = metadata !{metadata !5, metadata !28, metadata !31, metadata !34}
|
2014-10-04 04:01:09 +08:00
|
|
|
!5 = metadata !{metadata !"0x2e\00foo\00foo\00\005\000\001\000\006\00256\000\005", metadata !6, metadata !6, metadata !7, null, null, null, null, null} ; [ DW_TAG_subprogram ]
|
|
|
|
!6 = metadata !{metadata !"0x29", metadata !63} ; [ DW_TAG_file_type ]
|
|
|
|
!7 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", i32 0, null, null, metadata !8, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
|
2012-02-24 09:59:08 +08:00
|
|
|
!8 = metadata !{null, metadata !9}
|
2014-10-04 04:01:09 +08:00
|
|
|
!9 = metadata !{metadata !"0x16\00dispatch_block_t\001\000\000\000\000", metadata !63, null, metadata !10} ; [ DW_TAG_typedef ]
|
|
|
|
!10 = metadata !{metadata !"0xf\00\000\0064\000\000\000", null, null, metadata !11} ; [ DW_TAG_pointer_type ]
|
|
|
|
!11 = metadata !{metadata !"0x13\00__block_literal_generic\005\00256\000\000\008\000", metadata !63, metadata !6, null, metadata !12, null, null, null} ; [ DW_TAG_structure_type ] [__block_literal_generic] [line 5, size 256, align 0, offset 0] [def] [from ]
|
2012-02-24 09:59:08 +08:00
|
|
|
!12 = metadata !{metadata !13, metadata !15, metadata !17, metadata !18, metadata !19}
|
2014-10-04 04:01:09 +08:00
|
|
|
!13 = metadata !{metadata !"0xd\00__isa\000\0064\0064\000\000", metadata !63, metadata !6, metadata !14} ; [ DW_TAG_member ]
|
|
|
|
!14 = metadata !{metadata !"0xf\00\000\0064\0064\000\000", null, null, null} ; [ DW_TAG_pointer_type ]
|
|
|
|
!15 = metadata !{metadata !"0xd\00__flags\000\0032\0032\0064\000", metadata !63, metadata !6, metadata !16} ; [ DW_TAG_member ]
|
|
|
|
!16 = metadata !{metadata !"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ]
|
|
|
|
!17 = metadata !{metadata !"0xd\00__reserved\000\0032\0032\0096\000", metadata !63, metadata !6, metadata !16} ; [ DW_TAG_member ]
|
|
|
|
!18 = metadata !{metadata !"0xd\00__FuncPtr\000\0064\0064\00128\000", metadata !63, metadata !6, metadata !14} ; [ DW_TAG_member ]
|
|
|
|
!19 = metadata !{metadata !"0xd\00__descriptor\005\0064\0064\00192\000", metadata !63, metadata !6, metadata !20} ; [ DW_TAG_member ]
|
|
|
|
!20 = metadata !{metadata !"0xf\00\000\0064\000\000\000", null, null, metadata !21} ; [ DW_TAG_pointer_type ]
|
|
|
|
!21 = metadata !{metadata !"0x13\00__block_descriptor\005\00128\000\000\008\000", metadata !63, metadata !6, null, metadata !22, null, null, null} ; [ DW_TAG_structure_type ] [__block_descriptor] [line 5, size 128, align 0, offset 0] [def] [from ]
|
2012-02-24 09:59:08 +08:00
|
|
|
!22 = metadata !{metadata !23, metadata !25}
|
2014-10-04 04:01:09 +08:00
|
|
|
!23 = metadata !{metadata !"0xd\00reserved\000\0064\0064\000\000", metadata !63, metadata !6, metadata !24} ; [ DW_TAG_member ]
|
|
|
|
!24 = metadata !{metadata !"0x24\00long unsigned int\000\0064\0064\000\000\007", null, null} ; [ DW_TAG_base_type ]
|
|
|
|
!25 = metadata !{metadata !"0xd\00Size\000\0064\0064\0064\000", metadata !63, metadata !6, metadata !24} ; [ DW_TAG_member ]
|
|
|
|
!28 = metadata !{metadata !"0x2e\00__foo_block_invoke_0\00__foo_block_invoke_0\00\007\001\001\000\006\00256\000\007", metadata !6, metadata !6, metadata !29, null, void (i8*)* @__foo_block_invoke_0, null, null, null} ; [ DW_TAG_subprogram ]
|
|
|
|
!29 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", i32 0, null, null, metadata !30, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
|
2012-02-24 09:59:08 +08:00
|
|
|
!30 = metadata !{null, metadata !14}
|
2014-10-04 04:01:09 +08:00
|
|
|
!31 = metadata !{metadata !"0x2e\00__copy_helper_block_\00__copy_helper_block_\00\0010\001\001\000\006\00256\000\0010", metadata !6, metadata !6, metadata !32, null, null, null, null, null} ; [ DW_TAG_subprogram ]
|
|
|
|
!32 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", i32 0, null, null, metadata !33, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
|
2012-02-24 09:59:08 +08:00
|
|
|
!33 = metadata !{null, metadata !14, metadata !14}
|
2014-10-04 04:01:09 +08:00
|
|
|
!34 = metadata !{metadata !"0x2e\00__destroy_helper_block_\00__destroy_helper_block_\00\0010\001\001\000\006\00256\000\0010", metadata !6, metadata !6, metadata !29, null, null, null, null, null} ; [ DW_TAG_subprogram ]
|
2012-02-24 09:59:08 +08:00
|
|
|
!35 = metadata !{i32 1, metadata !"Objective-C Version", i32 2}
|
|
|
|
!36 = metadata !{i32 1, metadata !"Objective-C Image Info Version", i32 0}
|
|
|
|
!37 = metadata !{i32 1, metadata !"Objective-C Image Info Section", metadata !"__DATA, __objc_imageinfo, regular, no_dead_strip"}
|
|
|
|
!38 = metadata !{i32 4, metadata !"Objective-C Garbage Collection", i32 0}
|
2014-10-04 04:01:09 +08:00
|
|
|
!39 = metadata !{metadata !"0x101\00.block_descriptor\0016777223\0064", metadata !28, metadata !6, metadata !40} ; [ DW_TAG_arg_variable ]
|
|
|
|
!40 = metadata !{metadata !"0xf\00\000\0064\000\000\000", null, null, metadata !41} ; [ DW_TAG_pointer_type ]
|
|
|
|
!41 = metadata !{metadata !"0x13\00__block_literal_1\007\00320\0064\000\000\000", metadata !63, metadata !6, null, metadata !42, null, null, null} ; [ DW_TAG_structure_type ] [__block_literal_1] [line 7, size 320, align 64, offset 0] [def] [from ]
|
2012-02-24 09:59:08 +08:00
|
|
|
!42 = metadata !{metadata !43, metadata !44, metadata !45, metadata !46, metadata !47, metadata !50}
|
2014-10-04 04:01:09 +08:00
|
|
|
!43 = metadata !{metadata !"0xd\00__isa\007\0064\0064\000\000", metadata !63, metadata !6, metadata !14} ; [ DW_TAG_member ]
|
|
|
|
!44 = metadata !{metadata !"0xd\00__flags\007\0032\0032\0064\000", metadata !63, metadata !6, metadata !16} ; [ DW_TAG_member ]
|
|
|
|
!45 = metadata !{metadata !"0xd\00__reserved\007\0032\0032\0096\000", metadata !63, metadata !6, metadata !16} ; [ DW_TAG_member ]
|
|
|
|
!46 = metadata !{metadata !"0xd\00__FuncPtr\007\0064\0064\00128\000", metadata !63, metadata !6, metadata !14} ; [ DW_TAG_member ]
|
|
|
|
!47 = metadata !{metadata !"0xd\00__descriptor\007\0064\0064\00192\000", metadata !63, metadata !6, metadata !48} ; [ DW_TAG_member ]
|
|
|
|
!48 = metadata !{metadata !"0xf\00\000\0064\0064\000\000", null, null, metadata !49} ; [ DW_TAG_pointer_type ]
|
|
|
|
!49 = metadata !{metadata !"0x13\00__block_descriptor_withcopydispose\007\000\000\000\004\000", metadata !63, null, null, null, null, null, null} ; [ DW_TAG_structure_type ] [__block_descriptor_withcopydispose] [line 7, size 0, align 0, offset 0] [decl] [from ]
|
|
|
|
!50 = metadata !{metadata !"0xd\00block\007\0064\0064\00256\000", metadata !63, metadata !6, metadata !9} ; [ DW_TAG_member ]
|
2012-02-24 09:59:08 +08:00
|
|
|
!51 = metadata !{i32 7, i32 18, metadata !28, null}
|
|
|
|
!52 = metadata !{i32 7, i32 19, metadata !28, null}
|
2014-10-04 04:01:09 +08:00
|
|
|
!53 = metadata !{metadata !"0x100\00block\005\000", metadata !28, metadata !6, metadata !9} ; [ DW_TAG_auto_variable ]
|
2012-02-24 09:59:08 +08:00
|
|
|
!54 = metadata !{i32 5, i32 27, metadata !28, null}
|
|
|
|
!55 = metadata !{i32 8, i32 22, metadata !56, null}
|
2014-10-04 04:01:09 +08:00
|
|
|
!56 = metadata !{metadata !"0xb\007\0026\002", metadata !6, metadata !57} ; [ DW_TAG_lexical_block ]
|
|
|
|
!57 = metadata !{metadata !"0xb\007\0019\001", metadata !6, metadata !28} ; [ DW_TAG_lexical_block ]
|
2012-02-24 09:59:08 +08:00
|
|
|
!58 = metadata !{i32 10, i32 20, metadata !59, null}
|
2014-10-04 04:01:09 +08:00
|
|
|
!59 = metadata !{metadata !"0xb\009\0035\004", metadata !6, metadata !60} ; [ DW_TAG_lexical_block ]
|
|
|
|
!60 = metadata !{metadata !"0xb\009\0035\003", metadata !6, metadata !57} ; [ DW_TAG_lexical_block ]
|
2012-02-24 09:59:08 +08:00
|
|
|
!61 = metadata !{i32 10, i32 21, metadata !28, null}
|
|
|
|
!62 = metadata !{i32 9, i32 20, metadata !56, null}
|
2013-03-18 05:13:55 +08:00
|
|
|
!63 = metadata !{metadata !"foo.m", metadata !"/Users/echristo"}
|
2014-10-04 04:01:09 +08:00
|
|
|
!64 = metadata !{i32 1, metadata !"Debug Info Version", i32 2}
|
|
|
|
!65 = metadata !{metadata !"0x102\0034\0032"} ; [ DW_TAG_expression ] [DW_OP_plus 32]
|