GCC编译器AST树的修改
需要使用 GCC 插件收集有关翻译单元的必要信息,并在此基础上修改 AST。 我已经了解如何收集信息了。但我还不明白如何在 AST 传递到 CRT 之前对其进行修改。关于这个主题的信息很少。 请告诉我关于这个主题我应该读什么?分享想法、链接。
谢谢。
聚苯乙烯 我已经阅读了这些链接上的所有内容:
http://en.wikibooks.org/wiki/GNU_C_Compiler_Internals /打印版本 http://开发人员。 apple.com/library/mac/#documentation/DeveloperTools/gcc-4.2.1/gccint/index.html#Top
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.
Thank'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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
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 合作开展这项工作? ROSE 编译器是专门为执行源代码级修改而构建的,然后将生成的代码交给后端编译器。
Are you tied to GCC for this endeavor? The ROSE compiler is built specifically for performing source-level modification, then handing the resulting code off to a backend compiler.