Compiler capable of reducing interrupt handling in optimization and its optimization method
First Claim
1. A compiler reading a source program so as to perform a lexical analysis and a syntax analysis, generate an intermediate code, and add saving/return codes of a using register of a function, thereby generating an assembly program file, comprising:
- a using register control table by function for registering the information on a using register of a function and the information on a call function called by the function, in every function within the source program;
a using register extracting means by function for extracting a using register and a call function name, in every function, after analysis of the intermediate code, and registering the same into said using register control table by function;
a using register totaling means by function for totaling the registers used by a function called by an interruption function, with reference to said using register control table by function with the information registered therein by said using register extracting means by function, and newly registering the totaled registers in said using register control table by function as the using registers of the interruption function; and
an output means for adding saving/return codes of a using register of the interruption function to the intermediate code, with reference to said using register control table by function having the using registers totaled by said using register totaling means by function, so to generate and supply an assembly program file.
2 Assignments
0 Petitions
Accused Products
Abstract
A compiler comprises a using register control table by function, a using register extracting unit by function for extracting a using register and a call function name, in every function, based on the intermediate code generated from a source program, and registering the same into the using register control table by function, a using register totaling unit by function for totaling the registers used by a call function called by an interruption function, and newly registering the totaled registers in the using register control table by function as the using registers of the interruption function, and an output unit for adding saving/return codes of a using register of the interruption function to the intermediate code, with reference to the using register control table by function so to generate and supply an assembly program file.
-
Citations
13 Claims
-
1. A compiler reading a source program so as to perform a lexical analysis and a syntax analysis, generate an intermediate code, and add saving/return codes of a using register of a function, thereby generating an assembly program file, comprising:
-
a using register control table by function for registering the information on a using register of a function and the information on a call function called by the function, in every function within the source program;
a using register extracting means by function for extracting a using register and a call function name, in every function, after analysis of the intermediate code, and registering the same into said using register control table by function;
a using register totaling means by function for totaling the registers used by a function called by an interruption function, with reference to said using register control table by function with the information registered therein by said using register extracting means by function, and newly registering the totaled registers in said using register control table by function as the using registers of the interruption function; and
an output means for adding saving/return codes of a using register of the interruption function to the intermediate code, with reference to said using register control table by function having the using registers totaled by said using register totaling means by function, so to generate and supply an assembly program file. - View Dependent Claims (2, 3, 4, 5)
said using register totaling means by function reads the information having been registered in said using register control table by function sequentially in each function, so as to judge whether there exists a call function called by the function, and when there exists a call function called by the function, said unit deletes the call function from said using register control table by function, reads out the register information of the call function from said using register control table by function, and combines the using register of the call function with the using register of the calling function. -
4. A compiler as set forth in claim 1, wherein
said using register totaling means by function reads the information having been registered in said using register control table by function sequentially in each function, so as to judge whether there exists a call function called by the function; -
when there exists a call function called by the function, said unit deletes the call function from said using register control table by function, reads out the register information of the call function from said using register control table by function, and judges whether there exists a call function further called by this function;
when there exists a call function further called by this call function, said unit repeats the operation of deleting the call function and reading the information on this call function recursively; and
when there exists no more call function called by the noticed function, said unit combines the using register of the noticed function with the using register of the calling function that is the calling party for the noticed function.
-
-
5. A compiler as set forth in claim 1, wherein
said output means, with respect to an interruption function within the intermediate code, supplies the interruption function itself, supplies a saving code of a using register of the interruption function before the interruption function itself, and supplies a return code of the using register of the interruption function after the interruption function itself, while, with respect to the function other than the interruption function, said means supplies the function itself.
-
-
6. An optimization method in a compiler reading a source program so as to perform a lexical analysis and a syntax analysis, generate an intermediate code, and add saving/return codes of a using register in a function, thereby generating an assembly program file, comprising the following steps of:
-
extracting a using register and a call function name, in every function, after analysis of the intermediate code, and registering the same into said using register control table by function;
totaling the registers used by a function called by an interruption function, with reference to said using register control table by function with the information registered therein by said using register registering step, and newly registering the totaled registers in said using register control table by function as the using registers of the interruption function; and
adding saving/return codes of a using register of the interruption function to the intermediate code, with reference to said using register control table by function having the using registers totaled by said using register totaling step, so to generate and supply an assembly program file. - View Dependent Claims (7, 8, 9)
said every function using register totaling step further includes: a step of reading the information having been registered in said using register control table by function sequentially in each function, so as to judge whether there exists a call function called by the function; and
a step of, when there exists a call function called by the function, deleting the call function from said using register control table by function, reading out the register information of the call function from said using register control table by function, and combining the using register of the call function with the using register of the calling function.
-
-
8. An optimization method of a compiler as set forth in claim 6, wherein
said every function using register totaling step further includes: -
a step of reading the information having been registered in said using register control table by function sequentially in each function, so as to judge whether there exists a call function called by the function;
a step of, when there exists a call function called by the function, deleting the call function from said using register control table by function, reading out the register information of the call function from said using register control table by function, and judging whether there exists a call function further called by this function;
a step of, when there exists a call function further called by the above-mentioned call function, repeating the operation of deleting the call function and reading the information on this call function recursively; and
a step of, when there exists no more call function called from the noticed function, combining the using register of the noticed function with the using register of the calling function that is the calling party for the noticed function.
-
-
9. An optimization method of a compiler as set forth in claim 6, wherein
said output step includes: -
a step of judging whether a function within the intermediate code is an interruption function or not; and
with respect to an interruption function, said step includes;
a step of supplying a saving code of a using register of the interruption function before the interruption function itself;
a step of supplying the interruption function itself; and
a step of supplying a return code of a using register of the interruption function after the interruption function itself.
-
-
10. A computer readable memory storing a control program for generating an assembly program file by reading a source program, performing a lexical analysis and a syntax analysis, generating an intermediate code, and adding saving/return codes of a using register in a function, in a computer system, the control program comprising the following steps of:
-
extracting a using register and a call function name, in every function, after analysis of the intermediate code, and registering the same into said using register control table by function;
totaling the registers used by a function called by an interruption function, with reference to said using register control table by function with the information registered therein by said using register registering step, and newly registering the totaled registers in said using register control table by function as the using registers of the interruption function; and
adding saving/return codes of a using register of the interruption function, to the intermediate code, with reference to said using register control table by function having the using registers totaled by said using register totaling step, so to generate and supply an assembly program file. - View Dependent Claims (11, 12, 13)
said every function using register totaling step of said control program further includes: a step of reading the information having been registered in said using register control table by function sequentially in each function, so as to judge whether there exists a call function called by the function; and
a step of, when there exists a call function called by the function, deleting the call function from said using register control table by function, reading out the register information of the call function from said using register control table by function, and combining the using register of the call function with the using register of the calling function.
-
-
12. A computer readable memory as set forth in claim 10, wherein
said every function using register totaling step of said control program further includes: -
a step of reading the information having been registered in said using register control table by function sequentially in each function, so as to judge whether there exists a call function called by the function;
a step of, when there exists a call function called by the function, deleting the call function from said using register control table by function, reading out the register information of the call function from said using register control table by function, and judging whether there exists a call function further called by this function;
a step of, when there exists a call function further called by the above-mentioned call function, repeating the operation of deleting the call function and reading the information on this call function recursively; and
a step of, when there exists no more call function called from the noticed function, combining the using register of the noticed function with the using register of the calling function that is the calling party for the noticed function.
-
-
13. A computer readable memory as set forth in claim 10, wherein
said output step of said control program includes: -
a step of judging whether a function within the intermediate code is an interruption function or not; and
with respect to an interruption function, said step includes;
a step of supplying a saving code of a using register of the interruption function before the interruption function itself;
a step of supplying the interruption function itself; and
a step of supplying a return code of a using register of the interruption function after the interruption function itself.
-
Specification