def ast(self, astree: AbstractSyntaxTree, iaddr: str, bytestring: str, xdata: InstrXData) -> List[AST.ASTInstruction]: rhslval = XU.xvariable_to_ast_lval(xdata.vars[1], astree) rhs = astree.mk_lval_expr(rhslval) lhs = XU.xvariable_to_ast_lval(xdata.vars[0], astree) assign = astree.mk_assign(lhs, rhs) astree.add_instruction_span(assign.id, iaddr, bytestring) return [assign]
def ast(self, astree: AbstractSyntaxTree, iaddr: str, bytestring: str, xdata: InstrXData) -> List[ASTInstruction]: lhs = xdata.vars[0] rhs1 = str(xdata.xprs[0]) rhs2 = xdata.xprs[1] rhs3 = xdata.xprs[3] if lhs == "SP" and rhs1 == "SP" and rhs2.is_constant: return [] lhsast = XU.xvariable_to_ast_lval(lhs, astree) if rhs1 == "SP" and rhs3.is_stack_address: rhs3 = cast("XprCompound", rhs3) stackoffset = rhs3.stack_address_offset() rhslval = astree.mk_stack_variable_lval(stackoffset) rhsast: ASTExpr = astree.mk_address_of(rhslval) elif rhs1 == "PC" or str(rhs2) == "PC": if rhs3.is_int_constant: rhsval = cast("XprConstant", rhs3).intvalue rhsast = astree.mk_integer_constant(rhsval) else: rhsast = XU.xxpr_to_ast_expr(rhs3, astree) else: rhsast = XU.xxpr_to_ast_expr(rhs3, astree) result = astree.mk_assign(lhsast, rhsast) astree.add_instruction_span(result.id, iaddr, bytestring) return [result]
def ast(self, astree: AbstractSyntaxTree, iaddr: str, bytestring: str, xdata: InstrXData) -> List[AST.ASTInstruction]: (rhs, _, _) = self.operands[0].ast_rvalue(astree) lhs = xdata.vars[0] lval = XU.xvariable_to_ast_lval(lhs, astree) assign = astree.mk_assign(lval, rhs) astree.add_instruction_span(assign.id, iaddr, bytestring) return [assign]
def ast(self, astree: AbstractSyntaxTree, iaddr: str, bytestring: str, xdata: InstrXData) -> List[ASTInstruction]: lhs = XU.xvariable_to_ast_lval(xdata.vars[0], astree) cond = XU.xxpr_to_ast_expr(xdata.xprs[2], astree) rhs2 = XU.xxpr_to_ast_expr(xdata.xprs[3], astree) rhs1 = XU.xxpr_to_ast_expr(xdata.xprs[0], astree) rhs = astree.mk_question(cond, rhs1, rhs2) assign = astree.mk_assign(lhs, rhs) astree.add_instruction_span(assign.id, iaddr, bytestring) return [assign]
def ast( self, astree: AbstractSyntaxTree, iaddr: str, bytestring: str, xdata: InstrXData) -> List[AST.ASTInstruction]: if xdata.instruction_is_subsumed(): return [] else: lhs = XU.xvariable_to_ast_lval(xdata.vars[0], astree) rhs = XU.xxpr_to_ast_expr(xdata.xprs[0], astree) # (lhs, _, _) = self.operands[0].ast_lvalue(astree) # (rhs, _, _) = self.operands[1].ast_rvalue(astree) assign = astree.mk_assign(lhs, rhs) astree.add_instruction_span(assign.id, iaddr, bytestring) return [assign]