Patent ID: 7849292

Claim:
A method of optimizing a sequence of operations adapted for execution by a processor, where the execution is based in part on a set of condition flags, where some of the operations are of a producer type where execution of such an operation alters at least one of the condition flags, where some of the operations are of a consumer type where a result of the execution of such an operation differs based on a state of at least one of the condition flags, and where the method comprises: locating an operation, if any, that is next within the sequence of operations and setting a current operation to be that operation; processing the current operation as follows: a) de-activating, if not already de-activated, a consumed indicator associated with the current operation; b) when the current operation is of the producer type, then activating, if not already activated, a producer indicator associated with the current operation, and locating a first set of operations, if any, that i) are earlier in the sequence of operations than the current operation, ii) have their associated producer indicator activated, and iii) have their associated consumed indicator de-activated, and then de-activating the producer indicator associated with each operation in the first set; and c) when the current operation is of the consumer type, then locating a second set of operations, if any, that are earlier in the sequence of operations than the current operation, and then activating, if not already activated, the consumed indicator associated with each operation in the second set; and where: some of the operations are of a fusible type where such an operation may be fused with at least one other operation of the fusible type; the locating of the first set and the locating of the second set locate only those operations that are not within an exposed set at the time of the locating; and the processing of the current operation further comprises: d) when the current operation is the consumer type and is the fusible type, then locating a particular operation not in the exposed set, if any, that is the most recent occurrence within the sequence of operations of an operation with its producer indicator activated, and then if that particular operation is of the fusible type, then fusing the current operation with that particular operation.