Minimizing register spills by using register moves
First Claim
1. A system comprising:
- a compiler; and
a memory;
wherein the compiler comprises;
first instructions configured to generate code from a computer program, wherein said generating the code comprises performing register allocation for a plurality of variables of the computer program, and wherein the register allocation results in a plurality of spilled variables; and
second instructions configured to;
determine that a period of use of at least two spilled variables is covered by a period of availability of an available register;
determine a priority of each of the at least two spilled variables, wherein the priority is based at least in part on a number of cycles executed from a stack memory store instruction to a stack memory load instruction for a respective spilled variable;
determine to store a first spilled variable in the available register responsive to determining the first spilled variable has a highest priority of the at least two spilled variables;
wherein in response to the second instructions determining to store the first spilled variable in the available register, the first instructions are configured to modify the code to allocate the first spilled variable to the available register by replacing stack memory store and load instructions corresponding to the first spilled variable with inter-register-file move instructions.
1 Assignment
0 Petitions
Accused Products
Abstract
A system and method for minimizing register spills during compilation. A compiler reallocates spilled variables from stack memory to other available registers. Although a corresponding register file may not have available registers for storage, the compiler identifies available registers in other locations for storage. The compiler identifies available registers in an alternate register file, wherein the alternate register file may be a floating-point register file which is then used for spilled integer variables. Other instruction type combinations between spilled variables and alternate register files are possible. When an available register within the alternate register file is identified, the compiler modifies the program instructions to allocate the corresponding spilled variable to the available register.
-
Citations
17 Claims
-
1. A system comprising:
-
a compiler; and a memory; wherein the compiler comprises; first instructions configured to generate code from a computer program, wherein said generating the code comprises performing register allocation for a plurality of variables of the computer program, and wherein the register allocation results in a plurality of spilled variables; and second instructions configured to; determine that a period of use of at least two spilled variables is covered by a period of availability of an available register; determine a priority of each of the at least two spilled variables, wherein the priority is based at least in part on a number of cycles executed from a stack memory store instruction to a stack memory load instruction for a respective spilled variable; determine to store a first spilled variable in the available register responsive to determining the first spilled variable has a highest priority of the at least two spilled variables; wherein in response to the second instructions determining to store the first spilled variable in the available register, the first instructions are configured to modify the code to allocate the first spilled variable to the available register by replacing stack memory store and load instructions corresponding to the first spilled variable with inter-register-file move instructions. - View Dependent Claims (2, 3, 4, 5, 6, 7)
-
-
8. A computer implemented method for compiling a computer program, the method comprising:
-
generating, by the computer, code from the computer program, wherein said generating the code comprises performing register allocation for a plurality of variables of the computer program, and wherein the register allocation results in a plurality of spilled variables; determining that a period of use of at least two spilled variables is covered by a period of availability of an available register; determining a priority of each of the at least two spilled variables, wherein the priority is based at least in part on a number of cycles executed from a stack memory store instruction to a stack memory load instruction for a respective spilled variable; determining to store a first spilled variable in the available register responsive to determining the first spilled variable has a highest priority of the at least two spilled variables; and modifying, by the computer, the code to allocate the first spilled variable to the available register by replacing stack memory store and load instructions corresponding to the first spilled variable with inter-register-file move instructions, in response to determining to store the first spilled variable in the available register. - View Dependent Claims (9, 10, 11, 12, 13, 14)
-
-
15. A non-transitory computer readable storage medium storing program instructions, wherein the program instructions are executable by a computer system to compile a computer program, wherein in said compiling, the program instructions are executable by the computer system to:
-
generate code from the computer program, wherein said generating the code comprises performing register allocation for a plurality of variables of the computer program, and wherein the register allocation results in a plurality of spilled variables; determine that a period of use of at least two spilled variables is covered by a period of availability of an available register; determine a priority of each of the at least two spilled variables, wherein the priority is based at least in s art on a number of cycles executed from a stack memory store instruction to a stack memory load instruction for a respective spilled variable; determine to store a first spilled variable in the available register responsive to determining the first spilled variable has a highest priority of the at least two spilled variables; and modify the code to allocate the first spilled variable to the available register by replacing stack memory store and load instructions corresponding to the first spilled variable with inter-register-file move instructions, in response to determining to store the first spilled variable in the available register. - View Dependent Claims (16, 17)
-
Specification