Register File is small storage that provides support to just one instruction and is used for intermediate computations. And if you want to extensively use registers, it would kill the purpose of having fast storage such as the registers.
On the other hand, CACHEs are built for the 2nd level of the memory hierarchy that you would like to use. Therefore you need to design algorithms that take full benefit of data locality that are favored by these CACHEs. There are separate caches for instructions that reuse instruction, such as in loops, which are very efficiently implemented.
Even then if one wants to use registers intensively, then intelligent compilers are another option in which case intelligent register allocation techniques are used. A recent hybrid technique uses an off-line machine learning algorithm to build a heuristic function (which is used in run-time) that determines and switches between different allocation methods that will perform better in light of code behavior. I hope it helped. Regards
eip
by doingjmp value
. And you can read from it bycall foo; foo: pop eax;
But the first one probably has side-effects you don't want. :) In short, no you won't be able to useeip
andeflags
for other purposes. (and most arithmetic instructions will implicitly write toeflags
) – Mysticialah
toeflags
withsahf
and you can load them toah
withlahf
. You can also store data into flags withpopf
, but this may have unwanted side-effects. And in real-mode code (legacy or boot loader) you can block interrupts withcli
, then storeesp
somewhere, useesp
as general-purpose register, load the original value ofesp
and allow interrupts withsti
. You can useeip
to store some data with eg. withjmp eax
/call eax
, if all used values (jump targets) have valid code. Anyway, for practical purposes, you'd better follow Ira Baxter's advice. – nrzmovq
from/tomm0
,mm1
, etc. is a common trick in BIOS at its early stage when RAM isn't configured yet. – Netch