@@ -156,6 +156,22 @@ module Transform<InstructionSig Input> {
156156 Operand getAnAccess ( ) { result .getVariable ( ) = this }
157157 }
158158
159+ class StackPointer extends Variable {
160+ StackPointer ( ) { this .asOldVariable ( ) instanceof Input:: StackPointer }
161+ }
162+
163+ class FramePointer extends Variable {
164+ FramePointer ( ) { this .asOldVariable ( ) instanceof Input:: FramePointer }
165+ }
166+
167+ class TempVariable extends Variable {
168+ TempVariable ( ) {
169+ this .asOldVariable ( ) instanceof Input:: TempVariable
170+ or
171+ this .isNewVariable ( _, _)
172+ }
173+ }
174+
159175 final private class FinalTranslatedElement = TransformInput:: TranslatedElement ;
160176
161177 private class TranslatedElement extends FinalTranslatedElement {
@@ -574,6 +590,22 @@ module Transform<InstructionSig Input> {
574590 result = any ( TranslatedElement te ) .getInstructionSuccessor ( old , succType )
575591 }
576592
593+ private Input:: Instruction getASuccessorIfRemoved ( Input:: Instruction i ) {
594+ TransformInput:: isRemovedInstruction ( i ) and
595+ result = i .getASuccessor ( )
596+ }
597+
598+ private Input:: Instruction getSuccessorFromNonRemoved ( Input:: Instruction i , SuccessorType t ) {
599+ result = i .getSuccessor ( t ) and
600+ not TransformInput:: isRemovedInstruction ( i )
601+ or
602+ result = getASuccessorIfRemoved ( getSuccessorFromNonRemoved ( i , t ) )
603+ }
604+
605+ private Input:: Instruction getNonRemovedSuccessor ( Input:: Instruction i , SuccessorType t ) {
606+ result = getSuccessorFromNonRemoved ( i , t ) and not TransformInput:: isRemovedInstruction ( result )
607+ }
608+
577609 private class OldInstruction extends TOldInstruction , Instruction {
578610 Input:: Instruction old ;
579611
@@ -590,7 +622,7 @@ module Transform<InstructionSig Input> {
590622 override Instruction getSuccessor ( SuccessorType succType ) {
591623 exists ( Input:: Instruction oldSucc |
592624 not exists ( getInstructionSuccessor ( old , _) ) and
593- oldSucc = old . getSuccessor ( succType ) and
625+ oldSucc = getNonRemovedSuccessor ( old , succType ) and
594626 result = getNewInstruction ( oldSucc )
595627 )
596628 or
0 commit comments