int count_sgets(cfg::ControlFlowGraph& cfg) { int sgets = 0; for (auto& mie : InstructionIterable(cfg)) { TRACE(RME, 1, "%s\n", SHOW(mie.insn)); if (is_sget(mie.insn->opcode())) { sgets++; } } return sgets; }
void MethodBlock::sfield_op(DexOpcode opcode, DexField* field, Location& src_or_dst) { always_assert(is_sfield_op(opcode)); if (is_sget(opcode)) { auto sget = new DexOpcodeField(opcode, field); sget->set_dest(reg_num(src_or_dst)); src_or_dst.type = field->get_class(); push_instruction(sget); } else { auto sput = new DexOpcodeField(opcode, field); sput->set_src(0, reg_num(src_or_dst)); push_instruction(sput); } }
void MethodBlock::sfield_op(IROpcode opcode, DexField* field, Location& src_or_dst) { always_assert(is_sfield_op(opcode)); if (is_sget(opcode)) { auto sget = new IRInstruction(opcode); sget->set_field(field); src_or_dst.type = field->get_class(); push_instruction(sget); push_instruction( (new IRInstruction(opcode::move_result_pseudo_for_sget(opcode))) ->set_dest(src_or_dst.get_reg())); } else { auto sput = new IRInstruction(opcode); sput->set_field(field)->set_src(0, src_or_dst.get_reg()); push_instruction(sput); } }