9690584

Systems and Methods for Register Allocation

PublishedJune 27, 2017
Assigneenot available in USPTO data we have
Technical Abstract

Patent Claims
12 claims

Legal claims defining the scope of protection, as filed with the USPTO.

1

1. A method for register allocation, the method comprising: determining an original code block and a target code block associated with a branch of an execution loop, for execution by a processor device that comprises one or more processors and that includes physical processor registers including a first register and a second register; detecting an original allocation of the registers to variables associated with the original code block, which has been executed by the processor device; determining a target allocation of the registers to variables associated with the target code block, which is to be executed by the processor device; selecting a register, from among the processor registers, to be a temporary register, based at least in part on the register conforming to at least one of (i) the register not being allocated to a variable in the original allocation and (ii) the register not being allocated to a variable in the target allocation, wherein the selection of a register to be the temporary register includes: maintaining a first data structure having one bit for each register; setting each first data structure having one bit to a first state in response to the corresponding register being allocated in the target allocation to a variable that is allocated to a different register in the original allocation, and otherwise setting the first data structure to a second state; maintaining a second data structure having one bit for each register; setting each second data structure bit to the first state in response to the corresponding register being allocated in the original allocation to a variable that is allocated to a different register in the target allocation, and otherwise setting the second data structure bit to the second state; maintaining a third data structure having one bit for each register; determining each third data structure bit as a Boolean logic function of the corresponding first data structure bit and the corresponding second data structure bit; wherein the selection of a register to be a temporary register is based on the state of the corresponding third data structure bit; changing, by the processor device, from the original allocation to the target allocation using a process that includes: in response to determining that a first variable is allocated to the first register in the original allocation and to the second register in the target allocation, and that the second register is storing a value of a second variable, moving the value of the first variable from the first register to the temporary register, moving the value of the second variable from the second register to free up the second register, and moving the value of the first variable from the temporary register to the second register, such that the first variable is not used as an execution operand while being temporarily stored in the temporary register; and executing the target code block.

2

2. The method of claim 1 , wherein: the branch of the execution loop corresponds to a backward loop branch from the original code block to the target code block; and the execution loop further includes a forward loop branch from the target code block to the original code block.

3

3. The method of claim 1 , wherein the selecting the register includes: in response to determining that the selected register is allocated to a third variable in the original allocation and not allocated in the target allocation, freeing up the selected register by moving a value of the third variable from the selected register to a storage medium.

4

4. The method of claim 1 , wherein the moving of the second variable from the second register includes moving the second variable from the second register to a third register in response to determining that the third register is allocated to the second variable in the target allocation.

5

5. The method of claim 1 , further comprising: in response to determining that a fourth variable is not allocated in the original allocation and is allocated to a fourth register, from among the registers, in the target allocation, and that the fourth register is not currently allocated to a variable, loading a value of the fourth variable from a storage medium to the fourth register.

6

6. The method of claim 1 , wherein the first state is “1” and the second state is “0”, and the Boolean logic function includes ANDing the corresponding third data structure bit with an inverse of the corresponding second data structure bit, and the selection of a register to be a temporary register is based on the corresponding tempBitVector third data structure bit being a “1”.

7

7. A method for register allocation, the method comprising: determining an original code block and a target code block associated with a branch of an execution loop, for execution by a processor device that comprises one or more processors and that includes physical processor registers including a first register and a second register; detecting an original allocation of the registers to variables associated with the original code block, which has been executed by the processor device; determining a target allocation of the registers to variables associated with the target code block, which is to be executed by the processor device; selecting a register, from among the processor registers, to be a temporary register, based at least in part on the register conforming to at least one of (i) the register not being allocated to a variable in the original allocation and (ii) the register not being allocated to a variable in the target allocation, wherein the selection of a register to be the temporary register includes: maintaining a first data structure having one bit for each register; setting each first data structure having one bit to a first state in response to the corresponding register being allocated in the target allocation to a variable that is allocated to a different register in the original allocation, and otherwise setting the first data structure to a second state; maintaining a second data structure having one bit for each register; setting each second data structure bit to the first state in response to the corresponding register being allocated in the original allocation to a variable that is allocated to a different register in the target allocation, and otherwise setting the second data structure bit to the second state; changing, by the processor device, from the original allocation to the target allocation using a process that includes: in response to determining that a first variable is allocated to the first register in the original allocation and to the second register in the target allocation, and that the second register is storing a value of a second variable, moving the value of the first variable from the first register to the temporary register, moving the value of the second variable from the second register to free up the second register, and moving the value of the first variable from the temporary register to the second register, such that the first variable is not used as an execution operand while being temporarily stored in the temporary register; and executing the target code block; maintaining a fourth data structure having one bit for each register; and determining each fourth data structure bit as a Boolean logic function of the corresponding first data structure bit and the corresponding second data structure bit; selecting a register, from among the registers, based on the respective fourth data structure being set in the first state; and moving a value from the selected register to a storage medium.

8

8. The method of claim 7 , wherein the first state is “1” and the second state is “0”, and the Boolean logic function includes ANDing the corresponding third data structure bit with the corresponding second data structure bit, and the selection of the register for moving the value in the register to the storage medium is based on the corresponding fourth data structure bit being a “1”.

9

9. The method of claim 1 , wherein the registers include a group of n registers that are together allocated to a same group of n variables in both the original allocation and the target allocation, and each of the n variables is allocated to a different register in the original allocation than in the target allocation, and wherein the first and second registers are among the group of registers.

10

10. A non-transitory processor readable data storage medium storing software instructions configured to be executed by a processor device, the processor device comprising one or more processors and including physical processor registers that include a first register and a second register, to: detect an original allocation of the registers to variables associated with an original code block, which has been executed by the processor device; determine a target allocation of the registers to variables associated with a target code block, which is to be executed by the processor device; select a register, from among the processor registers, to be a temporary register, based at least in part on the register conforming to at least one of (i) the register not being allocated to a variable in the original allocation and (ii) the register not being allocated to a variable in the target allocation; changing, by the processor device, from the original allocation to the target allocation using a process that includes: in response to determining that a first variable is allocated to the first register in the original allocation and to the second register in the target allocation, and that the second register is storing a value of a second variable, moving the value of the first variable from the first register to the temporary register, moving the value of the second variable from the second register to free up the second register, and moving the value of the first variable from the temporary register to the second register, such that the first variable is not used as an execution operand while being temporarily stored in the temporary register; and executing the target code block; wherein the storage medium includes a first data structure having one bit for each register, wherein each first data structure bit is set to a first state if the corresponding register is allocated in the target allocation to a variable that is allocated to a different register in the original allocation, and is otherwise set the first data structure to a second state; wherein the storage medium includes a second data structure having one bit for each register, wherein each second data structure bit is set to the first state if the corresponding register is allocated in the original allocation to a variable that is allocated to a different register in the target allocation, and is otherwise set to the second state; wherein the storage medium includes a third data structure having one bit for each register, and each third data structure bit corresponds to a Boolean logic function of the corresponding first data structure bit and the corresponding second data structure bit, and the software instructions are configured for selecting the temporary register based on the state of the corresponding third data structure bit.

11

11. The method of claim 10 , wherein the first state is “1” and the second state is “0”, and the Boolean logic function includes ANDing the corresponding third data structure bit with an inverse of the corresponding second data structure bit, and the selection of a register to be a temporary register is based on the corresponding third data structure bit being a “1”.

12

12. A method for register allocation, the method comprising: determining an original code block and a target code block associated with a branch of an execution loop, for execution by a processor device that comprises one or more processors and that includes physical processor registers including a first register and a second register; detecting an original allocation of the registers to variables associated with the original code block, which has been executed by the processor device; determining a target allocation of the registers to variables associated with the target code block, which is to be executed by the processor device; selecting a register, from among the processor registers, to be a temporary register, based at least in part on the register conforming to at least one of (i) the register not being allocated to a variable in the original allocation and (ii) the register not being allocated to a variable in the target allocation, wherein the selection of a register to be the temporary register includes: maintaining a first data structure having one bit for each register; setting each first data structure having one bit to a first state in response to the corresponding register being allocated in the target allocation to a variable that is allocated to a different register in the original allocation, and otherwise setting the first data structure to a second state; maintaining a second data structure having one bit for each register; setting each second data structure bit to the first state in response to the corresponding register being allocated in the original allocation to a variable that is allocated to a different register in the target allocation, and otherwise setting the second data structure bit to the second state; changing, by the processor device, from the original allocation to the target allocation using a process that includes: in response to determining that a first variable is allocated to the first register in the original allocation and to the second register in the target allocation, and that the second register is storing a value of a second variable, moving the value of the first variable from the first register to the temporary register, moving the value of the second variable from the second register to free up the second register, and moving the value of the first variable from the temporary register to the second register, such that the first variable is not used as an execution operand while being temporarily stored in the temporary register; and executing the target code block; wherein the storage medium includes a fourth data structure having one bit for each register, wherein each fourth data structure bit corresponds to a Boolean logic function of the corresponding first data structure bit and the corresponding second data structure bit, and the software instructions are configured to select a register, from among the registers, based on the respective fourth data structure being set in the first state and to move a value from the selected register to a storage medium.

Patent Metadata

Filing Date

Unknown

Publication Date

June 27, 2017

Inventors

Ningsheng Jian
Yuheng Zhang
Liping Gao
Haitao Huang
Xinyu Qi

Want to explore more patents?

Browse 5M+ US patents with plain-English claim translations and AI-generated analysis.

Citation & reuse

Analysis on this page is generated by Patentable — an AI-powered patent intelligence platform. AI-generated summaries, explanations, and analysis may be reused with attribution and a visible link back to the canonical URL below. Patent abstracts and claims are USPTO public domain.

Cite as: Patentable. “Systems and Methods for Register Allocation” (9690584). https://patentable.app/patents/9690584

© 2026 Patentable. All rights reserved.

Patentable is a research and drafting-assistant tool, not a law firm, and does not provide legal advice. Documents we generate are drafts for review by a licensed patent attorney.