288 lines · plain
1; RUN: llc -mcpu=core2 -mtriple=i686-pc-win32 < %s | FileCheck %s --check-prefix=ASM2; RUN: llc -mcpu=core2 -mtriple=i686-pc-win32 < %s -filetype=obj | llvm-readobj --codeview - | FileCheck %s --check-prefix=OBJ3 4; This LL file was generated by running 'clang -O1 -g -gcodeview' on the5; following code:6; 1: extern volatile int x;7; 2: static inline void foo() {8; 3: int y = 1;9; 4: x += (int)&y;10; 5: x += 2;11; 6: x += 3;12; 7: }13; 8: static inline void bar() {14; 9: x += 4;15; 10: foo();16; 11: x += 5;17; 12: }18; 13: void baz() {19; 14: x += 6;20; 15: bar();21; 16: x += 7;22; 17: }23 24; ASM: .cv_func_id 025; ASM: .cv_loc 0 1 13 0 # t.cpp:13:026; ASM: .cv_loc 0 1 14 5 # t.cpp:14:527; ASM: addl $6, "?x@@3HC"28; ASM: .cv_inline_site_id 1 within 0 inlined_at 1 15 329; ASM: .cv_loc 1 1 9 5 # t.cpp:9:530; ASM: addl $4, "?x@@3HC"31; ASM: .cv_inline_site_id 2 within 1 inlined_at 1 10 332; ASM: .cv_loc 2 1 4 5 # t.cpp:4:533; ASM: addl {{.*}}, "?x@@3HC"34; ASM: .cv_loc 2 1 5 5 # t.cpp:5:535; ASM: addl $2, "?x@@3HC"36; ASM: .cv_loc 2 1 6 5 # t.cpp:6:537; ASM: addl $3, "?x@@3HC"38; ASM: .cv_loc 1 1 11 5 # t.cpp:11:539; ASM: addl $5, "?x@@3HC"40; ASM: .cv_loc 0 1 16 5 # t.cpp:16:541; ASM: addl $7, "?x@@3HC"42; ASM: .cv_loc 0 1 17 1 # t.cpp:17:143 44; ASM: .section .debug$S,"dr"45; ASM: .long 246 # Inlinee lines subsection46; ASM: .long [[inline_end:.*]]-[[inline_beg:.*]] #47; ASM: [[inline_beg]]:48; ASM: .long 049; ASM: # Inlined function bar starts at t.cpp:850; ASM: .long 4098 # Type index of inlined function51; ASM: .cv_filechecksumoffset 1 # Offset into filechecksum table52; ASM: .long 8 # Starting line number53; ASM: # Inlined function foo starts at t.cpp:254; ASM: .long 409955; ASM: .cv_filechecksumoffset 1 # Offset into filechecksum table56; ASM: .long 257; ASM: [[inline_end]]:58 59; ASM: .long 241 # Symbol subsection for baz60; ASM: .long {{.*}} # Subsection size61; ASM: .short 442962; ASM: .long63; ASM: .long64; ASM: .long65; ASM: .cv_inline_linetable 1 1 8 Lfunc_begin0 Lfunc_end066; ASM: .short 442967; ASM: .long68; ASM: .long69; ASM: .long70; ASM: .cv_inline_linetable 2 1 2 Lfunc_begin0 Lfunc_end071; ASM: .short 443072; ASM: .short 443073 74; ASM: .cv_filechecksums75 76; ASM: .section .debug$T,"dr"77; ASM: .long 4 # Debug section magic78; ASM: # ArgList (0x1000)79; ASM: .short 0x6 # Record length80; ASM: .short 0x1201 # Record kind: LF_ARGLIST81; ASM: .long 0x0 # NumArgs82; ASM: # Procedure (0x1001)83; ASM: .short 0xe # Record length84; ASM: .short 0x1008 # Record kind: LF_PROCEDURE85; ASM: .long 0x3 # ReturnType: void86; ASM: .byte 0x0 # CallingConvention: NearC87; ASM: .byte 0x0 # FunctionOptions88; ASM: .short 0x0 # NumParameters89; ASM: .long 0x1000 # ArgListType: ()90; ASM: # FuncId (0x1002)91; ASM: .short 0xe # Record length92; ASM: .short 0x1601 # Record kind: LF_FUNC_ID93; ASM: .long 0x0 # ParentScope94; ASM: .long 0x1001 # FunctionType: void ()95; ASM: .asciz "bar" # Name96; ASM: # FuncId (0x1003)97; ASM: .short 0xe # Record length98; ASM: .short 0x1601 # Record kind: LF_FUNC_ID99; ASM: .long 0x0 # ParentScope100; ASM: .long 0x1001 # FunctionType: void ()101; ASM: .asciz "foo" # Name102 103; We should only the LF_FUNC_ID records that we needed to reference.104; OBJ: CodeViewTypes [105; OBJ: Section: .debug$T106; OBJ: ArgList (0x1000) {107; OBJ: TypeLeafKind: LF_ARGLIST (0x1201)108; OBJ: NumArgs: 0109; OBJ: }110; OBJ: Procedure (0x1001) {111; OBJ: TypeLeafKind: LF_PROCEDURE (0x1008)112; OBJ: ReturnType: void (0x3)113; OBJ: NumParameters: 0114; OBJ: ArgListType: () (0x1000)115; OBJ: }116; OBJ: FuncId (0x1002) {117; OBJ: TypeLeafKind: LF_FUNC_ID (0x1601)118; OBJ: ParentScope: 0x0119; OBJ: FunctionType: void () (0x1001)120; OBJ: Name: bar121; OBJ: }122; OBJ: FuncId (0x1003) {123; OBJ: TypeLeafKind: LF_FUNC_ID (0x1601)124; OBJ: ParentScope: 0x0125; OBJ: FunctionType: void () (0x1001)126; OBJ: Name: foo127; OBJ: }128; OBJ: FuncId (0x1004) {129; OBJ: TypeLeafKind: LF_FUNC_ID (0x1601)130; OBJ: ParentScope: 0x0131; OBJ: FunctionType: void () (0x1001)132; OBJ: Name: baz133; OBJ: }134; OBJ-NOT: TypeLeafKind: LF_FUNC_ID135; OBJ: ]136 137; OBJ: Subsection [138; OBJ: SubSectionType: InlineeLines (0xF6)139; OBJ: SubSectionSize: 0x1C140; OBJ: InlineeSourceLine {141; OBJ: Inlinee: bar (0x1002)142; OBJ: FileID: D:\src\llvm\build\t.cpp (0x0)143; OBJ: SourceLineNum: 8144; OBJ: }145; OBJ: InlineeSourceLine {146; OBJ: Inlinee: foo (0x1003)147; OBJ: FileID: D:\src\llvm\build\t.cpp (0x0)148; OBJ: SourceLineNum: 2149; OBJ: }150; OBJ: ]151; OBJ: Subsection [152; OBJ: SubSectionType: Symbols (0xF1)153; OBJ: {{.*}}Proc{{.*}}Sym {154; OBJ: PtrParent: 0x0155; OBJ: PtrEnd: 0x0156; OBJ: PtrNext: 0x0157; OBJ: CodeSize: 0x35158; OBJ: DbgStart: 0x0159; OBJ: DbgEnd: 0x0160; OBJ: FunctionType: baz (0x1004)161; OBJ: CodeOffset: ?baz@@YAXXZ+0x0162; OBJ: Segment: 0x0163; OBJ: Flags [ (0x80)164; OBJ: HasOptimizedDebugInfo (0x80)165; OBJ: ]166; OBJ: DisplayName: baz167; OBJ: LinkageName: ?baz@@YAXXZ168; OBJ: }169; OBJ: InlineesSym {170; OBJ-NEXT: Kind: S_INLINEES (0x1168)171; OBJ-NEXT: Inlinees [172; OBJ-NEXT: FuncID: bar (0x1002)173; OBJ-NEXT: ]174; OBJ-NEXT:}175; OBJ: InlineSiteSym {176; OBJ: PtrParent: 0x0177; OBJ: PtrEnd: 0x0178; OBJ: Inlinee: bar (0x1002)179; OBJ: BinaryAnnotations [180; OBJ-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x8, LineOffset: 1}181; OBJ-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x9, LineOffset: 1}182; OBJ-NEXT: ChangeLineOffset: 1183; OBJ-NEXT: ChangeCodeOffset: 0x14184; OBJ-NEXT: ChangeCodeLength: 0x7185; OBJ: ]186; OBJ: }187; OBJ: InlineSiteSym {188; OBJ: PtrParent: 0x0189; OBJ: PtrEnd: 0x0190; OBJ: Inlinee: foo (0x1003)191; OBJ: BinaryAnnotations [192; OBJ-NEXT: ChangeLineOffset: 2193; OBJ-NEXT: ChangeCodeOffset: 0x11194; OBJ-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x6, LineOffset: 1}195; OBJ-NEXT: ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x7, LineOffset: 1}196; OBJ-NEXT: ChangeCodeLength: 0x7197; OBJ: ]198; OBJ: }199; OBJ: InlineSiteEnd {200; OBJ: }201; OBJ: InlineSiteEnd {202; OBJ: }203; OBJ: ProcEnd204; OBJ: ]205 206; ModuleID = 't.cpp'207target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"208target triple = "x86_64-pc-windows-msvc18.0.0"209 210@"\01?x@@3HC" = external global i32, align 4211 212; Function Attrs: norecurse nounwind uwtable213define void @"\01?baz@@YAXXZ"() #0 !dbg !4 {214entry:215 %y.i.i = alloca i32, align 4216 %0 = load volatile i32, ptr @"\01?x@@3HC", align 4, !dbg !12, !tbaa !13217 %add = add nsw i32 %0, 6, !dbg !12218 store volatile i32 %add, ptr @"\01?x@@3HC", align 4, !dbg !12, !tbaa !13219 %1 = load volatile i32, ptr @"\01?x@@3HC", align 4, !dbg !17, !tbaa !13220 %add.i = add nsw i32 %1, 4, !dbg !17221 store volatile i32 %add.i, ptr @"\01?x@@3HC", align 4, !dbg !17, !tbaa !13222 call void @llvm.lifetime.start(i64 4, ptr %y.i.i) #2, !dbg !19223 store i32 1, ptr %y.i.i, align 4, !dbg !21, !tbaa !13224 %2 = ptrtoint ptr %y.i.i to i64, !dbg !22225 %3 = trunc i64 %2 to i32, !dbg !22226 %4 = load volatile i32, ptr @"\01?x@@3HC", align 4, !dbg !23, !tbaa !13227 %add.i.i = add nsw i32 %4, %3, !dbg !23228 store volatile i32 %add.i.i, ptr @"\01?x@@3HC", align 4, !dbg !23, !tbaa !13229 %5 = load volatile i32, ptr @"\01?x@@3HC", align 4, !dbg !24, !tbaa !13230 %add1.i.i = add nsw i32 %5, 2, !dbg !24231 store volatile i32 %add1.i.i, ptr @"\01?x@@3HC", align 4, !dbg !24, !tbaa !13232 %6 = load volatile i32, ptr @"\01?x@@3HC", align 4, !dbg !25, !tbaa !13233 %add2.i.i = add nsw i32 %6, 3, !dbg !25234 store volatile i32 %add2.i.i, ptr @"\01?x@@3HC", align 4, !dbg !25, !tbaa !13235 call void @llvm.lifetime.end(i64 4, ptr %y.i.i) #2, !dbg !26236 %7 = load volatile i32, ptr @"\01?x@@3HC", align 4, !dbg !27, !tbaa !13237 %add1.i = add nsw i32 %7, 5, !dbg !27238 store volatile i32 %add1.i, ptr @"\01?x@@3HC", align 4, !dbg !27, !tbaa !13239 %8 = load volatile i32, ptr @"\01?x@@3HC", align 4, !dbg !28, !tbaa !13240 %add1 = add nsw i32 %8, 7, !dbg !28241 store volatile i32 %add1, ptr @"\01?x@@3HC", align 4, !dbg !28, !tbaa !13242 ret void, !dbg !29243}244 245; Function Attrs: argmemonly nounwind246declare void @llvm.lifetime.start(i64, ptr nocapture) #1247 248; Function Attrs: argmemonly nounwind249declare void @llvm.lifetime.end(i64, ptr nocapture) #1250 251attributes #0 = { norecurse nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "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" "use-soft-float"="false" }252attributes #1 = { argmemonly nounwind }253attributes #2 = { nounwind }254 255!llvm.dbg.cu = !{!0}256!llvm.module.flags = !{!8, !9, !10}257!llvm.ident = !{!11}258 259!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.9.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2)260!1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")261!2 = !{}262!4 = distinct !DISubprogram(name: "baz", scope: !1, file: !1, line: 13, type: !5, isLocal: false, isDefinition: true, scopeLine: 13, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !2)263!5 = !DISubroutineType(types: !2)264!6 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 8, type: !5, isLocal: true, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !2)265!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 2, type: !5, isLocal: true, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !2)266!8 = !{i32 2, !"CodeView", i32 1}267!9 = !{i32 2, !"Debug Info Version", i32 3}268!10 = !{i32 1, !"PIC Level", i32 2}269!11 = !{!"clang version 3.9.0 "}270!12 = !DILocation(line: 14, column: 5, scope: !4)271!13 = !{!14, !14, i64 0}272!14 = !{!"int", !15, i64 0}273!15 = !{!"omnipotent char", !16, i64 0}274!16 = !{!"Simple C/C++ TBAA"}275!17 = !DILocation(line: 9, column: 5, scope: !6, inlinedAt: !18)276!18 = distinct !DILocation(line: 15, column: 3, scope: !4)277!19 = !DILocation(line: 3, column: 3, scope: !7, inlinedAt: !20)278!20 = distinct !DILocation(line: 10, column: 3, scope: !6, inlinedAt: !18)279!21 = !DILocation(line: 3, column: 7, scope: !7, inlinedAt: !20)280!22 = !DILocation(line: 4, column: 8, scope: !7, inlinedAt: !20)281!23 = !DILocation(line: 4, column: 5, scope: !7, inlinedAt: !20)282!24 = !DILocation(line: 5, column: 5, scope: !7, inlinedAt: !20)283!25 = !DILocation(line: 6, column: 5, scope: !7, inlinedAt: !20)284!26 = !DILocation(line: 7, column: 1, scope: !7, inlinedAt: !20)285!27 = !DILocation(line: 11, column: 5, scope: !6, inlinedAt: !18)286!28 = !DILocation(line: 16, column: 5, scope: !4)287!29 = !DILocation(line: 17, column: 1, scope: !4)288