All Projects → llvm-hs → llvm-hs-kaleidoscope

llvm-hs / llvm-hs-kaleidoscope

Licence: MIT license
Kaleidoscope Tutorial using llvm-hs

Programming Languages

haskell
3896 projects

Projects that are alternatives of or similar to llvm-hs-kaleidoscope

neos
Language agnostic scripting engine with a custom bytecode JIT
Stars: ✭ 36 (-47.06%)
Mutual labels:  jit
snake
A terminal interface for Snake
Stars: ✭ 51 (-25%)
Mutual labels:  haskell-tutorial
sham
A DSL for runtime code generation in racket
Stars: ✭ 63 (-7.35%)
Mutual labels:  jit
adorad
Fast, Expressive, & High-Performance Programming Language for those who dare
Stars: ✭ 54 (-20.59%)
Mutual labels:  jit
wazero
wazero: the zero dependency WebAssembly runtime for Go developers
Stars: ✭ 2,065 (+2936.76%)
Mutual labels:  jit
Batch-First
A JIT compiled chess engine which traverses the search tree in batches in a best-first manner, allowing for neural network batching, asynchronous GPU use, and vectorized CPU computations.
Stars: ✭ 27 (-60.29%)
Mutual labels:  jit
libjit
Unofficial libjit mirror.
Stars: ✭ 46 (-32.35%)
Mutual labels:  jit
angular-compile
🆖 Angular Dynamic Compile - Convert strings to Angular components
Stars: ✭ 87 (+27.94%)
Mutual labels:  jit
tenderjit
JIT for Ruby that is written in Ruby
Stars: ✭ 388 (+470.59%)
Mutual labels:  jit
qemujs
Qemu.js source code with proof-of-concept machine-code-to-WASM JIT.
Stars: ✭ 101 (+48.53%)
Mutual labels:  jit
DoubleStar
A personalized/enhanced re-creation of the Darkhotel "Double Star" APT exploit chain with a focus on Windows 8.1 and mixed with some of my own techniques
Stars: ✭ 140 (+105.88%)
Mutual labels:  jit
openj9
Eclipse OpenJ9: A Java Virtual Machine for OpenJDK that's optimized for small footprint, fast start-up, and high throughput. Builds on Eclipse OMR (https://github.com/eclipse/omr) and combines with the Extensions for OpenJDK for OpenJ9 repo.
Stars: ✭ 2,973 (+4272.06%)
Mutual labels:  jit
RSqueak
A Squeak/Smalltalk VM written in RPython.
Stars: ✭ 78 (+14.71%)
Mutual labels:  jit
py-cryptonight
Python Cryptonight binding / extension. Monero hash function, proof-of-work, cn_slow_hash()
Stars: ✭ 20 (-70.59%)
Mutual labels:  jit
fasmi
F# -> ASM disassembler
Stars: ✭ 168 (+147.06%)
Mutual labels:  jit
CL-CXX-JIT
Common Lisp and CXX interoperation with JIT
Stars: ✭ 40 (-41.18%)
Mutual labels:  jit
transonic
🚀 Make your Python code fly at transonic speeds!
Stars: ✭ 93 (+36.76%)
Mutual labels:  jit
blend2d-rs
Blend2D Bindings for Rust
Stars: ✭ 20 (-70.59%)
Mutual labels:  jit
nj
A cross platform JIT engine based on Eclipse OMR
Stars: ✭ 19 (-72.06%)
Mutual labels:  jit
rpaheui
Industrial-strength implementaiton of Aheui written in RPython with JIT
Stars: ✭ 52 (-23.53%)
Mutual labels:  jit

llvm-tutorial-standalone

Build Status MIT License

A minimal LLVM builder. Basically the same code as the Haskell Kaleidoscope tutorial uses but without going through a frontend AST.

If you want to roll a custom LLVM compiler backend this might be a good starting point for the backend.

Install

Check that your installed LLVM version is precisely 9.0.

$ llvm-config --version
9.0

To build using stack:

$ stack build
$ stack exec main

To build using cabal:

$ cabal new-build

To run:

$ stack run
$ cabal run
Preprocessing executable 'standalone' for tutorial-0.2.0.0...
; ModuleID = 'my cool jit'

define double @main() {
  entry:
    ret double 3.000000e+01
}

Evaluated to: 30.0

Usage

Code is split across

The main program will use the embedded LLVM Monad to define a small program which will add two constants together.

initModule :: AST.Module
initModule = emptyModule "my cool jit"

logic :: LLVM ()
logic = do
  define double "main" [] $ \ptrToMain -> do
    let a = cons $ C.Float (F.Double 10)
    let b = cons $ C.Float (F.Double 20)
    res <- fadd a b
    ret res

main :: IO (AST.Module)
main = do
  let ast = runLLVM initModule logic
  runJIT ast
  return ast

This will generate and JIT compile into the following IR and use the LLVM execution engine to JIT it to machine code.

; ModuleID = 'my cool jit'

define double @main() {
entry:
  %1 = fadd double 1.000000e+01, 2.000000e+01
  ret double %1
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].