加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

启用链接时优化的技术和模式?

发布时间:2020-12-16 07:27:37 所属栏目:百科 来源:网络整理
导读:链路时间优化(LTO)(也称为统一构建)包含在GCC 4.5或更高版本中,其他编译器具有类似的优化通道.这不会使某些代码模式比以前更可行吗? 例如,为了获得最佳性能,C代码的“模块”通常需要暴露其内容. LTO是否过时了?现在有哪些代码模式可行,而不是之前? 解决方
链路时间优化(LTO)(也称为统一构建)包含在GCC 4.5或更高版本中,其他编译器具有类似的优化通道.这不会使某些代码模式比以前更可行吗?

例如,为了获得最佳性能,C代码的“模块”通常需要暴露其内容. LTO是否过时了?现在有哪些代码模式可行,而不是之前?

解决方法

我认为LTO只是一种优化,但不一定能消除对任何模块的实施文档(“暴露内容”)的需求.已经为此编写了整个语言;我不认为C很快就会将这种需求从中删除,或者也许永远不会.

从the description of the LTO feature in gcc开始:

Link Time Optimization (LTO) gives GCC the capability of dumping its
internal representation (GIMPLE) to disk,so that all the different
compilation units that make up a single executable can be optimized as
a single module. This expands the scope of inter-procedural
optimizations to encompass the whole program (or,rather,everything
that is visible at link time).

From the announcement of LTO’s inclusion into gcc:

The result should,in principle,execute faster but our IPA cost models are still not tweaked for LTO. We’ve seen speedups as well as slowdowns in benchmarks (see the LTO testers at 07002).

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读