Compiler with improved live range interference investigation
First Claim
1. A compiler for compiling a program composed of a plurality of instructions into a machine language program, comprising:
- jump instruction detection means for detecting jump instructions in the program and a jump destination instruction for each of the jump instructions;
division means for dividing the program into basic blocks based on the jump instructions and the jump destination instructions detected by the jump instruction detection means;
live range detection means for detecting, for every variable in the program, a live range which is a range for which a variable in the program is valid, and for expressing a detection result for each variable as a set of instruction position information showing positions of instructions included in the live range;
basic block internal live variable detection means for detecting every variable for which the live range detected by the live range detection means is positioned entirely within one of the basic blocks and for expressing a detection result for each of the basic blocks as a basic block internal live variable group corresponded to an appropriate basic block;
inter-basic block live variable detection means for detecting every variable for which the live range detected by the live range detection means extends between basic blocks and for expressing a detection result as an inter-basic block live variable group;
first live range interference judgement means for taking two variables at a time from the inter-basic block live variable group and, by finding an intersection set of sets of instruction position information corresponding to the live ranges of two variables, for judging whether there is interference between the live ranges;
second live range interference judgement means for taking two variables at a time from a basic block internal live variable group corresponded to a same basic block and, by calculating an intersection set of sets of instruction position information corresponding to the live ranges of the two variables, for judging whether there is interference between the live ranges; and
third live range interference judgement means for taking one variable at a time from a basic block internal live variable group corresponded to a basic block and one variable at a time from the inter-basic block live variable group and, by calculating an intersection set of sets of instruction position information corresponding to the live ranges of the two variables, for judging whether there is interference between the live ranges,wherein the compiler executes resource assignment using judgement results of the first, the second and the third live range interference judgement means.
1 Assignment
0 Petitions
Accused Products
Abstract
The present invention is constructed so as to form simple blocks within each basic block, with the simple block internal live range storage unit 12 storing variables whose live ranges are entirely located within one simple block. basic block internal live range storage unit 13 stores variables whose live ranges are located within a number of simple blocks but, at the same time, entirely within one basic block, and the inter-basic block live range group storage unit 14 stores variables whose live ranges extend between basic blocks. The live range generation unit 15 detects the live ranges of the variables and stores the result in the live range storage unit 11, whilst also storing the variables during the detection of live ranges in one of the simple block internal live range storage unit 12, the basic block internal live range storage unit 13 and the inter-basic block live range group storage unit 14. Then, the live range interference investigation unit 16 investigates the interference of live ranges between only the live ranges of the variables to be assigned by means of comparing the live ranges. By doing so, the investigation process for the live ranges of variables can be speeded up, and hence the speed of the compiling operation can be improved.
28 Citations
18 Claims
-
1. A compiler for compiling a program composed of a plurality of instructions into a machine language program, comprising:
-
jump instruction detection means for detecting jump instructions in the program and a jump destination instruction for each of the jump instructions; division means for dividing the program into basic blocks based on the jump instructions and the jump destination instructions detected by the jump instruction detection means; live range detection means for detecting, for every variable in the program, a live range which is a range for which a variable in the program is valid, and for expressing a detection result for each variable as a set of instruction position information showing positions of instructions included in the live range; basic block internal live variable detection means for detecting every variable for which the live range detected by the live range detection means is positioned entirely within one of the basic blocks and for expressing a detection result for each of the basic blocks as a basic block internal live variable group corresponded to an appropriate basic block; inter-basic block live variable detection means for detecting every variable for which the live range detected by the live range detection means extends between basic blocks and for expressing a detection result as an inter-basic block live variable group; first live range interference judgement means for taking two variables at a time from the inter-basic block live variable group and, by finding an intersection set of sets of instruction position information corresponding to the live ranges of two variables, for judging whether there is interference between the live ranges; second live range interference judgement means for taking two variables at a time from a basic block internal live variable group corresponded to a same basic block and, by calculating an intersection set of sets of instruction position information corresponding to the live ranges of the two variables, for judging whether there is interference between the live ranges; and third live range interference judgement means for taking one variable at a time from a basic block internal live variable group corresponded to a basic block and one variable at a time from the inter-basic block live variable group and, by calculating an intersection set of sets of instruction position information corresponding to the live ranges of the two variables, for judging whether there is interference between the live ranges, wherein the compiler executes resource assignment using judgement results of the first, the second and the third live range interference judgement means. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9)
-
-
10. A compiler for compiling a program, composed of a plurality of instructions, in which a number of simple blocks each of which is a series wherein at least one pair of a definition instruction for setting a value of a variable and a reference instruction which uses the value of the variable set by the definition variable are arranged in order, into a machine language program for which every variable in the program is assigned to one of registers and memory, comprising:
-
jump instruction detection means for detecting jump instructions in the program and a jump destination instruction for each of the jump instruction; division means for dividing the program into basic blocks based on the jump instructions and the jump destination instructions detected by the jump instruction detection means; definition instruction extraction means for extracting, once the program has been divided into basic blocks, one definition instruction at a time from a basic block; corresponding reference instruction detection means for detecting, once a definition instruction has been extracted, a reference instruction using a variable whose value is set by the definition instruction from the basic block including the definition instruction extracted by the definition instruction extraction means; definition instruction movement possibility judgement means for judging, once the reference instruction has been detected, whether it is possible to move the definition instruction to a position of the reference instruction detected by the corresponding reference instruction detection means; definition instruction movement means for moving, the definition instruction for which movement is judged by the definition instruction movement possibility judgement means to be possible to a point just before the reference instruction corresponding to the definition instruction and for synthesizing the definition instruction and the reference instruction into one simple block; and simple block remaining instruction movement means for moving, when the definition instruction moved by the definition instruction movement means before movement is a final instruction in a simple block, every remaining instruction in a same simple block as the definition instruction moved by the definition instruction movement means before movement to a point just before a movement destination of the definition instruction and for synthesizing every remaining instruction into a destination simple block; and resource assignment means for assigning, once the definition instruction extraction means has extracted every definition instruction, all variables whose live ranges interfere with one another to different registers. - View Dependent Claims (11, 12, 13, 14, 15, 16, 17, 18)
-
Specification