89 lines · plain
1# RUN: llvm-mc -triple=wasm32-unknown-unknown < %s | FileCheck %s2# RUN: llvm-mc -triple=wasm32-unknown-unknown -filetype=obj < %s | obj2yaml | FileCheck -check-prefix=BIN %s3 4# Tests creating an accessing actual wasm globals5 6.globl read_global7.globl write_global8.globaltype foo_global, i329.globaltype global2, i64, immutable10.globaltype global3, f3211.globaltype global4, f6412 13read_global:14 .functype read_global () -> (i32)15 global.get foo_global16 end_function17 18write_global:19 .functype write_global (i32, i64, f32, f64) -> ()20 local.get 021 global.set foo_global22 local.get 123 global.set global224 local.get 225 global.set global326 local.get 327 global.set global428 end_function29 30foo_global:31global2:32global3:33global4:34 35# CHECK: .globl read_global36# CNEXT: .globl write_global37# CHECK: .globaltype foo_global, i3238# CHECK: foo_global:39 40# BIN: - Type: GLOBAL41# BIN-NEXT: Globals:42# BIN-NEXT: - Index: 043# BIN-NEXT: Type: I3244# BIN-NEXT: Mutable: true45# BIN-NEXT: InitExpr:46# BIN-NEXT: Opcode: I32_CONST47# BIN-NEXT: Value: 048# BIN-NEXT: - Index: 149# BIN-NEXT: Type: I6450# BIN-NEXT: Mutable: false51# BIN-NEXT: InitExpr:52# BIN-NEXT: Opcode: I64_CONST53# BIN-NEXT: Value: 054 55# BIN: - Type: CUSTOM56# BIN-NEXT: Name: linking57# BIN-NEXT: Version: 258# BIN-NEXT: SymbolTable:59# BIN-NEXT: - Index: 060# BIN-NEXT: Kind: FUNCTION61# BIN-NEXT: Name: read_global62# BIN-NEXT: Flags: [ ]63# BIN-NEXT: Function: 064# BIN-NEXT: - Index: 165# BIN-NEXT: Kind: FUNCTION66# BIN-NEXT: Name: write_global67# BIN-NEXT: Flags: [ ]68# BIN-NEXT: Function: 169# BIN-NEXT: - Index: 270# BIN-NEXT: Kind: GLOBAL71# BIN-NEXT: Name: foo_global72# BIN-NEXT: Flags: [ BINDING_LOCAL ]73# BIN-NEXT: Global: 074# BIN-NEXT: - Index: 375# BIN-NEXT: Kind: GLOBAL76# BIN-NEXT: Name: global277# BIN-NEXT: Flags: [ BINDING_LOCAL ]78# BIN-NEXT: Global: 179# BIN-NEXT: - Index: 480# BIN-NEXT: Kind: GLOBAL81# BIN-NEXT: Name: global382# BIN-NEXT: Flags: [ BINDING_LOCAL ]83# BIN-NEXT: Global: 284# BIN-NEXT: - Index: 585# BIN-NEXT: Kind: GLOBAL86# BIN-NEXT: Name: global487# BIN-NEXT: Flags: [ BINDING_LOCAL ]88# BIN-NEXT: Global: 389