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

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

问题描述

需要使用 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. I've already read everything on these links:

http://en.wikibooks.org/wiki/GNU_C_Compiler_Internals/Print_versionhttp://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 展示了如何创建一个 var.不幸的是,对于更严重的修改,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-tree的修改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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