brintos

brintos / llvm-project-archived public Read only

0
0
Text · 7.1 KiB · 28fe071 Raw
141 lines · plain
1; RUN: llc < %s | FileCheck %s --check-prefix=ASM2; RUN: llc < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s --check-prefix=OBJ3 4; // C++ source to regenerate:5; namespace Test1 {6; const float TestConst1 = 3.14;7; }8; struct S {9;   static const int TestConst2 = -10;10;   // Unused static consts should still be emitted.11;   static const int TestConst3 = 3;12;   static constexpr int TestConst 4 = 4;13;   enum { SEnum = 42 };14; };15; enum TestEnum : int {16;   ENUM_A = 2147000000,17;   ENUM_B = -2147000000,18; };19; void useConst(int);20; void foo() {21;   useConst(Test1::TestConst1);22;   useConst(S::TestConst2);23;   useConst(ENUM_B);24;   useConst(S::SEnum);25; }26; 27; $ clang a.cpp -S -emit-llvm -g -gcodeview28 29; ASM-LABEL:  .long 241                     # Symbol subsection for globals30 31; ASM:	      .short	4359                    # Record kind: S_CONSTANT32; ASM-NEXT:	  .long	4099                    # Type33; ASM-NEXT:	  .byte	0x04, 0x80, 0xc3, 0xf5  # Value34; ASM-NEXT:	  .byte	0x48, 0x4035; ASM-NEXT:	  .asciz	"Test1::TestConst1"     # Name36; ASM-NEXT:	  .p2align	237 38; ASM:	      .short	4359                    # Record kind: S_CONSTANT39; ASM-NEXT:	  .long	4101                    # Type40; ASM-NEXT:	  .byte	0x03, 0x80, 0x40, 0x61  # Value41; ASM-NEXT:	  .byte	0x07, 0x8042; ASM-NEXT:	  .asciz	"ENUM_B"                # Name43; ASM-NEXT:	  .p2align	244; ASM-NOT:    .asciz "S::SEnum"             # Name45 46; ASM:	      .short	4359                    # Record kind: S_CONSTANT47; ASM-NEXT:	  .long	4105                    # Type48; ASM-NEXT:	  .byte	0x00, 0x80, 0xf6        # Value49; ASM-NEXT:	  .asciz	"S::TestConst2"         # Name50; ASM-NEXT:	  .p2align	251 52; OBJ:        CodeViewDebugInfo [53; OBJ:          Section: .debug$S54; OBJ:          Magic: 0x455; OBJ:          Subsection [56; OBJ:            SubSectionType: Symbols (0xF1)57; OBJ:            ConstantSym {58; OBJ-NEXT:         Kind: S_CONSTANT (0x1107)59; OBJ-NEXT:         Type: const float (0x1003)60; OBJ-NEXT:         Value: 107852333161; OBJ-NEXT:         Name: Test1::TestConst162; OBJ-NEXT:       }63; OBJ-NEXT:       ConstantSym {64; OBJ-NEXT:         Kind: S_CONSTANT (0x1107)65; OBJ-NEXT:         Type: TestEnum (0x1005)66; OBJ-NEXT:         Value: -21470000067; OBJ-NEXT:         Name: ENUM_B68; OBJ-NEXT:       }69; OBJ-NOT:          Name: S::SEnum70; OBJ-NEXT:       ConstantSym {71; OBJ-NEXT:         Kind: S_CONSTANT (0x1107)72; OBJ-NEXT:         Type: const int (0x1009)73; OBJ-NEXT:         Value: -1074; OBJ-NEXT:         Name: S::TestConst275; OBJ-NEXT:       }76 77; ModuleID = 'a.cpp'78source_filename = "a.cpp"79target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"80target triple = "x86_64-pc-windows-msvc19.25.28614"81 82; Function Attrs: noinline optnone uwtable83define dso_local void @"?foo@@YAXXZ"() #0 !dbg !31 {84entry:85  call void @"?useConst@@YAXH@Z"(i32 3), !dbg !3586  call void @"?useConst@@YAXH@Z"(i32 -10), !dbg !3687  call void @"?useConst@@YAXH@Z"(i32 -2147000000), !dbg !3788  call void @"?useConst@@YAXH@Z"(i32 42), !dbg !3889  ret void, !dbg !3990}91 92declare dso_local void @"?useConst@@YAXH@Z"(i32) #193 94attributes #0 = { noinline optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "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"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "use-soft-float"="false" }95attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "no-infs-fp-math"="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"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "use-soft-float"="false" }96 97!llvm.dbg.cu = !{!0}98!llvm.module.flags = !{!26, !27, !28, !29}99!llvm.ident = !{!30}100 101!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 12.0.0 (https://github.com/llvm/llvm-project.git 34cd06a9b3bddaa7a989c606bbf1327ee651711c)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !17, globals: !18, nameTableKind: None)102!1 = !DIFile(filename: "a.cpp", directory: "F:\\llvm-project\\__test", checksumkind: CSK_MD5, checksum: "a1dbf3aabea9e8f9d1be48f60287942f")103!2 = !{!3, !13}104!3 = !DICompositeType(tag: DW_TAG_enumeration_type, scope: !4, file: !1, line: 8, baseType: !8, size: 32, elements: !11, identifier: ".?AW4<unnamed-enum-SEnum>@S@@")105!4 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !1, line: 4, size: 8, flags: DIFlagTypePassByValue, elements: !5, identifier: ".?AUS@@")106!5 = !{!6, !9, !10, !3}107!6 = !DIDerivedType(tag: DW_TAG_member, name: "TestConst2", scope: !4, file: !1, line: 5, baseType: !7, flags: DIFlagStaticMember, extraData: i32 -10)108!7 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !8)109!8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)110!9 = !DIDerivedType(tag: DW_TAG_member, name: "TestConst3", scope: !4, file: !1, line: 6, baseType: !7, flags: DIFlagStaticMember, extraData: i32 3)111!10 = !DIDerivedType(tag: DW_TAG_member, name: "TestConst4", scope: !4, file: !1, line: 7, baseType: !7, flags: DIFlagStaticMember, extraData: i32 4)112!11 = !{!12}113!12 = !DIEnumerator(name: "SEnum", value: 42)114!13 = !DICompositeType(tag: DW_TAG_enumeration_type, name: "TestEnum", file: !1, line: 10, baseType: !8, size: 32, elements: !14, identifier: ".?AW4TestEnum@@")115!14 = !{!15, !16}116!15 = !DIEnumerator(name: "ENUM_A", value: 2147000000)117!16 = !DIEnumerator(name: "ENUM_B", value: -2147000000)118!17 = !{!4}119!18 = !{!19, !24}120!19 = !DIGlobalVariableExpression(var: !20, expr: !DIExpression(DW_OP_constu, 1078523331, DW_OP_stack_value))121!20 = distinct !DIGlobalVariable(name: "TestConst1", scope: !21, file: !1, line: 2, type: !22, isLocal: true, isDefinition: true)122!21 = !DINamespace(name: "Test1", scope: null)123!22 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !23)124!23 = !DIBasicType(name: "float", size: 32, encoding: DW_ATE_float)125!24 = !DIGlobalVariableExpression(var: !25, expr: !DIExpression(DW_OP_constu, 18446744071562551616, DW_OP_stack_value))126!25 = distinct !DIGlobalVariable(name: "ENUM_B", scope: !0, file: !1, line: 12, type: !13, isLocal: true, isDefinition: true)127!26 = !{i32 2, !"CodeView", i32 1}128!27 = !{i32 2, !"Debug Info Version", i32 3}129!28 = !{i32 1, !"wchar_size", i32 2}130!29 = !{i32 7, !"PIC Level", i32 2}131!30 = !{!"clang version 12.0.0 (https://github.com/llvm/llvm-project.git 34cd06a9b3bddaa7a989c606bbf1327ee651711c)"}132!31 = distinct !DISubprogram(name: "foo", linkageName: "?foo@@YAXXZ", scope: !1, file: !1, line: 15, type: !32, scopeLine: 15, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !34)133!32 = !DISubroutineType(types: !33)134!33 = !{null}135!34 = !{}136!35 = !DILocation(line: 16, scope: !31)137!36 = !DILocation(line: 17, scope: !31)138!37 = !DILocation(line: 18, scope: !31)139!38 = !DILocation(line: 19, scope: !31)140!39 = !DILocation(line: 20, scope: !31)141