Does compilation from Javascript or Typescript to C require LLVM or Clang or anything? #1698
Replies: 2 comments 1 reply
-
|
There is no transpiling. First the JS is parsed to an AST, the AST is compiled to SSA-based IR, multiple optimizations passes run it, then the IR is gradually lowered to a representation suitable for the target backend (bytecode, native, etc) and finally the backend performs the final lowering into the desired output. Hermes links internally to a forked copy of LLVM and uses it for various purposes like dominator tree construction, but mostly for its data structures (hash maps, etc). |
Beta Was this translation helpful? Give feedback.
-
|
@tmikov OK. Maybe 'transpiling' was a bad term I used. What I meant was that the end result of whatever Static Hermes does is C. That's what I saw, it outputs a temporary C file. OK, so it has its own internal copy of LLVM, that's what I was wondering. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I know that Typescript and Javascript code is transpiled to C before it is compiled to native code, and at this step I believe LLVM or Clang is required to compile to native. However I'm wondering if LLVM/Clang is required at the first step, ie., transpiling the Typescript/Javascript to C or if it's all contained within Static Hermes?
Beta Was this translation helpful? Give feedback.
All reactions