[LLVMdev] Test compiler help

Erick Tryzelaar idadesub at users.sourceforge.net
Tue Aug 18 10:25:12 PDT 2009


On Tue, Aug 18, 2009 at 10:02 AM, Reid Kleckner<rnk at mit.edu> wrote:
>>> 3. When the program is running, I'd like to print some values. As
>>> Kaleidoscope "returns" the value to the JIT, it's easy to give the
>>> answer, but in my case it won't happen. Do I need to create a simple
>>> IR routine to print doubles or is there something easy to use for that
>>> purpose?
>>
>> Yes, you'll probably need to implement printing functionality.


libc will get linked in automatically, so you have access to all those
functions automatically, like puts or printf. This is pretty obvious
when using the c example compiler:

http://llvm.org/demo/index.cgi


> Or you could link in clang-compiled C code that does it, or call out
> to code that does it.

And along with this, you can use the llvm-gcc family of compilers to
generate bitcode from c, c++, obj-c, and etc to implement your
runtime. Llvm also supports the c calling convention, so you can link
against normal c libraries. However, llvm won't be able to optimize it
as well.



More information about the llvm-dev mailing list