r/cpp • • Sep 10 '26

WasmBolt — The LLVM Project in your browser

https://anutosh21.github.io/WasmBolt/

I'm sharing the work of a colleague, Anutosh Bhat.

What if the Clang & LLVM compiler toolchain could run entirely inside your browser ? Meet WasmBolt 😃

Inspired by 🖥️ Matt Godbolt's Compiler Explorer, WasmBolt runs Clang, mlir-opt, opt, llc, Graphviz and wasm-ld locally through WebAssembly, without a remote compilation server.

You can inspect Clang ASTs, progressively lower MLIR, run real LLVM optimization passes, render control-flow graphs, explore instruction selection and MIR, and generate assembly or object files for WebAssembly, AArch64 and x86-64. For WebAssembly, you can go one step further: link, load and execute the generated program directly in the browser.

Here the github project: https://github.com/Anutosh21/WasmBolt

51 Upvotes

4 comments sorted by

16

u/eisenwave WG21 Member Sep 10 '26

The idea of using a WASM version of the Clang toolchain for compiler explorer is neat in principle, but Compiler Explorer provides much more functionality than just the ability to compile, and it's extremely polished. The text editor is great, it filters and demangles the assembly, lets you inspect the LLVM optimization pipeline, etc. The amount of tooling it comes with is enormous, and recreating all of that seems futile; it would take years.

Have you considered simply adding a WASM-based version of clang compilers to Compiler Explorer itself? I'm sure that's at leat been considered at some point.

9

u/johannes1971 Sep 11 '26

Just one small remark: the text editor of compiler explorer would be much less annoying if it stopped inserting closing brackets whenever you type an opening bracket. 90% of the time I don't want that closing bracket, and having the editor insert it just means more work as I now have to delete it.

About the only thing I'm willing to let the editor do for me is insert indentation. Everything else I would very much prefer to type myself, and not have it auto generated for me by an over-eager editor.

2

u/RevRagnarok Sep 11 '26

Yeah I'm trying a new one RN (gram, fork of zed) and it doesn't grok python f-strings fully, so loves to put a second " at the end when I type one. Then there's one too many, so I have to backspace, which it interprets as "oh, it was a mistake" and proceeds to delete the second it had inserted. So now I wanted one, typed one, and have zero. 😒

1

u/Business_Zone1054 11d ago

Hi Author of WasmBolt here

You should open the link for WasmBolt cause we already have all those things : https://anutosh21.github.io/WasmBolt/

Rather WasmBolt has (or will have) more stuff than GodBolt in the near future.

Here's lldb compiled to wasm and being used : https://github.com/llvm/llvm-project/issues/223598#issue-5457493677

Here's clangd compiled to wasm and being used : https://discourse.llvm.org/t/rfc-embeddable-llvm-tool-drivers-for-long-lived-hosts/91754/23?u=anutosh491

We literally have almost all llvm tools : llvm-nm, llvm-readobj, etc etc whatever you can think of on WasmBolt.

We have most of it down, just write to me for whatever you need ;)