2016-02-11 04:55:49 +08:00
; RUN: llc -mtriple=x86_64-windows-msvc < %s | FileCheck %s --check-prefix=ASM
; RUN: llc -mtriple=x86_64-windows-msvc < %s -filetype=obj | llvm-readobj -codeview - | FileCheck %s --check-prefix=OBJ
; This LL file was generated by running 'clang -g -gcodeview' on the
; following code:
; 1: extern "C" volatile int x;
; 2: extern "C" void capture(int *p);
; 3: static __forceinline inline void will_be_inlined() {
; 4: int v = 3;
; 5: capture(&v);
; 6: }
; 7: extern "C" void f(int param) {
; 8: if (param) {
; 9: int a = 42;
; 10: will_be_inlined();
; 11: capture(&a);
; 12: } else {
; 13: int b = 42;
; 14: will_be_inlined();
; 15: capture(&b);
; 16: }
; 17: }
; ASM: f: # @f
2016-09-08 00:15:31 +08:00
; ASM: .cv_func_id 0
2016-02-11 04:55:49 +08:00
; ASM: .cv_file 1 "D:\\src\\llvm\\build\\t.cpp"
2018-08-29 07:25:59 +08:00
; ASM: .cv_loc 0 1 7 0 # t.cpp:7:0
2016-02-11 04:55:49 +08:00
; ASM: .seh_proc f
2017-12-05 01:18:51 +08:00
; ASM: # %bb.0: # %entry
2016-02-11 04:55:49 +08:00
; ASM: subq $56, %rsp
2016-07-01 23:40:25 +08:00
; ASM: movl %ecx, 52(%rsp)
2016-02-11 04:55:49 +08:00
; ASM: [[prologue_end:\.Ltmp.*]]:
; ASM: .cv_loc 0 1 8 7 # t.cpp:8:7
; ASM: testl %ecx, %ecx
; ASM: je .LBB0_2
2017-12-05 01:18:51 +08:00
; ASM: # %bb.1: # %if.then
[DebugInfo] Don't turn dbg.declare into DBG_VALUE for static allocas
Summary:
We already have information about static alloca stack locations in our
side table. Emitting instructions for them is inefficient, and it only
happens when the address of the alloca has been materialized within the
current block, which isn't often.
Reviewers: aprantl, probinson, dblaikie
Subscribers: jfb, dschuff, sbc100, jgravelle-google, hiraditya, llvm-commits, aheejin
Differential Revision: https://reviews.llvm.org/D36117
llvm-svn: 309729
2017-08-02 03:45:09 +08:00
; ASM: [[if_start:\.Ltmp.*]]:
2016-02-11 04:55:49 +08:00
; ASM: .cv_loc 0 1 9 9 # t.cpp:9:9
; ASM: movl $42, 40(%rsp)
; ASM: [[inline_site1:\.Ltmp.*]]:
2016-09-08 00:15:31 +08:00
; ASM: .cv_inline_site_id 1 within 0 inlined_at 1 10 5
2016-02-11 04:55:49 +08:00
; ASM: .cv_loc 1 1 4 7 # t.cpp:4:7
2016-07-01 23:40:25 +08:00
; ASM: movl $3, 44(%rsp)
; ASM: leaq 44(%rsp), %rcx
2016-02-11 04:55:49 +08:00
; ASM: .cv_loc 1 1 5 3 # t.cpp:5:3
; ASM: callq capture
; ASM: leaq 40(%rsp), %rcx
; ASM: jmp .LBB0_3
; ASM: [[else_start:\.Ltmp.*]]:
; ASM: .LBB0_2: # %if.else
; ASM: .cv_loc 0 1 13 9 # t.cpp:13:9
; ASM: movl $42, 36(%rsp)
; ASM: [[inline_site2:\.Ltmp.*]]:
2016-09-08 00:15:31 +08:00
; ASM: .cv_inline_site_id 2 within 0 inlined_at 1 14 5
2016-02-11 04:55:49 +08:00
; ASM: .cv_loc 2 1 4 7 # t.cpp:4:7
2016-07-01 23:40:25 +08:00
; ASM: movl $3, 48(%rsp)
; ASM: leaq 48(%rsp), %rcx
2016-02-11 04:55:49 +08:00
; ASM: .cv_loc 2 1 5 3 # t.cpp:5:3
; ASM: callq capture
; ASM: leaq 36(%rsp), %rcx
2016-10-27 01:01:47 +08:00
; ASM: [[else_end:\.Ltmp.*]]:
2016-02-11 04:55:49 +08:00
; ASM: .LBB0_3: # %if.end
2018-08-24 06:35:58 +08:00
; ASM: .cv_loc 0 1 0 0 # t.cpp:0:0
2017-08-01 05:03:08 +08:00
; ASM: callq capture
2016-02-11 04:55:49 +08:00
; ASM: nop
; ASM: addq $56, %rsp
; ASM: retq
; ASM: [[param_end:\.Ltmp.*]]:
; ASM: .short 4414 # Record kind: S_LOCAL
; ASM: .long 116 # TypeIndex
; ASM: .short 1 # Flags
; ASM: .asciz "param"
[codeview] Emit S_FRAMEPROC and use S_DEFRANGE_FRAMEPOINTER_REL
Summary:
Before this change, LLVM would always describe locals on the stack as
being relative to some specific register, RSP, ESP, EBP, ESI, etc.
Variables in stack memory are pretty common, so there is a special
S_DEFRANGE_FRAMEPOINTER_REL symbol for them. This change uses it to
reduce the size of our debug info.
On top of the size savings, there are cases on 32-bit x86 where local
variables are addressed from ESP, but ESP changes across the function.
Unlike in DWARF, there is no FPO data to describe the stack adjustments
made to push arguments onto the stack and pop them off after the call,
which makes it hard for the debugger to find the local variables in
frames further up the stack.
To handle this, CodeView has a special VFRAME register, which
corresponds to the $T0 variable set by our FPO data in 32-bit. Offsets
to local variables are instead relative to this value.
This is part of PR38857.
Reviewers: hans, zturner, javed.absar
Subscribers: aprantl, hiraditya, JDevlieghere, llvm-commits
Differential Revision: https://reviews.llvm.org/D52217
llvm-svn: 343543
2018-10-02 05:59:45 +08:00
; ASM: .cv_def_range [[prologue_end]] [[param_end]], "B\0214\000\000\000"
2016-02-11 04:55:49 +08:00
; ASM: .short 4414 # Record kind: S_LOCAL
; ASM: .long 116 # TypeIndex
; ASM: .short 0 # Flags
; ASM: .asciz "a"
[codeview] Emit S_FRAMEPROC and use S_DEFRANGE_FRAMEPOINTER_REL
Summary:
Before this change, LLVM would always describe locals on the stack as
being relative to some specific register, RSP, ESP, EBP, ESI, etc.
Variables in stack memory are pretty common, so there is a special
S_DEFRANGE_FRAMEPOINTER_REL symbol for them. This change uses it to
reduce the size of our debug info.
On top of the size savings, there are cases on 32-bit x86 where local
variables are addressed from ESP, but ESP changes across the function.
Unlike in DWARF, there is no FPO data to describe the stack adjustments
made to push arguments onto the stack and pop them off after the call,
which makes it hard for the debugger to find the local variables in
frames further up the stack.
To handle this, CodeView has a special VFRAME register, which
corresponds to the $T0 variable set by our FPO data in 32-bit. Offsets
to local variables are instead relative to this value.
This is part of PR38857.
Reviewers: hans, zturner, javed.absar
Subscribers: aprantl, hiraditya, JDevlieghere, llvm-commits
Differential Revision: https://reviews.llvm.org/D52217
llvm-svn: 343543
2018-10-02 05:59:45 +08:00
; ASM: .cv_def_range [[if_start]] [[else_start]], "B\021(\000\000\000"
2016-02-11 04:55:49 +08:00
; ASM: .short 4414 # Record kind: S_LOCAL
; ASM: .long 116 # TypeIndex
; ASM: .short 0 # Flags
; ASM: .asciz "b"
[codeview] Emit S_FRAMEPROC and use S_DEFRANGE_FRAMEPOINTER_REL
Summary:
Before this change, LLVM would always describe locals on the stack as
being relative to some specific register, RSP, ESP, EBP, ESI, etc.
Variables in stack memory are pretty common, so there is a special
S_DEFRANGE_FRAMEPOINTER_REL symbol for them. This change uses it to
reduce the size of our debug info.
On top of the size savings, there are cases on 32-bit x86 where local
variables are addressed from ESP, but ESP changes across the function.
Unlike in DWARF, there is no FPO data to describe the stack adjustments
made to push arguments onto the stack and pop them off after the call,
which makes it hard for the debugger to find the local variables in
frames further up the stack.
To handle this, CodeView has a special VFRAME register, which
corresponds to the $T0 variable set by our FPO data in 32-bit. Offsets
to local variables are instead relative to this value.
This is part of PR38857.
Reviewers: hans, zturner, javed.absar
Subscribers: aprantl, hiraditya, JDevlieghere, llvm-commits
Differential Revision: https://reviews.llvm.org/D52217
llvm-svn: 343543
2018-10-02 05:59:45 +08:00
; ASM: .cv_def_range [[else_start]] [[else_end]], "B\021$\000\000\000"
2016-02-11 04:55:49 +08:00
; ASM: .short 4429 # Record kind: S_INLINESITE
; ASM: .short 4414 # Record kind: S_LOCAL
; ASM: .long 116 # TypeIndex
; ASM: .short 0 # Flags
; ASM: .asciz "v"
[codeview] Emit S_FRAMEPROC and use S_DEFRANGE_FRAMEPOINTER_REL
Summary:
Before this change, LLVM would always describe locals on the stack as
being relative to some specific register, RSP, ESP, EBP, ESI, etc.
Variables in stack memory are pretty common, so there is a special
S_DEFRANGE_FRAMEPOINTER_REL symbol for them. This change uses it to
reduce the size of our debug info.
On top of the size savings, there are cases on 32-bit x86 where local
variables are addressed from ESP, but ESP changes across the function.
Unlike in DWARF, there is no FPO data to describe the stack adjustments
made to push arguments onto the stack and pop them off after the call,
which makes it hard for the debugger to find the local variables in
frames further up the stack.
To handle this, CodeView has a special VFRAME register, which
corresponds to the $T0 variable set by our FPO data in 32-bit. Offsets
to local variables are instead relative to this value.
This is part of PR38857.
Reviewers: hans, zturner, javed.absar
Subscribers: aprantl, hiraditya, JDevlieghere, llvm-commits
Differential Revision: https://reviews.llvm.org/D52217
llvm-svn: 343543
2018-10-02 05:59:45 +08:00
; ASM: .cv_def_range [[inline_site1]] [[else_start]], "B\021,\000\000\000"
2016-02-11 04:55:49 +08:00
; ASM: .short 4430 # Record kind: S_INLINESITE_END
; ASM: .short 4429 # Record kind: S_INLINESITE
; ASM: .short 4414 # Record kind: S_LOCAL
; ASM: .long 116 # TypeIndex
; ASM: .short 0 # Flags
; ASM: .asciz "v"
[codeview] Emit S_FRAMEPROC and use S_DEFRANGE_FRAMEPOINTER_REL
Summary:
Before this change, LLVM would always describe locals on the stack as
being relative to some specific register, RSP, ESP, EBP, ESI, etc.
Variables in stack memory are pretty common, so there is a special
S_DEFRANGE_FRAMEPOINTER_REL symbol for them. This change uses it to
reduce the size of our debug info.
On top of the size savings, there are cases on 32-bit x86 where local
variables are addressed from ESP, but ESP changes across the function.
Unlike in DWARF, there is no FPO data to describe the stack adjustments
made to push arguments onto the stack and pop them off after the call,
which makes it hard for the debugger to find the local variables in
frames further up the stack.
To handle this, CodeView has a special VFRAME register, which
corresponds to the $T0 variable set by our FPO data in 32-bit. Offsets
to local variables are instead relative to this value.
This is part of PR38857.
Reviewers: hans, zturner, javed.absar
Subscribers: aprantl, hiraditya, JDevlieghere, llvm-commits
Differential Revision: https://reviews.llvm.org/D52217
llvm-svn: 343543
2018-10-02 05:59:45 +08:00
; ASM: .cv_def_range [[inline_site2]] [[else_end]], "B\0210\000\000\000"
2016-02-11 04:55:49 +08:00
; ASM: .short 4430 # Record kind: S_INLINESITE_END
; OBJ: Subsection [
; OBJ: SubSectionType: Symbols (0xF1)
2017-07-12 07:41:41 +08:00
; OBJ: {{.*}}Proc{{.*}}Sym {
2016-02-11 04:55:49 +08:00
; OBJ: DisplayName: f
; OBJ: LinkageName: f
; OBJ: }
2017-07-12 07:41:41 +08:00
; OBJ: LocalSym {
2016-02-11 04:55:49 +08:00
; OBJ: Type: int (0x74)
; OBJ: Flags [ (0x1)
; OBJ: IsParameter (0x1)
; OBJ: ]
; OBJ: VarName: param
; OBJ: }
[codeview] Emit S_FRAMEPROC and use S_DEFRANGE_FRAMEPOINTER_REL
Summary:
Before this change, LLVM would always describe locals on the stack as
being relative to some specific register, RSP, ESP, EBP, ESI, etc.
Variables in stack memory are pretty common, so there is a special
S_DEFRANGE_FRAMEPOINTER_REL symbol for them. This change uses it to
reduce the size of our debug info.
On top of the size savings, there are cases on 32-bit x86 where local
variables are addressed from ESP, but ESP changes across the function.
Unlike in DWARF, there is no FPO data to describe the stack adjustments
made to push arguments onto the stack and pop them off after the call,
which makes it hard for the debugger to find the local variables in
frames further up the stack.
To handle this, CodeView has a special VFRAME register, which
corresponds to the $T0 variable set by our FPO data in 32-bit. Offsets
to local variables are instead relative to this value.
This is part of PR38857.
Reviewers: hans, zturner, javed.absar
Subscribers: aprantl, hiraditya, JDevlieghere, llvm-commits
Differential Revision: https://reviews.llvm.org/D52217
llvm-svn: 343543
2018-10-02 05:59:45 +08:00
; OBJ: DefRangeFramePointerRelSym {
; OBJ: Offset: 52
2016-02-11 04:55:49 +08:00
; OBJ: LocalVariableAddrRange {
; OBJ: OffsetStart: .text+0x8
; OBJ: ISectStart: 0x0
2016-02-12 07:40:14 +08:00
; OBJ: Range: 0x4F
2016-02-11 04:55:49 +08:00
; OBJ: }
; OBJ: }
2017-07-12 07:41:41 +08:00
; OBJ: LocalSym {
2016-02-11 04:55:49 +08:00
; OBJ: Type: int (0x74)
; OBJ: Flags [ (0x0)
; OBJ: ]
; OBJ: VarName: a
; OBJ: }
[codeview] Emit S_FRAMEPROC and use S_DEFRANGE_FRAMEPOINTER_REL
Summary:
Before this change, LLVM would always describe locals on the stack as
being relative to some specific register, RSP, ESP, EBP, ESI, etc.
Variables in stack memory are pretty common, so there is a special
S_DEFRANGE_FRAMEPOINTER_REL symbol for them. This change uses it to
reduce the size of our debug info.
On top of the size savings, there are cases on 32-bit x86 where local
variables are addressed from ESP, but ESP changes across the function.
Unlike in DWARF, there is no FPO data to describe the stack adjustments
made to push arguments onto the stack and pop them off after the call,
which makes it hard for the debugger to find the local variables in
frames further up the stack.
To handle this, CodeView has a special VFRAME register, which
corresponds to the $T0 variable set by our FPO data in 32-bit. Offsets
to local variables are instead relative to this value.
This is part of PR38857.
Reviewers: hans, zturner, javed.absar
Subscribers: aprantl, hiraditya, JDevlieghere, llvm-commits
Differential Revision: https://reviews.llvm.org/D52217
llvm-svn: 343543
2018-10-02 05:59:45 +08:00
; OBJ: DefRangeFramePointerRelSym {
; OBJ: Offset: 40
2016-02-11 04:55:49 +08:00
; OBJ: LocalVariableAddrRange {
; OBJ: OffsetStart: .text+0xC
; OBJ: ISectStart: 0x0
2016-02-12 07:40:14 +08:00
; OBJ: Range: 0x21
2016-02-11 04:55:49 +08:00
; OBJ: }
; OBJ: }
2017-07-12 07:41:41 +08:00
; OBJ: LocalSym {
2016-02-11 04:55:49 +08:00
; OBJ: Type: int (0x74)
; OBJ: Flags [ (0x0)
; OBJ: ]
; OBJ: VarName: b
; OBJ: }
[codeview] Emit S_FRAMEPROC and use S_DEFRANGE_FRAMEPOINTER_REL
Summary:
Before this change, LLVM would always describe locals on the stack as
being relative to some specific register, RSP, ESP, EBP, ESI, etc.
Variables in stack memory are pretty common, so there is a special
S_DEFRANGE_FRAMEPOINTER_REL symbol for them. This change uses it to
reduce the size of our debug info.
On top of the size savings, there are cases on 32-bit x86 where local
variables are addressed from ESP, but ESP changes across the function.
Unlike in DWARF, there is no FPO data to describe the stack adjustments
made to push arguments onto the stack and pop them off after the call,
which makes it hard for the debugger to find the local variables in
frames further up the stack.
To handle this, CodeView has a special VFRAME register, which
corresponds to the $T0 variable set by our FPO data in 32-bit. Offsets
to local variables are instead relative to this value.
This is part of PR38857.
Reviewers: hans, zturner, javed.absar
Subscribers: aprantl, hiraditya, JDevlieghere, llvm-commits
Differential Revision: https://reviews.llvm.org/D52217
llvm-svn: 343543
2018-10-02 05:59:45 +08:00
; OBJ: DefRangeFramePointerRelSym {
; OBJ: Offset: 36
2016-02-11 04:55:49 +08:00
; OBJ: LocalVariableAddrRange {
; OBJ: OffsetStart: .text+0x2D
; OBJ: ISectStart: 0x0
2016-10-27 01:01:47 +08:00
; OBJ: Range: 0x1F
2016-02-11 04:55:49 +08:00
; OBJ: }
; OBJ: }
2017-07-12 07:41:41 +08:00
; OBJ: InlineSiteSym {
2016-02-11 04:55:49 +08:00
; OBJ: PtrParent: 0x0
; OBJ: PtrEnd: 0x0
2016-03-19 02:54:32 +08:00
; OBJ: Inlinee: will_be_inlined (0x1002)
2016-02-11 04:55:49 +08:00
; OBJ: BinaryAnnotations [
; OBJ: ChangeLineOffset: 1
; OBJ: ChangeCodeOffset: 0x14
; OBJ: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0xD, LineOffset: 1}
; OBJ: ChangeCodeLength: 0xC
; OBJ: ]
; OBJ: }
2017-07-12 07:41:41 +08:00
; OBJ: LocalSym {
2016-02-11 04:55:49 +08:00
; OBJ: Type: int (0x74)
; OBJ: Flags [ (0x0)
; OBJ: ]
; OBJ: VarName: v
; OBJ: }
[codeview] Emit S_FRAMEPROC and use S_DEFRANGE_FRAMEPOINTER_REL
Summary:
Before this change, LLVM would always describe locals on the stack as
being relative to some specific register, RSP, ESP, EBP, ESI, etc.
Variables in stack memory are pretty common, so there is a special
S_DEFRANGE_FRAMEPOINTER_REL symbol for them. This change uses it to
reduce the size of our debug info.
On top of the size savings, there are cases on 32-bit x86 where local
variables are addressed from ESP, but ESP changes across the function.
Unlike in DWARF, there is no FPO data to describe the stack adjustments
made to push arguments onto the stack and pop them off after the call,
which makes it hard for the debugger to find the local variables in
frames further up the stack.
To handle this, CodeView has a special VFRAME register, which
corresponds to the $T0 variable set by our FPO data in 32-bit. Offsets
to local variables are instead relative to this value.
This is part of PR38857.
Reviewers: hans, zturner, javed.absar
Subscribers: aprantl, hiraditya, JDevlieghere, llvm-commits
Differential Revision: https://reviews.llvm.org/D52217
llvm-svn: 343543
2018-10-02 05:59:45 +08:00
; OBJ: DefRangeFramePointerRelSym {
; OBJ: Offset: 44
2016-02-11 04:55:49 +08:00
; OBJ: LocalVariableAddrRange {
; OBJ: OffsetStart: .text+0x14
; OBJ: ISectStart: 0x0
2016-02-12 07:40:14 +08:00
; OBJ: Range: 0x19
2016-02-11 04:55:49 +08:00
; OBJ: }
; OBJ: }
; OBJ: InlineSiteEnd {
; OBJ: }
2017-07-12 07:41:41 +08:00
; OBJ: InlineSiteSym {
2016-02-11 04:55:49 +08:00
; OBJ: PtrParent: 0x0
; OBJ: PtrEnd: 0x0
2016-03-19 02:54:32 +08:00
; OBJ: Inlinee: will_be_inlined (0x1002)
2016-02-11 04:55:49 +08:00
; OBJ: BinaryAnnotations [
; OBJ: ChangeLineOffset: 1
; OBJ: ChangeCodeOffset: 0x35
; OBJ: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0xD, LineOffset: 1}
2017-07-01 05:33:44 +08:00
; OBJ: ChangeCodeLength: 0xA
2016-02-11 04:55:49 +08:00
; OBJ: ]
; OBJ: }
2017-07-12 07:41:41 +08:00
; OBJ: LocalSym {
2016-02-11 04:55:49 +08:00
; OBJ: Type: int (0x74)
; OBJ: Flags [ (0x0)
; OBJ: ]
; OBJ: VarName: v
; OBJ: }
[codeview] Emit S_FRAMEPROC and use S_DEFRANGE_FRAMEPOINTER_REL
Summary:
Before this change, LLVM would always describe locals on the stack as
being relative to some specific register, RSP, ESP, EBP, ESI, etc.
Variables in stack memory are pretty common, so there is a special
S_DEFRANGE_FRAMEPOINTER_REL symbol for them. This change uses it to
reduce the size of our debug info.
On top of the size savings, there are cases on 32-bit x86 where local
variables are addressed from ESP, but ESP changes across the function.
Unlike in DWARF, there is no FPO data to describe the stack adjustments
made to push arguments onto the stack and pop them off after the call,
which makes it hard for the debugger to find the local variables in
frames further up the stack.
To handle this, CodeView has a special VFRAME register, which
corresponds to the $T0 variable set by our FPO data in 32-bit. Offsets
to local variables are instead relative to this value.
This is part of PR38857.
Reviewers: hans, zturner, javed.absar
Subscribers: aprantl, hiraditya, JDevlieghere, llvm-commits
Differential Revision: https://reviews.llvm.org/D52217
llvm-svn: 343543
2018-10-02 05:59:45 +08:00
; OBJ: DefRangeFramePointerRelSym {
; OBJ: Offset: 48
2016-02-11 04:55:49 +08:00
; OBJ: LocalVariableAddrRange {
; OBJ: OffsetStart: .text+0x35
; OBJ: ISectStart: 0x0
2016-02-12 07:40:14 +08:00
; OBJ: Range: 0x17
2016-02-11 04:55:49 +08:00
; OBJ: }
; OBJ: }
; OBJ: InlineSiteEnd {
; OBJ: }
; OBJ: ProcEnd
; OBJ: ]
; ModuleID = 't.cpp'
target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-pc-windows-msvc18.0.0"
; Function Attrs: nounwind uwtable
define void @f ( i32 %param ) #0 !dbg !4 {
entry:
%v.i1 = alloca i32 , align 4
call void @llvm.dbg.declare ( metadata i32 * %v.i1 , metadata !15 , metadata !16 ) , !dbg !17
%v.i = alloca i32 , align 4
call void @llvm.dbg.declare ( metadata i32 * %v.i , metadata !15 , metadata !16 ) , !dbg !21
%param.addr = alloca i32 , align 4
%a = alloca i32 , align 4
%b = alloca i32 , align 4
store i32 %param , i32 * %param.addr , align 4
call void @llvm.dbg.declare ( metadata i32 * %param.addr , metadata !24 , metadata !16 ) , !dbg !25
%0 = load i32 , i32 * %param.addr , align 4 , !dbg !26
%tobool = icmp ne i32 %0 , 0 , !dbg !26
br i1 %tobool , label %if.then , label %if.else , !dbg !27
if.then: ; preds = %entry
call void @llvm.dbg.declare ( metadata i32 * %a , metadata !28 , metadata !16 ) , !dbg !29
store i32 42 , i32 * %a , align 4 , !dbg !29
store i32 3 , i32 * %v.i , align 4 , !dbg !21
call void @capture ( i32 * %v.i ) #3 , !dbg !30
call void @capture ( i32 * %a ) , !dbg !31
br label %if.end , !dbg !32
if.else: ; preds = %entry
call void @llvm.dbg.declare ( metadata i32 * %b , metadata !33 , metadata !16 ) , !dbg !34
store i32 42 , i32 * %b , align 4 , !dbg !34
store i32 3 , i32 * %v.i1 , align 4 , !dbg !17
call void @capture ( i32 * %v.i1 ) #3 , !dbg !35
call void @capture ( i32 * %b ) , !dbg !36
br label %if.end
if.end: ; preds = %if.else, %if.then
ret void , !dbg !37
}
; Function Attrs: nounwind readnone
declare void @llvm.dbg.declare ( metadata , metadata , metadata ) #1
declare void @capture ( i32 * ) #2
attributes #0 = { nounwind uwtable "disable-tail-calls" = "false" "less-precise-fpmad" = "false" "no-frame-pointer-elim" = "false" "no-infs-fp-math" = "false" "no-nans-fp-math" = "false" "stack-protector-buffer-size" = "8" "target-cpu" = "x86-64" "target-features" = "+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math" = "false" "use-soft-float" = "false" }
attributes #1 = { nounwind readnone }
attributes #2 = { "disable-tail-calls" = "false" "less-precise-fpmad" = "false" "no-frame-pointer-elim" = "false" "no-infs-fp-math" = "false" "no-nans-fp-math" = "false" "stack-protector-buffer-size" = "8" "target-cpu" = "x86-64" "target-features" = "+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math" = "false" "use-soft-float" = "false" }
attributes #3 = { nounwind }
!llvm.dbg.cu = ! { !0 }
!llvm.module.flags = ! { !11 , !12 , !13 }
!llvm.ident = ! { !14 }
2016-04-15 23:57:41 +08:00
!0 = distinct !DICompileUnit ( language: D W _ L A N G _ C _ p l u s _ p l u s , file: !1 , producer: "clang version 3.9.0 " , isOptimized: false , runtimeVersion: 0 , emissionKind: F u l l D e b u g , enums: !2 )
2016-02-11 04:55:49 +08:00
!1 = !DIFile ( filename: "t.cpp" , directory: "D:\5Csrc\5Cllvm\5Cbuild" )
!2 = ! { }
[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is
!DILabel(scope: !1, name: "foo", file: !2, line: 3)
We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is
llvm.dbg.label(metadata !1)
It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.
We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.
Differential Revision: https://reviews.llvm.org/D45024
Patch by Hsiangkai Wang.
llvm-svn: 331841
2018-05-09 10:40:45 +08:00
!4 = distinct !DISubprogram ( name: "f" , scope: !1 , file: !1 , line: 7 , type: !5 , isLocal: false , isDefinition: true , scopeLine: 7 , flags: D I F l a g P r o t o t y p e d , isOptimized: false , unit: !0 , retainedNodes: !2 )
2016-02-11 04:55:49 +08:00
!5 = !DISubroutineType ( types: !6 )
!6 = ! { null , !7 }
!7 = !DIBasicType ( name: "int" , size: 32 , align: 32 , encoding: D W _ A T E _ s i g n e d )
[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is
!DILabel(scope: !1, name: "foo", file: !2, line: 3)
We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is
llvm.dbg.label(metadata !1)
It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.
We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.
Differential Revision: https://reviews.llvm.org/D45024
Patch by Hsiangkai Wang.
llvm-svn: 331841
2018-05-09 10:40:45 +08:00
!8 = distinct !DISubprogram ( name: "will_be_inlined" , linkageName: "\01?will_be_inlined@@YAXXZ" , scope: !1 , file: !1 , line: 3 , type: !9 , isLocal: true , isDefinition: true , scopeLine: 3 , flags: D I F l a g P r o t o t y p e d , isOptimized: false , unit: !0 , retainedNodes: !2 )
2016-02-11 04:55:49 +08:00
!9 = !DISubroutineType ( types: !10 )
!10 = ! { null }
!11 = ! { i32 2 , !"CodeView" , i32 1 }
!12 = ! { i32 2 , !"Debug Info Version" , i32 3 }
!13 = ! { i32 1 , !"PIC Level" , i32 2 }
!14 = ! { !"clang version 3.9.0 " }
!15 = !DILocalVariable ( name: "v" , scope: !8 , file: !1 , line: 4 , type: !7 )
!16 = !DIExpression ( )
!17 = !DILocation ( line: 4 , column: 7 , scope: !8 , inlinedAt: !18 )
!18 = distinct !DILocation ( line: 14 , column: 5 , scope: !19 )
!19 = distinct !DILexicalBlock ( scope: !20 , file: !1 , line: 12 , column: 10 )
!20 = distinct !DILexicalBlock ( scope: !4 , file: !1 , line: 8 , column: 7 )
!21 = !DILocation ( line: 4 , column: 7 , scope: !8 , inlinedAt: !22 )
!22 = distinct !DILocation ( line: 10 , column: 5 , scope: !23 )
!23 = distinct !DILexicalBlock ( scope: !20 , file: !1 , line: 8 , column: 14 )
!24 = !DILocalVariable ( name: "param" , arg: 1 , scope: !4 , file: !1 , line: 7 , type: !7 )
!25 = !DILocation ( line: 7 , column: 23 , scope: !4 )
!26 = !DILocation ( line: 8 , column: 7 , scope: !20 )
!27 = !DILocation ( line: 8 , column: 7 , scope: !4 )
!28 = !DILocalVariable ( name: "a" , scope: !23 , file: !1 , line: 9 , type: !7 )
!29 = !DILocation ( line: 9 , column: 9 , scope: !23 )
!30 = !DILocation ( line: 5 , column: 3 , scope: !8 , inlinedAt: !22 )
!31 = !DILocation ( line: 11 , column: 5 , scope: !23 )
!32 = !DILocation ( line: 12 , column: 3 , scope: !23 )
!33 = !DILocalVariable ( name: "b" , scope: !19 , file: !1 , line: 13 , type: !7 )
!34 = !DILocation ( line: 13 , column: 9 , scope: !19 )
!35 = !DILocation ( line: 5 , column: 3 , scope: !8 , inlinedAt: !18 )
!36 = !DILocation ( line: 15 , column: 5 , scope: !19 )
!37 = !DILocation ( line: 17 , column: 1 , scope: !4 )