| Issue |
172732
|
| Summary |
[WebAssembly] add ability to intialize `global`s
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
daxpedda
|
Its currently not possible to define Wasm `global`s with a non-default value.
E.g.:
```gas
.globaltype foo, i32, immutable
```
produces:
```wat
global i32 i32.const 0
```
Unfortunately simply adding a parameter to `.globaltype` wouldn't be enough because in reality Wasm potentially supports a whole instruction sequence here.
Instead I would propose the following:
```gas
.globaltype foo, i32, immutable
.globalinit foo
i32.const -1
end_function // or some other more appropriate directive
```
would produce:
```wat
global i32 i32.const -1
```
Happy to do the implementation on a design sign-off.
Pinging @sbc100 as a target maintainer.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs