免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4497 | 回复: 6

GCC 文档 gccinternal.pdf中提到的reload是什么? [复制链接]

论坛徽章:
0
发表于 2015-01-23 09:32 |显示全部楼层
本帖最后由 lazy_linux 于 2015-01-23 10:03 编辑

如题,在GCC 文档 gccinternal-4.4.0.pdf中经常看到一个词语就是reload,这个reload是个什么过程?求指点!谢谢! ()

例如在17 Target Description Macros and Functions的17.14 Addressing Modes中对于宏定义GO_IF_LEGITIMATE_ADDRESS有如下描述:

GO_IF_LEGITIMATE_ADDRESS (mode, x, label) [Macro]

This macro must exist in two variants: a strict variant and a non-strict one.
The strict variant is used in the reload pass. It must be defined so that any pseudo-register that has not been allocated a hard register is considered a memory reference. In contexts where some kind of register is required, a pseudo-register with no hard register must be rejected. The non-strict variant is used in other passes. It must be defined to accept all pseudoregisters in every context where some kind of register is required.
Compiler source files that want to use the strict variant of this macro define the macro REG_OK_STRICT. You should use an #ifdef REG_OK_STRICT conditional to define the
strict variant in that case and the non-strict variant otherwise.
......

论坛徽章:
2
摩羯座
日期:2013-10-10 14:29:04天蝎座
日期:2014-01-03 09:14:49
发表于 2015-01-26 17:07 |显示全部楼层
https://gcc.gnu.org/onlinedocs/gccint/RTL-passes.html#RTL-passes

Reloading. This pass renumbers pseudo registers with the hardware registers numbers they were allocated. Pseudo registers that did not get hard registers are replaced with stack slots. Then it finds instructions that are invalid because a value has failed to end up in a register, or has ended up in a register of the wrong kind. It fixes up these instructions by reloading the problematical values temporarily into registers. Additional instructions are generated to do the copying.

The reload pass also optionally eliminates the frame pointer and inserts instructions to save and restore call-clobbered registers around calls.

Source files are reload.c and reload1.c, plus the header reload.h used for communication between them.

论坛徽章:
0
发表于 2015-01-27 14:33 |显示全部楼层
回复 2# EricFisher

谢谢版主!
   

论坛徽章:
0
发表于 2015-01-27 22:56 来自手机 |显示全部楼层
lazy_linux 发表于 2015-01-27 14:33:52
回复 2# EricFisher

reload是其中一个优化,将所有的伪寄存器分配物理寄存器。一般在一个特定值以下的都可以分配到物理寄存器,如果物理寄存器不够,就会将值放入mem中

论坛徽章:
7
天秤座
日期:2014-08-07 13:56:30丑牛
日期:2014-08-27 20:34:21双鱼座
日期:2014-08-27 22:02:21天秤座
日期:2014-08-30 10:39:11双鱼座
日期:2014-09-21 20:07:532015年亚洲杯之日本
日期:2015-02-06 14:00:282015亚冠之大阪钢巴
日期:2015-11-02 14:50:19
发表于 2015-01-28 17:33 |显示全部楼层
回复 4# evenstronger

分配寄存器是IRA的功能吧,RELOAD是处理那些没分配到真实寄存器的伪寄存器吧?
   

论坛徽章:
0
发表于 2015-03-07 11:32 |显示全部楼层
回复 5# MeRcy_PM

多谢! 如果IRA中没有分配到物理寄存器,应该怎么办?reload的原理是什么?请指点 。
   

论坛徽章:
7
天秤座
日期:2014-08-07 13:56:30丑牛
日期:2014-08-27 20:34:21双鱼座
日期:2014-08-27 22:02:21天秤座
日期:2014-08-30 10:39:11双鱼座
日期:2014-09-21 20:07:532015年亚洲杯之日本
日期:2015-02-06 14:00:282015亚冠之大阪钢巴
日期:2015-11-02 14:50:19
发表于 2015-03-09 09:27 |显示全部楼层
回复 6# lazy_linux
原理我也不太清楚,在ira完如果还有伪寄存器,在reload好像会用栈进行spill。


   
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP