lazy_linux 发表于 2015-01-23 09:32

GCC 文档 gccinternal.pdf中提到的reload是什么?

本帖最后由 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)

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.
......

EricFisher 发表于 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.

lazy_linux 发表于 2015-01-27 14:33

回复 2# EricFisher

谢谢版主!
   

evenstronger 发表于 2015-01-27 22:56

lazy_linux 发表于 2015-01-27 14:33:52 static/image/common/back.gif
回复 2# EricFisher
reload是其中一个优化,将所有的伪寄存器分配物理寄存器。一般在一个特定值以下的都可以分配到物理寄存器,如果物理寄存器不够,就会将值放入mem中

MeRcy_PM 发表于 2015-01-28 17:33

回复 4# evenstronger

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

lazy_linux 发表于 2015-03-07 11:32

回复 5# MeRcy_PM

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

MeRcy_PM 发表于 2015-03-09 09:27

回复 6# lazy_linux
原理我也不太清楚,在ira完如果还有伪寄存器,在reload好像会用栈进行spill。


   
页: [1]
查看完整版本: GCC 文档 gccinternal.pdf中提到的reload是什么?