<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7654.12">
<TITLE>RE: [LLVMdev] Compile, link and run on the fly</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->

<P><FONT SIZE=2>see tools/llvmc/example/mcc16 for an example driver.<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
<BR>
-----Original Message-----<BR>
From: llvmdev-bounces@cs.uiuc.edu on behalf of Radovan Baranec<BR>
Sent: Fri 4/16/2010 12:29 AM<BR>
To: Reid Kleckner<BR>
Cc: llvmdev@cs.uiuc.edu<BR>
Subject: Re: [LLVMdev] Compile, link and run on the fly<BR>
<BR>
First of all thanks for fast replay. I appreciated it:-)<BR>
<BR>
> Is your compiler written in C++ or something that can interface with<BR>
> it easily?  If so, you should probably check out the JIT, and the<BR>
> tutorial here:<BR>
<BR>
Yes my compiler is written in C++ and I had followed tutorial you <BR>
mentioned.<BR>
<BR>
> It sounds like you're generating LLVM IL and dumping it to a .ll file<BR>
> in your own compiler, so you'll probably have to just add some driver<BR>
> code to your compiler that drives llvm-as, opt, llvm-link, and llc.<BR>
<BR>
Yes I am generating LLVM IR and dumping it to, so far only, .s file using <BR>
my compiler. Other two modules are already manually written so I need the <BR>
one that I generate to link with other two and run. And this was precisely <BR>
my question about. Is it even possible to do so? Can I generate only one <BR>
module, link it with other two and run, everything on the fly in my <BR>
compiler? It will be like glued everything together in one binary file <BR>
(compiler), all phases: compiling, linking, running using single binary. <BR>
 From your answer I partially assumed that it is possible. Can you <BR>
recommend me some other tutorial or sample code?<BR>
<BR>
Rado<BR>
<BR>
Dna Thu, 15 Apr 2010 22:19:28 +0300 Reid Kleckner <rnk@mit.edu> napísal:<BR>
<BR>
> Is your compiler written in C++ or something that can interface with<BR>
> it easily?  If so, you should probably check out the JIT, and the<BR>
> tutorial here:<BR>
> <A HREF="http://llvm.org/docs/tutorial/">http://llvm.org/docs/tutorial/</A><BR>
><BR>
> In particular, this bit is relevant to using a JIT:<BR>
> <A HREF="http://llvm.org/docs/tutorial/LangImpl4.html#jit">http://llvm.org/docs/tutorial/LangImpl4.html#jit</A><BR>
><BR>
> It sounds like you're generating LLVM IL and dumping it to a .ll file<BR>
> in your own compiler, so you'll probably have to just add some driver<BR>
> code to your compiler that drives llvm-as, opt, llvm-link, and llc.<BR>
><BR>
> Reid<BR>
><BR>
> On Thu, Apr 15, 2010 at 1:18 PM, Radovan Baranec <BR>
> <rado.baranec@gmail.com> wrote:<BR>
>> Hi,<BR>
>><BR>
>> I am working on my diploma thesis "Consideration of Virtual Machines<BR>
>> Suitability for Packet Decoding". One of VMs I am testing is LLVM.<BR>
>> Currently I have a filter written in LLVM IR which consist of 3 modules:<BR>
>> filter, decoder and filter_rule. The last one is generated using my<BR>
>> own-written compiler. I`d like to ask if there is a possibility to<BR>
>> generate filter_rule, then link it with other two modules and run on the<BR>
>> fly. Now I compile my own BPF-like minilanguage to IR, then translate it<BR>
>> to bitcode using llvm-as, then link it with other two modules with<BR>
>> llvm-link and finally run with lli. I don`t want to use makefile I want <BR>
>> to<BR>
>> do everything on the fly in my compiler. Thanks.<BR>
>><BR>
>> Radovan Baranec<BR>
>> _______________________________________________<BR>
>> LLVM Developers mailing list<BR>
>> LLVMdev@cs.uiuc.edu         <A HREF="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</A><BR>
>> <A HREF="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</A><BR>
<BR>
_______________________________________________<BR>
LLVM Developers mailing list<BR>
LLVMdev@cs.uiuc.edu         <A HREF="http://llvm.cs.uiuc.edu">http://llvm.cs.uiuc.edu</A><BR>
<A HREF="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</A><BR>
<BR>
</FONT>
</P>

</BODY>
</HTML>