There's been a few demos of this over the years, but nothing went upstream or became widely used. I decided to upstream this, so I wrote an LLVM RFC, sent a pull request currently undergoing review, and set up a build harness with continuous integration under the YoWASP project umbrella to make sure LLVM doesn't regress on Wasm support. (I'll enable daily builds once the PR is merged.)
The build harness produces Clang and LLD built for Wasm with only the Wasm target enabled, and includes a build of compiler-rt, wasi-libc, and libcxxabi/libcxx. (Targeting wasm32-wasip1
only because I still find components incredibly confusing to work with on toolchain level, and because I'm still not quite sure if I want to have the with/without threads variants or if I want to build just the former.) Unfortunately I couldn't reuse the build scripts from wasi-sdk, at least for the moment.
The next steps for me would be to add an npm package wrapping clang.wasm/lld.wasm into a pure function that can be used from other applications, like the YoWASP toolchain VS Code plugin. In the end, the Wasm build of Clang will be used to compile C++ simulation models that can be produced by Yosys or other language frontends like Spade, in order to run high(er) performance digital design simulations.
All of this is making EDA both accessible and reliable like never before.
Last updated: Dec 23 2024 at 13:07 UTC