brintos

brintos / llvm-project-archived public Read only

0
0
Text · 8.9 KiB · 7a3c351 Raw
191 lines · plain
1; RUN: llc < %s -filetype=obj > %t.obj2; RUN: llvm-readobj --codeview %t.obj | FileCheck --check-prefix=READOBJ %s3; RUN: llvm-pdbutil dump -symbols %t.obj | FileCheck --check-prefix=PDBUTIL %s4 5; C++ to regenerate:6; $ clang -g -gcodeview -m64 -S -emit-llvm t.cpp7; $ cat t.cpp8; void f() {9;   typedef int FOO;10;   FOO f;11; }12;13; struct S { int x; };14; float g(S *s) {15;   union pun { int x; float f; } p;16;   p.x = s->x;17;   return p.f;18; }19; struct A {20;   // We should not output S_UDT for nested typedef.21;   typedef S C;22;   C c;23;   // We should output S_UDT for typedef of nested unnamed struct24;   typedef struct { long X; } D;25;   D d;26; };27; A a;28; 29; typedef struct { int x; } U;30; U u;31 32; READOBJ-NOT:  UDTName: A::C33; READOBJ:      {{.*}}Proc{{.*}}Sym {34; READOBJ:        DisplayName: f35; READOBJ:        LinkageName: ?f@@YAXXZ36; READOBJ:      }37; READOBJ:      UDTSym {38; READOBJ-NEXT:   Kind: S_UDT (0x1108)39; READOBJ-NEXT:   Type: int (0x74)40; READOBJ-NEXT:   UDTName: f::FOO41; READOBJ-NEXT: }42; READOBJ-NEXT: ProcEnd {43 44; READOBJ:      {{.*}}Proc{{.*}}Sym {45; READOBJ:        DisplayName: g46; READOBJ:        LinkageName: ?g@@YAMPEAUS@@@Z47; READOBJ:      }48; READOBJ:      UDTSym {49; READOBJ-NEXT:   Kind: S_UDT (0x1108)50; READOBJ-NEXT:   Type: g::pun (0x{{[0-9A-F]+}})51; READOBJ-NEXT:   UDTName: g::pun52; READOBJ-NEXT: }53; READOBJ-NEXT: ProcEnd {54 55; READOBJ:      Subsection56; READOBJ-NOT:  {{.*}}Proc{{.*}}Sym57; READOBJ:      UDTSym {58; READOBJ-NEXT:   Kind: S_UDT (0x1108)59; READOBJ-NEXT: Type: S (0x{{[0-9A-F]+}})60; READOBJ-NEXT: UDTName: S61; READOBJ:      UDTSym {62; READOBJ-NEXT:   Kind: S_UDT (0x1108)63; READOBJ-NEXT: Type: A (0x{{[0-9A-F]+}})64; READOBJ-NEXT: UDTName: A65; READOBJ:      UDTSym {66; READOBJ-NEXT:   Kind: S_UDT (0x1108)67; READOBJ-NEXT: Type: A::D (0x{{[0-9A-F]+}})68; READOBJ-NEXT: UDTName: A::D69; READOBJ:      UDTSym {70; READOBJ-NEXT:   Kind: S_UDT (0x1108)71; READOBJ-NEXT: Type: U (0x{{[0-9A-F]+}})72; READOBJ-NEXT: UDTName: U73; READOBJ:      UDTSym {74; READOBJ-NEXT:   Kind: S_UDT (0x1108)75; READOBJ-NEXT: Type: U (0x{{[0-9A-F]+}})76; READOBJ-NEXT: UDTName: U77; READOBJ-NOT: UDTSym78 79; PDBUTIL:                           Symbols80; PDBUTIL-NEXT: ============================================================81; PDBUTIL-NOT:   S_UDT {{.*}} `A::C`82; PDBUTIL:       S_UDT [size = 16] `f::FOO`83; PDBUTIL:       S_UDT [size = 16] `g::pun`84; PDBUTIL:       S_UDT [size = 12] `S`85; PDBUTIL:       S_UDT [size = 12] `A`86; PDBUTIL:       S_UDT [size = 16] `A::D`87; PDBUTIL:       S_UDT [size = 12] `U`88; PDBUTIL:       S_UDT [size = 12] `U`89 90source_filename = "test/DebugInfo/COFF/udts.ll"91target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"92target triple = "x86_64-pc-windows-msvc19.11.25506"93 94%struct.A = type { %struct.S, %"struct.A::D" }95%struct.S = type { i32 }96%"struct.A::D" = type { i32 }97%struct.U = type { i32 }98%union.pun = type { i32 }99 100@"\01?a@@3UA@@A" = global %struct.A zeroinitializer, align 4, !dbg !0101@"\01?u@@3UU@@A" = global %struct.U zeroinitializer, align 4, !dbg !6102 103; Function Attrs: noinline nounwind optnone uwtable104define void @"\01?f@@YAXXZ"() #0 !dbg !31 {105  %1 = alloca i32, align 4106  call void @llvm.dbg.declare(metadata ptr %1, metadata !34, metadata !DIExpression()), !dbg !36107  ret void, !dbg !37108}109 110; Function Attrs: nounwind readnone speculatable111declare void @llvm.dbg.declare(metadata, metadata, metadata) #1112 113; Function Attrs: noinline nounwind optnone uwtable114define float @"\01?g@@YAMPEAUS@@@Z"(ptr) #0 !dbg !38 {115  %2 = alloca ptr, align 8116  %3 = alloca %union.pun, align 4117  store ptr %0, ptr %2, align 8118  call void @llvm.dbg.declare(metadata ptr %2, metadata !43, metadata !DIExpression()), !dbg !44119  call void @llvm.dbg.declare(metadata ptr %3, metadata !45, metadata !DIExpression()), !dbg !50120  %4 = load ptr, ptr %2, align 8, !dbg !51121  %5 = load i32, ptr %4, align 4, !dbg !52122  store i32 %5, ptr %3, align 4, !dbg !54123  %6 = load float, ptr %3, align 4, !dbg !55124  ret float %6, !dbg !56125}126 127attributes #0 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "use-soft-float"="false" }128attributes #1 = { nounwind readnone speculatable }129 130!llvm.dbg.cu = !{!2}131!llvm.module.flags = !{!26, !27, !28, !29}132!llvm.ident = !{!30}133 134!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())135!1 = distinct !DIGlobalVariable(name: "a", linkageName: "\01?a@@3UA@@A", scope: !2, file: !3, line: 21, type: !13, isLocal: false, isDefinition: true)136!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 6.0.0 ", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)137!3 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvmbuild\5Cninja-release", checksumkind: CSK_MD5, checksum: "e894de94ed2e0d503ebb5dbcc550c544")138!4 = !{}139!5 = !{!0, !6}140!6 = !DIGlobalVariableExpression(var: !7, expr: !DIExpression())141!7 = distinct !DIGlobalVariable(name: "u", linkageName: "\01?u@@3UU@@A", scope: !2, file: !3, line: 24, type: !8, isLocal: false, isDefinition: true)142!8 = !DIDerivedType(tag: DW_TAG_typedef, name: "U", file: !3, line: 23, baseType: !9)143!9 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "U", file: !3, line: 23, size: 32, elements: !10, identifier: ".?AUU@@")144!10 = !{!11}145!11 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !9, file: !3, line: 23, baseType: !12, size: 32)146!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)147!13 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A", file: !3, line: 13, size: 64, elements: !14, identifier: ".?AUA@@")148!14 = !{!15, !19, !20, !24, !25}149!15 = !DIDerivedType(tag: DW_TAG_typedef, name: "C", scope: !13, file: !3, line: 15, baseType: !16)150!16 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !3, line: 6, size: 32, elements: !17, identifier: ".?AUS@@")151!17 = !{!18}152!18 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !16, file: !3, line: 6, baseType: !12, size: 32)153!19 = !DIDerivedType(tag: DW_TAG_member, name: "c", scope: !13, file: !3, line: 16, baseType: !15, size: 32)154!20 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "D", scope: !13, file: !3, line: 18, size: 32, elements: !21, identifier: ".?AUD@A@@")155!21 = !{!22}156!22 = !DIDerivedType(tag: DW_TAG_member, name: "X", scope: !20, file: !3, line: 18, baseType: !23, size: 32)157!23 = !DIBasicType(name: "long int", size: 32, encoding: DW_ATE_signed)158!24 = !DIDerivedType(tag: DW_TAG_typedef, name: "D", scope: !13, file: !3, line: 18, baseType: !20)159!25 = !DIDerivedType(tag: DW_TAG_member, name: "d", scope: !13, file: !3, line: 19, baseType: !24, size: 32, offset: 32)160!26 = !{i32 2, !"CodeView", i32 1}161!27 = !{i32 2, !"Debug Info Version", i32 3}162!28 = !{i32 1, !"wchar_size", i32 2}163!29 = !{i32 7, !"PIC Level", i32 2}164!30 = !{!"clang version 6.0.0 "}165!31 = distinct !DISubprogram(name: "f", linkageName: "\01?f@@YAXXZ", scope: !3, file: !3, line: 1, type: !32, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !2, retainedNodes: !4)166!32 = !DISubroutineType(types: !33)167!33 = !{null}168!34 = !DILocalVariable(name: "f", scope: !31, file: !3, line: 3, type: !35)169!35 = !DIDerivedType(tag: DW_TAG_typedef, name: "FOO", scope: !31, file: !3, line: 2, baseType: !12)170!36 = !DILocation(line: 3, column: 7, scope: !31)171!37 = !DILocation(line: 4, column: 1, scope: !31)172!38 = distinct !DISubprogram(name: "g", linkageName: "\01?g@@YAMPEAUS@@@Z", scope: !3, file: !3, line: 7, type: !39, isLocal: false, isDefinition: true, scopeLine: 7, flags: DIFlagPrototyped, isOptimized: false, unit: !2, retainedNodes: !4)173!39 = !DISubroutineType(types: !40)174!40 = !{!41, !42}175!41 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)176!42 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !16, size: 64)177!43 = !DILocalVariable(name: "s", arg: 1, scope: !38, file: !3, line: 7, type: !42)178!44 = !DILocation(line: 7, column: 12, scope: !38)179!45 = !DILocalVariable(name: "p", scope: !38, file: !3, line: 8, type: !46)180!46 = distinct !DICompositeType(tag: DW_TAG_union_type, name: "pun", scope: !38, file: !3, line: 8, size: 32, elements: !47)181!47 = !{!48, !49}182!48 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !46, file: !3, line: 8, baseType: !12, size: 32)183!49 = !DIDerivedType(tag: DW_TAG_member, name: "f", scope: !46, file: !3, line: 8, baseType: !41, size: 32)184!50 = !DILocation(line: 8, column: 33, scope: !38)185!51 = !DILocation(line: 9, column: 9, scope: !38)186!52 = !DILocation(line: 9, column: 12, scope: !38)187!53 = !DILocation(line: 9, column: 5, scope: !38)188!54 = !DILocation(line: 9, column: 7, scope: !38)189!55 = !DILocation(line: 10, column: 12, scope: !38)190!56 = !DILocation(line: 10, column: 3, scope: !38)191