修改GCC编译器的AST树 [英] Modification of the AST-tree of the GCC compiler

查看:126
本文介绍了修改GCC编译器的AST树的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要使用GCC插件收集有关翻译单元的必要信息,并在其基础上修改AST. 我已经了解了如何收集信息.但是我还不了解如何在将AST传递到CRT之前对其进行修改.关于此主题的信息很少. 告诉我请问我应该读什么?分享想法和链接.

It is needed to gather the necessary information about the translation unit using the plugin for GCC and to modify AST on its base. I've already understood how to gather information. But I haven't understand yet how to modify AST before it's passed into CRT. Very little information is available on this subject. Tell me plese what should I read on this subject? Share thoughts, links.

谢谢.

P.S. 我已经阅读了这些链接上的所有内容:

P.S. I've already read everything on these links:

http://en.wikibooks.org/wiki/GNU_C_Compiler_Internals/Print_version http://developer. apple.com/library/mac/#documentation/DeveloperTools/gcc-4.2.1/gccint/index.html#Top

推荐答案

GCC测试套件包含此类修改的基本示例.参见 http://gcc.gnu. org/viewcvs/gcc/trunk/gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c 和start_unit_plugin.c显示了如何创建变量.不幸的是,对于更认真的修改,GCC源代码可能是最好的选择.

The GCC test suite contains a basic examples of such modifications. See http://gcc.gnu.org/viewcvs/gcc/trunk/gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c and start_unit_plugin.c shows how to create a var. Unfortunately for more serious modifications the GCC source code are probably your best bet.

这篇关于修改GCC编译器的AST树的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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