Optimizing compiler for shortening execution time of object program
AssigneeFujitsu Limited
InventorKohIchiro Hotta
Life of this patent
Estimating the term…
Abstract
An optimizing compiler has a function of determining whether the result of a statement to be executed precedent to a conditional branch statement is not referred to by one destination of the conditional branch statement. If the conditional branch statement is not influenced by the execution result of the precedent statement, the conditional branch statement is shifted in front of the precedent statement, to suppress the execution of the unnecessary statement. Therefore, the optimizing compiler shifts/copies conditional branch statements, to shorten the execution time of an object program.
Claims18
An optimizing compiler comprising:
- a source program analyzer for converting a source program written in a first language into intermediate codes, said source code having a conditional branch statement;
- an optimization unit for receiving said intermediate codes from said source program analyzer and for optimizing said intermediate codes;
- and
- a code generator for receiving said optimized intermediate codes from said optimization unit and for converting said optimized intermediate codes into an object program written in a second language, wherein said optimization unit includes
- a data flow analyzer for determining, from said intermediate codes received by said optimization unit, whether one destination of said conditional branch statement does not refer to a result of a statement to be executed precedent to said conditional branch statement,
- a program structure analyzer for determining, from said intermediate codes received by said optimization unit, whether said conditional branch statement is not affected by the execution result of said precedent statement, and
- a program structure changer for shifting said conditional branch statement before the precedent statement in accordance with the determination of said data flow analyzer and the determination of said program structure analyzer, to suppress an execution of an unnecessary statement.
An optimizing compiler comprising:
- a source program analyzer for converting a source program written in a first language into intermediate code, said source code having a sequence of instructions which includes a conditional branch statement;
- an optimization unit for receiving said intermediate codes from said source program analyzer and for optimizing said intermediate code;
- and
- a code generator for receiving said optimized intermediate codes from said optimization unit and for converting said optimized intermediate code into an object program written in a second language, wherein said optimization unit includes
- a data flow analyzer for determining, from said intermediate codes received by said optimization unit, whether a destination of said conditional branch statement does not refer to a result of a statement to be executed precedent to said conditional branch statement,
- a program structure analyzer for determining, from said intermediate codes received by said optimization unit and before the execution of said precedent statement, a sufficient condition to branch to said destination that does not refer to the execution result of said precedent statement even if said conditional branch statement is influenced by the execution result of said precedent statement, and
- a program structure changer for copying said conditional branch statement to a different position in the sequence of instructions, to reduce the number of repetitions of said precedent statement.
A compiler for optimizing code, the code including a sequence of instructions having a conditional branch statement, the compiler comprising:
- a data flow analyzer receiving the code and determining whether a destination of the conditional branch statement does not refer to a result of a statement to be executed precedent to the conditional branch statement;
- a program structure analyzer receiving the code and determining whether the conditional branch statement is not affected by the execution result of the precedent statement;
- and
- a program structure changer shifting the conditional branch statement before the precedent statement in accordance with the determination of the data flow analyzer and the determination of the program structure analyzer.
A compiler for optimizing code, the code including a sequence of instructions having a conditional branch statement, the compiler comprising:
- a data flow analyzer receiving the code and determining whether a destination of the conditional branch statement does not refer to a result of a statement to be executed precedent to the conditional branch statement;
- a program structure analyzer receiving the code and determining, before the execution of the precedent statement, a sufficient condition to branch to the destination that does not refer to the execution result of the precedent statement even when the conditional branch statement is influenced by the execution result of the precedent statement;
- and
- a program structure changer for copying the conditional branch statement before the precedent statement in accordance with the determination of the data flow analyzer and the determination of the program structure analyzer, to reduce the number of repetitions of the precedent statement.
An optimizing method for a compiler which compiles code having a conditional branch statement, the method comprising the steps of:
- determining whether a destination of the conditional branch statement does not refer to a result of an execution of a statement precedent to said conditional branch statement;
- and
- shifting said conditional branch statement before said precedent statement if said conditional branch statement is not affected by the execution result of said precedent statement, to thereby suppress an execution of an unnecessary statement.
An optimizing method for a compiler which compiles code having a sequence of instructions that includes a conditional branch statement, the method comprising:
- determining whether a destination of the conditional branch statement does not refer to a result of an execution of a statement precedent to said conditional branch statement;
- reducing the number of repetitions of said precedent statement by determining, before executing said precedent statement, a sufficient condition of branching to the destination that does not refer to the execution result of said precedent statement;
- and
- copying said conditional branch statement to a different position in the sequence of instructions, even if said conditional branch statement is influenced by the execution result of said precedent statement.
Dependencies are inferred from the claim text.