brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.3 KiB · 2619222 Raw
327 lines · plain
1# REQUIRES: x86-registered-target2# RUN: llvm-mc -filetype=obj --triple=x86_64-pc-windows-msvc %s | llvm-readobj - --codeview --codeview-subsection-bytes | FileCheck %s3 4# Rust source to regenerate:5# #[no_mangle]6# extern "C" fn add_numbers(x: &Option<i32>, y: &Option<i32>) -> i32 {7#     let x1 = x.unwrap();8#     let y1 = y.unwrap();9#     x1 + y110# }11# $ rustc trailing-inlined-function.rs --crate-type cdylib --emit=asm -Copt-level=3 -Cpanic=abort -Cdebuginfo=112 13# Validate that unwrap() was inlined.14# CHECK:       InlineSiteSym {15# CHECK-NEXT:    Kind: S_INLINESITE (0x114D)16# CHECK-NEXT:    PtrParent: 0x017# CHECK-NEXT:    PtrEnd: 0x018# CHECK-NEXT:    Inlinee: unwrap19# CHECK-NEXT:    BinaryAnnotations [20# CHECK-NEXT:      ChangeCodeOffsetAndLineOffset: {CodeOffset: [[#%#x,Offset1_1:]], LineOffset: 1}21# CHECK-NEXT:      ChangeCodeLength: [[#%#x,Length1_1:]]22# CHECK-NEXT:      ChangeLineOffset: 223# CHECK-NEXT:      ChangeCodeOffset: [[#%#x,Offset1_2:]]24# CHECK-NEXT:      ChangeCodeLength: [[#%#x,]]25# CHECK-NEXT:      (Annotation Padding)26# CHECK:      InlineSiteSym {27# CHECK-NEXT:    Kind: S_INLINESITE (0x114D)28# CHECK-NEXT:    PtrParent: 0x029# CHECK-NEXT:    PtrEnd: 0x030# CHECK-NEXT:    Inlinee: unwrap31# CHECK-NEXT:    BinaryAnnotations [32# CHECK-NEXT:      ChangeCodeOffsetAndLineOffset: {CodeOffset: [[#%#x,Offset2_1:]], LineOffset: 1}33# CHECK-NEXT:      ChangeCodeLength: [[#%#x,Length2_1:]]34# CHECK-NEXT:      ChangeLineOffset: 235# CHECK-NEXT:      ChangeCodeOffset: [[#%#x,Offset2_2:]]36# CHECK-NEXT:      ChangeCodeLength: [[#%#x,]]37# CHECK-NEXT:      (Annotation Padding)38 39# Validate that basic blocks from an inlined function that are sunk below the rest of the function40# (namely bb1 and bb4 in this test) get the correct debug info.41# CHECK:       SubSectionType: Lines (0xF2)42# CHECK-NEXT:   SubSectionSize: [[#%#x,]]43# CHECK-NEXT:   SubSectionContents (44# CHECK-NEXT:     0000: [[#%.8X,]] [[#%.8X,]] [[#%.8X,]] [[#%.8X,]]45#                       Code starts at line 246# CHECK-NEXT:     0010: [[#%.8X,]] [[#%.8X,]] [[#%.8X,]] 0200000047#                       The success paths for unwrap() (lines 3 & 4) are next.48# CHECK-NEXT:     0020: [[#%.2X,Offset1_1]]000000 03000000 [[#%.2X,Offset2_1]]000000 0400000049#                       Then the addition (line 5) and the end of the function (end-brace on line 6).50# CHECK-NEXT:     0030: [[#%.8X,]] 05000000 [[#%.8X,]] 0600000051#                       The failure paths for unwrap() (lines 3 & 4) are placed after the `ret` instruction.52# CHECK-NEXT:     0040: [[#%.2X,Offset1_1 + Length1_1 + Offset1_2]]000000 03000000 [[#%.2X,Offset2_1 + Length2_1 + Offset2_2]]000000 0400000053# CHECK-NOT:    SubSectionType: Lines (0xF2)54 55	.text56	.def	@feat.00;57	.scl	3;58	.type	0;59	.endef60	.globl	@feat.0061.set @feat.00, 062	.file	"trailing_inlined_function.3a6e73a087a7434a-cgu.0"63	.def	add_numbers;64	.scl	2;65	.type	32;66	.endef67	.section	.text,"xr",one_only,add_numbers68	.globl	add_numbers69	.p2align	4, 0x9070add_numbers:71.Lfunc_begin0:72	.cv_func_id 073	.cv_file	1 "C:\\llvm\\trailing-inlined-function.rs" "A63E3A719BDF505386FDB73BF86EC58591BDAC588181F0E423E724AEEC3E4852" 374	.cv_loc	0 1 2 075.seh_proc add_numbers76	subq	$40, %rsp77	.seh_stackalloc 4078	.seh_endprologue79.Ltmp0:80	.cv_file	2 "/rustc/bc28abf92efc32f8f9312851bf8af38fbd23be42\\library\\core\\src\\option.rs" "7B702FA8D5AAEDC0CCA1EE32F30D5922BC11516B54D592279493A30457F918D9" 381	.cv_inline_site_id 1 within 0 inlined_at 1 3 082	.cv_loc	1 2 933 083	cmpl	$0, (%rcx)84	je	.LBB0_185.Ltmp1:86	.cv_inline_site_id 2 within 0 inlined_at 1 4 087	.cv_loc	2 2 933 088	cmpl	$0, (%rdx)89	je	.LBB0_490.Ltmp2:91	.cv_loc	0 1 5 092	movl	4(%rcx), %eax93.Ltmp3:94	addl	4(%rdx), %eax95.Ltmp4:96	.cv_loc	0 1 6 097	.seh_startepilogue98	addq	$40, %rsp99	.seh_endepilogue100	retq101.LBB0_1:102.Ltmp5:103	.cv_loc	1 2 935 0104	leaq	__unnamed_1(%rip), %rcx105	leaq	__unnamed_2(%rip), %r8106.Ltmp6:107	movl	$43, %edx108	callq	_ZN4core9panicking5panic17hd083df7b722701afE109	ud2110.LBB0_4:111.Ltmp7:112	.cv_loc	2 2 935 0113	leaq	__unnamed_1(%rip), %rcx114	leaq	__unnamed_3(%rip), %r8115.Ltmp8:116	movl	$43, %edx117	callq	_ZN4core9panicking5panic17hd083df7b722701afE118	ud2119.Ltmp9:120.Lfunc_end0:121	.seh_endproc122 123	.section	.rdata,"dr",one_only,__unnamed_1124__unnamed_1:125	.ascii	"called `Option::unwrap()` on a `None` value"126 127	.section	.rdata,"dr",one_only,__unnamed_4128__unnamed_4:129	.ascii	"trailing-inlined-function.rs"130 131	.section	.rdata,"dr",one_only,__unnamed_2132	.p2align	3, 0x0133__unnamed_2:134	.quad	__unnamed_4135	.asciz	"\034\000\000\000\000\000\000\000\003\000\000\000\020\000\000"136 137	.section	.rdata,"dr",one_only,__unnamed_3138	.p2align	3, 0x0139__unnamed_3:140	.quad	__unnamed_4141	.asciz	"\034\000\000\000\000\000\000\000\004\000\000\000\020\000\000"142 143	.section	.debug$S,"dr"144	.p2align	2, 0x0145	.long	4146	.long	241147	.long	.Ltmp11-.Ltmp10148.Ltmp10:149	.short	.Ltmp13-.Ltmp12150.Ltmp12:151	.short	4353152	.long	0153	.byte	0154	.p2align	2, 0x0155.Ltmp13:156	.short	.Ltmp15-.Ltmp14157.Ltmp14:158	.short	4412159	.long	21160	.short	208161	.short	1162	.short	73163	.short	0164	.short	0165	.short	17000166	.short	0167	.short	0168	.short	0169	.asciz	"clang LLVM (rustc version 1.73.0-beta.3 (bc28abf92 2023-08-27))"170	.p2align	2, 0x0171.Ltmp15:172.Ltmp11:173	.p2align	2, 0x0174	.long	246175	.long	.Ltmp17-.Ltmp16176.Ltmp16:177	.long	0178 179 180	.long	4099181	.cv_filechecksumoffset	2182	.long	932183 184 185	.long	4099186	.cv_filechecksumoffset	2187	.long	932188.Ltmp17:189	.p2align	2, 0x0190	.section	.debug$S,"dr",associative,add_numbers191	.p2align	2, 0x0192	.long	4193	.long	241194	.long	.Ltmp19-.Ltmp18195.Ltmp18:196	.short	.Ltmp21-.Ltmp20197.Ltmp20:198	.short	4423199	.long	0200	.long	0201	.long	0202	.long	.Lfunc_end0-add_numbers203	.long	0204	.long	0205	.long	4101206	.secrel32	add_numbers207	.secidx	add_numbers208	.byte	128209	.asciz	"trailing_inlined_function::add_numbers"210	.p2align	2, 0x0211.Ltmp21:212	.short	.Ltmp23-.Ltmp22213.Ltmp22:214	.short	4114215	.long	40216	.long	0217	.long	0218	.long	0219	.long	0220	.short	0221	.long	1138688222	.p2align	2, 0x0223.Ltmp23:224	.short	.Ltmp25-.Ltmp24225.Ltmp24:226	.short	4429227	.long	0228	.long	0229	.long	4099230	.cv_inline_linetable	1 2 932 .Lfunc_begin0 .Lfunc_end0231	.p2align	2, 0x0232.Ltmp25:233	.short	2234	.short	4430235	.short	.Ltmp27-.Ltmp26236.Ltmp26:237	.short	4429238	.long	0239	.long	0240	.long	4099241	.cv_inline_linetable	2 2 932 .Lfunc_begin0 .Lfunc_end0242	.p2align	2, 0x0243.Ltmp27:244	.short	2245	.short	4430246	.short	2247	.short	4431248.Ltmp19:249	.p2align	2, 0x0250	.cv_linetable	0, add_numbers, .Lfunc_end0251	.section	.debug$S,"dr"252	.cv_filechecksums253	.cv_stringtable254	.long	241255	.long	.Ltmp29-.Ltmp28256.Ltmp28:257	.short	.Ltmp31-.Ltmp30258.Ltmp30:259	.short	4428260	.long	4105261	.p2align	2, 0x0262.Ltmp31:263.Ltmp29:264	.p2align	2, 0x0265	.section	.debug$T,"dr"266	.p2align	2, 0x0267	.long	4268	.short	0x1e269	.short	0x1605270	.long	0x0271	.asciz	"core::option::Option"272	.byte	243273	.byte	242274	.byte	241275	.short	0x6276	.short	0x1201277	.long	0x0278	.short	0xe279	.short	0x1008280	.long	0x3281	.byte	0x0282	.byte	0x0283	.short	0x0284	.long	0x1001285	.short	0x12286	.short	0x1601287	.long	0x1000288	.long	0x1002289	.asciz	"unwrap"290	.byte	241291	.short	0x22292	.short	0x1605293	.long	0x0294	.asciz	"trailing_inlined_function"295	.byte	242296	.byte	241297	.short	0x16298	.short	0x1601299	.long	0x1004300	.long	0x1002301	.asciz	"add_numbers"302	.short	0xe303	.short	0x1605304	.long	0x0305	.asciz	"C:\\llvm"306	.short	0x56307	.short	0x1605308	.long	0x0309	.asciz	"trailing-inlined-function.rs\\@\\trailing_inlined_function.3a6e73a087a7434a-cgu.0"310	.short	0xa311	.short	0x1605312	.long	0x0313	.byte	0314	.byte	243315	.byte	242316	.byte	241317	.short	0x1a318	.short	0x1603319	.short	0x5320	.long	0x1006321	.long	0x0322	.long	0x1007323	.long	0x1008324	.long	0x0325	.byte	242326	.byte	241327