English 中文(简体)
How to generate LLVM IR with ANTLR and C target
原标题:
  • 时间:2010-02-02 09:30:53
  •  标签:
  • llvm
  • antlr3

im currently trying to generate LLVM IR with ANTLR3. But the problem ist, that i need the C target (C++ would be better but is not working yet, or is it?) but from C i can t call the LLVM C++ API for Building the IR.

The Tutorial from Terence Parr uses Java and the StringTemplate lib. But as i know the StringTemplate lib ist not available for C.

Does anyone have some good ideas how this can be done? :)

Thx

问题回答

there is a very good entry in the LLVM faq, discussing what you want to do: http://llvm.org/docs/FAQ.html#langirgen It points to llvm-c, which is a C binding to llvm, allowing to generate IR directly from C, and is integrated to llvm since at lease llvm-2.6

The approach Terence takes in its example with antlr-java and stringtemplates is to generate llvm assembly as text (and generating text is really what stringtemplates is about).





相关问题
How to generate LLVM IR with ANTLR and C target

im currently trying to generate LLVM IR with ANTLR3. But the problem ist, that i need the C target (C++ would be better but is not working yet, or is it?) but from C i can t call the LLVM C++ API for ...

How to build LLVM using GCC 4 on Windows?

I have been able to build LLVM 2.6 (the llvm-2.6.tar.gz package) using MinGW GCC 3.4.5. I haven t tested properly, but it seems to work. The trouble is, I have libraries of my own which don t build ...

Pros/Cons of Static and Dynamic Instrumentation

There are many static and dynamic instrumentation tools. Soot is a static instrumentation tool for Java bytecode. Pin and Valgrind are dynamic instrumentation tools for binaries. What are pros and ...

Bootstrapping a language on LLVM

I m bootstrapping a programming language compiler on top of LLVM. Currently I m mostly done writing a compiler for a subset of C which is self-compiling. When I m finished with that, I ll bootstrap ...

Call LLVM Jit from c program

I have generated a bc file with the online compiler on llvm.org, and I would like to know if it is possible to load this bc file from a c or c++ program, execute the IR in the bc file with the llvm ...

LLVM MinGW installation on Vista?

From llvm.org I ve downloaded llvm-2.6-x86-mingw32.tar.bz2 into c:llvm and llvm-gcc-4.2-2.6-x86-mingw32-tar.bz2 into c:llvm-gcc as well as setup a desktop shortcut the following batch file in c:...

热门标签