2013-09-17 01:29:03 +02:00
|
|
|
; RUN: llc -filetype=asm < %s | FileCheck %s
|
2017-07-31 22:48:52 +02:00
|
|
|
; RUN: llc -filetype=obj < %s \
|
2017-09-12 00:59:45 +02:00
|
|
|
; RUN: | llvm-dwarfdump -debug-info - | FileCheck %s --check-prefix=DWARF
|
2017-07-31 22:48:52 +02:00
|
|
|
;
|
2017-08-01 23:45:24 +02:00
|
|
|
; CHECK: @DEBUG_VALUE: h:x <- [DW_OP_plus_uconst {{.*}}] [%R{{.*}}+0]
|
[dwarfdump] Pretty print location expressions and location lists
Summary:
Based on Fred's patch here: https://reviews.llvm.org/D6771
I can't seem to commandeer the old review, so I'm creating a new one.
With that change the locations exrpessions are pretty printed inline in the
DIE tree. The output looks like this for debug_loc entries:
DW_AT_location [DW_FORM_data4] (0x00000000
0x0000000000000001 - 0x000000000000000b: DW_OP_consts +3
0x000000000000000b - 0x0000000000000012: DW_OP_consts +7
0x0000000000000012 - 0x000000000000001b: DW_OP_reg0 RAX, DW_OP_piece 0x4
0x000000000000001b - 0x0000000000000024: DW_OP_breg5 RDI+0)
And like this for debug_loc.dwo entries:
DW_AT_location [DW_FORM_sec_offset] (0x00000000
Addr idx 2 (w/ length 190): DW_OP_consts +0, DW_OP_stack_value
Addr idx 3 (w/ length 23): DW_OP_reg0 RAX, DW_OP_piece 0x4)
Simple locations without ranges are printed inline:
DW_AT_location [DW_FORM_block1] (DW_OP_reg4 RSI, DW_OP_piece 0x4, DW_OP_bit_piece 0x20 0x0)
The debug_loc(.dwo) dumping in changed accordingly to factor the code.
Reviewers: dblaikie, aprantl, friss
Subscribers: mgorny, javed.absar, hiraditya, llvm-commits, JDevlieghere
Differential Revision: https://reviews.llvm.org/D37123
llvm-svn: 312042
2017-08-29 23:41:21 +02:00
|
|
|
; DWARF: DW_TAG_formal_parameter
|
|
|
|
; DWARF: DW_AT_location
|
|
|
|
; DWARF-NEXT: DW_OP_reg0 R0
|
|
|
|
; DWARF: DW_TAG_formal_parameter
|
|
|
|
; DWARF: DW_AT_location
|
|
|
|
; DWARF-NEXT: DW_OP_reg1 R1
|
|
|
|
; DWARF: DW_TAG_formal_parameter
|
|
|
|
; DWARF: DW_AT_location
|
|
|
|
; DWARF-NEXT: DW_OP_reg2 R2
|
|
|
|
; DWARF: DW_TAG_formal_parameter
|
|
|
|
; DWARF: DW_AT_location
|
|
|
|
; DWARF-NEXT: DW_OP_reg3 R3
|
|
|
|
; DWARF: DW_TAG_formal_parameter
|
|
|
|
; DWARF: DW_AT_location
|
|
|
|
; DWARF-NEXT: DW_OP_breg7 R7+8
|
2013-09-17 01:29:03 +02:00
|
|
|
; generated from:
|
2013-09-17 02:15:36 +02:00
|
|
|
; clang -cc1 -triple thumbv7 -S -O1 arm.cpp -g
|
2013-09-17 01:29:03 +02:00
|
|
|
;
|
|
|
|
; int f();
|
|
|
|
; void g(float);
|
|
|
|
; void h(int, int, int, int, float x) {
|
|
|
|
; g(x = f());
|
|
|
|
; }
|
|
|
|
;
|
|
|
|
target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:64:128-a0:0:32-n32-S64"
|
|
|
|
target triple = "thumbv7-apple-ios"
|
|
|
|
|
|
|
|
; Function Attrs: nounwind
|
[ARM] Generate consistent frame records for Thumb2
There is not an official documented ABI for frame pointers in Thumb2,
but we should try to emit something which is useful.
We use r7 as the frame pointer for Thumb code, which currently means
that if a function needs to save a high register (r8-r11), it will get
pushed to the stack between the frame pointer (r7) and link register
(r14). This means that while a stack unwinder can follow the chain of
frame pointers up the stack, it cannot know the offset to lr, so does
not know which functions correspond to the stack frames.
To fix this, we need to push the callee-saved registers in two batches,
with the first push saving the low registers, fp and lr, and the second
push saving the high registers. This is already implemented, but
previously only used for iOS. This patch turns it on for all Thumb2
targets when frame pointers are required by the ABI, and the frame
pointer is r7 (Windows uses r11, so this isn't a problem there). If
frame pointer elimination is enabled we still emit a single push/pop
even if we need a frame pointer for other reasons, to avoid increasing
code size.
We must also ensure that lr is pushed to the stack when using a frame
pointer, so that we end up with a complete frame record. Situations that
could cause this were rare, because we already push lr in most
situations so that we can return using the pop instruction.
Differential Revision: https://reviews.llvm.org/D23516
llvm-svn: 279506
2016-08-23 11:19:22 +02:00
|
|
|
define arm_aapcscc void @_Z1hiiiif(i32, i32, i32, i32, float %x) #0 "no-frame-pointer-elim"="true" !dbg !4 {
|
2013-09-17 01:29:03 +02:00
|
|
|
entry:
|
2017-07-28 22:21:02 +02:00
|
|
|
tail call void @llvm.dbg.value(metadata i32 %0, metadata !12, metadata !DIExpression()), !dbg !18
|
|
|
|
tail call void @llvm.dbg.value(metadata i32 %1, metadata !13, metadata !DIExpression()), !dbg !18
|
|
|
|
tail call void @llvm.dbg.value(metadata i32 %2, metadata !14, metadata !DIExpression()), !dbg !18
|
|
|
|
tail call void @llvm.dbg.value(metadata i32 %3, metadata !15, metadata !DIExpression()), !dbg !18
|
|
|
|
tail call void @llvm.dbg.value(metadata float %x, metadata !16, metadata !DIExpression()), !dbg !18
|
2013-09-17 01:29:03 +02:00
|
|
|
%call = tail call arm_aapcscc i32 @_Z1fv() #3, !dbg !19
|
|
|
|
%conv = sitofp i32 %call to float, !dbg !19
|
2017-07-28 22:21:02 +02:00
|
|
|
tail call void @llvm.dbg.value(metadata float %conv, metadata !16, metadata !DIExpression()), !dbg !19
|
2013-09-17 01:29:03 +02:00
|
|
|
tail call arm_aapcscc void @_Z1gf(float %conv) #3, !dbg !19
|
|
|
|
ret void, !dbg !20
|
|
|
|
}
|
|
|
|
|
|
|
|
declare arm_aapcscc void @_Z1gf(float)
|
|
|
|
|
|
|
|
declare arm_aapcscc i32 @_Z1fv()
|
|
|
|
|
|
|
|
; Function Attrs: nounwind readnone
|
2017-07-28 22:21:02 +02:00
|
|
|
declare void @llvm.dbg.value(metadata, metadata, metadata) #2
|
2013-09-17 01:29:03 +02:00
|
|
|
|
|
|
|
attributes #0 = { nounwind }
|
|
|
|
attributes #2 = { nounwind readnone }
|
|
|
|
attributes #3 = { nounwind }
|
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!0}
|
2013-11-22 22:49:45 +01:00
|
|
|
!llvm.module.flags = !{!17, !21}
|
2013-09-17 01:29:03 +02:00
|
|
|
|
2016-04-15 17:57:41 +02:00
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 (trunk 190804) (llvm/trunk 190797)", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
|
2015-04-29 18:38:44 +02:00
|
|
|
!1 = !DIFile(filename: "/<unknown>", directory: "")
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-15 20:07:53 +01:00
|
|
|
!2 = !{}
|
2016-04-15 17:57:41 +02:00
|
|
|
!4 = distinct !DISubprogram(name: "h", linkageName: "_Z1hiiiif", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 3, file: !5, scope: !6, type: !7, variables: !11)
|
2015-04-29 18:38:44 +02:00
|
|
|
!5 = !DIFile(filename: "/arm.cpp", directory: "")
|
|
|
|
!6 = !DIFile(filename: "/arm.cpp", directory: "")
|
|
|
|
!7 = !DISubroutineType(types: !8)
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-15 20:07:53 +01:00
|
|
|
!8 = !{null, !9, !9, !9, !9, !10}
|
2015-04-29 18:38:44 +02:00
|
|
|
!9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
|
|
|
!10 = !DIBasicType(tag: DW_TAG_base_type, name: "float", size: 32, align: 32, encoding: DW_ATE_float)
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-15 20:07:53 +01:00
|
|
|
!11 = !{!12, !13, !14, !15, !16}
|
2015-07-31 20:58:39 +02:00
|
|
|
!12 = !DILocalVariable(name: "", line: 3, arg: 1, scope: !4, file: !6, type: !9)
|
|
|
|
!13 = !DILocalVariable(name: "", line: 3, arg: 2, scope: !4, file: !6, type: !9)
|
|
|
|
!14 = !DILocalVariable(name: "", line: 3, arg: 3, scope: !4, file: !6, type: !9)
|
|
|
|
!15 = !DILocalVariable(name: "", line: 3, arg: 4, scope: !4, file: !6, type: !9)
|
|
|
|
!16 = !DILocalVariable(name: "x", line: 3, arg: 5, scope: !4, file: !6, type: !10)
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-15 20:07:53 +01:00
|
|
|
!17 = !{i32 2, !"Dwarf Version", i32 4}
|
2015-04-29 18:38:44 +02:00
|
|
|
!18 = !DILocation(line: 3, scope: !4)
|
|
|
|
!19 = !DILocation(line: 4, scope: !4)
|
|
|
|
!20 = !DILocation(line: 5, scope: !4)
|
2015-03-03 18:24:31 +01:00
|
|
|
!21 = !{i32 1, !"Debug Info Version", i32 3}
|