Resource assigning apparatus which assigns the variable in a program to resources
First Claim
1. A resource assigning apparatus to be used by a compiler which compiles a program written in a high-level language into a machine language program, wherein the resource assigning apparatus generates a plurality of assignments, each of which is a combination of a variable in the program written in the high-level language and a live range, and assigns the generated assignments in order to resource elements of hardware resources such as registers and memory, the resource assigning apparatus comprising:
- profit/loss value calculation means for calculating, for each resource element, a profit/loss value which shows a degree of suitability of a resource element for a next assignment to be assigned, based on a positional relationship between live ranges of any assignments which have already been assigned and a live range of the next assignment;
assigning means for assigning the next assignment to any of the resource elements based on a value of the profit/loss value calculated for each resource element; and
control means for repeatedly activating the profit/loss value calculation means and the assigning means until every assignment has been assigned.
2 Assignments
0 Petitions
Accused Products
Abstract
A resource assigning apparatus which generates assignments which are combinations of variables and their respective live ranges, which investigates, for each assignment, other assignments with live ranges which interfere or which are continuous and which calculates assigning priority levels. Next, the assigning resource element determination unit assigns each assignment to an assignable resource element starting with the assignment with the highest priority level, in doing so taking into account the use cost which is the cost incurred by the parts of the program which use an assignment and the resource succession relations, thereby calculating a profit value which standardizes an evaluation of a reduction in transfer instructions in the object code and assigning assignments to resource elements with a lowest use cost and highest profit value. In this way, by thoroughly investigating the relations between assignments which allow assigning to a same resource element, a more optimal assigning result is attained.
-
Citations
51 Claims
-
1. A resource assigning apparatus to be used by a compiler which compiles a program written in a high-level language into a machine language program, wherein the resource assigning apparatus generates a plurality of assignments, each of which is a combination of a variable in the program written in the high-level language and a live range, and assigns the generated assignments in order to resource elements of hardware resources such as registers and memory, the resource assigning apparatus comprising:
-
profit/loss value calculation means for calculating, for each resource element, a profit/loss value which shows a degree of suitability of a resource element for a next assignment to be assigned, based on a positional relationship between live ranges of any assignments which have already been assigned and a live range of the next assignment; assigning means for assigning the next assignment to any of the resource elements based on a value of the profit/loss value calculated for each resource element; and control means for repeatedly activating the profit/loss value calculation means and the assigning means until every assignment has been assigned. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34)
-
-
35. A resource assigning apparatus to be used by a compiler which compiles a program written in a high-level language into a machine language program, wherein the resource assigning apparatus generates a plurality of assignments, each of which is a combination of a variable in the program written in the high-level language and a live range, sets each generated assignment a priority level and assigns the generated assignments in order to resource elements of hardware resources such as registers and memory, the resource assigning apparatus comprising:
-
priority level setting means for detecting for each assignment in the program at least one of a frequency of use and a loop-nesting depth level from every part of the program and setting a priority level of each assignment based on a detection result; profit/loss value calculation means for calculating, for each resource element, a profit/loss value which shows a degree of suitability of a resource element for a next assignment, based on a positional relationship between live ranges of any assignments which have already been assigned and a live range of the next assignment; assigning means for assigning the next assignment to any of the resource elements based on the size of the profit/loss value calculated for each resource element; control means for repeatedly activating the profit/loss value calculation means and the assigning means until every assignment has been assigned. - View Dependent Claims (36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47)
-
-
48. A resource assigning apparatus to be used by a compiler which compiles a program written in a high-level language into a machine language program, wherein the resource assigning apparatus assigns a plurality of assignments, which are a combination of a variable in the program written in the high-level language and a live range, in order to resource elements of hardware resources such as registers and memory, the resource assigning apparatus comprising:
-
assignment storage means for storing assignments in the program, each assignment being corresponded to a priority level; first resource element assigning means for retrieving an assignment with a highest priority level in the assignment storage means and assigning the assignment with the highest priority level to any of the resource elements; assignment retrieval means for retrieving from the assignment storage means an assignment which has a priority level which comes in order directly after a priority level of an assignment which has just been assigned; following assignment interfering assignment detection means for detecting any assignments with a live range which interferes with a live range of the assignment retrieved by the assignment retrieval means; resource element detection means for detecting resource elements which have been assigned assignments detected by the following assignment interfering assignment detection means; assignment-resource element detection means for detecting all assignments which have been assigned to any resource element which has not been detected by the resource element detection means; profit continuation assigned assignment determination means for determining every assignment which has a live range which is continuous with a live range of the assignment retrieved by the assignment retrieval means, out of the assigned assignments detected by the assignment-resource element detection means; first profit/loss value calculation means for calculating a profit/loss value, which is a value showing appropriateness of assigning a next assignment to a resource element to which an assignment has already been assigned, based on an extent of live range length from an assignment determined by the profit continuation assigned assignment determination means to the assignment retrieved by the assignment retrieval means, for each resource element assigned an assignment determined by the profit continuation assigned assignment determination means; totalling means for totalling the calculated profit/loss values for each resource element determined by the assignment-resource element detection means; second resource element assigning means for assigning the assignment retrieved by the assignment retrieval means to a resource element with a highest total value totalled by the totalling means; and control means for repeatedly activating the assignment retrieval means until every assignment has been assigned. - View Dependent Claims (49, 50, 51)
-
Specification