Skip to content

Latest commit

 

History

History
58 lines (39 loc) · 927 Bytes

README.md

File metadata and controls

58 lines (39 loc) · 927 Bytes

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