3 ms·
I think that the MIPS does this quite well. There exist four (of 32) registers to hold the first four arguments to a function, and then any more go on the stack
by koenigdavidmj 16y ago
I think that the MIPS does this quite well. There exist four (of 32) registers to hold the first four arguments to a function, and then any more go on the stack. However, most calling conventions require that you leave enough space in the stack frame to copy the argument registers into it (although you do not actually need to do the copy). That way, you can get the speed benefits of register-passed arguments while making it easy to do array indexing off the stack pointer if you really need to.
- paulbaumgart 16y agoSPARC (V8 at least) is the same, just with 6 instead of 4 argument registers: %i0 to %i5.
- tptacek 16y agoI think SPARC has always had register argument passing; it's practically the design thesis for the processor.
- pmjordan 16y agoIt's not that arguments are passed in registers that makes it so complicated, but the fact that there are separate register files for integer/pointer and floating-point types. Most classic RISC architectures have only one register file.