The essence of compiler is in back-end, precisely, it is optimization. And Register Allocation is one very important aspect of compiler optimization.
This article contains a simple review on existing open sourced Register Allocation algorithms, with GCC and LLVM.
1. Traditional, general Register Allocation algorithm - Graph Coloring
In input language, there exists an invisible reference\dependent graph among registers and instructions. To avoid conflictions, different vars should reside in different registers. Essentially it is a graph coloring algorithm, which is a NP-hard problem. This is not the focus of this review. Please refer to http://www.cs.cmu.edu/~dkoes/research/graphraTR.pdf
2. GCC vs. LLVM
GCC buys the graph coloring algorithm, but it seems not easy to do this job: http://gcc.gnu.org/wiki/RegisterAllocation. But LLVM decides to adopt simpler but more efficient methods to implement RA problem: linear scanning + spiller strategy, and it says it works very well, with 1-2% smaller memory occupation and up to 10% faster code execution. And in LLVM, Greedy RA algorithm is defaulted, which is based on the linear scanning strategy, in which reg life intervals are basic tools to operate.
In perspective of engineering, it is LLVM that is a better choice indeed - simpler, more capable. http://blog.llvm.org/2011/09/greedy-register-allocation-in-llvm-30.html