[LLVMdev] Compile, link and run on the fly

Sanjiv.Gupta at microchip.com Sanjiv.Gupta at microchip.com
Fri Apr 16 03:06:45 PDT 2010


see tools/llvmc/example/mcc16 for an example driver.






-----Original Message-----
From: llvmdev-bounces at cs.uiuc.edu on behalf of Radovan Baranec
Sent: Fri 4/16/2010 12:29 AM
To: Reid Kleckner
Cc: llvmdev at cs.uiuc.edu
Subject: Re: [LLVMdev] Compile, link and run on the fly
 
First of all thanks for fast replay. I appreciated it:-)

> Is your compiler written in C++ or something that can interface with
> it easily?  If so, you should probably check out the JIT, and the
> tutorial here:

Yes my compiler is written in C++ and I had followed tutorial you  
mentioned.

> It sounds like you're generating LLVM IL and dumping it to a .ll file
> in your own compiler, so you'll probably have to just add some driver
> code to your compiler that drives llvm-as, opt, llvm-link, and llc.

Yes I am generating LLVM IR and dumping it to, so far only, .s file using  
my compiler. Other two modules are already manually written so I need the  
one that I generate to link with other two and run. And this was precisely  
my question about. Is it even possible to do so? Can I generate only one  
module, link it with other two and run, everything on the fly in my  
compiler? It will be like glued everything together in one binary file  
(compiler), all phases: compiling, linking, running using single binary.  
 From your answer I partially assumed that it is possible. Can you  
recommend me some other tutorial or sample code?

Rado

Dna Thu, 15 Apr 2010 22:19:28 +0300 Reid Kleckner <rnk at mit.edu> napĂ­sal:

> Is your compiler written in C++ or something that can interface with
> it easily?  If so, you should probably check out the JIT, and the
> tutorial here:
> http://llvm.org/docs/tutorial/
>
> In particular, this bit is relevant to using a JIT:
> http://llvm.org/docs/tutorial/LangImpl4.html#jit
>
> It sounds like you're generating LLVM IL and dumping it to a .ll file
> in your own compiler, so you'll probably have to just add some driver
> code to your compiler that drives llvm-as, opt, llvm-link, and llc.
>
> Reid
>
> On Thu, Apr 15, 2010 at 1:18 PM, Radovan Baranec  
> <rado.baranec at gmail.com> wrote:
>> Hi,
>>
>> I am working on my diploma thesis "Consideration of Virtual Machines
>> Suitability for Packet Decoding". One of VMs I am testing is LLVM.
>> Currently I have a filter written in LLVM IR which consist of 3 modules:
>> filter, decoder and filter_rule. The last one is generated using my
>> own-written compiler. I`d like to ask if there is a possibility to
>> generate filter_rule, then link it with other two modules and run on the
>> fly. Now I compile my own BPF-like minilanguage to IR, then translate it
>> to bitcode using llvm-as, then link it with other two modules with
>> llvm-link and finally run with lli. I don`t want to use makefile I want  
>> to
>> do everything on the fly in my compiler. Thanks.
>>
>> Radovan Baranec
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100416/4377931f/attachment.html>


More information about the llvm-dev mailing list