diff --git a/llvm/docs/CodeGenerator.html b/llvm/docs/CodeGenerator.html index f2d0dca1adc6..af75bc749386 100644 --- a/llvm/docs/CodeGenerator.html +++ b/llvm/docs/CodeGenerator.html @@ -58,6 +58,10 @@
To Be Written
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.
+ +The first step to 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., +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 +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 +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.
+ +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 +basic blocks. If a successor basic block has a PHI node and one of +the PHI node's operands is coming from the current basic block, +then the variable is marked as alive within the current basic block +and all of its predecessor basic blocks, until the basic block with the +defining instruction is encountered.
+ +