使用gcc的中间GIMPLE格式 [英] Playing with gcc's intermediate GIMPLE format

查看:429
本文介绍了使用gcc的中间GIMPLE格式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据本文,gcc在生成代码之前会使用几种中间格式.我读到GIMPLE格式使用三个地址代码,这似乎是最容易使用的中间语言.但是我需要更多细节,因为我需要构建一个可以使用中间代码并在生成最终代码之前向其中插入一些代码的工具.

According to this article gcc uses several intermediate formats before generating code. I read that the GIMPLE format uses three address code, which seems to be the easiest intermediate language to use. But I need some more detail, as I need to build a tool that can take the intermediate code and insert some code to it before generating the final code.

为此,我首先需要知道如何生成GIMPLE格式代码并将其保存在文件中.因此,我正在寻找一些文档和示例.另外,如果有人进行过此类工作,我是否可以知道此任务的复杂性,即在中间代码中插入一些代码?

For this I first need to know how can I even generate the GIMPLE format code and save it in a file. So I'm looking for some documents and examples. Also, if anyone has worked with such things, can I know the complexity of this task, which is to insert some code into the intermediate code?

推荐答案

您可能会发现编写插件,它将允许您挂接GIMPLE生成并在GCC中对其进行更改,这将减少保存,编辑然后尝试从GIMPLE表单进行编译的停机时间. MELT 就是这样的插件(尽管它提供了 不仅仅是更改较低级别的表示形式).在GIMPLE修改方面,此处还有一个不错的PDF.插件.

You might find it easier to write a plugin for GCC, which would allow you to hook the GIMPLE generation and alter it inside GCC, which should drop the downtime of saving, editing then trying to compile from GIMPLE form. MELT is one such plugin (though it offers way more than just altering the lower level representations). There is also a nice PDF here on GIMPLE altering plugins.

否则,您可以在此处中查找有关GCC GIMPLE工作方式的信息. 关于将GIMPLE转储出去:

Else, you can look here for information on how GCC's GIMPLE works. In terms of dumping GIMPLE out:

您可以请求转储带有标志-fdump-tree-gimple的GIMPLE表单的类似C的表示形式.

You can request to dump a C-like representation of the GIMPLE form with the flag -fdump-tree-gimple.

这篇关于使用gcc的中间GIMPLE格式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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