源到源代码编译与LLVM [英] Source-to-source compilation with LLVM

查看:541
本文介绍了源到源代码编译与LLVM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要x86汇编源$ C ​​$ C转换为LLVM可读.ll文件(又名LLVM汇编语言)。我怎样才能做到这一点?如果没有直接的解决方案,才有可能实现LLVM基础设施中的一个作为与少努力,可能吗?

I need to convert x86 assembly source code to LLVM human-readable .ll file (aka LLVM assembly language). How can I do this? If there is no direct solution would it be possible to implement one within the LLVM infrastructure with as less efforts as possible?

我想,我在寻找解决方案应该是某种有限责任公司的对应的转换.s文件回.ll重新presentation。

I guess, the solution I'm looking for should be some kind of llc's counterpart that converts .s file back to .ll representation.

推荐答案

只是对于那些谁仍在寻求更多的信息,关于这个话题,我想分享大约一个正在进行的项目(信息的http://dslab.epfl.ch/proj/s2e ),我已经在网上找到。该项目由两部分组成:

Just for those who are still seeking for more information on this topic, I want to share the information about one ongoing project (http://dslab.epfl.ch/proj/s2e) that I've found on the web. The project has two components:


  1. x86-to-LLVM后端 用于x86机器code到LLVM IR动态转换

  2. RevGen 用于x86二进制的静态分析,能够工具在线翻译x86汇编到LLVM IR

这里的 RevGen 原型的:
RevGen需要输入一个x86二进制和分三步输出相当于LLVM模块。首先,RevGen查找code的所有可执行块,并把它们转换成LLVM编译块。其次,当没有更多的翻译块覆盖,RevGen将它们转换成基本程序块并重建在LLVM格式原二进制的控制流图。第三,RevGen解决外部函数调用来建立最终的LLVM模块。对于动态分析,在最后一步的链接LLVM模块运行时库,允许LLVM模块的执行。

Here is RevGen prototype: RevGen takes as input an x86 binary and outputs an equivalent LLVM module in three steps. First, RevGen looks for all executable blocks of code and converts them to LLVM translation blocks. Second, when there are no more translation blocks to cover, RevGen transforms them into basic blocks and rebuilds the control flow graph of the original binary in LLVM format. Third, RevGen resolves external function calls to build the final LLVM module. For dynamic analysis, a last step links the LLVM module with a run-time library that allows the execution of the LLVM module.

这篇关于源到源代码编译与LLVM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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