Lines Matching refs:lir

709 size_t X86Mir2Lir::GetInsnSize(LIR* lir) {  in GetInsnSize()  argument
710 DCHECK(!IsPseudoLirOp(lir->opcode)); in GetInsnSize()
711 const X86EncodingMap* entry = &X86Mir2Lir::EncodingMap[lir->opcode]; in GetInsnSize()
712 DCHECK_EQ(entry->opcode, lir->opcode) << entry->name; in GetInsnSize()
718 return lir->operands[0]; // Length of nop is sole operand. in GetInsnSize()
722 return ComputeSize(entry, NO_REG, NO_REG, lir->operands[0], 0); in GetInsnSize()
724 return ComputeSize(entry, NO_REG, NO_REG, lir->operands[0], 0); in GetInsnSize()
726 return ComputeSize(entry, NO_REG, NO_REG, lir->operands[0], lir->operands[1]); in GetInsnSize()
728 return ComputeSize(entry, NO_REG, lir->operands[1], lir->operands[0], lir->operands[3]); in GetInsnSize()
730 return ComputeSize(entry, lir->operands[2], NO_REG, lir->operands[0], lir->operands[1]); in GetInsnSize()
732 return ComputeSize(entry, lir->operands[2], NO_REG, lir->operands[0], lir->operands[1]); in GetInsnSize()
734 return ComputeSize(entry, lir->operands[4], lir->operands[1], lir->operands[0], in GetInsnSize()
735 lir->operands[3]); in GetInsnSize()
738 return ComputeSize(entry, lir->operands[1], NO_REG, NO_REG, 0x12345678); in GetInsnSize()
740 return ComputeSize(entry, lir->operands[0], NO_REG, lir->operands[1], 0); in GetInsnSize()
742 return ComputeSize(entry, lir->operands[1], NO_REG, lir->operands[0], 0); in GetInsnSize()
744 return ComputeSize(entry, lir->operands[0], NO_REG, lir->operands[1], lir->operands[2]); in GetInsnSize()
746 return ComputeSize(entry, lir->operands[0], lir->operands[2], lir->operands[1], in GetInsnSize()
747 lir->operands[4]); in GetInsnSize()
750 return ComputeSize(entry, lir->operands[0], NO_REG, NO_REG, 0x12345678); in GetInsnSize()
752 size_t size = ComputeSize(entry, lir->operands[0], NO_REG, NO_REG, 0); in GetInsnSize()
757 return size - (RegStorage::RegNum(lir->operands[0]) == rs_rAX.GetRegNum() ? 1 : 0); in GetInsnSize()
761 return ComputeSize(entry, NO_REG, NO_REG, lir->operands[0], lir->operands[1]); in GetInsnSize()
763 return ComputeSize(entry, NO_REG, lir->operands[1], lir->operands[0], lir->operands[3]); in GetInsnSize()
769 return ComputeSize(entry, lir->operands[0], lir->operands[1], NO_REG, 0); in GetInsnSize()
772 return ComputeSize(entry, lir->operands[1], lir->operands[0], NO_REG, 0); in GetInsnSize()
774 return ComputeSize(entry, lir->operands[0], NO_REG, lir->operands[1], lir->operands[2]); in GetInsnSize()
776 return ComputeSize(entry, lir->operands[0], lir->operands[2], lir->operands[1], in GetInsnSize()
777 lir->operands[4]); in GetInsnSize()
780 return ((entry->skeleton.prefix1 != 0 || NeedsRex(lir->operands[0])) ? 1 : 0) + 1 + in GetInsnSize()
784 return ComputeSize(entry, lir->operands[0], NO_REG, NO_REG, 0) - in GetInsnSize()
785 (lir->operands[1] == 1 ? 1 : 0); in GetInsnSize()
788 return ComputeSize(entry, NO_REG, NO_REG, lir->operands[0], lir->operands[1]) - in GetInsnSize()
789 (lir->operands[2] == 1 ? 1 : 0); in GetInsnSize()
792 return ComputeSize(entry, NO_REG, lir->operands[1], lir->operands[0], lir->operands[3]) - in GetInsnSize()
793 (lir->operands[4] == 1 ? 1 : 0); in GetInsnSize()
795 DCHECK_EQ(rs_rCX.GetRegNum(), RegStorage::RegNum(lir->operands[1])); in GetInsnSize()
797 return ComputeSize(entry, lir->operands[0], NO_REG, NO_REG, 0); in GetInsnSize()
799 DCHECK_EQ(rs_rCX.GetRegNum(), RegStorage::RegNum(lir->operands[2])); in GetInsnSize()
800 return ComputeSize(entry, NO_REG, NO_REG, lir->operands[0], lir->operands[1]); in GetInsnSize()
802 DCHECK_EQ(rs_rCX.GetRegNum(), RegStorage::RegNum(lir->operands[4])); in GetInsnSize()
803 return ComputeSize(entry, lir->operands[4], lir->operands[1], lir->operands[0], in GetInsnSize()
804 lir->operands[3]); in GetInsnSize()
806 DCHECK_EQ(rs_rCX.GetRegNum(), RegStorage::RegNum(lir->operands[2])); in GetInsnSize()
807 return ComputeSize(entry, lir->operands[0], NO_REG, lir->operands[1], 0); in GetInsnSize()
809 return ComputeSize(entry, NO_REG, NO_REG, lir->operands[0], 0); in GetInsnSize()
811 return ComputeSize(entry, NO_REG, NO_REG, lir->operands[0], lir->operands[1]); in GetInsnSize()
814 return ComputeSize(entry, NO_REG, lir->operands[1], lir->operands[0], lir->operands[3]); in GetInsnSize()
817 return ComputeSize(entry, lir->operands[0], NO_REG, lir->operands[1], 0); in GetInsnSize()
820 return ComputeSize(entry, lir->operands[0], NO_REG, lir->operands[1], lir->operands[2]); in GetInsnSize()
822 if (lir->opcode == kX86Jcc8) { in GetInsnSize()
825 DCHECK(lir->opcode == kX86Jcc32); in GetInsnSize()
829 if (lir->opcode == kX86Jmp8 || lir->opcode == kX86Jecxz8) { in GetInsnSize()
831 } else if (lir->opcode == kX86Jmp32) { in GetInsnSize()
833 } else if (lir->opcode == kX86JmpT) { in GetInsnSize()
837 DCHECK(lir->opcode == kX86JmpR); in GetInsnSize()
838 if (NeedsRex(lir->operands[0])) { in GetInsnSize()
845 switch (lir->opcode) { in GetInsnSize()
849 return ComputeSize(entry, NO_REG, NO_REG, lir->operands[0], lir->operands[1]); in GetInsnSize()
851 return ComputeSize(entry, NO_REG, lir->operands[1], lir->operands[0], lir->operands[3]); in GetInsnSize()
863 return ComputeSize(entry, lir->operands[0], lir->operands[2], lir->operands[1], in GetInsnSize()
1618 void X86Mir2Lir::EmitUnimplemented(const X86EncodingMap* entry, LIR* lir) { in EmitUnimplemented() argument
1620 << BuildInsnString(entry->fmt, lir, 0); in EmitUnimplemented()
1621 for (size_t i = 0; i < GetInsnSize(lir); ++i) { in EmitUnimplemented()
1634 LIR *lir; in AssembleInstructions() local
1638 for (lir = first_lir_insn; lir != nullptr; lir = NEXT_LIR(lir)) { in AssembleInstructions()
1639 if (IsPseudoLirOp(lir->opcode)) { in AssembleInstructions()
1643 if (lir->flags.is_nop) { in AssembleInstructions()
1647 if (lir->flags.fixup != kFixupNone) { in AssembleInstructions()
1648 switch (lir->opcode) { in AssembleInstructions()
1650 LIR *target_lir = lir->target; in AssembleInstructions()
1654 if (IS_SIMM8(lir->operands[0])) { in AssembleInstructions()
1655 pc = lir->offset + 2 /* opcode + rel8 */; in AssembleInstructions()
1657 pc = lir->offset + 6 /* 2 byte opcode + rel32 */; in AssembleInstructions()
1661 if (IS_SIMM8(delta) != IS_SIMM8(lir->operands[0])) { in AssembleInstructions()
1663 LOG(INFO) << "Retry for JCC growth at " << lir->offset in AssembleInstructions()
1664 << " delta: " << delta << " old delta: " << lir->operands[0]; in AssembleInstructions()
1666 lir->opcode = kX86Jcc32; in AssembleInstructions()
1667 lir->flags.size = GetInsnSize(lir); in AssembleInstructions()
1668 DCHECK(lir->u.m.def_mask->Equals(kEncodeAll)); in AssembleInstructions()
1669 DCHECK(lir->u.m.use_mask->Equals(kEncodeAll)); in AssembleInstructions()
1674 DumpLIRInsn(lir, 0); in AssembleInstructions()
1679 lir->operands[0] = delta; in AssembleInstructions()
1683 LIR *target_lir = lir->target; in AssembleInstructions()
1685 CodeOffset pc = lir->offset + 6 /* 2 byte opcode + rel32 */; in AssembleInstructions()
1690 DumpLIRInsn(lir, 0); in AssembleInstructions()
1695 lir->operands[0] = delta; in AssembleInstructions()
1699 LIR *target_lir = lir->target; in AssembleInstructions()
1702 pc = lir->offset + 2; // opcode + rel8 in AssembleInstructions()
1705 lir->operands[0] = delta; in AssembleInstructions()
1710 LIR *target_lir = lir->target; in AssembleInstructions()
1714 if (IS_SIMM8(lir->operands[0])) { in AssembleInstructions()
1715 pc = lir->offset + 2 /* opcode + rel8 */; in AssembleInstructions()
1717 pc = lir->offset + 5 /* opcode + rel32 */; in AssembleInstructions()
1723 NopLIR(lir); in AssembleInstructions()
1725 LOG(INFO) << "Retry for useless branch at " << lir->offset; in AssembleInstructions()
1728 } else if (IS_SIMM8(delta) != IS_SIMM8(lir->operands[0])) { in AssembleInstructions()
1730 LOG(INFO) << "Retry for JMP growth at " << lir->offset; in AssembleInstructions()
1732 lir->opcode = kX86Jmp32; in AssembleInstructions()
1733 lir->flags.size = GetInsnSize(lir); in AssembleInstructions()
1734 DCHECK(lir->u.m.def_mask->Equals(kEncodeAll)); in AssembleInstructions()
1735 DCHECK(lir->u.m.use_mask->Equals(kEncodeAll)); in AssembleInstructions()
1738 lir->operands[0] = delta; in AssembleInstructions()
1742 LIR *target_lir = lir->target; in AssembleInstructions()
1744 CodeOffset pc = lir->offset + 5 /* opcode + rel32 */; in AssembleInstructions()
1747 lir->operands[0] = delta; in AssembleInstructions()
1751 if (lir->flags.fixup == kFixupLoad) { in AssembleInstructions()
1752 LIR *target_lir = lir->target; in AssembleInstructions()
1756 if (lir->operands[1] == kRIPReg) { in AssembleInstructions()
1758 lir->operands[2] = target - (lir->offset + lir->flags.size); in AssembleInstructions()
1760 const LIR* anchor = UnwrapPointer<LIR>(lir->operands[4]); in AssembleInstructions()
1761 lir->operands[2] = target - anchor->offset; in AssembleInstructions()
1762 int newSize = GetInsnSize(lir); in AssembleInstructions()
1763 if (newSize != lir->flags.size) { in AssembleInstructions()
1764 lir->flags.size = newSize; in AssembleInstructions()
1768 } else if (lir->flags.fixup == kFixupSwitchTable) { in AssembleInstructions()
1770 …DCHECK_EQ(lir->opcode, kX86Lea64RM) << "Unknown instruction: " << X86Mir2Lir::EncodingMap[lir->opc… in AssembleInstructions()
1771 DCHECK_EQ(lir->operands[1], static_cast<int>(kRIPReg)); in AssembleInstructions()
1773 const EmbeddedData* tab_rec = UnwrapPointer<Mir2Lir::EmbeddedData>(lir->operands[4]); in AssembleInstructions()
1777 lir->operands[2] = target - (lir->offset + lir->flags.size); in AssembleInstructions()
1791 CHECK_EQ(static_cast<size_t>(lir->offset), code_buffer_.size()); in AssembleInstructions()
1792 const X86EncodingMap *entry = &X86Mir2Lir::EncodingMap[lir->opcode]; in AssembleInstructions()
1796 code_buffer_.push_back(lir->operands[0]); in AssembleInstructions()
1802 EmitOpRegOpcode(entry, lir->operands[0]); in AssembleInstructions()
1805 EmitOpReg(entry, lir->operands[0]); in AssembleInstructions()
1808 EmitOpMem(entry, lir->operands[0], lir->operands[1]); in AssembleInstructions()
1811 EmitOpArray(entry, lir->operands[0], lir->operands[1], lir->operands[2], lir->operands[3]); in AssembleInstructions()
1814 EmitMemReg(entry, lir->operands[0], lir->operands[1], lir->operands[2]); in AssembleInstructions()
1817 EmitMemImm(entry, lir->operands[0], lir->operands[1], lir->operands[2]); in AssembleInstructions()
1820 EmitArrayImm(entry, lir->operands[0], lir->operands[1], lir->operands[2], in AssembleInstructions()
1821 lir->operands[3], lir->operands[4]); in AssembleInstructions()
1824 EmitArrayReg(entry, lir->operands[0], lir->operands[1], lir->operands[2], in AssembleInstructions()
1825 lir->operands[3], lir->operands[4]); in AssembleInstructions()
1828 EmitRegMem(entry, lir->operands[0], lir->operands[1], lir->operands[2]); in AssembleInstructions()
1831 EmitRegArray(entry, lir->operands[0], lir->operands[1], lir->operands[2], in AssembleInstructions()
1832 lir->operands[3], lir->operands[4]); in AssembleInstructions()
1835 EmitRegThread(entry, lir->operands[0], lir->operands[1]); in AssembleInstructions()
1838 EmitRegReg(entry, lir->operands[0], lir->operands[1]); in AssembleInstructions()
1841 EmitRegReg(entry, lir->operands[1], lir->operands[0]); in AssembleInstructions()
1844 EmitMemRegImm(entry, lir->operands[0], lir->operands[1], lir->operands[2], in AssembleInstructions()
1845 lir->operands[3]); in AssembleInstructions()
1848 EmitRegRegImm(entry, lir->operands[0], lir->operands[1], lir->operands[2]); in AssembleInstructions()
1851 EmitRegRegImm(entry, lir->operands[1], lir->operands[0], lir->operands[2]); in AssembleInstructions()
1854 EmitRegMemImm(entry, lir->operands[0], lir->operands[1], lir->operands[2], in AssembleInstructions()
1855 lir->operands[3]); in AssembleInstructions()
1858 EmitRegImm(entry, lir->operands[0], lir->operands[1]); in AssembleInstructions()
1861 EmitThreadImm(entry, lir->operands[0], lir->operands[1]); in AssembleInstructions()
1864 EmitMovRegImm(entry, lir->operands[0], lir->operands[1]); in AssembleInstructions()
1867 int64_t value = static_cast<int64_t>(static_cast<int64_t>(lir->operands[1]) << 32 | in AssembleInstructions()
1868 static_cast<uint32_t>(lir->operands[2])); in AssembleInstructions()
1869 EmitMovRegImm(entry, lir->operands[0], value); in AssembleInstructions()
1873 EmitShiftRegImm(entry, lir->operands[0], lir->operands[1]); in AssembleInstructions()
1876 EmitShiftMemImm(entry, lir->operands[0], lir->operands[1], lir->operands[2]); in AssembleInstructions()
1879 EmitShiftRegCl(entry, lir->operands[0], lir->operands[1]); in AssembleInstructions()
1882 EmitShiftMemCl(entry, lir->operands[0], lir->operands[1], lir->operands[2]); in AssembleInstructions()
1885 EmitShiftRegRegCl(entry, lir->operands[1], lir->operands[0], lir->operands[2]); in AssembleInstructions()
1888 EmitRegCond(entry, lir->operands[0], lir->operands[1]); in AssembleInstructions()
1891 EmitMemCond(entry, lir->operands[0], lir->operands[1], lir->operands[2]); in AssembleInstructions()
1894 EmitRegRegCond(entry, lir->operands[0], lir->operands[1], lir->operands[2]); in AssembleInstructions()
1897 EmitRegMemCond(entry, lir->operands[0], lir->operands[1], lir->operands[2], in AssembleInstructions()
1898 lir->operands[3]); in AssembleInstructions()
1904 EmitCallThread(entry, lir->operands[0]); in AssembleInstructions()
1906 EmitJmp(entry, lir->operands[0]); in AssembleInstructions()
1910 EmitJcc(entry, lir->operands[0], lir->operands[1]); in AssembleInstructions()
1915 EmitCallImmediate(entry, lir->operands[0]); in AssembleInstructions()
1918 EmitCallMem(entry, lir->operands[0], lir->operands[1]); in AssembleInstructions()
1921 EmitCallThread(entry, lir->operands[0]); in AssembleInstructions()
1924 EmitUnimplemented(entry, lir); in AssembleInstructions()
1929 EmitPcRel(entry, lir->operands[0], lir->operands[1], lir->operands[2], in AssembleInstructions()
1930 lir->operands[3], lir->operands[4]); in AssembleInstructions()
1939 EmitUnimplemented(entry, lir); in AssembleInstructions()
1942 DCHECK_EQ(lir->flags.size, GetInsnSize(lir)); in AssembleInstructions()
1943 CHECK_EQ(lir->flags.size, code_buffer_.size() - starting_cbuf_size) in AssembleInstructions()
1944 << "Instruction size mismatch for entry: " << X86Mir2Lir::EncodingMap[lir->opcode].name; in AssembleInstructions()
1952 LIR* lir; in AssignInsnOffsets() local
1955 for (lir = first_lir_insn_; lir != nullptr; lir = NEXT_LIR(lir)) { in AssignInsnOffsets()
1956 lir->offset = offset; in AssignInsnOffsets()
1957 if (LIKELY(!IsPseudoLirOp(lir->opcode))) { in AssignInsnOffsets()
1958 if (!lir->flags.is_nop) { in AssignInsnOffsets()
1959 offset += lir->flags.size; in AssignInsnOffsets()
1961 } else if (UNLIKELY(lir->opcode == kPseudoPseudoAlign4)) { in AssignInsnOffsets()
1964 lir->operands[0] = 1; in AssignInsnOffsets()
1966 lir->operands[0] = 0; in AssignInsnOffsets()