File: globals.s

package info (click to toggle)
llvm-toolchain-15 1%3A15.0.6-4
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,554,644 kB
  • sloc: cpp: 5,922,452; ansic: 1,012,136; asm: 674,362; python: 191,568; objc: 73,855; f90: 42,327; lisp: 31,913; pascal: 11,973; javascript: 10,144; sh: 9,421; perl: 7,447; ml: 5,527; awk: 3,523; makefile: 2,520; xml: 885; cs: 573; fortran: 567
file content (88 lines) | stat: -rw-r--r-- 2,809 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# RUN: llvm-mc -triple=wasm32-unknown-unknown < %s | FileCheck %s
# RUN: llvm-mc -triple=wasm32-unknown-unknown -filetype=obj < %s | obj2yaml | FileCheck -check-prefix=BIN %s

# Tests creating an accessing actual wasm globals

.globl read_global
.globl write_global
.globaltype foo_global, i32
.globaltype global2, i64, immutable
.globaltype global3, f32
.globaltype global4, f64

read_global:
  .functype read_global () -> (i32)
  global.get foo_global
  end_function

write_global:
  .functype write_global (i32, i64, f32, f64) -> ()
  local.get 0
  global.set foo_global
  local.get 1
  global.set global2
  local.get 2
  global.set global3
  local.get 3
  global.set global4
  end_function

foo_global:
global2:
global3:
global4:

# CHECK: .globl  read_global
# CNEXT: .globl  write_global
# CHECK: .globaltype foo_global, i32
# CHECK: foo_global:

#      BIN: - Type:            GLOBAL
# BIN-NEXT:   Globals:
# BIN-NEXT:     - Index:           0
# BIN-NEXT:       Type:            I32
# BIN-NEXT:       Mutable:         true
# BIN-NEXT:       InitExpr:
# BIN-NEXT:         Opcode:          I32_CONST
# BIN-NEXT:         Value:           0
# BIN-NEXT:     - Index:           1
# BIN-NEXT:       Type:            I64
# BIN-NEXT:       Mutable:         false
# BIN-NEXT:       InitExpr:
# BIN-NEXT:         Opcode:          I64_CONST
# BIN-NEXT:         Value:           0

#      BIN:  - Type:            CUSTOM
# BIN-NEXT:    Name:            linking
# BIN-NEXT:    Version:         2
# BIN-NEXT:    SymbolTable:
# BIN-NEXT:      - Index:           0
# BIN-NEXT:        Kind:            FUNCTION
# BIN-NEXT:        Name:            read_global
# BIN-NEXT:        Flags:           [  ]
# BIN-NEXT:        Function:        0
# BIN-NEXT:      - Index:           1
# BIN-NEXT:        Kind:            FUNCTION
# BIN-NEXT:        Name:            write_global
# BIN-NEXT:        Flags:           [  ]
# BIN-NEXT:        Function:        1
# BIN-NEXT:      - Index:           2
# BIN-NEXT:        Kind:            GLOBAL
# BIN-NEXT:        Name:            foo_global
# BIN-NEXT:        Flags:           [ BINDING_LOCAL ]
# BIN-NEXT:        Global:          0
# BIN-NEXT:      - Index:           3
# BIN-NEXT:        Kind:            GLOBAL
# BIN-NEXT:        Name:            global2
# BIN-NEXT:        Flags:           [ BINDING_LOCAL ]
# BIN-NEXT:        Global:          1
# BIN-NEXT:      - Index:           4
# BIN-NEXT:        Kind:            GLOBAL
# BIN-NEXT:        Name:            global3
# BIN-NEXT:        Flags:           [ BINDING_LOCAL ]
# BIN-NEXT:        Global:          2
# BIN-NEXT:      - Index:           5
# BIN-NEXT:        Kind:            GLOBAL
# BIN-NEXT:        Name:            global4
# BIN-NEXT:        Flags:           [ BINDING_LOCAL ]
# BIN-NEXT:        Global:          3