Lines Matching refs:lir
1070 uint8_t* ArmMir2Lir::EncodeLIRs(uint8_t* write_pos, LIR* lir) { in EncodeLIRs() argument
1071 for (; lir != NULL; lir = NEXT_LIR(lir)) { in EncodeLIRs()
1072 if (!lir->flags.is_nop) { in EncodeLIRs()
1073 int opcode = lir->opcode; in EncodeLIRs()
1077 if (lir->offset & 0x2) { in EncodeLIRs()
1083 } else if (LIKELY(!lir->flags.is_nop)) { in EncodeLIRs()
1084 const ArmEncodingMap *encoder = &EncodingMap[lir->opcode]; in EncodeLIRs()
1089 operand = lir->operands[i]; in EncodeLIRs()
1211 LIR* lir; in AssembleLIR() local
1230 lir = first_fixup_; in AssembleLIR()
1232 while (lir != NULL) { in AssembleLIR()
1240 lir->offset += offset_adjustment; in AssembleLIR()
1242 lir->flags.generation = generation; in AssembleLIR()
1243 switch (static_cast<FixupKind>(lir->flags.fixup)) { in AssembleLIR()
1248 if (lir->operands[1] != rs_r15pc.GetReg()) { in AssembleLIR()
1259 LIR *lir_target = lir->target; in AssembleLIR()
1260 CodeOffset pc = (lir->offset + 4) & ~3; in AssembleLIR()
1262 ((lir_target->flags.generation == lir->flags.generation) ? 0 : offset_adjustment); in AssembleLIR()
1273 if (kIsDebugBuild && (((lir->opcode == kThumbAddPcRel) && (delta > 1020)) || in AssembleLIR()
1274 ((lir->opcode == kThumbLdrPcRel) && (delta > 1020)))) { in AssembleLIR()
1279 if (((lir->opcode == kThumb2LdrPcRel12) && (delta > 4091)) || in AssembleLIR()
1280 ((lir->opcode == kThumb2LdrdPcRel8) && (delta > 1020)) || in AssembleLIR()
1281 ((lir->opcode == kThumb2Vldrs) && (delta > 1020)) || in AssembleLIR()
1282 ((lir->opcode == kThumb2Vldrd) && (delta > 1020))) { in AssembleLIR()
1288 int base_reg = ((lir->opcode == kThumb2LdrdPcRel8) || in AssembleLIR()
1289 (lir->opcode == kThumb2LdrPcRel12)) ? lir->operands[0] : in AssembleLIR()
1293 LIR* new_adr = RawLIR(lir->dalvik_offset, kThumb2Adr, in AssembleLIR()
1294 base_reg, 0, 0, 0, 0, lir->target); in AssembleLIR()
1295 new_adr->offset = lir->offset; in AssembleLIR()
1298 InsertLIRBefore(lir, new_adr); in AssembleLIR()
1299 lir->offset += new_adr->flags.size; in AssembleLIR()
1303 ReplaceFixup(prev_lir, lir, new_adr); in AssembleLIR()
1306 offset_adjustment -= lir->flags.size; in AssembleLIR()
1307 if (lir->opcode == kThumb2LdrPcRel12) { in AssembleLIR()
1308 lir->opcode = kThumb2LdrRRI12; in AssembleLIR()
1309 } else if (lir->opcode == kThumb2LdrdPcRel8) { in AssembleLIR()
1310 lir->opcode = kThumb2LdrdI8; in AssembleLIR()
1312 lir->flags.size = EncodingMap[lir->opcode].size; in AssembleLIR()
1313 offset_adjustment += lir->flags.size; in AssembleLIR()
1315 if (lir->opcode == kThumb2LdrdI8) { in AssembleLIR()
1316 lir->operands[3] = 0; in AssembleLIR()
1317 lir->operands[2] = base_reg; in AssembleLIR()
1319 lir->operands[2] = 0; in AssembleLIR()
1320 lir->operands[1] = base_reg; in AssembleLIR()
1323 lir = new_adr->u.a.pcrel_next; in AssembleLIR()
1327 if ((lir->opcode == kThumb2Vldrs) || in AssembleLIR()
1328 (lir->opcode == kThumb2Vldrd) || in AssembleLIR()
1329 (lir->opcode == kThumb2LdrdPcRel8)) { in AssembleLIR()
1330 lir->operands[2] = delta >> 2; in AssembleLIR()
1332 lir->operands[1] = (lir->opcode == kThumb2LdrPcRel12) ? delta : in AssembleLIR()
1339 LIR *target_lir = lir->target; in AssembleLIR()
1340 CodeOffset pc = lir->offset + 4; in AssembleLIR()
1342 ((target_lir->flags.generation == lir->flags.generation) ? 0 : offset_adjustment); in AssembleLIR()
1350 RawLIR(lir->dalvik_offset, kThumbBCond, 0, in AssembleLIR()
1351 (lir->opcode == kThumb2Cbz) ? kArmCondEq : kArmCondNe, in AssembleLIR()
1352 0, 0, 0, lir->target); in AssembleLIR()
1353 InsertLIRAfter(lir, new_inst); in AssembleLIR()
1357 offset_adjustment -= lir->flags.size; in AssembleLIR()
1358 lir->opcode = kThumbCmpRI8; in AssembleLIR()
1360 lir->operands[1] = 0; in AssembleLIR()
1361 lir->target = 0; in AssembleLIR()
1362 lir->flags.size = EncodingMap[lir->opcode].size; in AssembleLIR()
1364 offset_adjustment += lir->flags.size; in AssembleLIR()
1366 new_inst->offset = lir->offset + lir->flags.size; in AssembleLIR()
1372 ReplaceFixup(prev_lir, lir, new_inst); in AssembleLIR()
1374 lir = new_inst->u.a.pcrel_next; in AssembleLIR()
1378 lir->operands[1] = delta >> 1; in AssembleLIR()
1383 if (__builtin_popcount(lir->operands[0]) == 1) { in AssembleLIR()
1390 lir->opcode = (lir->opcode == kThumb2Push) ? kThumb2Push1 : in AssembleLIR()
1393 while (lir->operands[0]) { in AssembleLIR()
1394 if (lir->operands[0] & 0x1) { in AssembleLIR()
1398 lir->operands[0] >>= 1; in AssembleLIR()
1401 lir->operands[0] = reg; in AssembleLIR()
1403 lir->flags.fixup = kFixupNone; in AssembleLIR()
1408 LIR *target_lir = lir->target; in AssembleLIR()
1411 CodeOffset pc = lir->offset + 4; in AssembleLIR()
1413 ((target_lir->flags.generation == lir->flags.generation) ? 0 : offset_adjustment); in AssembleLIR()
1415 if ((lir->opcode == kThumbBCond) && (delta > 254 || delta < -256)) { in AssembleLIR()
1416 offset_adjustment -= lir->flags.size; in AssembleLIR()
1417 lir->opcode = kThumb2BCond; in AssembleLIR()
1418 lir->flags.size = EncodingMap[lir->opcode].size; in AssembleLIR()
1420 offset_adjustment += lir->flags.size; in AssembleLIR()
1423 lir->operands[0] = delta >> 1; in AssembleLIR()
1427 LIR *target_lir = lir->target; in AssembleLIR()
1428 CodeOffset pc = lir->offset + 4; in AssembleLIR()
1430 ((target_lir->flags.generation == lir->flags.generation) ? 0 : offset_adjustment); in AssembleLIR()
1432 lir->operands[0] = delta >> 1; in AssembleLIR()
1433 if (!(cu_->disable_opt & (1 << kSafeOptimizations)) && lir->operands[0] == 0) { in AssembleLIR()
1435 offset_adjustment -= lir->flags.size; in AssembleLIR()
1436 lir->flags.is_nop = true; in AssembleLIR()
1438 lir->flags.fixup = kFixupNone; in AssembleLIR()
1444 LIR *target_lir = lir->target; in AssembleLIR()
1445 CodeOffset pc = lir->offset + 4; in AssembleLIR()
1447 ((target_lir->flags.generation == lir->flags.generation) ? 0 : offset_adjustment); in AssembleLIR()
1451 offset_adjustment -= lir->flags.size; in AssembleLIR()
1452 lir->opcode = kThumb2BUncond; in AssembleLIR()
1453 lir->operands[0] = 0; in AssembleLIR()
1454 lir->flags.size = EncodingMap[lir->opcode].size; in AssembleLIR()
1455 lir->flags.fixup = kFixupT2Branch; in AssembleLIR()
1456 offset_adjustment += lir->flags.size; in AssembleLIR()
1459 lir->operands[0] = delta >> 1; in AssembleLIR()
1460 if (!(cu_->disable_opt & (1 << kSafeOptimizations)) && lir->operands[0] == -1) { in AssembleLIR()
1462 offset_adjustment -= lir->flags.size; in AssembleLIR()
1463 lir->flags.is_nop = true; in AssembleLIR()
1465 lir->flags.fixup = kFixupNone; in AssembleLIR()
1472 DCHECK(NEXT_LIR(lir)->opcode == kThumbBlx2); in AssembleLIR()
1474 CodeOffset cur_pc = (lir->offset + 4) & ~3; in AssembleLIR()
1475 CodeOffset target = lir->operands[1]; in AssembleLIR()
1484 lir->operands[0] = (delta >> 12) & 0x7ff; in AssembleLIR()
1485 NEXT_LIR(lir)->operands[0] = (delta>> 1) & 0x7ff; in AssembleLIR()
1489 DCHECK(NEXT_LIR(lir)->opcode == kThumbBl2); in AssembleLIR()
1491 CodeOffset cur_pc = lir->offset + 4; in AssembleLIR()
1492 CodeOffset target = lir->operands[1]; in AssembleLIR()
1497 lir->operands[0] = (delta >> 12) & 0x7ff; in AssembleLIR()
1498 NEXT_LIR(lir)->operands[0] = (delta>> 1) & 0x7ff; in AssembleLIR()
1502 EmbeddedData *tab_rec = reinterpret_cast<EmbeddedData*>(UnwrapPointer(lir->operands[2])); in AssembleLIR()
1503 LIR* target = lir->target; in AssembleLIR()
1505 : target->offset + ((target->flags.generation == lir->flags.generation) ? 0 : in AssembleLIR()
1507 int32_t disp = target_disp - ((lir->offset + 4) & ~3); in AssembleLIR()
1509 lir->operands[1] = disp; in AssembleLIR()
1514 RawLIR(lir->dalvik_offset, kThumb2MovImm16LST, lir->operands[0], 0, in AssembleLIR()
1515 WrapPointer(lir), WrapPointer(tab_rec), 0, lir->target); in AssembleLIR()
1518 new_mov16L->offset = lir->offset; in AssembleLIR()
1520 InsertLIRBefore(lir, new_mov16L); in AssembleLIR()
1521 lir->offset += new_mov16L->flags.size; in AssembleLIR()
1523 InsertFixupBefore(prev_lir, lir, new_mov16L); in AssembleLIR()
1526 RawLIR(lir->dalvik_offset, kThumb2MovImm16HST, lir->operands[0], 0, in AssembleLIR()
1527 WrapPointer(lir), WrapPointer(tab_rec), 0, lir->target); in AssembleLIR()
1530 new_mov16H->offset = lir->offset; in AssembleLIR()
1532 InsertLIRBefore(lir, new_mov16H); in AssembleLIR()
1533 lir->offset += new_mov16H->flags.size; in AssembleLIR()
1535 InsertFixupBefore(prev_lir, lir, new_mov16H); in AssembleLIR()
1538 offset_adjustment -= lir->flags.size; in AssembleLIR()
1539 if (RegStorage::RegNum(lir->operands[0]) < 8) { in AssembleLIR()
1540 lir->opcode = kThumbAddRRLH; in AssembleLIR()
1542 lir->opcode = kThumbAddRRHH; in AssembleLIR()
1544 lir->operands[1] = rs_rARM_PC.GetReg(); in AssembleLIR()
1545 lir->flags.size = EncodingMap[lir->opcode].size; in AssembleLIR()
1546 offset_adjustment += lir->flags.size; in AssembleLIR()
1548 lir->flags.fixup = kFixupNone; in AssembleLIR()
1555 LIR *addPCInst = reinterpret_cast<LIR*>(UnwrapPointer(lir->operands[2])); in AssembleLIR()
1556 EmbeddedData *tab_rec = reinterpret_cast<EmbeddedData*>(UnwrapPointer(lir->operands[3])); in AssembleLIR()
1558 LIR* target = lir->target; in AssembleLIR()
1560 lir->operands[1] = (target_disp - (addPCInst->offset + 4)) & 0xffff; in AssembleLIR()
1565 LIR *addPCInst = reinterpret_cast<LIR*>(UnwrapPointer(lir->operands[2])); in AssembleLIR()
1566 EmbeddedData *tab_rec = reinterpret_cast<EmbeddedData*>(UnwrapPointer(lir->operands[3])); in AssembleLIR()
1568 LIR* target = lir->target; in AssembleLIR()
1570 lir->operands[1] = in AssembleLIR()
1575 int32_t required_size = lir->offset & 0x2; in AssembleLIR()
1576 if (lir->flags.size != required_size) { in AssembleLIR()
1577 offset_adjustment += required_size - lir->flags.size; in AssembleLIR()
1578 lir->flags.size = required_size; in AssembleLIR()
1584 LOG(FATAL) << "Unexpected case " << lir->flags.fixup; in AssembleLIR()
1586 prev_lir = lir; in AssembleLIR()
1587 lir = lir->u.a.pcrel_next; in AssembleLIR()
1631 size_t ArmMir2Lir::GetInsnSize(LIR* lir) { in GetInsnSize() argument
1632 DCHECK(!IsPseudoLirOp(lir->opcode)); in GetInsnSize()
1633 return EncodingMap[lir->opcode].size; in GetInsnSize()
1641 for (LIR* lir = head_lir; lir != end_lir; lir = NEXT_LIR(lir)) { in LinkFixupInsns() local
1642 if (!lir->flags.is_nop) { in LinkFixupInsns()
1643 if (lir->flags.fixup != kFixupNone) { in LinkFixupInsns()
1644 if (!IsPseudoLirOp(lir->opcode)) { in LinkFixupInsns()
1645 lir->flags.size = EncodingMap[lir->opcode].size; in LinkFixupInsns()
1646 lir->flags.fixup = EncodingMap[lir->opcode].fixup; in LinkFixupInsns()
1647 } else if (UNLIKELY(lir->opcode == kPseudoPseudoAlign4)) { in LinkFixupInsns()
1648 lir->flags.size = (offset & 0x2); in LinkFixupInsns()
1649 lir->flags.fixup = kFixupAlign4; in LinkFixupInsns()
1651 lir->flags.size = 0; in LinkFixupInsns()
1652 lir->flags.fixup = kFixupLabel; in LinkFixupInsns()
1655 lir->flags.use_def_invalid = true; in LinkFixupInsns()
1656 lir->u.a.pcrel_next = NULL; in LinkFixupInsns()
1658 first_fixup_ = lir; in LinkFixupInsns()
1660 last_fixup->u.a.pcrel_next = lir; in LinkFixupInsns()
1662 last_fixup = lir; in LinkFixupInsns()
1663 lir->offset = offset; in LinkFixupInsns()
1665 offset += lir->flags.size; in LinkFixupInsns()