September 19th, 2011, 03:03 AM
Why split the temporary registers?
I recently started digging into assembly programming, mainly out of curiosity and to broaden the understanding of what's actually going on under the hood. I'm currently studying mips, and there is this little mystery that I haven't seen addressed anywhere - why are the temporary registers split in two groups, in the register use convention? First $t0-$t7 in $8-$15, then some other varieties, and then you get two more t's in $24-$25. Is there any particular reason for this or did it just happen to end up that way?
September 20th, 2011, 11:55 PM
I have no idea, but I'm sort of curious now, so if you ever find out post back and let me know.
It's possible that in older RISC machines $24 and $25 were reserved for some special purpose that became obsolete so they changed the convention to temp registers.
It's also possible that $24 and $25 are essentially reserved for some future special purpose.
Or perhaps they are simply left overs spots that they defined as temporary registers because they had nothing else to do with them after having allocated all of the necessary special registers.
October 3rd, 2011, 08:26 AM
I'm not an expert in assembly and my memory of college assembly class could be horribly wrong but...
$0,$1 - hi/lo
$2,$3 - returns
$4-$7 - args
$8-$15 - general-purpose
There ends the definition of the 4-bit addressing space. Once we made 8-bit processors we were able to extend it with:
$16-$23 - preserved registers
Starting from the big-end so the instructions are easy to identify (all 1s are return location)
$31 - return storage
$30 - frame pointer
$29 - stack pointer
$24,$25 - Extra space, may as well give the programmer two more general purpose registers
Just a theory combined with a vague memory.
HEY! YOU! Read the New User Guide and Forum Rules
"They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin
"The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002
Think we're being rude? Maybe you asked a bad question
or you're a Help Vampire.
Trying to argue intelligently? Please read this.