Playing with gcc's intermediate GIMPLE format

a 夏天 提交于 2019-12-03 06:28:37

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.

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

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

neel

You can easily generate GIMPLE representation of any file using the flag -fdump-tree-gimple.

If you want to write a plugin, then you might be interested in how passes work on GCC. You can see the output of each pass with flags of the form:

-fdump-<ir>-<passname>

where ir could be:

  • tree : Intraprocedural passes on GIMPLE
  • ipa : Interprocedural passes on GIMPLE
  • rtl : Intraprocedural passes on RTL

Use <passname> = all to see all the dumps, e.g. -fdump-ipa-all.

Farouq

I tried the flag -fdump-tree-gimple. It works only for the C/C++ language, and not for other languages such as Java, Ada, Fortran, and Objective-C)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!