Patent ID: 8296750
Filing Date: 2012-10-23
Classification: G06F

Abstract:
1. A method for optimizing a target program comprising a pattern to be replaced, said pattern comprising instructions, said method being performed by execution of program code by a processor of an information processing apparatus that comprises a computer readable storage medium and an output device, said program code stored on the computer readable storage medium, said method comprising: retrieving a target subprogram comprising instructions corresponding to the instructions of the pattern to be replaced; performing at least one transformation on the target program to generate a transformed target subprogram in which dependencies among the instructions comprised by the target subprogram are matched with dependencies in the pattern to be replaced; and replacing the transformed target subprogram, with a post-replacement instruction stream determined to correspond to the pattern to be replaced, to generate a replaced target subprogram; outputting an optimized target program that includes the replaced target subprogram to the output device of the information processing apparatus; wherein the at least one transformation comprises a first transformation, a loop transformation, or both the first transformation and the loop transformation; wherein performing the first transformation comprises moving an instruction of the target subprogram executed prior to a conditional branch instruction of the target subprogram to each branch destination of the conditional branch instruction, said performing the first transformation resulting in first dependencies among the instructions comprised by the target subprogram being matched with corresponding dependencies in the pattern to be replaced; wherein performing the loop transformation comprises changing phases of instruction execution for loop processing in the target subprogram with respect to a first group of instructions at a beginning of the loop processing and a second group of instructions following the first group of instructions in the loop processing, said changing phases of instruction execution resulting in loop dependencies among the instructions comprised by the target subprogram being matched with corresponding dependencies in the pattern to be replaced; wherein said changing phases of instruction execution comprises duplicating the first group of instructions from the loop processing, moving the second group of instructions to the beginning of the loop processing, copying the duplicated first group of instructions to after the second group of instructions in the loop processing, and copying at least one instruction of the duplicated first group of instructions to before the loop processing.