Resource assignment apparatus
First Claim
1. A resource assignment apparatus used by a compiler which compiles programs written in a high-level language into programs written in machine language for assigning assignments which are a pairing of variables and live ranges in a program to separate resource elements which make up resources, divided up according to function, such as registers and memory, according to a priority value of the assignment, comprising:
- assignment storage means for storing the assignments in a program and their priority values;
first resource element assigning means for taking an assignment with a highest priority value from the assignment storage means and assigning the assignment with the highest priority value to a resource element;
assigning result storage means for storing assigning results;
assignment retrieval means for retrieving from the assignment storage means an assignment which has a next highest priority value after a priority value of an assignment which has just been assigned;
interfering assignment extraction means for extracting assignments whose live ranges interfere with a live range of the assignment retrieved by the assignment retrieval means;
same resource remaining resource element determination means for determining whether there are any resource elements of resources which perform a same function as each of the resource elements to which the assignments extracted by the interfering assignment extraction means have been assigned by referring to the assigning result storage means;
coherent assignment retrieval means for retrieving the assignments for which, by referring to the starting point and end point of the live range, a starting point is coincident with the end point of the assignment retrieved by the assignment retrieval means and assignments for which an end point is coincident with the starting point of the assignment retrieved by the assignment retrieval means;
succession resource element determination means for determining the resource element to which the assignments retrieved by the coherent assignment retrieval means are assigned, by referring to the assigning result storage means;
second resource element assigning meansfor assigning, when there is only one resource element determined by the same resource remaining element determination means, the assignment retrieved by the assignment retrieval means to the resource element,for assigning the assignment taken by the assignment retrieval means to any resource element which is the determination result of the same resource remaining resource element determination means and, moreover, the determination result of the succession resource element determination means, when there is a plurality of resource elements determined by the same resource remaining resource element determination means and a resource element determined by the succession resource element determination means exists,and for storing the assigning result in the assigning result storage means;
control means for repeatedly having the assignment retrieval means activated, until all of the assignments have been assigned;
profit value calculation means for calculating a profit value which shows how memory size and/or execution time are reduced for a machine language program after compiling if an assignment is assigned to one of the resource elements determined by the same resource remaining resource element determination means, for each of the resource elements determined by the same resource remaining resource element determination means;
loss value calculation means for calculating a loss value which shows how memory size and/or execution time are increased for a machine language program after compiling if an assignment is assigned to one of the resource elements determined by the same resource remaining resource element determination means for each of the resource elements determined by the same resource remaining resource element determination means;
secondary interfering assignment extraction means for retrieving assignments which have live ranges which interfere with the live ranges of the assignments retrieved by the coherent assignment retrieval means, but are not the retrieved results of the interfering assignment extraction means; and
first loss occurring resource element determination means for determining to which resource elements the assignments which are the retrieval results of the secondary interfering assignment retrieval means are assigned, by referring to the assigning result storage means;
wherein the loss value calculation means calculates loss values of the resource elements determined by the first loss occurring resource element determination means based on the priority values of the assignments determined by the coherent assignment determination means and, moreover, whose live range interferes with the live range of the assignment which is assigned to each of the resource elements, with the loss values of all of the resource elements aside from the resource element determined by the first loss occurring resource element determination means being set at 0.
1 Assignment
0 Petitions
Accused Products
Abstract
A resource assignment apparatus for use with a software compiler or translator for compiling or translating a high-level source program into a machine language program, wherein the resource assignment apparatus assigns the variables in the high-level source program to system resources consisting of registers, memory, and the like. The resource assignment apparatus generates assignments consisting of the variables and their live ranges and finds the interference cost incurred when assigning these various assignments to each of the various resources, consisting of data registers, address registers, memory, and the like. The apparatus sorts the assignments into groups whereby these interference costs will be the lowest. The resource element minority assignment unit then carries out the assigning of each of these groups of sorted assignment. The various assignments with live ranges which interfere are assigned to different resource elements. When there are a number of resource elements to which an assignment can be assigned, the apparatus determines which is the most appropriate resource element, and assigns the assignment to this most appropriate resource element. When there is no resource element for which assigning is possible, the assignment is then moved to another resource group.
-
Citations
58 Claims
-
1. A resource assignment apparatus used by a compiler which compiles programs written in a high-level language into programs written in machine language for assigning assignments which are a pairing of variables and live ranges in a program to separate resource elements which make up resources, divided up according to function, such as registers and memory, according to a priority value of the assignment, comprising:
-
assignment storage means for storing the assignments in a program and their priority values; first resource element assigning means for taking an assignment with a highest priority value from the assignment storage means and assigning the assignment with the highest priority value to a resource element; assigning result storage means for storing assigning results; assignment retrieval means for retrieving from the assignment storage means an assignment which has a next highest priority value after a priority value of an assignment which has just been assigned; interfering assignment extraction means for extracting assignments whose live ranges interfere with a live range of the assignment retrieved by the assignment retrieval means; same resource remaining resource element determination means for determining whether there are any resource elements of resources which perform a same function as each of the resource elements to which the assignments extracted by the interfering assignment extraction means have been assigned by referring to the assigning result storage means; coherent assignment retrieval means for retrieving the assignments for which, by referring to the starting point and end point of the live range, a starting point is coincident with the end point of the assignment retrieved by the assignment retrieval means and assignments for which an end point is coincident with the starting point of the assignment retrieved by the assignment retrieval means; succession resource element determination means for determining the resource element to which the assignments retrieved by the coherent assignment retrieval means are assigned, by referring to the assigning result storage means; second resource element assigning means for assigning, when there is only one resource element determined by the same resource remaining element determination means, the assignment retrieved by the assignment retrieval means to the resource element, for assigning the assignment taken by the assignment retrieval means to any resource element which is the determination result of the same resource remaining resource element determination means and, moreover, the determination result of the succession resource element determination means, when there is a plurality of resource elements determined by the same resource remaining resource element determination means and a resource element determined by the succession resource element determination means exists, and for storing the assigning result in the assigning result storage means; control means for repeatedly having the assignment retrieval means activated, until all of the assignments have been assigned; profit value calculation means for calculating a profit value which shows how memory size and/or execution time are reduced for a machine language program after compiling if an assignment is assigned to one of the resource elements determined by the same resource remaining resource element determination means, for each of the resource elements determined by the same resource remaining resource element determination means; loss value calculation means for calculating a loss value which shows how memory size and/or execution time are increased for a machine language program after compiling if an assignment is assigned to one of the resource elements determined by the same resource remaining resource element determination means for each of the resource elements determined by the same resource remaining resource element determination means; secondary interfering assignment extraction means for retrieving assignments which have live ranges which interfere with the live ranges of the assignments retrieved by the coherent assignment retrieval means, but are not the retrieved results of the interfering assignment extraction means; and first loss occurring resource element determination means for determining to which resource elements the assignments which are the retrieval results of the secondary interfering assignment retrieval means are assigned, by referring to the assigning result storage means; wherein the loss value calculation means calculates loss values of the resource elements determined by the first loss occurring resource element determination means based on the priority values of the assignments determined by the coherent assignment determination means and, moreover, whose live range interferes with the live range of the assignment which is assigned to each of the resource elements, with the loss values of all of the resource elements aside from the resource element determined by the first loss occurring resource element determination means being set at 0. - View Dependent Claims (2, 3, 4)
-
-
5. A resource assignment apparatus used by a compiler which compiles programs written in a high-level language into programs written in machine language for assigning assignments which are a pairing of variables and live ranges in a program to separate resource elements which make up resources, divided up according to function, such as registers and memory, according to a priority value of the assignment, comprising:
-
assignment storage means for storing the assignments in a program and their priority values; first resource element assigning means for taking an assignment with a highest priority value from the assignment storage means and assigning the assignment with the highest priority value to a resource element; assigning result storage means for storing assigning results; assignment retrieval means for retrieving from the assignment storage means an assignment which has a next highest priority value after a priority value of an assignment which has just been assigned; interfering assignment extraction means for extracting assignments whose live ranges interfere with a live range of the assignment retrieved by the assignment retrieval means; same resource remaining resource element determination means for determining whether there are any resource elements of resources which perform a same function as each of the resource elements to which the assignments extracted by the interfering assignment extraction means have been assigned by referring to the assigning result storage means; coherent assignment retrieval means for retrieving the assignments for which, by referring to the starting point and end point of the live range, a starting point is coincident with the end point of the assignment retrieved by the assignment retrieval means and assignments for which an end point is coincident with the starting point of the assignment retrieved by the assignment retrieval means; succession resource element determination means for determining the resource element to which the assignments retrieved by the coherent assignment retrieval means are assigned, by referring to the assigning result storage means; second resource element assigning means for assigning, when there is only one resource element determined by the same resource remaining element determination means, the assignment retrieved by the assignment retrieval means to the resource element, for assigning the assignment taken by the assignment retrieval means to any resource element which is the determination result of the same resource remaining resource element determination means and, moreover, the determination result of the succession resource element determination means, when there is a plurality of resource elements determined by the same resource remaining resource element determination means and a resource element determined by the succession resource element determination means exists, and for storing the assigning result in the assigning result storage means, the second resource element assigning means comprising; first assigning means for assigning, when there is only one resource element determined by the same resource remaining resource element determination means, the assignment taken by the assignment retrieval means to the resource element; second assigning means for assigning the assignment taken by the assignment retrieval means to any of the resource elements determined by the same resource remaining resource element determination means when there is a plurality of resource elements determined by the same resource remaining resource element determination means and there is no corresponding resource element determined by the succession resource element determination means; and third assigning means for assigning the assignment taken by the assignment retrieval means to any of the resource elements determined as the determination result of the same resource remaining resource element determination means and, moreover, determined as the determination result of the succession resource element determination means, when there is a plurality of resource elements determined by the same resource remaining resource element determination means and a resource element determined by the succession resource element determination means exists; control means for repeatedly having the assignment retrieval means activated, until all of the assignments have been assigned; profit value calculation means for calculating a profit value which shows how memory size and/or execution time are reduced for a machine language program after compiling if an assignment is assigned to one of the resource elements determined by the same resource remaining resource element determination means, for each of the resource elements determined by the same resource remaining resource element determination means; loss value calculation means for calculating a loss value which shows how memory size and/or execution time are increased for a machine language program after compiling if an assignment is assigned to one of the resource elements determined by the same resource remaining resource element determination means, for each of the resource elements determined by the same resource remaining resource element determination means; greatest difference resource element determination means for calculating a difference between the profit value and the loss value and determining which resource elements have a greatest difference, wherein the third assigning means assigns the assignments retrieved by the assignment retrieval means to one of the resource elements determined by the greatest difference resource element determination means, and wherein the profit value calculation means calculates the profit value for the resource element determined by the succession resource element determination means based on the priority values of the assignments assigned to the resource element, with the profit values of the resource elements aside from the resource element determined by the succession resource element determination means being set to equal 0; secondary interfering assignment extraction means for retrieving assignments which have live ranges which interfere with the live ranges of the assignments retrieved by the coherent assignment retrieval means, but are not the retrieved results of the interfering assignment extraction means; and first loss occurring resource element determination means for determining to which resource elements the assignments which are the retrieval results of the secondary interfering assignment retrieval means are assigned, by referring to the assigning result storage means, wherein the loss value calculation means calculates loss values of the resource elements determined by the first loss occurring resource element determination means based on the priority values of the assignments determined by the coherent assignment determination means and, moreover, whose live range interferes with the live range of the assignment which is assigned to each of the resource elements, with the loss values of all of the resource elements aside from the resource element determined by the first loss occurring resource element determination means being set at 0. - View Dependent Claims (6, 7)
-
-
8. A resource assignment apparatus used by a compiler which compiles programs written in a high-level language into programs written in machine language for assigning assignments which are a pairing of variables and live ranges in a program to separate resource elements which make up resources, divided up according to function, such as registers and memory, according to a priority value of the assignment, comprising:
-
assignment storage means for storing the assignments in a program and their priority values; first resource element assigning means for taking an assignment with a highest priority value from the assignment storage means and assigning the assignment with the highest priority value to a resource element; assigning result storage means for storing assigning results; assignment retrieval means for retrieving from the assignment storage means an assignment which has a next highest priority value after a priority value of an assignment which has just been assigned; interfering assignment extraction means for extracting assignments whose live ranges interfere with a live range of the assignment retrieved by the assignment retrieval means; same resource remaining resource element determination means for determining whether there are any resource elements of resources which perform a same function as each of the resource elements to which the assignments extracted by the interfering assignment extraction means have been assigned by referring to the assigning result storage means; coherent assignment retrieval means for retrieving the assignments for which, by referring to the starting point and end point of the live range, a starting point is coincident with the end point of the assignment retrieved by the assignment retrieval means and assignments for which an end point is coincident with the starting point of the assignment retrieved by the assignment retrieval means; succession resource element determination means for determining the resource element to which the assignments retrieved by the coherent assignment retrieval means are assigned, by referring to the assigning result storage means; second resource element assigning means for assigning, when there is only one resource element determined by the same resource remaining element determination means, the assignment retrieved by the assignment retrieval means to the resource element, for assigning the assignment taken by the assignment retrieval means to any resource element which is the determination result of the same resource remaining resource element determination means and, moreover, the determination result of the succession resource element determination means, when there is a plurality of resource elements determined by the same resource remaining resource element determination means and a resource element determined by the succession resource element determination means exists, and for storing the assigning result in the assigning result storage means, the second resource element assigning means comprising; first assigning means for assigning, when there is only one resource element determined by the same resource remaining resource element determination means, the assignment taken by the assignment retrieval means to the resource element; second assigning means for assigning the assignment taken by the assignment retrieval means to any of the resource elements determined by the same resource remaining resource element determination means when there is a plurality of resource elements determined by the same resource remaining resource element determination means and there is no corresponding resource element determined by the succession resource element determination means; and third assigning means for assigning the assignment taken by the assignment retrieval means to any of the resource elements determined as the determination result of the same resource remaining resource element determination means and, moreover, determined as the determination result of the succession resource element determination means, when there is a plurality of resource elements determined by the same resource remaining resource element determination means and a resource element determined by the succession resource element determination means exists; control means for repeatedly having the assignment retrieval means activated until all of the assignments have been assigned; profit value calculation means for calculating a profit value which shows how memory size and/or execution time are reduced for a machine language program after compiling if an assignment is assigned to one of the resource elements determined by the same resource remaining resource element determination means, for each of the resource elements determined by the same resource remaining resource element determination means; loss value calculation means for calculating a loss value which shows how memory size and/or execution time are increased for a machine language program after compiling if an assignment is assigned to one of the resource elements determined by the same resource remaining resource element determination means, for each of the resource elements determined by the same resource remaining resource element determination means; greatest difference resource element determination means for calculating difference between the profit value and the loss value and determining which resource elements have a greatest difference; wherein the third assigning means assigns the assignments retrieved by the assignment retrieval means to one of the resource elements determined by the greatest difference resource element determination means; and loop-nesting depth level retrieval means for retrieving a loop-nesting depth level of each of the loops in the program; wherein the profit value calculation means calculates the profit value for the resource element determined by the succession resource element determination means based on the loop-nesting depth levels of the assignments assigned to the resource element, with the profit values of the resource elements aside from the resource element determined by the succession resource element determination means being set to equal 0. - View Dependent Claims (9, 10, 11)
-
-
12. A resource assignment apparatus used by a compiler which compiles programs written in a high-level language into programs written in machine language for assigning assignments which are a pairing of variables and live ranges in a program to separate resource elements which make up resources, divided up according to function, such as registers and memory, according to a priority value of the assignment, comprising:
-
assignment storage means for storing the assignments in a program and their priority values; first resource element assigning means for taking an assignment with a highest priority value from the assignment storage means and assigning the assignment with the highest priority value to a resource element; assigning result storage means for storing assigning results; assignment retrieval means for retrieving from the assignment storage means an assignment which has a next highest priority value after a priority value of an assignment which has just been assigned; interfering assignment extraction means for extracting assignments whose live ranges interfere with a live range of the assignment retrieved by the assignment retrieval means; same resource remaining resource element determination means for determining whether there are any resource elements of resources which perform a same function as each of the resource elements to which the assignments extracted by the interfering assignment extraction means have been assigned by referring to the assigning result storage means; coherent assignment retrieval means for retrieving the assignments for which, by referring to the starting point and end point of the live range, a starting point is coincident with the end point of the assignment retrieved by the assignment retrieval means and assignments for which an end point is coincident with the starting point of the assignment retrieved by the assignment retrieval means; succession resource element determination means for determining the resource element to which the assignments retrieved by the coherent assignment retrieval means are assigned, by referring to the assigning result storage means; second resource element assigning means for assigning, when there is only one resource element determined by the same resource remaining element determination means, the assignment retrieved by the assignment retrieval means to the resource element, for assigning the assignment taken by the assignment retrieval means to any resource element which is the determination result of the same resource remaining resource element determination means and, moreover, the determination result of the succession resource element determination means, when there is a plurality of resource elements determined by the same resource remaining resource element determination means and a resource element determined by the succession resource element determination means exists, and for storing the assigning result in the assigning result storage means, the second resource element assigning means comprising; first assigning means for assigning, when there is only one resource element determined by the same resource remaining resource element determination means, the assignment taken by the assignment retrieval means to the resource element; second assigning means for assigning the assignment taken by the assignment retrieval means to any of the resource elements determined by the same resource remaining resource element determination means when there is a plurality of resource elements determined by the same resource remaining resource element determination means and there is no corresponding resource element determined by the succession resource element determination means; third assigning means for assigning the assignment taken by the assignment retrieval means to any of the resource elements determined as the determination result of the same resource remaining resource element determination means and, moreover, determined as the determination result of the succession resource element determination means, when there is a plurality of resource elements determined by the same resource remaining resource element determination means and a resource element determined by the succession resource element determination means exists; control means for repeatedly having the assignment retrieval means activated, until all of the assignments have been assigned; profit value calculation means for calculating a profit value which shows how memory size and/or execution time are reduced for a machine language program after compiling if an assignment is assigned to one of the resource elements determined by the same resource remaining resource element determination means, for each of the resource elements determined by the same resource remaining resource element determination means; loss value calculation means for calculating a loss value which shows how memory size and/or execution time are increased for a machine language program after compiling if an assignment is assigned to one of the resource elements determined by the same resource remaining resource element determination means, for each of the resource elements determined by the same resource remaining resource element determination means; and greatest difference resource element determination means for calculating a difference between the profit value and the loss value and determining which resource elements have a greatest difference; wherein the third assigning means assigns the assignments retrieved by the assignment retrieval means to one of the resource elements determined by the greatest difference resource element determination means; and wherein the profit value calculation means calculates the profit value for the resource element determined by the succession resource element determination means, based on a number of assignments out of the retrieved results of the coherent assignment retrieval means which are assigned to the resource element, with the profit values of the resource elements aside from the resource element determined by the succession resource element determination means being set to equal 0. - View Dependent Claims (13)
-
-
14. A resource assignment apparatus used by a compiler which compiles programs written in a high-level language into programs written in machine language for assigning assignments which are a pairing of variables and live ranges in a program to separate resource elements which make up resources, divided up according to function, such as registers and memory, according to a priority value of the assignment, comprising:
-
assignment storage means for storing the assignments in a program and their priority values; first resource element assigning means for taking an assignment with a highest priority value from the assignment storage means and assigning the assignment with the highest priority value to a resource element; assigning result storage means for storing assigning results; assignment retrieval means for retrieving from the assignment storage means an assignment which has a next highest priority value after a priority value of an assignment which has just been assigned; interfering assignment extraction means for extracting assignments whose live ranges interfere with a live range of the assignment retrieved by the assignment retrieval means; same resource remaining resource element determination means for determining whether there are any resource elements of resources which perform a same function as each of the resource elements to which the assignments extracted by the interfering assignment extraction means have been assigned by referring to the assigning result storage means; coherent assignment retrieval means for retrieving the assignments for which, by referring to the starting point and end point of the live range, a starting point is coincident with the end point of the assignment retrieved by the assignment retrieval means and assignments for which an end point is coincident with the starting point of the assignment retrieved by the assignment retrieval means; succession resource element determination means for determining the resource element to which the assignments retrieved by the coherent assignment retrieval means are assigned, by referring to the assigning result storage means; second resource element assigning means for assigning, when there is only one resource element determined by the same resource remaining element determination means, the assignment retrieved by the assignment retrieval means to the resource element, for assigning the assignment taken by the assignment retrieval means to any resource element which is the determination result of the same resource remaining resource element determination means and, moreover, the determination result of the succession resource element determination means, when there is a plurality of resource elements determined by the same resource remaining resource element determination means and a resource element determined by the succession resource element determination means exists, and for storing the assigning result in the assigning result storage means, the second resource element assigning means comprising; first assigning means for assigning, when there is only one resource element determined by the same resource remaining resource element determination means, the assignment taken by the assignment retrieval means to the resource element; second assigning means for assigning the assignment taken by the assignment retrieval means to any of the resource elements determined by the same resource remaining resource element determination means when there is a plurality of resource elements determined by the same resource remaining resource element determination means and there is no corresponding resource element determined by the succession resource element determination means; and third assigning means for assigning the assignment taken by the assignment retrieval means to any of the resource elements determined as the determination result of the same resource remaining resource element determination means and, moreover, determined as the determination result of the succession resource element determination means, when there is a plurality of resource elements determined by the same resource remaining resource element determination means and a resource element determined by the succession resource element determination means exists; control means for repeatedly having the assignment retrieval means activated, until all of the assignments have been assigned; profit value calculation means for calculating a profit value which shows how memory size and/or execution time are reduced for a machine language program after compiling if an assignment is assigned to one of the resource elements determined by the same resource remaining resource element determination means, for each of the resource elements determined by the same resource remaining resource element determination means; loss value calculation means for calculating a loss value which shows how memory size and/or execution time are increased for a machine language program after compiling if an assignment is assigned to one of the resource elements determined by the same resource remaining resource element determination means, for each of the resource elements determined by the same resource remaining resource element determination means; greatest difference resource element determination means for calculating a difference between the profit value and the loss value and determining which resource elements have a greatest difference; wherein the third assigning means assigns the assignments retrieved by the assignment retrieval means to one of the resource elements determined by the greatest difference resource element determination means; and execution frequency storage means for storing a frequency which shows how often each step in the program is executed corresponding to every step in the program; and
execution frequency totalling means for totalling the frequencies of steps in the program for every assignment stored in the assignment storage means, setting the corresponding totalled values as the execution frequency of every assignment;wherein the profit value calculation means calculates the profit value for the resource element determined by the succession resource element determination means based on the execution frequencies of the assignments assigned to the resource element, with the profit values of the resource elements aside from the resource element determined by the succession resource element determination means being set to equal 0. - View Dependent Claims (15)
-
-
16. A resource assignment apparatus used by a compiler which compiles programs written in a high-level language into programs written in machine language for assigning assignments which are a pairing of variables and live ranges in a program to separate resource elements which make up resources, divided up according to function, such as registers and memory, according to a priority value of the assignment, comprising:
-
assignment storage means for storing the assignments in a program and their priority values; first resource element assigning means for taking an assignment with a highest priority value from the assignment storage means and assigning the assignment with the highest priority value to a resource element; assigning result storage means for storing assigning results; assignment retrieval means for retrieving from the assignment storage means an assignment which has a next highest priority value after a priority value of an assignment which has just been assigned; interfering assignment extraction means for extracting assignments whose live ranges interfere with a live range of the assignment retrieved by the assignment retrieval means; same resource remaining resource element determination means for determining whether there are any resource elements of resources which perform a same function as each of the resource elements to which the assignments extracted by the interfering assignment extraction means have been assigned by referring to the assigning result storage means; coherent assignment retrieval means for retrieving the assignments for which, by referring to the starting point and end point of the live range, a starting point is coincident with the end point of the assignment retrieved by the assignment retrieval means and assignments for which an end point is coincident with the starting point of the assignment retrieved by the assignment retrieval means; succession resource element determination means for determining the resource element to which the assignments retrieved by the coherent assignment retrieval means are assigned, by referring to the assigning result storage means; second resource element assigning means for assigning, when there is only one resource element determined by the same resource remaining element determination means, the assignment retrieved by the assignment retrieval means to the resource element, for assigning the assignment taken by the assignment retrieval means to any resource element which is the determination result of the same resource remaining resource element determination means and, moreover, the determination result of the succession resource element determination means, when there is a plurality of resource elements determined by the same resource remaining resource element determination means and a resource element determined by the succession resource element determination means exists, and for storing the assigning result in the assigning result storage means, the second resource element assigning means comprising; first assigning means for assigning, when there is only one resource element determined by the same resource remaining resource element determination means, the assignment taken by the assignment retrieval means to the resource element; second assigning means for assigning the assignment taken by the assignment retrieval means to any of the resource elements determined by the same resource remaining resource element determination means when there is a plurality of resource elements determined by the same resource remaining resource element determination means and there is no corresponding resource element determined by the succession resource element determination means; and third assigning means for assigning the assignment taken by the assignment retrieval means to any of the resource elements determined as the determination result of the same resource remaining resource element determination means and, moreover, determined as the determination result of the succession resource element determination means, when there is a plurality of resource elements determined by the same resource remaining resource element determination means and a resource element determined by the succession resource element determination means exists; control means for repeatedly having the assignment retrieval means activated, until all of the assignments have been assigned; profit value calculation means for calculating a profit value which shows how memory size and/or execution time are reduced for a machine language program after compiling if an assignment is assigned to one of the resource elements determined by the same resource remaining resource element determination means, for each of the resource elements determined by the same resource remaining resource element determination means; loss value calculation means for calculating a loss value which shows how memory size and/or execution time are increased for a machine language program after compiling if an assignment is assigned to one of the resource elements determined by the same resource remaining resource element determination means, for each of the resource elements determined by the same resource remaining resource element determination means.; greatest difference resource element determination means for calculating a difference between the profit value and the loss value and determining which resource elements have a greatest difference; wherein the third assigning means assigns the assignments retrieved by the assignment retrieval means to one of the resource elements determined by the greatest difference resource element determination means; global group creation means for retrieving a plurality of assignments whose live ranges are connected one after another, out of the assignments stored in the assignment storage means, and setting the retrieved assignments as a global group; global group retrieval means for retrieving a global group which contains the assignment retrieved by the assignment retrieval means, when there are a plurality of resource elements determined by the greatest resource element determination means; and global profit value calculation means for calculating a global profit value which shows how memory size and/or execution time are reduced if an as yet unassigned assignment is assigned to a common resource element, for each of the resource elements determined by the same resource remaining resource element determination means; and
global loss calculation means for calculating a global loss value which shows how memory size and/or execution time are increased if an as yet unassigned assignment is assigned to a common resource element, for each of the resource elements determined by the same resource remaining resource element determination means;wherein for a case when a plurality of resource elements are determined by the greatest difference resource element determination means, the third assigning means calculates a difference between the global profit value and the global loss value, and then assigns the taken assignment to a resource element for which the difference is greatest. - View Dependent Claims (17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28)
-
-
29. A resource assignment apparatus used by a compiler which compiles programs written in a high-level language into programs written in machine language for assigning assignments which are a pairing of variables and live ranges in a program written in programming language to separate resource elements which make up resources, divided up according to function, such as registers and memory, according to a priority value of the assignment, comprising:
-
cost storage means for storing for every resource a cost which shows code size and/or execution time of every instruction used by the resource; cost retrieval means for retrieving the cost for every resource by referring to the cost storage means, for each of the instructions in a program which are used in the live range of a variable in one assignment; cost totalling means for totalling the costs retrieved by the cost retrieval means of each of the assignments for each resource; priority value calculation means for calculating the priority value based on the cost total value calculated for each of the assignments and the live ranges of the various assignments; assignment storage means for storing the assignments in a program and their priority values; first resource element assigning means for taking an assignment with a highest priority value from the assignment storage means and assigning the assignment with the highest priority value to a resource element; assigning result storage means for storing assigning results; assignment retrieval means for retrieving from the assignment storage means an assignment which has a next highest priority value after a priority value of an assignment which has just been assigned; interfering assignment extraction means for extracting assignments whose live ranges interfere with a live range of the assignment retrieved by the assignment retrieval means; same resource remaining resource element determination means for determining whether there are any resource elements of resources which perform the same function as each of the resource elements to which the assignment extracted by the interfering assignment extraction means has been assigned by referring to the assigning result storage means; coherent assignment retrieval means for retrieving the assignments for which, by referring to the starting point and end point of the live range, a starting point is coincident with the end point of the assignment taken by the assignment retrieval means and assignments for which an end point is coincident with the same starting point of the assignment taken by the assignment retrieval means; succession resource element determination means for determining the resource elements to which the assignments retrieved by the coherent assignment retrieval means are assigned, by referring to the assigning result storage means; second resource element assigning means for assigning, when there is only one resource element determined by the same resource remaining element determination means, the assignment retrieved by the assignment retrieval means to the resource element, for assigning the assignment taken by the assignment retrieval means to any resource element which is the determination result of the succession resource element determination means and, moreover, the determination result of the same resource remaining resource element determination means, when there is a plurality of resource elements determined by the same resource remaining resource element determination means and a resource element determined by the succession resource element determination means exists, and for storing the assigning result in the assigning result storage means; and control means for repeatedly having the assignment retrieval means activated, until all of the assignments have been assigned. - View Dependent Claims (38, 39)
-
-
30. A resource assignment apparatus used by a compiler which compiles programs written in a high-level language into programs written in machine language for assigning assignments which are a pairing of variables and live ranges in a program written in programming language to separate resource elements which make up resources, divided up according to function, such as registers and memory, according to a priority value of the assignment, comprising:
-
cost storage means for storing for every resource a cost which shows code size and/or execution time of every instruction used by the resource; cost retrieval means for retrieving the cost for every resource by referring to the cost storage means, for each of the instructions in a program which are used in the live range of a variable in one assignment; cost totalling means for totalling the costs retrieved by the cost retrieval means of each of the assignments for each resource; priority value calculation means for calculating the priority value based on the cost total value calculated for each of the assignments and the live ranges of the various assignments; assignment storage means for storing the assignments in a program and their priority values; first resource element assigning means for taking an assignment with a highest priority value from the assignment storage means and assigning the assignment with the highest priority value to a resource element; assigning result storage means for storing assigning results; assignment retrieval means for retrieving from the assignment storage means an assignment which has a next highest priority value after a priority value of an assignment which has just been assigned; interfering assignment extraction means for extracting assignments whose live ranges interfere with a live range of the assignment retrieved by the assignment retrieval means; same resource remaining resource element determination means for determining whether there are any resource elements of resources which perform the same function as each of the resource elements to which the assignment extracted by the interfering assignment extraction means has been assigned by referring to the assigning result storage means; coherent assignment retrieval means for retrieving the assignments for which, by referring to the starting point and end point of the live range, a starting point is coincident with the end point of the assignment taken by the assignment retrieval means and assignments for which an end point is coincident with the same starting point of the assignment taken by the assignment retrieval means; succession resource element determination means for determining the resource elements to which the assignments retrieved by the coherent assignment retrieval means are assigned, by referring to the assigning result storage means; second resource element assigning means for assigning, when there is only one resource element determined by the same resource remaining element determination means, the assignment retrieved by the assignment retrieval means to the resource element, for assigning the assignment taken by the assignment retrieval means to any resource element which is the determination result of the succession resource element determination means and, moreover, the determination result of the same resource remaining resource element determination means, when there is a plurality of resource elements determined by the same resource remaining resource element determination means and a resource element determined by the succession resource element determination means exists, and for storing the assigning result in the assigning result storage means; control means for repeatedly having the assignment retrieval means activated, until all of the assignments have been assigned; and resource classified assignment supply means for supplying all of the assignments which can be assigned to the same resource to the assignment storage means, wherein the resource classified assignment supply means comprises; resource determination means for determining which resource has a lowest total cost, out of the totalled costs for the various assignments calculated by the cost totalling means; resource classified group conversion means for referring to the various assignments and the resources which correspond to the assignments determined by the resource determination means and converting into groups the assignments obtained as having the same determination results to form resource classified groups; resource classified group selection means for selecting one group out of the several resource classified groups formed by the resource classified group conversion means; resource classified group writing means for writing the resource classified group selected by the resource classified group selection means into the assignment storage means; and control means for indicating a selection of a next resource classified group, when all the assignments stored in the assignment storage means have been taken by the assignment retrieval means. - View Dependent Claims (31, 32, 33, 34, 35, 36, 37)
-
-
40. A resource assignment apparatus used by a compiler which compiles programs written in a high-level language into programs written in machine language for assigning assignments which are a pairing of variables and live ranges in a program written in programming language to resource elements which make up resources, divided up according to function, such as registers and memory, according to a priority value of the assignment, comprising:
-
reserved assignment extraction means for extracting assignments in the program which should be assigned to a previously determined resource element; reserved resource element storage means for storing the resource elements to which the assignments extracted by the reserved assignment extraction means should be assigned; reserved assigning means for assigning the assignments extracted by the reserved assignment extraction means to the corresponding resource elements out of the resource elements stored by the reserved resource element storage means, and having the assigning results stored by the assigning result storage means; assignment storage means for storing the assignments in a program and their priority values; first resource element assigning means for taking an assignment with a highest priority value from the assignment storage means and assigning an assignment with the highest priority value to a resource element; assigning result storage means for storing assigning results; assignment retrieval means for retrieving from the assignment storage means an assignment which has a next highest priority value after a priority value of an assignment which has just been assigned; interfering assignment extraction means for extracting assignments whose live ranges interfere with a live range of the assignment retrieved by the assignment retrieval means; same resource remaining resource element determination means for determining whether there are any resource elements of resources which perform a same function as each of the resource elements to which the assignments extracted by the interfering assignment extraction means have been assigned by referring to the assigning result storage means; coherent assignment retrieval means for retrieving the assignments for which, by referring to the starting point and end point of the live range, a starting point is coincident with the end point of the assignment taken by the assignment retrieval means and assignments for which an end point is coincident with the starting point of the assignment taken by the assignment retrieval means; succession resource element determination means for determining the resource elements to which the assignments retrieved by the coherent assignment retrieval means can be assigned, by referring to the assigning result storage means; second resource element assigning means for assigning, when there is only one resource element determined by the same resource remaining element determination means, the assignment retrieved by the assignment retrieval means to the resource element, for assigning the assignment taken by the assignment retrieval means to any resource element which is the determination result of the same resource remaining resource element determination means and, moreover, the determination result of the succession resource element determination means, when there is a plurality of resource elements determined by the same resource remaining resource element determination means and a resource element determined by the succession resource element determination means exists, and for storing the assigning result in the assigning result storage means; and control means for repeatedly having the assignment retrieval means activated, until all of the assignments have been assigned.
-
-
41. A resource assignment apparatus used by a compiler which compiles programs written in a high-level language into programs written in machine language for assigning assignments which are a pairing of variables and live ranges in a program written in programming language to resource elements which make up resources, divided up according to function, such as registers and memory, according to a priority value of the assignment, comprising:
-
reserved assignment extraction means for extracting assignments in the program which should be assigned to a previously determined resource element; reserved resource element storage means for storing the resource elements to which the assignments extracted by the reserved assignment extraction means should be assigned; reserved assigning means for assigning the assignments extracted by the reserved assignment extraction means to the corresponding resource elements out of the resource elements stored by the reserved resource element storage means, and having the assigning results stored by the assigning result storage means; assignment storage means for storing the assignments in a program and their priority values; first resource element assigning means for taking an assignment with a highest priority value from the assignment storage means and assigning an assignment with the highest priority value to a resource element; assigning result storage means for storing assigning results; assignment retrieval means for retrieving from the assignment storage means an assignment which has a next highest priority value after a priority value of an assignment which has just been assigned; interfering assignment extraction means for extracting assignments whose live ranges interfere with a live range of the assignment retrieved by the assignment retrieval means; same resource remaining resource element determination means for determining whether there are any resource elements of resources which perform a same function as each of the resource elements to which the assignments extracted by the interfering assignment extraction means have been assigned by referring to the assigning result storage means; coherent assignment retrieval means for retrieving the assignments for which, by referring to the starting point and end point of the live range, a starting point is coincident with the end point of the assignment taken by the assignment retrieval means and assignments for which an end point is coincident with the starting point of the assignment taken by the assignment retrieval means; succession resource element determination means for determining the resource elements to which the assignments retrieved by the coherent assignment retrieval means can be assigned, by referring to the assigning result storage means; second resource element assigning means for assigning, when there is only one resource element determined by the same resource remaining element determination means the assignment retrieved by the assignment retrieval means to the resource element, for assigning the assignment taken by the assignment retrieval means to any resource element which is the determination result of the same resource remaining resource element determination means and, moreover, the determination result of the succession resource element determination means, when there is a plurality of resource elements determined by the same resource remaining resource element determination means and a resource element determined by the succession resource element determination means exists, and for storing the assigning result in the assigning result storage means; and control means for repeatedly having the assignment retrieval means activated, until all of the assignments have been assigned; the second resource element assigning means comprising;
first assigning means for assigning, when there is only one resource element determined by the same resource remaining resource element determination means, the assignment taken by the assignment retrieval means to the resource element;second assigning means for assigning the assignment taken by the assignment retrieval means to any of the resource elements determined by the same resource remaining resource element determination means when there is a plurality of resource elements determined by the same resource remaining resource element determination means and there is no corresponding resource element determined by the succession resource element determination means; and third assigning means for assigning the assignment taken by the assignment retrieval means to any of the resource elements determined as the determination result of the same resource remaining resource element determination means and, moreover, determined as the determination result of the succession resource element determination means, when there is a plurality of resource elements determined by the same resource remaining resource element determination means and a resource element determined by the succession resource element determination means exists. - View Dependent Claims (42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58)
-
Specification