Use of different color sequences for variables of different sizes and different semantics
First Claim
1. A method of allocating registers to variables in a software program, the method comprising:
- generating an interference graph for said software program, each node in the interference graph representing a web of a variable in the software program;
ordering nodes of the graph into a sequence (also called “
node sequence”
) in a descending order based on the number of edges of each node;
identifying a node in sequential order from the node sequence;
selecting a sequence of colors from among a plurality of sequences of colors, each sequence containing colors that are arranged in a specific order based on a predetermined preference;
identifying a color in sequential order from the selected sequence of colors;
checking if any register associated with the identified color is used by a neighbor of the identified node and if not, using the identified color for coloring the identified node; and
if the identified color cannot be used, repeatedly performing the acts of “
identifying a color” and
“
checking”
until all colors in the selected sequence are used.
2 Assignments
0 Petitions
Accused Products
Abstract
Colors to be used in register allocation are grouped into a number of sequences. Each sequence is associated with an attribute (e.g. size and/or type) of variables whose nodes in an interference graph can be colored by colors in the sequence. In certain embodiments, in addition to the above-described grouping, colors within a group are ordered in a sequence. The specific order that is used may depend on, for example, an attribute (such as size) and a predetermined preference. One example of such a predetermined preference is that a color that represents a register of the size that is associated with the sequence is located at the front of the sequence. Another color located later in the sequence represents a register of a different size than the size associated with the sequence.
-
Citations
18 Claims
-
1. A method of allocating registers to variables in a software program, the method comprising:
-
generating an interference graph for said software program, each node in the interference graph representing a web of a variable in the software program;
ordering nodes of the graph into a sequence (also called “
node sequence”
) in a descending order based on the number of edges of each node;
identifying a node in sequential order from the node sequence;
selecting a sequence of colors from among a plurality of sequences of colors, each sequence containing colors that are arranged in a specific order based on a predetermined preference;
identifying a color in sequential order from the selected sequence of colors;
checking if any register associated with the identified color is used by a neighbor of the identified node and if not, using the identified color for coloring the identified node; and
if the identified color cannot be used, repeatedly performing the acts of “
identifying a color” and
“
checking”
until all colors in the selected sequence are used. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9)
-
-
10. A computer programmed to allocate registers to variables in a software program, the programmed computer comprising:
-
means for generating an interference graph for said software program, each node in the interference graph representing a web of a variable in the software program;
means for ordering nodes of the graph into a sequence (also called “
node sequence”
) in a descending order based on the number of edges of each node;
means for identifying a node in sequential order from the node sequence;
means for selecting a sequence of colors from among a plurality of sequences of colors, each sequence containing colors that are arranged in a specific order based on a predetermined preference;
means for identifying a color in sequential order from the selected sequence of colors;
means for checking if any register associated with the identified color is used by a neighbor of the identified node and if not, using the identified color for coloring the identified node; and
means for repeatedly performing the acts of “
identifying a color” and
“
checking”
until all colors in the selected sequence are used, if the identified color cannot be used. - View Dependent Claims (11, 12, 13, 14, 15, 16, 17, 18)
-
Specification