Patent ID: 7171438

Claim:
A method of recognizing full-word saturating addition and subtraction in a program for every basis statement A of the form z=ADD(x,y) or z=SUB(x,y), the method performed on a computer comprising: inserting the statement z sat =ADDSAT(x,y) or z sat =SUBSAT(x,y) immediately following the statement A; computing bits values BITS(E,v) properties of the variable v at edges E in the program; computing condition COND(E) properties under which the edges E are executed in the program; computing reach REACH(E,v) properties indicating which values of the variable v reaches a use of variable z in statement S at edges E in the program for overflow or underflow or normal occurrences; replacing z in a statement S that uses z with the use of z sat if all of the following conditions hold for the statement S: a) the only values of z that reach S cause SATMAX to be assigned to z when overflow has occurred, b) the only values of z that reach S cause SATMIN to be assigned to z if underflow has occurred, and c) the only values of z that reach S are from the basis statement A if no underflow and no overflow has occurred; and removing statements made unnecessary by the replacement of uses of z with z sat in the previous step.