Lines Matching refs:mir
46 MIR* mir;
48 for (mir = bb->first_mir_insn; mir != NULL; mir = mir->next) {
49 // Skip pass if BB has MIR without SSA representation.
50 if (mir->ssa_rep == nullptr) {
54 uint64_t df_attributes = GetDataFlowAttributes(mir);
56 MIR::DecodedInstruction* d_insn = &mir->dalvikInsn;
68 SetConstant(mir->ssa_rep->defs[0], vB);
71 SetConstant(mir->ssa_rep->defs[0], vB << 16);
75 SetConstantWide(mir->ssa_rep->defs[0], static_cast<int64_t>(vB));
78 SetConstantWide(mir->ssa_rep->defs[0], d_insn->vB_wide);
81 SetConstantWide(mir->ssa_rep->defs[0], static_cast<int64_t>(vB) << 48);
91 for (i = 0; i < mir->ssa_rep->num_uses; i++) {
92 if (!is_constant_v_->IsBitSet(mir->ssa_rep->uses[i])) break;
95 if (i == mir->ssa_rep->num_uses) {
96 SetConstant(mir->ssa_rep->defs[0], constant_values_[mir->ssa_rep->uses[0]]);
98 SetConstant(mir->ssa_rep->defs[1], constant_values_[mir->ssa_rep->uses[1]]);
106 /* Advance to next strictly dominated MIR node in an extended basic block */
107 MIR* MIRGraph::AdvanceMIR(BasicBlock** p_bb, MIR* mir) {
109 if (mir != NULL) {
110 mir = mir->next;
111 if (mir == NULL) {
114 mir = NULL;
117 mir = bb->first_mir_insn;
121 return mir;
125 * To be used at an invoke mir. If the logically next mir node represents
131 MIR* MIRGraph::FindMoveResult(BasicBlock* bb, MIR* mir) {
133 mir = AdvanceMIR(&tbb, mir);
134 while (mir != NULL) {
135 if ((mir->dalvikInsn.opcode == Instruction::MOVE_RESULT) ||
136 (mir->dalvikInsn.opcode == Instruction::MOVE_RESULT_OBJECT) ||
137 (mir->dalvikInsn.opcode == Instruction::MOVE_RESULT_WIDE)) {
141 if (MIR::DecodedInstruction::IsPseudoMirOp(mir->dalvikInsn.opcode)) {
142 mir = AdvanceMIR(&tbb, mir);
144 mir = NULL;
147 return mir;
173 static MIR* FindPhi(BasicBlock* bb, int ssa_name) {
174 for (MIR* mir = bb->first_mir_insn; mir != NULL; mir = mir->next) {
175 if (static_cast<int>(mir->dalvikInsn.opcode) == kMirOpPhi) {
176 for (int i = 0; i < mir->ssa_rep->num_uses; i++) {
177 if (mir->ssa_rep->uses[i] == ssa_name) {
178 return mir;
186 static SelectInstructionKind SelectKind(MIR* mir) {
187 switch (mir->dalvikInsn.opcode) {
267 // The MIR graph keeps track of the sreg for method pointer specially, so record that now.
319 /* Do some MIR-level extended basic block optimizations */
336 for (MIR* mir = bb->first_mir_insn; mir != NULL; mir = mir->next) {
339 local_valnum->GetValueNumber(mir);
342 Instruction::Code opcode = mir->dalvikInsn.opcode;
353 if (mir->next != NULL) {
354 MIR* mir_next = mir->next;
357 (mir->ssa_rep->defs[0] == mir_next->ssa_rep->uses[0]) &&
358 (GetSSAUseCount(mir->ssa_rep->defs[0]) == 1)) {
383 mir->dalvikInsn.opcode = static_cast<Instruction::Code>(kMirOpNop);
385 mir_next->ssa_rep->num_uses = mir->ssa_rep->num_uses;
386 mir_next->ssa_rep->uses = mir->ssa_rep->uses;
387 mir_next->ssa_rep->fp_use = mir->ssa_rep->fp_use;
389 mir->ssa_rep->num_uses = 0;
390 mir->ssa_rep->num_defs = 0;
392 mir_next->dalvikInsn.vA = mir->dalvikInsn.vB;
393 mir_next->dalvikInsn.vB = mir->dalvikInsn.vC;
416 mir->optimization_flags |= MIR_IGNORE_SUSPEND_CHECK;
419 << mir->offset;
432 IsInstructionIfCcZ(mir->dalvikInsn.opcode)) {
468 MIR* if_true = tk->first_mir_insn;
469 MIR* if_false = ft->first_mir_insn;
471 MIR* phi = FindPhi(tk_tk, if_true->ssa_rep->defs[0]);
481 mir->meta.ccode = ConditionCodeForIfCcZ(mir->dalvikInsn.opcode);
482 mir->dalvikInsn.opcode = static_cast<Instruction::Code>(kMirOpSelect);
499 mir->dalvikInsn.vB = if_true->dalvikInsn.vB;
501 mir->dalvikInsn.vC = if_false->dalvikInsn.vB;
507 src_ssa[0] = mir->ssa_rep->uses[0];
510 mir->ssa_rep->uses = src_ssa;
511 mir->ssa_rep->num_uses = 3;
513 mir->ssa_rep->num_defs = 1;
514 mir->ssa_rep->defs =
516 mir->ssa_rep->fp_def =
518 mir->ssa_rep->fp_def[0] = if_true->ssa_rep->fp_def[0];
520 mir->ssa_rep->fp_use =
521 static_cast<bool*>(arena_->Alloc(sizeof(bool) * mir->ssa_rep->num_uses,
523 for (int i = 0; i < mir->ssa_rep->num_uses; i++) {
524 mir->ssa_rep->fp_use[i] = mir->ssa_rep->fp_def[0];
535 mir->ssa_rep->defs[0] = phi->ssa_rep->defs[0];
540 mir->ssa_rep->defs[0] = live_def;
558 for (MIR* tmir = ft->first_mir_insn; tmir != NULL; tmir = tmir->next) {
578 for (MIR* mir = bb->first_mir_insn; mir != NULL; mir = mir->next) {
579 if (mir->ssa_rep == NULL) {
582 uint64_t df_attributes = GetDataFlowAttributes(mir);
585 if (mir->optimization_flags & MIR_IGNORE_NULL_CHECK) {
591 if (mir->optimization_flags & MIR_IGNORE_RANGE_CHECK) {
678 MIR* mir = bb->last_mir_insn;
680 MIR* throw_insn = mir->meta.throw_insn;
777 MIR* last_insn = pred_bb->last_mir_insn;
822 for (MIR* mir = bb->first_mir_insn; mir != NULL; mir = mir->next) {
823 if (mir->ssa_rep == NULL) {
828 infer_changed = InferTypeAndSize(bb, mir, infer_changed);
833 uint64_t df_attributes = GetDataFlowAttributes(mir);
845 int src_sreg = mir->ssa_rep->uses[src_idx];
848 mir->optimization_flags |= MIR_IGNORE_NULL_CHECK;
851 mir->optimization_flags &= ~MIR_IGNORE_NULL_CHECK;
869 ssa_regs_to_check->SetBit(mir->ssa_rep->defs[0]);
875 ssa_regs_to_check->ClearBit(mir->ssa_rep->defs[0]);
880 MIR* next_mir = mir->next;
892 for (MIR* tmir = next_bb->first_mir_insn; tmir != NULL;
894 if (MIR::DecodedInstruction::IsPseudoMirOp(tmir->dalvikInsn.opcode)) {
916 int tgt_sreg = mir->ssa_rep->defs[0];
918 mir->ssa_rep->num_uses;
921 needs_null_check |= ssa_regs_to_check->IsBitSet(mir->ssa_rep->uses[i]);
1014 for (MIR* mir = bb->first_mir_insn; mir != nullptr; mir = mir->next) {
1016 if (mir->dalvikInsn.opcode >= Instruction::SGET &&
1017 mir->dalvikInsn.opcode <= Instruction::SPUT_SHORT) {
1018 const MirSFieldLoweringInfo& field_info = GetSFieldLoweringInfo(mir);
1033 temp_insn_data_[mir->offset / 2u] = index;
1103 for (MIR* mir = bb->first_mir_insn; mir != nullptr; mir = mir->next) {
1104 if (mir->dalvikInsn.opcode >= Instruction::SGET &&
1105 mir->dalvikInsn.opcode <= Instruction::SPUT_SHORT) {
1106 uint16_t index = temp_insn_data_[mir->offset / 2u];
1108 if (mir->dalvikInsn.opcode >= Instruction::SGET &&
1109 mir->dalvikInsn.opcode <= Instruction::SPUT_SHORT) {
1112 mir->optimization_flags |= MIR_IGNORE_CLINIT_CHECK;
1115 mir->optimization_flags &= ~MIR_IGNORE_CLINIT_CHECK;
1174 for (MIR* mir = bb->first_mir_insn; mir != nullptr; mir = mir->next) {
1175 lvn->GetValueNumber(mir);
1191 for (MIR* mir = bb->first_mir_insn; mir != nullptr; mir = mir->next) {
1192 lvn->GetValueNumber(mir);
1208 void MIRGraph::ComputeInlineIFieldLoweringInfo(uint16_t field_idx, MIR* invoke, MIR* iget_or_iput) {
1247 // each INVOKE, we can index the data by the MIR::meta::method_lowering_info index.
1263 for (MIR* mir = bb->first_mir_insn; mir != NULL; mir = mir->next) {
1264 if (MIR::DecodedInstruction::IsPseudoMirOp(mir->dalvikInsn.opcode)) {
1267 if (!(Instruction::FlagsOf(mir->dalvikInsn.opcode) & Instruction::kInvoke)) {
1270 const MirMethodLoweringInfo& method_info = GetMethodLoweringInfo(mir);
1282 ->GenInline(this, bb, mir, target.dex_method_index)) {
1287 << "\" @0x" << std::hex << mir->offset;