开发者

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 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? :)

Th开发者_Python百科x


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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜