System and method are described for register optimization during code
translation utilizes a technique that removes the time overhead for
analyzing register usage and eliminates fixed restraints on the compiler
register usage. The present invention for register optimization utilizes
a compiler to produce a register usage bit vector in a NOP instruction
within each basic block (i.e., subroutine, function, and/or procedure).
Each bit in the bit vector represents a particular caller-saved register.
A bit is set if, at the location of NOP instruction, the compiler uses
the corresponding register within that basic block containing the NOP
instruction to hold information to be used at a later time. During the
translation, the translator examines the register usage bit vector to
very quickly determine which registers are free and therefore can be used
during the register optimization without the need to save and restore the
register values.