Hello guys,

for a uni paper I need to explain how Emscripten works (on higher-level) to 
emit WebAssembly-Binary in the end.
I'm new into compilers and toolchains and I'm not sure if I understand it 
correctly, how Emscripten is converting compatible code (like C) to 
WebAssembly Binary.

If I got it right, for creating .wasm, these tools are used by Emscripten:

   - emsdk as configurator for the whole toolchain
   - emcc (which includes Clang+LLVM)
   - the (upstream) LLVM WebAssembly Backend
   - Binaryen

So if i got it right, to create .wasm, the compilation works like this:

   1. C-Code -> LLVM IR
   2. LLVM IR -> LLVM IR (optimized)
   3. LLVM IR (optimized) -> Wasm Binary
   4. Wasm Binary -> Wasm Binary (optimized)
   5. (Wasm Binary (optimized) -> JS) [optional]

Did I forget something?

What I am especially unsure of, is, which tool is doing what:
So emcc uses Clang+LLVM. Now I'm not sure if emcc emits LLVM IR only (since 
Clang is creating LLVM IR), or does it also convert it to emit Wasm Binary 
(which means that the upstream LLVM Wasm Backend lies in the emcc)?
What I'm quite sure of, is that step 1 is done by Clang and steps 4 & 5 are 
done by Binaryen.

Also, to me it seems like 'emcc' has 2 different meanings: 1. as part(!!) 
of the compilation process and 2. as command representation for the whole 
toolchain

Also, which component/tool of Emscripten is creating the JS and HTML 
Gluecode?

I'm happy if someone can help me out!

-- 
You received this message because you are subscribed to the Google Groups 
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to emscripten-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/emscripten-discuss/3efb5151-1d5c-4ae1-89a5-b37ed3085793n%40googlegroups.com.

Reply via email to