@@ -810,3 +810,81 @@ class TranslatedSwitchStmt extends TranslatedStmt {
810810 child = getBody ( ) and result = getParent ( ) .getChildSuccessor ( this )
811811 }
812812}
813+
814+ class TranslatedAsmStmt extends TranslatedStmt {
815+ override AsmStmt stmt ;
816+
817+ override TranslatedElement getChild ( int id ) {
818+ none ( )
819+ }
820+
821+ override Instruction getFirstInstruction ( ) {
822+ if exists ( stmt .getChild ( 0 ) )
823+ then result = getInstruction ( AsmInputTag ( 0 ) )
824+ else result = getInstruction ( AsmTag ( ) )
825+ }
826+
827+ override predicate hasInstruction ( Opcode opcode , InstructionTag tag ,
828+ Type resultType , boolean isGLValue ) {
829+ tag = AsmTag ( ) and
830+ opcode instanceof Opcode:: InlineAsm and
831+ resultType instanceof UnknownType and
832+ isGLValue = false
833+ or
834+ exists ( int index , VariableAccess va |
835+ tag = AsmInputTag ( index ) and
836+ stmt .getChild ( index ) = va and
837+ opcode instanceof Opcode:: VariableAddress and
838+ resultType = va .getType ( ) .getUnspecifiedType ( ) and
839+ isGLValue = true
840+ )
841+ }
842+
843+ override IRVariable getInstructionVariable ( InstructionTag tag ) {
844+ exists ( int index |
845+ tag = AsmInputTag ( index ) and
846+ result = getIRUserVariable ( stmt .getEnclosingFunction ( ) , stmt .getChild ( index ) .( VariableAccess ) .getTarget ( ) )
847+ )
848+ }
849+
850+ override Instruction getInstructionOperand ( InstructionTag tag ,
851+ OperandTag operandTag ) {
852+ tag = AsmTag ( ) and
853+ operandTag instanceof SideEffectOperandTag and
854+ result = getTranslatedFunction ( stmt .getEnclosingFunction ( ) ) .getUnmodeledDefinitionInstruction ( )
855+ or
856+ exists ( int index |
857+ tag = AsmTag ( ) and
858+ operandTag = asmOperand ( index ) and
859+ result = getInstruction ( AsmInputTag ( index ) )
860+ )
861+ }
862+
863+ override final Type getInstructionOperandType ( InstructionTag tag ,
864+ TypedOperandTag operandTag ) {
865+ tag = AsmTag ( ) and
866+ operandTag instanceof SideEffectOperandTag and
867+ result instanceof UnknownType
868+ }
869+
870+ override Instruction getInstructionSuccessor ( InstructionTag tag ,
871+ EdgeKind kind ) {
872+ tag = AsmTag ( ) and
873+ result = getParent ( ) .getChildSuccessor ( this ) and
874+ kind instanceof GotoEdge
875+ or
876+ exists ( int index |
877+ tag = AsmInputTag ( index ) and
878+ kind instanceof GotoEdge and
879+ if exists ( stmt .getChild ( index + 1 ) )
880+ then
881+ result = getInstruction ( AsmInputTag ( index + 1 ) )
882+ else
883+ result = getInstruction ( AsmTag ( ) )
884+ )
885+ }
886+
887+ override Instruction getChildSuccessor ( TranslatedElement child ) {
888+ none ( )
889+ }
890+ }
0 commit comments