Types of Registers
Today, I got this explanation from Chris Lattner. Very clarifying:
Before register allocation, there are three types of registers:
1. Virtual registers. These are in SSA form, and follow all the normal SSA properties. These can be live across blocks.
2. Unallocatable physical registers (e.g. ESP). These can be live anywhere and can be used/modified in ways the register allocator is not required to understand.
3. Allocatable physregs (e.g. EAX). These are required to only be live within a machine basic block. This restriction is primarily to simplify/speed up the compiler (at no loss of generality because vregs can always be used). The live ranges of allocatable physregs should be short, e.g. an instruction selector may emit:
The set of allocatable physregs can be obtained with
Before register allocation, there are three types of registers:
1. Virtual registers. These are in SSA form, and follow all the normal SSA properties. These can be live across blocks.
2. Unallocatable physical registers (e.g. ESP). These can be live anywhere and can be used/modified in ways the register allocator is not required to understand.
3. Allocatable physregs (e.g. EAX). These are required to only be live within a machine basic block. This restriction is primarily to simplify/speed up the compiler (at no loss of generality because vregs can always be used). The live ranges of allocatable physregs should be short, e.g. an instruction selector may emit:
EAX = vreg1234
EDX = vreg4567
div vreg1928
vreg8910 = EAX
The set of allocatable physregs can be obtained with
MRegisterInfo::getAllocatableSet
.
0 Comments:
Post a Comment
<< Home