Kengo's blog

Technical articles about original projects, JVM, Static Analysis and JavaScript.


How to implement Brainf*ck on LLVM IR

I am still thinking... Brainf*ckLLVM IR > (incr pointer)load, add nsw, storephi < (decr pointer)load, sub nsw, storephi + (incr value)getelementptr, load, add nsw, store - (decr value)getelementptr, load, sub nsw, store . (output)call i32 …

Hello, LLVM

LLVM3.2 on OSX. quickstart $ cat hello.cpp #include <stdio.h> int main() { printf("Hello World!\n"); } $ clang++ hello.cpp -emit-llvm -S -o hello.ll $ cat hello.ll ; ModuleID = 'hello.cpp' target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i</stdio.h>…