On 07/05/2026 01:26, Thomas Schwinge wrote:
Hi!
On 2026-05-06T01:30:43+0300, feedable <[email protected]> wrote:
This patch series introduces a GCC backend for WebAssembly.
Hey, great that you're working on this!
I've had this idea, many years ago (when I had first heard about
asm.js/WebAssembly); see, for example,
<https://inbox.sourceware.org/[email protected]>
"Re: More compatibility it's possible?". But of course, I always have
too many ideas, and too little time, so... ;-)
Your code is not based on Pip Cet's "asmjs" work (see the URL above), I
assume? (..., from almost a decade ago, oh wow...)
Hi, no, I wasn't even aware that there was any GCC-related prior art here.
I did find out, however, that there was some effort in gas and bfd to
support wasm (via LLVM syntax), but I didn't use that, because I opted
for the official assembly format earlier.
I would like
some feedback on the overall code, before merging it.
I'll try to have a look, but it'll take me a while.
You're aware that for getting this accepted into GCC, you'll need
approval by the GCC Steering Committee? See
<https://gcc.gnu.org/steering.html> "GCC steering committee",
<https://gcc.gnu.org/wiki/gcc-steering-committee>
"GCC Steering Committee":
"Accepting major contributions to GCC, such as [...] new backends [...]".
(Happy to try to help with that, too.)
Yes, I'm aware, but I don't really know the process, so I hoped that
would just be picked up by them?
In any case, I think I would like some help with this.
Grüße
Thomas
Please consult https://gcc.gnu.org/wiki/WebAssemblyBackend for build
instructions and the current feature implementation status in the
backend.
Please note that the following patch would be a prerequisite for this patchset,
I just didn't feel like submitting a patch with x86 code in it would make sense
here:
https://gcc.gnu.org/pipermail/gcc-patches/2026-May/715690.html
feedable (3):
df: Add support for pseudos in function arguments
wasm: New backend
wasm: Adjust tests
gcc/config.gcc | 7 +
gcc/config/wasm/attrs.md | 84 ++
gcc/config/wasm/t-wasm | 13 +
gcc/config/wasm/wasm-asm.cc | 945 ++++++++++++++++++
gcc/config/wasm/wasm-cg.cc | 621 ++++++++++++
gcc/config/wasm/wasm-modes.def | 0
gcc/config/wasm/wasm-passes.cc | 153 +++
gcc/config/wasm/wasm-passes.def | 27 +
gcc/config/wasm/wasm-protos.h | 12 +
gcc/config/wasm/wasm.cc | 128 +++
gcc/config/wasm/wasm.h | 307 ++++++
gcc/config/wasm/wasm.md | 495 +++++++++
gcc/df-problems.cc | 6 +-
gcc/df-scan.cc | 4 +
gcc/doc/tm.texi | 5 +
gcc/doc/tm.texi.in | 2 +
gcc/expr.cc | 3 +-
gcc/target.def | 7 +
gcc/testsuite/c-c++-common/analyzer/errno-1.c | 2 +
.../c-c++-common/analyzer/isatty-1.c | 1 +
.../gcc.c-torture/compile/20000804-1.c | 1 +
gcc/testsuite/gcc.c-torture/compile/pr55921.c | 1 +
.../gcc.c-torture/compile/pr60655-1.c | 2 +-
.../gcc.c-torture/execute/20030222-1.c | 2 +-
.../execute/builtins/20010124-1.x | 2 +-
.../ieee/bfloat16-builtin-issignaling-1.c | 1 +
.../execute/ieee/builtin-issignaling-1.c | 1 +
.../ieee/float128-builtin-issignaling-1.c | 1 +
.../ieee/float128x-builtin-issignaling-1.c | 1 +
.../ieee/float16-builtin-issignaling-1.c | 1 +
.../ieee/float32-builtin-issignaling-1.c | 1 +
.../ieee/float32x-builtin-issignaling-1.c | 1 +
.../ieee/float64-builtin-issignaling-1.c | 1 +
.../ieee/float64x-builtin-issignaling-1.c | 1 +
.../gcc.c-torture/execute/pr67037-1.c | 56 ++
gcc/testsuite/gcc.c-torture/execute/pr67037.c | 4 +-
gcc/testsuite/gcc.dg/20060410.c | 2 +-
.../analyzer/fd-access-mode-target-headers.c | 1 +
.../gcc.dg/analyzer/fd-mktemp-family.c | 1 +
gcc/testsuite/gcc.dg/analyzer/mkdtemp-1.c | 1 +
gcc/testsuite/gcc.dg/analyzer/mkostemp-1.c | 1 +
gcc/testsuite/gcc.dg/analyzer/mkostemps-1.c | 1 +
gcc/testsuite/gcc.dg/analyzer/mkstemp-1.c | 1 +
gcc/testsuite/gcc.dg/analyzer/mkstemps-1.c | 1 +
gcc/testsuite/gcc.dg/analyzer/mktemp-1.c | 1 +
gcc/testsuite/gcc.dg/array-quals-1.c | 1 +
gcc/testsuite/gcc.dg/attr-weakref-1.c | 3 +
gcc/testsuite/gcc.dg/builtin-alloc-size.c | 1 +
gcc/testsuite/gcc.dg/builtin-apply5.c | 1 +
gcc/testsuite/gcc.dg/builtin-prefetch-1.c | 3 +-
gcc/testsuite/gcc.dg/builtins-config.h | 2 +
gcc/testsuite/gcc.dg/builtins-nonnull.c | 1 +
gcc/testsuite/gcc.dg/c23-stdint-1.c | 1 +
gcc/testsuite/gcc.dg/c99-stdint-1.c | 1 +
gcc/testsuite/gcc.dg/c99-stdint-2.c | 1 +
gcc/testsuite/gcc.dg/c99-stdint-7.c | 3 +
gcc/testsuite/gcc.dg/c99-stdint-8.c | 1 +
gcc/testsuite/gcc.dg/charset/function.c | 2 +-
gcc/testsuite/gcc.dg/cpp/escape-3.i | 1 +
gcc/testsuite/gcc.dg/format/pr78304.c | 1 +
gcc/testsuite/gcc.dg/ipa/symver1.c | 2 +-
gcc/testsuite/gcc.dg/lower-subreg-1.c | 2 +-
gcc/testsuite/gcc.dg/pch/valid-1.c | 1 +
gcc/testsuite/gcc.dg/pr115066.c | 2 +-
gcc/testsuite/gcc.dg/pr28755.c | 2 +-
gcc/testsuite/gcc.dg/pr49551.c | 2 +-
gcc/testsuite/gcc.dg/profile-info-section.c | 1 +
gcc/testsuite/gcc.dg/stdint-width-1.c | 1 +
gcc/testsuite/gcc.dg/stdint-width-2.c | 1 +
gcc/testsuite/gcc.dg/tls/thr-cse-1.c | 2 +-
gcc/testsuite/gcc.misc-tests/gcov-23.c | 1 +
gcc/testsuite/gcc.misc-tests/gcov.exp | 4 +
gcc/testsuite/gcc.misc-tests/options.exp | 9 +-
gcc/testsuite/lib/file-format.exp | 8 +-
gcc/testsuite/lib/scanasm.exp | 2 +
gcc/testsuite/lib/target-supports.exp | 39 +-
libgcc/config.host | 5 +
libgcc/config/wasm/t-wasm | 4 +
78 files changed, 2991 insertions(+), 29 deletions(-)
create mode 100644 gcc/config/wasm/attrs.md
create mode 100644 gcc/config/wasm/t-wasm
create mode 100644 gcc/config/wasm/wasm-asm.cc
create mode 100644 gcc/config/wasm/wasm-cg.cc
create mode 100644 gcc/config/wasm/wasm-modes.def
create mode 100644 gcc/config/wasm/wasm-passes.cc
create mode 100644 gcc/config/wasm/wasm-passes.def
create mode 100644 gcc/config/wasm/wasm-protos.h
create mode 100644 gcc/config/wasm/wasm.cc
create mode 100644 gcc/config/wasm/wasm.h
create mode 100644 gcc/config/wasm/wasm.md
create mode 100644 gcc/testsuite/gcc.c-torture/execute/pr67037-1.c
create mode 100644 libgcc/config/wasm/t-wasm
--
2.54.0