Commit 9ac5df2
committed
[WebAssembly] Add a new
This is an implementation of WebAssembly/tool-conventions#268 here in
LLVM. This adds a new calling convention to Clang, named
`wasm_multivalue`, which is intended to be used on WebAssembly targets
to configure multiple return values and slightly tweak the ABI. Changes
here are:
* Parsing/validation of `__attribute__((wasm_multivalue))`. Note that
validation here means that it's not only well-formed but on wasm
targets the `multivalue` target feature is additionally enabled.
* Clang-level ABI adjustments for the `wasm_multivalue` calling
convention. These are defined by WebAssembly/tool-conventions#268 and
notably includes expanding structs with exactly 2 scalar fields in
parameter-position and directly returning structs with any number of
scalar fields in return-position.
* A new `wasm_multivaluecc` keyword/calling convention for LLVM IR. This
is what Clang lowers to when using the `wasm_multivalue` calling
convention.
* Adjustments at the LLVM ABI layer to support returning multiple values
with the `wasm_multivaluecc` calling convention.
My goal after this would be to start integrating this into Rust next,
under and unstable feature, and then further continue
testing/vetting/etc for component model usage.wasm_multivalue calling convention1 parent 60bd8f8 commit 9ac5df2
33 files changed
Lines changed: 509 additions & 75 deletions
File tree
- clang
- include
- clang-c
- clang/Basic
- lib
- AST
- Basic/Targets
- CodeGen
- Targets
- Sema
- test
- CodeGen/WebAssembly
- Sema
- tools/libclang
- llvm
- include
- llvm-c
- llvm
- AsmParser
- BinaryFormat
- IR
- lib
- AsmParser
- IR
- Target/WebAssembly
- GISel
- test/CodeGen/WebAssembly
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3086 | 3086 | | |
3087 | 3087 | | |
3088 | 3088 | | |
| 3089 | + | |
3089 | 3090 | | |
3090 | 3091 | | |
3091 | 3092 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3555 | 3555 | | |
3556 | 3556 | | |
3557 | 3557 | | |
| 3558 | + | |
| 3559 | + | |
| 3560 | + | |
| 3561 | + | |
| 3562 | + | |
| 3563 | + | |
3558 | 3564 | | |
3559 | 3565 | | |
3560 | 3566 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3732 | 3732 | | |
3733 | 3733 | | |
3734 | 3734 | | |
| 3735 | + | |
| 3736 | + | |
| 3737 | + | |
| 3738 | + | |
| 3739 | + | |
| 3740 | + | |
| 3741 | + | |
| 3742 | + | |
| 3743 | + | |
| 3744 | + | |
| 3745 | + | |
| 3746 | + | |
| 3747 | + | |
| 3748 | + | |
| 3749 | + | |
3735 | 3750 | | |
3736 | 3751 | | |
3737 | 3752 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13832 | 13832 | | |
13833 | 13833 | | |
13834 | 13834 | | |
13835 | | - | |
| 13835 | + | |
13836 | 13836 | | |
13837 | 13837 | | |
13838 | 13838 | | |
| |||
13875 | 13875 | | |
13876 | 13876 | | |
13877 | 13877 | | |
| 13878 | + | |
| 13879 | + | |
| 13880 | + | |
13878 | 13881 | | |
13879 | 13882 | | |
13880 | 13883 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
316 | 316 | | |
317 | 317 | | |
318 | 318 | | |
| 319 | + | |
319 | 320 | | |
320 | 321 | | |
321 | 322 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3534 | 3534 | | |
3535 | 3535 | | |
3536 | 3536 | | |
| 3537 | + | |
3537 | 3538 | | |
3538 | 3539 | | |
3539 | 3540 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3741 | 3741 | | |
3742 | 3742 | | |
3743 | 3743 | | |
| 3744 | + | |
| 3745 | + | |
3744 | 3746 | | |
3745 | 3747 | | |
3746 | 3748 | | |
| |||
4552 | 4554 | | |
4553 | 4555 | | |
4554 | 4556 | | |
| 4557 | + | |
4555 | 4558 | | |
4556 | 4559 | | |
4557 | 4560 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1173 | 1173 | | |
1174 | 1174 | | |
1175 | 1175 | | |
| 1176 | + | |
| 1177 | + | |
| 1178 | + | |
1176 | 1179 | | |
1177 | 1180 | | |
1178 | 1181 | | |
| |||
2088 | 2091 | | |
2089 | 2092 | | |
2090 | 2093 | | |
| 2094 | + | |
| 2095 | + | |
| 2096 | + | |
2091 | 2097 | | |
2092 | 2098 | | |
2093 | 2099 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| 187 | + | |
187 | 188 | | |
188 | 189 | | |
189 | 190 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
| 107 | + | |
106 | 108 | | |
107 | 109 | | |
108 | 110 | | |
| |||
0 commit comments