xref: /llvm-project/llvm/test/MC/COFF/cv-def-range-align.s (revision da60fc813c225209cadbd137ce17b05e993acd8e)
1# RUN: llvm-mc -triple x86_64-windows-msvc %s -filetype=obj -o %t.o
2# RUN: llvm-pdbutil dump -symbols %t.o | FileCheck %s
3
4# We used to have a label flushing bug down below by the "BUG" comments that
5# would cause the S_DEFRANGE_FRAMEPOINTER_REL records to appear missing. In
6# practice, the label would extend past the def range, so it would appear that
7# every local was optimized out or had no def ranges.
8
9# CHECK: S_GPROC32_ID {{.*}} `max`
10# CHECK: S_LOCAL [size = {{.*}}] `a`
11# CHECK: S_DEFRANGE_FRAMEPOINTER_REL
12# CHECK: S_LOCAL [size = {{.*}}] `b`
13# CHECK: S_DEFRANGE_FRAMEPOINTER_REL
14
15	.text
16	.def	 @feat.00;
17	.scl	3;
18	.type	0;
19	.endef
20	.globl	@feat.00
21.set @feat.00, 0
22	.def	 max;
23	.scl	2;
24	.type	32;
25	.endef
26	.globl	max                     # -- Begin function max
27	.p2align	4, 0x90
28max:                                    # @max
29.Lfunc_begin0:
30	.cv_func_id 0
31	.cv_file	1 "C:\\src\\llvm-project\\build\\t.c" "44649E6EBC4FC8880991A1AF1F2D2990" 1
32	.cv_loc	0 1 1 0                 # t.c:1:0
33.seh_proc max
34# %bb.0:                                # %entry
35	pushq	%rax
36	.seh_stackalloc 8
37	.seh_endprologue
38	movl	%edx, 4(%rsp)
39	movl	%ecx, (%rsp)
40.Ltmp0:
41	.cv_loc	0 1 2 0                 # t.c:2:0
42	movl	(%rsp), %eax
43	cmpl	4(%rsp), %eax
44	jle	.LBB0_2
45# %bb.1:                                # %cond.true
46	movl	(%rsp), %eax
47	jmp	.LBB0_3
48.LBB0_2:                                # %cond.false
49	movl	4(%rsp), %eax
50.LBB0_3:                                # %cond.end
51	popq	%rcx
52	retq
53.Ltmp1:
54.Lfunc_end0:
55	.seh_handlerdata
56	.text
57	.seh_endproc
58                                        # -- End function
59	.section	.debug$S,"dr"
60	.p2align	2
61	.long 4
62	.long	241                     # Symbol subsection for max
63	.long	.Ltmp7-.Ltmp6           # Subsection size
64.Ltmp6:
65	.short	.Ltmp9-.Ltmp8           # Record length
66.Ltmp8:
67	.short	4423                    # Record kind: S_GPROC32_ID
68	.long	0                       # PtrParent
69	.long	0                       # PtrEnd
70	.long	0                       # PtrNext
71	.long	.Lfunc_end0-max         # Code size
72	.long	0                       # Offset after prologue
73	.long	0                       # Offset before epilogue
74	.long	4098                    # Function type index
75	.secrel32	max             # Function section relative address
76	.secidx	max                     # Function section index
77	.byte	0                       # Flags
78	.asciz	"max"                   # Function name
79.Ltmp9:
80	.short	.Ltmp11-.Ltmp10         # Record length
81.Ltmp10:
82	.short	4114                    # Record kind: S_FRAMEPROC
83	.long	8                       # FrameSize
84	.long	0                       # Padding
85	.long	0                       # Offset of padding
86	.long	0                       # Bytes of callee saved registers
87	.long	0                       # Exception handler offset
88	.short	0                       # Exception handler section
89	.long	81920                   # Flags (defines frame register)
90.Ltmp11:
91	.short	.Ltmp13-.Ltmp12         # Record length
92.Ltmp12:
93	.short	4414                    # Record kind: S_LOCAL
94	.long	18                      # TypeIndex
95	.short	1                       # Flags
96	.asciz	"a"
97	# BUG
98	.p2align 2
99.Ltmp13:
100	.cv_def_range	 .Ltmp0 .Ltmp1, frame_ptr_rel, 8
101	.short	.Ltmp15-.Ltmp14         # Record length
102.Ltmp14:
103	.short	4414                    # Record kind: S_LOCAL
104	.long	18                      # TypeIndex
105	.short	1                       # Flags
106	.asciz	"b"
107	# BUG
108	.p2align 2
109.Ltmp15:
110	.cv_def_range	 .Ltmp0 .Ltmp1, frame_ptr_rel, 8
111	.short	2                       # Record length
112	.short	4431                    # Record kind: S_PROC_ID_END
113.Ltmp7:
114	.p2align	2
115	.cv_linetable	0, max, .Lfunc_end0
116	.cv_filechecksums               # File index to string table offset subsection
117	.cv_stringtable                 # String table
118	.long	241
119	.long	.Ltmp17-.Ltmp16         # Subsection size
120.Ltmp16:
121.Ltmp17:
122	.p2align	2
123	.section	.debug$T,"dr"
124	.p2align	2
125	.long	4                       # Debug section magic
126	# ArgList (0x1000) {
127	#   TypeLeafKind: LF_ARGLIST (0x1201)
128	#   NumArgs: 2
129	#   Arguments [
130	#     ArgType: long (0x12)
131	#     ArgType: long (0x12)
132	#   ]
133	# }
134	.byte	0x0e, 0x00, 0x01, 0x12
135	.byte	0x02, 0x00, 0x00, 0x00
136	.byte	0x12, 0x00, 0x00, 0x00
137	.byte	0x12, 0x00, 0x00, 0x00
138	# Procedure (0x1001) {
139	#   TypeLeafKind: LF_PROCEDURE (0x1008)
140	#   ReturnType: long (0x12)
141	#   CallingConvention: NearC (0x0)
142	#   FunctionOptions [ (0x0)
143	#   ]
144	#   NumParameters: 2
145	#   ArgListType: (long, long) (0x1000)
146	# }
147	.byte	0x0e, 0x00, 0x08, 0x10
148	.byte	0x12, 0x00, 0x00, 0x00
149	.byte	0x00, 0x00, 0x02, 0x00
150	.byte	0x00, 0x10, 0x00, 0x00
151	# FuncId (0x1002) {
152	#   TypeLeafKind: LF_FUNC_ID (0x1601)
153	#   ParentScope: 0x0
154	#   FunctionType: long (long, long) (0x1001)
155	#   Name: max
156	# }
157	.byte	0x0e, 0x00, 0x01, 0x16
158	.byte	0x00, 0x00, 0x00, 0x00
159	.byte	0x01, 0x10, 0x00, 0x00
160	.byte	0x6d, 0x61, 0x78, 0x00
161
162