brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.9 KiB · 8239432 Raw
204 lines · plain
1# RUN: llvm-mc -triple=wasm32-unknown-unknown -mattr=+reference-types < %s | FileCheck %s2# RUN: llvm-mc -show-encoding -triple=wasm32-unknown-unknown -mattr=+reference-types < %s | FileCheck -check-prefix=ENC %s3# RUN: llvm-mc -triple=wasm32-unknown-unknown -mattr=+reference-types -filetype=obj < %s | obj2yaml | FileCheck -check-prefix=BIN %s4 5# Creating several empty tables6 7# CHECK:         .tabletype foo, externref8# CHECK: foo:9    .tabletype foo, externref10foo:11 12 13#      CHECK: bar:14# CHECK-NEXT:         .tabletype bar, funcref15bar:16    .tabletype bar, funcref17 18table1:19    .tabletype table1, funcref, 4220table2:21    .tabletype table2, funcref, 42, 10022 23# Table instructions24 25#      CHECK: copy_tables:26# CHECK-NEXT:         .functype	copy_tables (i32, i32) -> ()27# CHECK-NEXT:	local.get	028# CHECK-NEXT:	local.get	129#      CHECK:	table.size	table130#      CHECK:	table.copy	table1, table231# CHECK-NEXT:	end_function32copy_tables:33    .functype copy_tables (i32, i32) -> ()34    local.get 035    local.get 136 37    # ENC: table.size	table1                  # encoding: [0xfc,0x10,0x80'A',0x80'A',0x80'A',0x80'A',A]38    table.size table139 40    # ENC: table.copy	table1, table2          # encoding: [0xfc,0x0e,0x80'A',0x80'A',0x80'A',0x80'A',A,0x80'B',0x80'B',0x80'B',0x80'B',B]41    table.copy table1, table242    end_function43 44#      CHECK: table_get:45# CHECK-NEXT:	.functype	table_get (i32) -> (externref)46# CHECK-NEXT:	local.get	047#      CHECK:	table.get	foo48# CHECK-NEXT:	end_function49table_get:50    .functype table_get (i32) -> (externref)51    local.get 052 53    # ENC: table.get	foo                     # encoding: [0x25,0x80'A',0x80'A',0x80'A',0x80'A',A]54    table.get foo55    end_function56 57#      CHECK: table_set:58# CHECK-NEXT:	.functype	table_set (i32, externref) -> ()59# CHECK-NEXT:	local.get	060# CHECK-NEXT:	local.get	161#      CHECK:	table.set	foo62# CHECK-NEXT:	end_function63table_set:64    .functype table_set (i32, externref) -> ()65    local.get 066    local.get 167 68    # ENC: table.set	foo                     # encoding: [0x26,0x80'A',0x80'A',0x80'A',0x80'A',A]69    table.set foo70    end_function71 72#      CHECK: table_grow:73# CHECK-NEXT:	.functype	table_grow (i32) -> (i32)74# CHECK-NEXT:	i32.const	075# CHECK-NEXT:	table.get	foo76# CHECK-NEXT:	local.get	077#      CHECK:	table.grow	foo78# CHECK-NEXT:	local.get	079# CHECK-NEXT:	i32.add80# CHECK-NEXT:	end_function81table_grow:82    .functype table_grow (i32) -> (i32)83    i32.const 084    table.get foo85    local.get 086 87    # ENC: table.grow	foo                     # encoding: [0xfc,0x0f,0x80'A',0x80'A',0x80'A',0x80'A',A]88    table.grow foo89    local.get 090    i32.add91    end_function92 93#      CHECK: table_fill:94# CHECK-NEXT:	.functype	table_fill (i32, i32) -> ()95# CHECK-NEXT:	local.get	096# CHECK-NEXT:	i32.const	097# CHECK-NEXT:	table.get	table198# CHECK-NEXT:	local.get	199#      CHECK:	table.fill	table1100# CHECK-NEXT:	end_function101table_fill:102    .functype table_fill (i32, i32) -> ()103    local.get 0104    i32.const 0105    table.get table1106    local.get 1107 108    # ENC: table.fill	table1                  # encoding: [0xfc,0x11,0x80'A',0x80'A',0x80'A',0x80'A',A]109    table.fill table1110    end_function111 112#      BIN:  - Type:            TABLE113# BIN-NEXT:    Tables:114# BIN-NEXT:      - Index:           0115# BIN-NEXT:        ElemType:        EXTERNREF116# BIN-NEXT:        Limits:117# BIN-NEXT:          Minimum:         0x0118# BIN-NEXT:      - Index:           1119# BIN-NEXT:        ElemType:        FUNCREF120# BIN-NEXT:        Limits:121# BIN-NEXT:          Minimum:         0x0122# BIN-NEXT:      - Index:           2123# BIN-NEXT:        ElemType:        FUNCREF124# BIN-NEXT:        Limits:125# BIN-NEXT:          Minimum:         0x2A126# BIN-NEXT:      - Index:           3127# BIN-NEXT:        ElemType:        FUNCREF128# BIN-NEXT:        Limits:129# BIN-NEXT:          Flags:           [ HAS_MAX ]130# BIN-NEXT:          Minimum:         0x2A131# BIN-NEXT:          Maximum:         0x64132 133#      BIN:  - Type:            CODE134# BIN-NEXT:    Relocations:135# BIN-NEXT:      - Type:            R_WASM_TABLE_NUMBER_LEB136# BIN-NEXT:        Index:           2137# BIN-NEXT:        Offset:          0x9138# BIN-NEXT:      - Type:            R_WASM_TABLE_NUMBER_LEB139# BIN-NEXT:        Index:           2140# BIN-NEXT:        Offset:          0x10141# BIN-NEXT:      - Type:            R_WASM_TABLE_NUMBER_LEB142# BIN-NEXT:        Index:           3143# BIN-NEXT:        Offset:          0x15144# BIN-NEXT:      - Type:            R_WASM_TABLE_NUMBER_LEB145# BIN-NEXT:        Index:           0146# BIN-NEXT:        Offset:          0x20147# BIN-NEXT:      - Type:            R_WASM_TABLE_NUMBER_LEB148# BIN-NEXT:        Index:           0149# BIN-NEXT:        Offset:          0x2D150# BIN-NEXT:      - Type:            R_WASM_TABLE_NUMBER_LEB151# BIN-NEXT:        Index:           0152# BIN-NEXT:        Offset:          0x38153# BIN-NEXT:      - Type:            R_WASM_TABLE_NUMBER_LEB154# BIN-NEXT:        Index:           0155# BIN-NEXT:        Offset:          0x41156# BIN-NEXT:      - Type:            R_WASM_TABLE_NUMBER_LEB157# BIN-NEXT:        Index:           2158# BIN-NEXT:        Offset:          0x51159# BIN-NEXT:      - Type:            R_WASM_TABLE_NUMBER_LEB160# BIN-NEXT:        Index:           2161# BIN-NEXT:        Offset:          0x5A162# BIN-NEXT:    Functions:163# BIN-NEXT:      - Index:           0164# BIN-NEXT:        Locals:          []165# BIN-NEXT:        Body:            20002001FC108280808000FC0E828080800083808080000B166# BIN-NEXT:      - Index:           1167# BIN-NEXT:        Locals:          []168# BIN-NEXT:        Body:            20002580808080000B169# BIN-NEXT:      - Index:           2170# BIN-NEXT:        Locals:          []171# BIN-NEXT:        Body:            200020012680808080000B172# BIN-NEXT:      - Index:           3173# BIN-NEXT:        Locals:          []174# BIN-NEXT:        Body:            41002580808080002000FC0F808080800020006A0B175# BIN-NEXT:      - Index:           4176# BIN-NEXT:        Locals:          []177# BIN-NEXT:        Body:            200041002582808080002001FC1182808080000B178 179#      BIN:  - Type:            CUSTOM180# BIN-NEXT:    Name:            linking181# BIN-NEXT:    Version:         2182# BIN-NEXT:    SymbolTable:183# BIN-NEXT:      - Index:           0184# BIN-NEXT:        Kind:            TABLE185# BIN-NEXT:        Name:            foo186# BIN-NEXT:        Flags:           [ BINDING_LOCAL ]187# BIN-NEXT:        Table:           0188# BIN-NEXT:      - Index:           1189# BIN-NEXT:        Kind:            TABLE190# BIN-NEXT:        Name:            bar191# BIN-NEXT:        Flags:           [ BINDING_LOCAL ]192# BIN-NEXT:        Table:           1193# BIN-NEXT:      - Index:           2194# BIN-NEXT:        Kind:            TABLE195# BIN-NEXT:        Name:            table1196# BIN-NEXT:        Flags:           [ BINDING_LOCAL ]197# BIN-NEXT:        Table:           2198# BIN-NEXT:      - Index:           3199# BIN-NEXT:        Kind:            TABLE200# BIN-NEXT:        Name:            table2201# BIN-NEXT:        Flags:           [ BINDING_LOCAL ]202# BIN-NEXT:        Table:           3203# BIN-NEXT:      - Index:           4204