[MIParser] Set RegClassOrRegBank during instruction parsing
[llvm-complete.git] / test / MC / WebAssembly / external-func-address.ll
blob9c16c02a4a0f42c41e0ee4c273d4d244ae4225fd
1 ; RUN: llc -filetype=obj %s -o - | obj2yaml | FileCheck %s
3 target triple = "wasm32-unknown-unknown"
5 ; Verify that addresses of external functions generate correctly typed
6 ; imports and relocations of type R_TABLE_INDEX_I32.
8 declare void @f0(i32) #0
9 @ptr_to_f0 = hidden global void (i32)* @f0, align 4
11 attributes #0 = { "wasm-import-module"="somewhere" "wasm-import-name"="something" }
13 declare void @f1(i32) #1
14 @ptr_to_f1 = hidden global void (i32)* @f1, align 4
16 ; Check that varargs functions have correctly typed imports
17 declare i32 @varargs(i32, i32, ...)
18 define void @call(i32) {
19  %a = call i32 (i32, i32, ...) @varargs(i32 0, i32 0)
20  ret void
23 ; CHECK:      --- !WASM
24 ; CHECK-NEXT: FileHeader:
25 ; CHECK-NEXT:   Version:         0x00000001
26 ; CHECK-NEXT: Sections:
27 ; CHECK-NEXT:   - Type:            TYPE
28 ; CHECK-NEXT:     Signatures:
29 ; CHECK-NEXT:       - Index:           0
30 ; CHECK-NEXT:         ParamTypes:
31 ; CHECK-NEXT:           - I32
32 ; CHECK-NEXT:         ReturnTypes:     []
33 ; CHECK-NEXT:       - Index:           1
34 ; CHECK-NEXT:         ParamTypes:
35 ; CHECK-NEXT:           - I32
36 ; CHECK-NEXT:           - I32
37 ; CHECK-NEXT:           - I32
38 ; CHECK-NEXT:         ReturnTypes:
39 ; CHECK-NEXT:           - I32
40 ; CHECK:        - Type:            IMPORT
41 ; CHECK-NEXT:     Imports:
42 ; CHECK:            - Module:          env
43 ; CHECK-NEXT:         Field:           __linear_memory
44 ; CHECK:            - Module:          env
45 ; CHECK-NEXT:         Field:           __indirect_function_table
46 ; CHECK:            - Module:          env
47 ; CHECK-NEXT:         Field:           varargs
48 ; CHECK-NEXT:         Kind:            FUNCTION
49 ; CHECK-NEXT:         SigIndex:        1
50 ; CHECK:            - Module:          somewhere
51 ; CHECK-NEXT:         Field:           something
52 ; CHECK:            - Module:          env
53 ; CHECK-NEXT:         Field:           f1
54 ; CHECK-NEXT:         Kind:            FUNCTION
55 ; CHECK-NEXT:         SigIndex:        0
56 ; CHECK:        - Type:            ELEM
57 ; CHECK-NEXT:     Segments:
58 ; CHECK-NEXT:       - Offset:
59 ; CHECK-NEXT:           Opcode:          I32_CONST
60 ; CHECK-NEXT:           Value:           1
61 ; CHECK-NEXT:         Functions:       [ 1, 2 ]
62 ; CHECK:        - Type:            DATA{{$}}
63 ; CHECK-NEXT:     Relocations:
64 ; CHECK-NEXT:       - Type:            R_WASM_TABLE_INDEX_I32
65 ; CHECK-NEXT:         Index:           3
66 ; CHECK-NEXT:         Offset:          0x00000006