From: Bill Wendling
@@ -1160,16 +1161,16 @@ SelectionDAGs.
Live Interval Analysis identifies the ranges where a variable is live. -It's used by the register allocator pass to determine -if two or more virtual registers which require the same register are live at -the same point in the program (conflict). When this situation occurs, one -virtual register must be spilt.
+Live Intervals are the ranges (intervals) where a variable is live. +They are used by some register allocator passes to +determine if two or more virtual registers which require the same register are +live at the same point in the program (conflict). When this situation occurs, +one virtual register must be spilled.
The first step to determining the live intervals of variables is to +
The first step in determining the live intervals of variables is to calculate the set of registers that are immediately dead after the -instruction (i.e., the instruction calculates the value, but it is never -used) and the set of registers that are used by the instruction, but are -never used after the instruction (i.e., they are killed). Live variable -information is computed for each virtual and register -allocatable physical register in the function. LLVM assumes that -physical registers are only live within a single basic block. This allows -it to do a single, local analysis to resolve physical register lifetimes in -each basic block. If a physical register is not register allocatable (e.g., +instruction (i.e., the instruction calculates the value, but it is +never used) and the set of registers that are used by the instruction, +but are never used after the instruction (i.e., they are killed). Live +variable information is computed for each virtual and +register allocatable physical register in the function. This +is done in a very efficient manner because it uses SSA to sparsely +computer lifetime information for virtual registers (which are in SSA +form) and only has to track physical registers within a block. Before +register allocation, LLVM can assume that physical registers are only +live within a single basic block. This allows it to do a single, +local analysis to resolve physical register lifetimes within each +basic block. If a physical register is not register allocatable (e.g., a stack pointer or condition codes), it is not tracked.
Physical registers may be live in to or out of a function. Live in values -are typically arguments in register. Live out values are typically return +are typically arguments in registers. Live out values are typically return values in registers. Live in values are marked as such, and are given a dummy "defining" instruction during live interval analysis. If the last basic block -of a function is a return, then it's marked as using all live-out +of a function is a return, then it's marked as using all live out values in the function.
PHI nodes need to be handled specially, because the calculation of the live variable information from a depth first traversal of the CFG of -the function won't guarantee that a virtual register is defined before it's -used. When a PHI node is encounted, only the definition is -handled, because the uses will be handled in other basic blocks.
+the function won't guarantee that a virtual register used by the PHI +node is defined before it's used. When a PHI node is encounted, only +the definition is handled, because the uses will be handled in other basic +blocks.For each PHI node of the current basic block, we simulate an assignment at the end of the current basic block and traverse the successor @@ -1215,132 +1221,16 @@ defining instruction is encountered.
To Be Written
+ + +