可以从LLVM-IR自动生成llvm c ++ api代码? [英] Possible to auto-generate llvm c++ api code from LLVM-IR?

查看:1039
本文介绍了可以从LLVM-IR自动生成llvm c ++ api代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

clang 3.0在线演示页面 http://llvm.org/demo/index.cgi 提供了一个选项输出LLVM C ++ API代码代表输入程序的LLVM-IR。



是产生LLVM C ++ API代码输出一个clang选项



是可以做的吗?



相同的东西,但从LLVM-IR输入?基本上我想看到产生一个特定的llvm-ir序列需要适当的llvm c ++ api调用。我想通过示例而不是从文档向前学习。



手动页面以及--help和--help-hidden用于clang,llvm-as和llvm-dis不会显示任何明显的内容。



现在我在该网页的输出中看到由llvm2cpp生成但是在最近的llvm版本中找不到该工具,只有旧版本,有一个新工具在2.9和3.0接管llvm2cpp?

解决方案

是的。 C ++后端是这样做的工具。尝试llc -march = cpp foo.bc


The clang 3.0 online demo page http://llvm.org/demo/index.cgi provides an option to output LLVM C++ API code" representing the LLVM-IR for the input program.

Is "produce LLVM C++ API code" output a clang option (and if so, what is it)?

Or is it an llvm tool option (which one)?

Is it possible to do the same thing but from LLVM-IR input? Basically I'd like to see the proper llvm c++ api calls needed to produce a particular given llvm-ir sequence. I'd like to learn backwards by example rather than forwards from the documentation.

Manual pages and --help and --help-hidden for clang, llvm-as and llvm-dis don't show anything obvious.

edit: OK now I see in the output on that web page, "generated by llvm2cpp". But I can't find that tool in recent llvm releases, only old releases, has a new tool in 2.9 and 3.0 taken over for llvm2cpp?

解决方案

Yes. C++ backend is the tool which does this. Try "llc -march=cpp foo.bc"

这篇关于可以从LLVM-IR自动生成llvm c ++ api代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆