一些了解 GCC 源代码的指针

发布于 2024-08-25 23:00:19 字数 130 浏览 15 评论 0原文

我是一名学生,致力于为多核处理器优化 GCC。我尝试查看源代码,但很难跟踪它,因为我需要在后端添加一些代码。任何人都可以建议一些好的资源来解释不同阶段的代码流程。 还建议一些用于调试GCC的开发环境,主要是单步执行代码。在windows上可以吗?

I'm student working on optimizing GCC for multi-core processor. I tried going through the source code, it is difficult to follow through it since I need to add some code to the back end. Can anyone suggest some good resource which explains the code flow through the different phases.
Also suggest some development environment for debugging GCC mainly to step through the code. Is it possible on windows?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

森罗 2024-09-01 23:00:19

作为起点,请参阅 GCC 网站上的链接和选定读物。我认为您特别感兴趣的是:

如果您想在 Windows 上进行开发,您可能需要从 MinGW(Minimalist GNU for Windows)编译器套件源(它包括 GNU GDB 调试器)开始,这是一个GCC 到 Windows 的端口。

对于舒适的开发环境我帮不了什么忙,因为我不使用 C++ 开发。但我想你需要一个好的 C/C++ IDE:看看 这种比较,有很多适用于 Windows 的免费/开源 IDE。

更新:我认为ICI也可以是您感兴趣:

交互式编译界面
(或简称“ICI”)是一个插件
具有高水平的系统
独立于编译器的低级
依赖于编译器的 API 进行转换
当前编译器进入协作状态
开放式模块化交互式工具集。这
ICI框架充当“中间件”
编译器和编译器之间的接口
用户可定义的插件。它打开了
并重复利用生产质量
编译器基础设施以启用
程序分析和仪器,
细粒度程序优化,
新开发的简单原型
和研究想法,同时避免
构建新的编译工具
划痕。例如,它用于
MILEPOST GCC 自动化编译器和
架构设计与程序
基于统计的优化
分析和机器学习。它
应该启用通用自调整
适应异构的编译器,
可重构、多核
架构范围从
超级计算机到嵌入式系统。

.. 与集体调整保护伞下的其余项目一样。

注意: 正如 BlueRaja 在评论中所写,“编译器是最复杂的程序之一”,这种说法有些夸张:编译器有非常简单的编译器和非常复杂的编译器。但在编译器理论中(一旦你研究了它)并没有什么深奥的。 GCC 是一个复杂的程序,需要理解为任何、文档不完善的程序1。所以 rizwanhudda 不要灰心:开始研究可用的文档,然后询问 GCC 开发人员(在 GCC irc 频道上,如 由 nvlGCC 开发者邮件列表建议< /a>)来解释哪些内容记录得不好(或根本没有)。

  1. 事实上,程序理解是一个活跃的研究领域。

As a starting point see Links and Selected Readings on GCC site. Of particular interest to you, I think, are:

If you want to develop on Windows you probably need to start from MinGW (Minimalist GNU for Windows) Compiler Suite sources (it includes GNU GDB debugger), which is a port of GCC to Windows.

For a comfortable development environment I cannot help much because I don't develop in C++. But I suppose a good IDE for C/C++ is what you need: have a look at this comparison, there are plenty free/open source IDEs for Windows.

Update: I think ICI can also be of interest to you:

The Interactive Compilation Interface
(or 'ICI' for short) is a plugin
system with a high-level
compiler-independent and low-level
compiler-dependent API to transform
current compilers into collaborative
open modular interactive toolsets. The
ICI framework acts as a "middleware"
interface between the compiler and the
user-definable plugins. It opens up
and reuses the production-quality
compiler infrastructure to enable
program analysis and instrumentation,
fine-grain program optimizations,
simple prototyping of new development
and research ideas while avoiding
building new compilation tools from
scratch. For example, it is used in
MILEPOST GCC to automate compiler and
architecture design and program
optimizations based on statistical
analysis and machine learning. It
should enable universal self-tuning
compilers adaptable to heterogeneous,
reconfigurable, multi-core
architectures ranging from
supercomputers to embedded systems.

.. as the rest of projects under the Collective TUNING umbrella.

Note: Writing "compilers are one of the most complex programs there are", as BlueRaja wrote in comments, is an overstatement: there are very simple compilers and very complex compilers. But in compiler theory (once you have studied it) there is nothing esoteric. GCC is a complex program to understand as whatever BIG, poorly documented program out there1. So rizwanhudda don't be discouraged: start studying the documentation available and then ask GCC developers (on GCC irc channel, as suggested by nvl or GCC developers mailing list) to explain what is poorly (or not at all) documented.

  1. In fact program comprehension is an active field of research.
紅太極 2024-09-01 23:00:19

我建议你使用GCC irc频道,它是为了讨论GCC的发展。

I would suggest you to use the GCC irc channel, it is meant for discussion of development of GCC.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文