Compiler, compiler apparatus and compilation method
First Claim
1. A compilation method for translating a source program into a machine language program, including operation definition information in which an operation that corresponds to a machine language instruction specific to a target processor is defined, the compilation method comprising:
- a parser step of analyzing the source program;
an intermediate code conversion step of converting the analyzed source program into intermediate codes;
an optimization step of optimizing the converted intermediate codes; and
a code generation step of converting the optimized intermediate codes into machine language instructions, wherein the intermediate code conversion step includes;
a conversion sub-step of converting each statement in the analyzed source program into intermediate codes including a first intermediate code in a format of a function invocation and a second intermediate code in a format of a machine language instruction;
a detection sub-step of detecting whether or not the first intermediate code in the format of the function invocation refers to the operation defined in the operation definition information; and
a substitution sub-step of substituting the first intermediate code in the format of the function invocation with a corresponding machine language instruction in response to the detection in the detection sub-step, and wherein in the optimization step, the intermediate codes are optimized by performing one of the following;
(1) combining the corresponding machine language instruction of the first intermediate code in the format of the function invocation and the second intermediate code in the format of the machine language instruction into one machine language instruction, (2) removing redundancy between the corresponding machine language instruction of the first intermediate code in the format of the function invocation and the second intermediate code in the format of the machine language instruction, and (3) changing an order of the corresponding machine language instruction of the first intermediate code in the format of the function invocation and the second intermediate code in the format of the machine language instruction.
1 Assignment
0 Petitions
Accused Products
Abstract
An operator definition file 102 and the like included in a source program 101 and a compiler 100 that translates the source program 101 into a machine language program 105 are provided. The operator definition file 102 includes definitions of various fixed point type operators by class definitions. The compiler 100 can generate effectively advanced and specific instructions that a processor executes and make improvements through expanding functions and the like without repeating frequently upgrading of the version of the compiler itself. The compiler 100 is made up of an intermediate code generation unit 121 that generates intermediate codes, a machine language instruction substitution unit 122 that substitutes the intermediate codes referring to classes defined by the operator definition file 102 with machine language instructions and an optimization unit 130 that performs optimization targeting the intermediate codes including the substituted machine language instructions.
-
Citations
2 Claims
-
1. A compilation method for translating a source program into a machine language program, including operation definition information in which an operation that corresponds to a machine language instruction specific to a target processor is defined, the compilation method comprising:
-
a parser step of analyzing the source program;
an intermediate code conversion step of converting the analyzed source program into intermediate codes;
an optimization step of optimizing the converted intermediate codes; and
a code generation step of converting the optimized intermediate codes into machine language instructions, wherein the intermediate code conversion step includes;
a conversion sub-step of converting each statement in the analyzed source program into intermediate codes including a first intermediate code in a format of a function invocation and a second intermediate code in a format of a machine language instruction;
a detection sub-step of detecting whether or not the first intermediate code in the format of the function invocation refers to the operation defined in the operation definition information; and
a substitution sub-step of substituting the first intermediate code in the format of the function invocation with a corresponding machine language instruction in response to the detection in the detection sub-step, and wherein in the optimization step, the intermediate codes are optimized by performing one of the following;
(1) combining the corresponding machine language instruction of the first intermediate code in the format of the function invocation and the second intermediate code in the format of the machine language instruction into one machine language instruction, (2) removing redundancy between the corresponding machine language instruction of the first intermediate code in the format of the function invocation and the second intermediate code in the format of the machine language instruction, and (3) changing an order of the corresponding machine language instruction of the first intermediate code in the format of the function invocation and the second intermediate code in the format of the machine language instruction.
-
-
2-41. -41. (canceled)
Specification