Lines Matching refs:mir
140 int MIRGraph::ParseInsn(const uint16_t* code_ptr, MIR::DecodedInstruction* decoded_instruction) {
158 MIR* insn = orig_block->first_mir_insn;
159 MIR* prev = NULL;
234 !MIR::DecodedInstruction::IsPseudoMirOp(insn->dalvikInsn.opcode));
236 MIR* p = insn;
249 if ((opcode == kMirOpCheck) || !MIR::DecodedInstruction::IsPseudoMirOp(opcode)) {
399 BasicBlock* MIRGraph::ProcessCanBranch(BasicBlock* cur_block, MIR* insn, DexOffset cur_offset,
466 BasicBlock* MIRGraph::ProcessCanSwitch(BasicBlock* cur_block, MIR* insn, DexOffset cur_offset,
542 BasicBlock* MIRGraph::ProcessCanThrow(BasicBlock* cur_block, MIR* insn, DexOffset cur_offset,
627 * pseudo exception edge MIR. Note also that this new block is
639 MIR* new_insn = NewMIR();
656 // TODO: will need to snapshot stack image and use that as the mir context identification.
724 MIR *insn = NewMIR();
866 uint64_t MIRGraph::GetDataFlowAttributes(MIR* mir) {
867 DCHECK(mir != nullptr);
868 Instruction::Code opcode = mir->dalvikInsn.opcode;
911 const MIR* mir;
914 for (mir = bb->first_mir_insn; mir; mir = mir->next) {
915 int opcode = mir->dalvikInsn.opcode;
918 fprintf(file, " {%04x %s %d %d %d %d %d %d\\l}%s\\\n", mir->offset,
920 mir->dalvikInsn.vA,
921 mir->dalvikInsn.vB,
922 mir->dalvikInsn.arg[0],
923 mir->dalvikInsn.arg[1],
924 mir->dalvikInsn.arg[2],
925 mir->dalvikInsn.arg[3],
926 mir->next ? " | " : " ");
928 fprintf(file, " {%04x %s %d %d %d\\l}%s\\\n", mir->offset,
930 mir->dalvikInsn.vA,
931 mir->dalvikInsn.vB,
932 mir->dalvikInsn.vC,
933 mir->next ? " | " : " ");
936 fprintf(file, " {%04x %s %s %s %s\\l}%s\\\n", mir->offset,
937 mir->ssa_rep ? GetDalvikDisassembly(mir) :
938 !MIR::DecodedInstruction::IsPseudoMirOp(opcode) ?
939 Instruction::Name(mir->dalvikInsn.opcode) :
941 (mir->optimization_flags & MIR_IGNORE_RANGE_CHECK) != 0 ? " no_rangecheck" : " ",
942 (mir->optimization_flags & MIR_IGNORE_NULL_CHECK) != 0 ? " no_nullcheck" : " ",
943 (mir->optimization_flags & MIR_IGNORE_SUSPEND_CHECK) != 0 ? " no_suspendcheck" : " ",
944 mir->next ? " | " : " ");
1029 /* Insert an MIR instruction to the end of a basic block. */
1030 void BasicBlock::AppendMIR(MIR* mir) {
1031 // Insert it after the last MIR.
1032 InsertMIRListAfter(last_mir_insn, mir, mir);
1035 void BasicBlock::AppendMIRList(MIR* first_list_mir, MIR* last_list_mir) {
1036 // Insert it after the last MIR.
1040 void BasicBlock::AppendMIRList(const std::vector<MIR*>& insns) {
1041 for (std::vector<MIR*>::const_iterator it = insns.begin(); it != insns.end(); it++) {
1042 MIR* new_mir = *it;
1044 // Add a copy of each MIR.
1049 /* Insert a MIR instruction after the specified MIR. */
1050 void BasicBlock::InsertMIRAfter(MIR* current_mir, MIR* new_mir) {
1054 void BasicBlock::InsertMIRListAfter(MIR* insert_after, MIR* first_list_mir, MIR* last_list_mir) {
1055 // If no MIR, we are done.
1066 MIR* after_list = insert_after->next;
1075 MIR* last = last_list_mir->next;
1076 for (MIR* mir = first_list_mir; mir != last; mir = mir->next) {
1077 mir->bb = id;
1081 /* Insert an MIR instruction to the head of a basic block. */
1082 void BasicBlock::PrependMIR(MIR* mir) {
1083 InsertMIRListBefore(first_mir_insn, mir, mir);
1086 void BasicBlock::PrependMIRList(MIR* first_list_mir, MIR* last_list_mir) {
1087 // Insert it before the first MIR.
1091 void BasicBlock::PrependMIRList(const std::vector<MIR*>& to_add) {
1092 for (std::vector<MIR*>::const_iterator it = to_add.begin(); it != to_add.end(); it++) {
1093 MIR* mir = *it;
1095 InsertMIRListBefore(first_mir_insn, mir, mir);
1099 /* Insert a MIR instruction before the specified MIR. */
1100 void BasicBlock::InsertMIRBefore(MIR* current_mir, MIR* new_mir) {
1105 MIR* BasicBlock::FindPreviousMIR(MIR* mir) {
1106 MIR* current = first_mir_insn;
1109 MIR* next = current->next;
1111 if (next == mir) {
1121 void BasicBlock::InsertMIRListBefore(MIR* insert_before, MIR* first_list_mir, MIR* last_list_mir) {
1122 // If no MIR, we are done.
1137 // Find the preceding MIR.
1138 MIR* before_list = FindPreviousMIR(insert_before);
1146 for (MIR* mir = first_list_mir; mir != last_list_mir->next; mir = mir->next) {
1147 mir->bb = id;
1151 bool BasicBlock::RemoveMIR(MIR* mir) {
1153 return RemoveMIRList(mir, mir);
1156 bool BasicBlock::RemoveMIRList(MIR* first_list_mir, MIR* last_list_mir) {
1161 // Try to find the MIR.
1162 MIR* before_list = nullptr;
1163 MIR* after_list = nullptr;
1165 // If we are removing from the beginning of the MIR list.
1171 // We did not find the mir.
1177 for (MIR* mir = first_list_mir; mir != last_list_mir; mir = mir->next) {
1178 mir->bb = NullBasicBlockId;
1198 MIR* BasicBlock::GetNextUnconditionalMir(MIRGraph* mir_graph, MIR* current) {
1199 MIR* next_mir = nullptr;
1206 // Only look for next MIR that follows unconditionally.
1215 char* MIRGraph::GetDalvikDisassembly(const MIR* mir) {
1216 MIR::DecodedInstruction insn = mir->dalvikInsn;
1222 SSARepresentation* ssa_rep = mir->ssa_rep;
1232 insn = mir->meta.throw_insn->dalvikInsn;
1233 ssa_rep = mir->meta.throw_insn->ssa_rep;
1240 insn.opcode = Instruction::At(current_code_item_->insns_ + mir->offset)->Opcode();
1245 if (MIR::DecodedInstruction::IsPseudoMirOp(opcode)) {
1254 BasicBlockId* incoming = mir->meta.phi_incoming;
1287 str.append(StringPrintf(" 0x%x (%c%x)", mir->offset + offset,
1452 CallInfo* MIRGraph::NewMemCallInfo(BasicBlock* bb, MIR* mir, InvokeType type,
1456 MIR* move_result_mir = FindMoveResult(bb, mir);
1463 info->num_arg_words = mir->ssa_rep->num_uses;
1467 info->args[i] = GetRawSrc(mir, i);
1469 info->opt_flags = mir->optimization_flags;
1472 info->index = mir->dalvikInsn.vB;
1473 info->offset = mir->offset;
1474 info->mir = mir;
1478 // Allocate a new MIR.
1479 MIR* MIRGraph::NewMIR() {
1480 MIR* mir = new (arena_) MIR();
1481 return mir;
1898 for (MIR* mir = first_mir_insn; mir != 0; mir = mir->next) {
1900 MIR* copy = mir->Copy(mir_graph);
1909 MIR* MIR::Copy(MIRGraph* mir_graph) {
1910 MIR* res = mir_graph->NewMIR();
1921 MIR* MIR::Copy(CompilationUnit* c_unit) {
1977 bool MIR::DecodedInstruction::GetConstant(int64_t* ptr_value, bool* wide) const {
2025 for (MIR* mir = first_mir_insn; mir != NULL; mir = mir->next) {
2026 mir->optimization_flags &= (~reset_flags);
2039 for (MIR* mir = first_mir_insn; mir != nullptr; mir = mir->next) {
2040 mir->bb = NullBasicBlockId;
2076 for (MIR* mir = first_mir_insn; mir != nullptr; mir = mir->next) {
2078 SSARepresentation *ssa_rep = mir->ssa_rep;
2080 // Go through the defines for this MIR.