[MIParser] Set RegClassOrRegBank during instruction parsing
[llvm-complete.git] / test / MC / WebAssembly / comdat.ll
blobe50f5bf1cc96af0bcc5470382c8c889379650ded
1 ; RUN: llc -filetype=obj %s -o - | obj2yaml | FileCheck %s
3 target triple = "wasm32-unknown-unknown"
5 ; Import a function just so we can check the index arithmetic for
6 ; WASM_COMDAT_FUNCTION entries is performed correctly
7 declare i32 @funcImport()
8 define i32 @callImport() {
9 entry:
10   %call = call i32 @funcImport()
11   ret i32 %call
14 ; Function in its own COMDAT
15 $basicInlineFn = comdat any
16 define linkonce_odr i32 @basicInlineFn() #1 comdat {
17   ret i32 0
20 ; Global, data, and function in same COMDAT
21 $sharedComdat = comdat any
22 @constantData = weak_odr constant [3 x i8] c"abc", comdat($sharedComdat)
23 define linkonce_odr i32 @sharedFn() #1 comdat($sharedComdat) {
24   ret i32 0
27 ; CHECK:      Sections:
28 ; CHECK-NEXT:   - Type:            TYPE
29 ; CHECK-NEXT:     Signatures:
30 ; CHECK-NEXT:       - Index:           0
31 ; CHECK-NEXT:         ParamTypes:      []
32 ; CHECK-NEXT:         ReturnTypes:
33 ; CHECK-NEXT:           - I32
34 ; CHECK-NEXT:   - Type:            IMPORT
35 ; CHECK-NEXT:     Imports:
36 ; CHECK-NEXT:       - Module:          env
37 ; CHECK-NEXT:         Field:           __linear_memory
38 ; CHECK-NEXT:         Kind:            MEMORY
39 ; CHECK-NEXT:         Memory:
40 ; CHECK-NEXT:           Initial:         0x00000001
41 ; CHECK-NEXT:       - Module:          env
42 ; CHECK-NEXT:         Field:           __indirect_function_table
43 ; CHECK-NEXT:         Kind:            TABLE
44 ; CHECK-NEXT:         Table:
45 ; CHECK-NEXT:           ElemType:        FUNCREF
46 ; CHECK-NEXT:           Limits:
47 ; CHECK-NEXT:             Initial:         0x00000000
48 ; CHECK-NEXT:       - Module:          env
49 ; CHECK-NEXT:         Field:           funcImport
50 ; CHECK-NEXT:         Kind:            FUNCTION
51 ; CHECK-NEXT:         SigIndex:        0
52 ; CHECK-NEXT:   - Type:            FUNCTION
53 ; CHECK-NEXT:     FunctionTypes:   [ 0, 0, 0 ]
54 ; CHECK-NEXT:  - Type:            DATACOUNT
55 ; CHECK-NEXT:    Count:           1
56 ; CHECK-NEXT:  - Type:            CODE
57 ; CHECK-NEXT:    Relocations:
58 ; CHECK-NEXT:      - Type:            R_WASM_FUNCTION_INDEX_LEB
59 ; CHECK-NEXT:        Index:           1
60 ; CHECK-NEXT:        Offset:          0x00000004
61 ; CHECK-NEXT:    Functions:
62 ; CHECK-NEXT:      - Index:           1
63 ; CHECK-NEXT:        Locals:
64 ; CHECK-NEXT:        Body:            1080808080000B
65 ; CHECK-NEXT:      - Index:           2
66 ; CHECK-NEXT:        Locals:
67 ; CHECK-NEXT:        Body:            41000B
68 ; CHECK-NEXT:      - Index:           3
69 ; CHECK-NEXT:        Locals:
70 ; CHECK-NEXT:        Body:            41000B
71 ; CHECK-NEXT:  - Type:            DATA
72 ; CHECK-NEXT:    Segments:
73 ; CHECK-NEXT:      - SectionOffset:   6
74 ; CHECK-NEXT:        InitFlags:       0
75 ; CHECK-NEXT:        Offset:
76 ; CHECK-NEXT:          Opcode:          I32_CONST
77 ; CHECK-NEXT:          Value:           0
78 ; CHECK-NEXT:        Content:         '616263'
79 ; CHECK-NEXT:  - Type:            CUSTOM
80 ; CHECK-NEXT:    Name:            linking
81 ; CHECK-NEXT:    Version:         2
82 ; CHECK-NEXT:    SymbolTable:
83 ; CHECK-NEXT:       - Index:           0
84 ; CHECK-NEXT:         Kind:            FUNCTION
85 ; CHECK-NEXT:         Name:            callImport
86 ; CHECK-NEXT:         Flags:           [  ]
87 ; CHECK-NEXT:         Function:        1
88 ; CHECK-NEXT:       - Index:           1
89 ; CHECK-NEXT:         Kind:            FUNCTION
90 ; CHECK-NEXT:         Name:            funcImport
91 ; CHECK-NEXT:         Flags:           [ UNDEFINED ]
92 ; CHECK-NEXT:         Function:        0
93 ; CHECK-NEXT:       - Index:           2
94 ; CHECK-NEXT:         Kind:            FUNCTION
95 ; CHECK-NEXT:         Name:            basicInlineFn
96 ; CHECK-NEXT:         Flags:           [ BINDING_WEAK ]
97 ; CHECK-NEXT:         Function:        2
98 ; CHECK-NEXT:       - Index:           3
99 ; CHECK-NEXT:         Kind:            FUNCTION
100 ; CHECK-NEXT:         Name:            sharedFn
101 ; CHECK-NEXT:         Flags:           [ BINDING_WEAK ]
102 ; CHECK-NEXT:         Function:        3
103 ; CHECK-NEXT:       - Index:           4
104 ; CHECK-NEXT:         Kind:            DATA
105 ; CHECK-NEXT:         Name:            constantData
106 ; CHECK-NEXT:         Flags:           [ BINDING_WEAK ]
107 ; CHECK-NEXT:         Segment:         0
108 ; CHECK-NEXT:         Size:            3
109 ; CHECK-NEXT:    SegmentInfo:
110 ; CHECK-NEXT:      - Index:           0
111 ; CHECK-NEXT:        Name:            .rodata.constantData
112 ; CHECK-NEXT:        Alignment:       0
113 ; CHECK-NEXT:        Flags:           [  ]
114 ; CHECK-NEXT:    Comdats:
115 ; CHECK-NEXT:        Name:            basicInlineFn
116 ; CHECK-NEXT:        Entries:
117 ; CHECK-NEXT:          - Kind:            FUNCTION
118 ; CHECK-NEXT:            Index:           2
119 ; CHECK-NEXT:        Name:            sharedComdat
120 ; CHECK-NEXT:        Entries:
121 ; CHECK-NEXT:          - Kind:            FUNCTION
122 ; CHECK-NEXT:            Index:           3
123 ; CHECK-NEXT:          - Kind:            DATA
124 ; CHECK-NEXT:            Index:           0
125 ; CHECK-NEXT: ...