Patent ID: 6412105
Filing Date: 2002-06-25
Classification: G06F

Abstract:
A computer method, executed by an optimizing compiler program, for compiling a switch statement including one or more cases, and one or more alternatives, with each alternative selected by a subset of a full set of possible switch parameter values, with the method for execution on a VLIW-type CPU, said method comprising the steps of:generating modified executable code based on the switch statement so that said modified executable code contains instructions and data structures collect profile data describing frequencies of the occurrence of various constant switch parameter values; executing the modified executable code on the CPU and saving the collected profile data describing the frequencies of various constant switch parameter values into a profile data file; observing the frequencies of occurrence of said constant switch parameter values in said profile data file to identify probable alternatives which are most likely to be selected based on the constant values in the profile data file; for each identified probable alternative of said switch statement, identifying a probable subset of constant values, with the probable subset being those constant values in the full set with the highest frequency of occurrence; generating optimized executable code including a conditional statement, based on an identified probable subset of constant values, constructed before said switch statement; moving instructions of the identified probable alternative out of the switch statement; and scheduling moved instructions to be executed, prior to executing the switch statement, in the conditional mode under control of said conditional statement.