Skip to content

dvoytenko/typescript-llvm

Repository files navigation

Typescript to LLVM Compiler

To get started

  1. Ensure clang is installed.
  2. Install LLVM.
  3. Install WABT.
  4. Run npm install.

To run

npm install
npm run test

Known issues

  1. I had to patch llvm-bindings in a few places. Not all of them have been released yet. E.g. see ApsarasX/llvm-bindings#23.

Some common commands

Assembly to bitcode:

llvm-as x.ll
ls -l x.bc

To compile .ll to machine code:

llc x.ll -filetype=obj
gcc x.o
./a.out

To run optimizer:

opt -Oz -S -o x.Oz.ll x.ll
# --metarenamer - rename everything

To WASM:

llc -mtriple=wasm32-unknown-unknown -O3 -filetype=obj one.ll -o one.o
wasm-ld one.o -o one.wasm -allow-undefined --entry "main"

To see WAT (see wabt):

wasm2wat -o one.wat one.wasm

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published