@@ -33,7 +33,9 @@ private module Impl {
3333 /** Holds if SSA definition `def` equals `e + delta`. */
3434 predicate ssaUpdateStep ( ExplicitDefinition def , ExprNode e , int delta ) {
3535 exists ( ControlFlow:: Node cfn | cfn = def .getControlFlowNode ( ) |
36- e = cfn .( ExprNode:: Assignment ) .getRValue ( ) and delta = 0
36+ e = cfn .( ExprNode:: Assignment ) .getRValue ( ) and
37+ delta = 0 and
38+ not cfn instanceof ExprNode:: AssignOperation
3739 or
3840 e = cfn .( ExprNode:: PostIncrExpr ) .getOperand ( ) and delta = 1
3941 or
@@ -66,12 +68,24 @@ private module Impl {
6668 x .getIntValue ( ) = delta
6769 )
6870 or
71+ exists ( ConstantIntegerExpr x |
72+ e2 .( ExprNode:: AssignAddExpr ) .getLeftOperand ( ) = e1 and
73+ e2 .( ExprNode:: AssignAddExpr ) .getRightOperand ( ) = x and
74+ x .getIntValue ( ) = delta
75+ )
76+ or
6977 exists ( ConstantIntegerExpr x |
7078 e2 .( ExprNode:: SubExpr ) .getLeftOperand ( ) = e1 and
7179 e2 .( ExprNode:: SubExpr ) .getRightOperand ( ) = x and
7280 x .getIntValue ( ) = - delta
7381 )
7482 or
83+ exists ( ConstantIntegerExpr x |
84+ e2 .( ExprNode:: AssignSubExpr ) .getLeftOperand ( ) = e1 and
85+ e2 .( ExprNode:: AssignSubExpr ) .getRightOperand ( ) = x and
86+ x .getIntValue ( ) = - delta
87+ )
88+ or
7589 // Conditional expressions with only one branch can happen either
7690 // because of pruning or because of Boolean splitting. In such cases
7791 // the conditional expression has the same value as the branch.
@@ -230,6 +244,11 @@ module ExprNode {
230244 override CS:: AssignExpr e ;
231245 }
232246
247+ /** A compound assignment operation. */
248+ class AssignOperation extends Assignment , BinaryOperation {
249+ override CS:: AssignOperation e ;
250+ }
251+
233252 /** A unary operation. */
234253 class UnaryOperation extends ExprNode {
235254 override CS:: UnaryOperation e ;
@@ -397,6 +416,90 @@ module ExprNode {
397416 override TUnsignedRightShiftOp getOp ( ) { any ( ) }
398417 }
399418
419+ /** A compound addition assignment operation. */
420+ class AssignAddExpr extends AssignOperation {
421+ override CS:: AssignAddExpr e ;
422+
423+ override TAddOp getOp ( ) { any ( ) }
424+ }
425+
426+ /** A compound subtraction assignment operation. */
427+ class AssignSubExpr extends AssignOperation {
428+ override CS:: AssignSubExpr e ;
429+
430+ override TSubOp getOp ( ) { any ( ) }
431+ }
432+
433+ /** A compound multiplication assignment operation. */
434+ class AssignMulExpr extends AssignOperation {
435+ override CS:: AssignMulExpr e ;
436+
437+ override TMulOp getOp ( ) { any ( ) }
438+ }
439+
440+ /** A compound division assignment operation. */
441+ class AssignDivExpr extends AssignOperation {
442+ override CS:: AssignDivExpr e ;
443+
444+ override TDivOp getOp ( ) { any ( ) }
445+ }
446+
447+ /** A compound remainder assignment operation. */
448+ class AssignRemExpr extends AssignOperation {
449+ override CS:: AssignRemExpr e ;
450+
451+ override TRemOp getOp ( ) { any ( ) }
452+ }
453+
454+ /** A compound bitwise assignment operation. */
455+ class AssignBitwiseOperation extends AssignOperation {
456+ override CS:: AssignBitwiseOperation e ;
457+
458+ override TBinarySignOperation getOp ( ) { none ( ) }
459+ }
460+
461+ /** A compound bitwise-and assignment operation. */
462+ class AssignAndExpr extends AssignOperation {
463+ override CS:: AssignAndExpr e ;
464+
465+ override TBitAndOp getOp ( ) { any ( ) }
466+ }
467+
468+ /** A compound bitwise-or assignment operation. */
469+ class AssignOrExpr extends AssignOperation {
470+ override CS:: AssignOrExpr e ;
471+
472+ override TBitOrOp getOp ( ) { any ( ) }
473+ }
474+
475+ /** A compound bitwise-xor assignment operation. */
476+ class AssignXorExpr extends AssignOperation {
477+ override CS:: AssignXorExpr e ;
478+
479+ override TBitXorOp getOp ( ) { any ( ) }
480+ }
481+
482+ /** A compound left-shift assignment operation. */
483+ class AssignLeftShiftExpr extends AssignOperation {
484+ override CS:: AssignLeftShiftExpr e ;
485+
486+ override TLeftShiftOp getOp ( ) { any ( ) }
487+ }
488+
489+ /** A compound right-shift assignment operation. */
490+ class AssignRightShiftExpr extends AssignOperation {
491+ override CS:: AssignRightShiftExpr e ;
492+
493+ override TRightShiftOp getOp ( ) { any ( ) }
494+ }
495+
496+ /** A compound unsigned right-shift assignment operation. */
497+ class AssignUnsignedRightShiftExpr extends AssignOperation {
498+ override CS:: AssignUnsighedRightShiftExpr e ;
499+
500+ override TUnsignedRightShiftOp getOp ( ) { any ( ) }
501+ }
502+
400503 /** A conditional expression. */
401504 class ConditionalExpr extends ExprNode {
402505 override CS:: ConditionalExpr e ;
0 commit comments