It gets better. Stack mapping to registers can occur on registers 32-127. This allows you to allocate and call subroutines by passing parameters by register-stack. This results in a unified subroutine calling model but with the speed of passing by register. Let's examine this further:Quote:
Originally posted by Bash:
...When you compile code for the x86, you have to continually load variables from memory because you don't have near enough registers to store all of them. With 128 user accessable registers you'll be able to compile code much more effeciently. Of course, this is a necessity for the Itanium since the compiler is doing all of the instruction scheduling too.
-Bash
[This message has been edited by Bash (edited November 09, 2000).]
The typical IA-32 subroutine calling model involves decrementing the ESP and moving the parameters on to the SS:[ESP] memory area. The called subroutine retrieves from SS:[ESP]. The pass and retrieval of subroutine parameters are all load/store instructions. Passing by register is extremely difficult to do because of the few general registers in IA-32, and the difficulty in supporting this is in a precompiled object or library. In summary, passing by register on IA-32 is nearly non-existant.
In IA-64, the "default" passing model is on the register-stack. IA-64 instructions are provided to allocate and free register stack space, which automatically fills/spills to the stack and rotates as needed. Well, if you think that fill/spills are load/stores, you're right. But if you analyze the stack frame level of object-orientated code, in particular, you'll find that the stack frame level a majority of the time stays well within 1-2 levels a high percentage of the time from the current level. And because most methods are not parameter heavy, chances are that spills/fills are infrequent. So effectively, registers 32-127 become a register cache for the run-time stack.
Better still, because this is the only parameter passing model, these benefits are gained across precompiled objects and libraries without special treatment. Big win.
