Get the latest tech news
How do modern compilers choose which variables to put in registers?
C has the register keyword, originally designed as a hint to the compiler that a variable should be placed in a register rather than on the stack. However this is generally considered an unneeded f...
(Aside: Pedantic readers may complain that this architecture is highly anachronistic, featuring a single accumulator, stack-relative addressing, and an extremely rich instruction set that allows specifying the location of every operand and result. Each row in the timeline (and thus each variable in the program) can be thought of as the vertex in a graph, where edges connect vertices with overlapping liveness ranges. Features of modern processors, such as out-of-order execution, CPU caches, and SIMD operations, can complicate the definition of an “optimal” register assignment.
Or read this on Hacker News