[LLVMdev] The most efficient way to compile to LLVM IR?

Hongbo Zhang bobzhang1988 at gmail.com
Mon Apr 15 15:32:40 PDT 2013


Hi all,
    I am trying to compile my toy language to LLVM back end. (I am new 
to LLVM, so my questions may sound naive)
    I am looking at some tutorials about LLVM, most are about how to use 
LLVM IRBuilder, however, I find the API provided by IRBuilder is quite 
imperative and verbose, and the API changes so fast that most of the 
tutorials are out of dated.
    So I am wondering what's the benefit of emitting LLVM IR using 
IRBuilder compared with designing my own abstract syntax in a high-level 
programming language(e.g. Haskell or OCaml) and unparsing it to LLVM IR. 
Is there some benefit of using IRBuilder I ignored here? And I have some 
follow-up questions: 1. How stable is the IR format? 2. Is the binary 
representation of IR format (*.bc) stable and the same across different 
platforms? 3. Is there any previous work of building a 
declarative`interface instead of using IRBuilder?
    Thank you in advance!



More information about the llvm-dev mailing list