LLVMを試してみる

# C++ source(sample.cpp) -> LLVM assembly language(sample.ll)
llvm-gcc -S -emit-llvm sample.cpp -o sample.ll

# LLVM assembly language(sample.ll) -> LLVM bitcode(sample.bc)
llvm-as sample.ll -o sample.bc

# (remove sample.ll)
rm -f sample.ll

# LLVM bitcode(sample.bc) -> LLVM assembly language(sample.ll)
llvm-dis sample.bc -o sample.ll

# execute LLVM bitcode(sample.bc)
lli sample.bc