Hi Jacek,
Yes, basically that should work - run
emcc input.bc -o output.js
where input.bc is LLVM IR, and then you'll get a js+wasm combination that you can run in node.js or on the Web. And with -o output.html you'd also get html etc.
Things to be careful of:
* The LLVM version that generated the IR should be close enough to emscripten's LLVM version. It's best to use the wasm backend (
https://v8.dev/blog/emscripten-llvm-wasm#testing) with emscripten - the default there is a very recent build of LLVM from master. If that's too new for you, you can use an older emscripten version perhaps.
* An alternative to using LLVM IR is to use wasm object files, which are a much more stable format. You can emit those using your compiler's LLVM by telling it to use the wasm backend, and then run emcc on that .o file.
* Emscripten's libc etc. assume the code was compiled with the emscripten headers. If not, the ABI may be incompatible for things like syscalls.
- Alon