Register Pressure in Machine Instruction Scheduler

Register Pressure in Machine Instruction Scheduler

This article will introduce the register pressure of virtual register. In short, register pressure represent the number of live registers at a position of the instruction sequence. When doing schedule, the sequence of instructions will be changed, and this may introduce large register pressure to some point and cause spill in the following register allocation. To prevent such things, When there are multiple Sunits can be emitted, the emission of Sunit which induces less register pressure to the CurrentPressure will be prioritized.

Process

Firstly, register pressure module will calculate the register pressure at each point of instruction sequence and record the MaxPressure of each type of virtual register. The calculated pressure here will be used as a reference for the BotRPTracker. The BotRPTracker will try to make the register pressure generated at sheduling less than the original one. If the MaxPressure is larger than the limit of this type of virtual register, then this type will be put to CriticalPSets. In the meantime, calculate the PressureDiff of each Sunit. The PressureDiff is the number of register pressure increased / decreased by the current Sunit.
Secondly, Initialize the status of livereg at the beginning of the scheduling. In other words, calculating the register pressure at the beginning. At the same time, update the PressureDiff of sunits in VRegUses. These sunits in VRegUses will increase the register pressure of certain virtual register type for they read the virtual register of the certain type. The original PressureDiff is calculated statically. If the certain type is alive at the current circle and the current Sunit use the certain type of virtual register, the register pressure of the certain type should not be increased. So, the original Pressure should be decreased by a weight.
Thirdly if there is only one elected Suint for emission, the register pressure calculated by BotRPTracker will be ignored. But when they are more than one Sunits can be emitted, scheduler is inclined to select the Sunit which introduce less register pressure. The process of selection is complicated, refer to tryCandidate for more details.
Fourthly, after emitting the Sunit, update the PressureDiff of unscheduled Sunit which use the same virtual register type. update the MaxPressure.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值