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

Sean Silva silvas at purdue.edu
Tue Apr 16 09:55:58 PDT 2013


On Tue, Apr 16, 2013 at 10:09 AM, bob zhang <bobzhang1988 at gmail.com> wrote:

>
>
> Thanks for your reply.
> On Mon, Apr 15, 2013 at 9:15 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
>> On Mon, Apr 15, 2013 at 3:32 PM, Hongbo Zhang <bobzhang1988 at gmail.com>
>> wrote:
>> > 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.
>>
>> To be clear you're suggesting having your frontend (say, for
>> argument's sake, written in C++) parse your toy language and then emit
>> a (say) Haskell representation of IR? Using some Haskell APIs you'll
>> write that will emit LLVM bitcode? And then running the resulting
>> Haskell program to produce your bitcode that you'll load back in to
>> LLVM to optimize/compile?
>>
>>  Yes, that's what I am doing, in OCaml though. Functional languages are
> excellent
> for program transformation and manipulation. Where is the specification
> for the bitcode format?
>

http://llvm.org/docs/BitCodeFormat.html

-- Sean Silva
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130416/e6e784c8/attachment.html>


More information about the llvm-dev mailing list