Home | History | Annotate | Download | only in mips64

Lines Matching refs:branch

71   // existing instructions (branch placeholders) in the buffer.
73 for (auto& branch : branches_) {
74 EmitBranch(&branch);
696 LOG(FATAL) << "Unexpected branch condition " << cond;
1170 void Mips64Assembler::Branch::InitShortOrLong(Mips64Assembler::Branch::OffsetBits offset_size,
1171 Mips64Assembler::Branch::Type short_type,
1172 Mips64Assembler::Branch::Type long_type) {
1176 void Mips64Assembler::Branch::InitializeType(bool is_call) {
1193 bool Mips64Assembler::Branch::IsNop(BranchCondition condition, GpuRegister lhs, GpuRegister rhs) {
1205 bool Mips64Assembler::Branch::IsUncond(BranchCondition condition,
1221 Mips64Assembler::Branch::Branch(uint32_t location, uint32_t target)
1231 Mips64Assembler::Branch::Branch(uint32_t location,
1273 // Branch condition is always true, make the branch unconditional.
1279 Mips64Assembler::Branch::Branch(uint32_t location, uint32_t target, GpuRegister indirect_reg)
1291 Mips64Assembler::BranchCondition Mips64Assembler::Branch::OppositeCondition(
1327 LOG(FATAL) << "Unexpected branch condition " << cond;
1332 Mips64Assembler::Branch::Type Mips64Assembler::Branch::GetType() const {
1336 Mips64Assembler::BranchCondition Mips64Assembler::Branch::GetCondition() const {
1340 GpuRegister Mips64Assembler::Branch::GetLeftRegister() const {
1344 GpuRegister Mips64Assembler::Branch::GetRightRegister() const {
1348 uint32_t Mips64Assembler::Branch::GetTarget() const {
1352 uint32_t Mips64Assembler::Branch::GetLocation() const {
1356 uint32_t Mips64Assembler::Branch::GetOldLocation() const {
1360 uint32_t Mips64Assembler::Branch::GetLength() const {
1364 uint32_t Mips64Assembler::Branch::GetOldLength() const {
1368 uint32_t Mips64Assembler::Branch::GetSize() const {
1372 uint32_t Mips64Assembler::Branch::GetOldSize() const {
1376 uint32_t Mips64Assembler::Branch::GetEndLocation() const {
1380 uint32_t Mips64Assembler::Branch::GetOldEndLocation() const {
1384 bool Mips64Assembler::Branch::IsLong() const {
1400 bool Mips64Assembler::Branch::IsResolved() const {
1404 Mips64Assembler::Branch::OffsetBits Mips64Assembler::Branch::GetOffsetSize() const {
1412 Mips64Assembler::Branch::OffsetBits Mips64Assembler::Branch::GetOffsetSizeNeeded(uint32_t location,
1420 // bump up the distance by a value larger than the max byte size of a composite branch.
1435 void Mips64Assembler::Branch::Resolve(uint32_t target) {
1439 void Mips64Assembler::Branch::Relocate(uint32_t expand_location, uint32_t delta) {
1451 void Mips64Assembler::Branch::PromoteToLong() {
1470 uint32_t Mips64Assembler::Branch::PromoteIfNeeded(uint32_t max_short_distance) {
1471 // If the branch is still unresolved or already long, nothing to do.
1475 // Promote the short branch to long if the offset size is too small
1500 uint32_t Mips64Assembler::Branch::GetOffsetLocation() const {
1504 uint32_t Mips64Assembler::Branch::GetOffset() const {
1515 Mips64Assembler::Branch* Mips64Assembler::GetBranch(uint32_t branch_id) {
1520 const Mips64Assembler::Branch* Mips64Assembler::GetBranch(uint32_t branch_id) const {
1533 Branch* branch = GetBranch(branch_id);
1534 branch->Resolve(bound_pc);
1536 uint32_t branch_location = branch->GetLocation();
1537 // Extract the location of the previous branch in the list (walking the list backwards;
1538 // the previous branch ID was stored in the space reserved for this branch).
1541 // On to the previous branch in the list...
1546 // branch, if any; it will be used by the branches referring to and following this label).
1550 const Branch* branch = GetBranch(branch_id);
1551 bound_pc -= branch->GetEndLocation();
1560 // Get label location based on the branch preceding it.
1562 const Branch* branch = GetBranch(branch_id);
1563 target += branch->GetEndLocation();
1580 const Branch* branch = GetBranch(last_branch_id_);
1581 if (branch->GetLocation() >= old_position + last_position_adjustment_) {
1584 last_position_adjustment_ += branch->GetSize() - branch->GetOldSize();
1594 // Branch forward (to a following label), distance is unknown.
1595 // The first branch forward will contain 0, serving as the terminator of
1599 // Now make the label object point to this branch
1604 // Reserve space for the branch.
1611 uint32_t target = label->IsBound() ? GetLabelLocation(label) : Branch::kUnresolved;
1621 if (Branch::IsNop(condition, lhs, rhs)) {
1624 uint32_t target = label->IsBound() ? GetLabelLocation(label) : Branch::kUnresolved;
1630 uint32_t target = label->IsBound() ? GetLabelLocation(label) : Branch::kUnresolved;
1640 for (auto& branch : branches_) {
1641 CHECK(branch.IsResolved());
1642 uint32_t delta = branch.PromoteIfNeeded();
1643 // If this branch has been promoted and needs to expand in size,
1647 uint32_t expand_location = branch.GetLocation();
1655 // Account for branch expansion by resizing the code buffer
1660 Branch& last_branch = branches_[branch_count - 1];
1664 // Move the code residing between branch placeholders.
1667 Branch& branch = branches_[--i];
1668 uint32_t size = end - branch.GetOldEndLocation();
1669 buffer_.Move(branch.GetEndLocation(), branch.GetOldEndLocation(), size);
1670 end = branch.GetOldLocation();
1676 const Mips64Assembler::Branch::BranchInfo Mips64Assembler::Branch::branch_info_[] = {
1678 { 1, 0, 1, Mips64Assembler::Branch::kOffset28, 2 }, // kUncondBranch
1679 { 2, 0, 1, Mips64Assembler::Branch::kOffset18, 2 }, // kCondBranch
1681 { 2, 0, 0, Mips64Assembler::Branch::kOffset21, 2 }, // kCall
1683 { 2, 0, 0, Mips64Assembler::Branch::kOffset32, 0 }, // kLongUncondBranch
1684 { 3, 1, 0, Mips64Assembler::Branch::kOffset32, 0 }, // kLongCondBranch
1685 { 3, 0, 0, Mips64Assembler::Branch::kOffset32, 0 }, // kLongCall
1689 void Mips64Assembler::EmitBranch(Mips64Assembler::Branch* branch) {
1691 overwrite_location_ = branch->GetLocation();
1692 uint32_t offset = branch->GetOffset();
1693 BranchCondition condition = branch->GetCondition();
1694 GpuRegister lhs = branch->GetLeftRegister();
1695 GpuRegister rhs = branch->GetRightRegister();
1696 switch (branch->GetType()) {
1698 case Branch::kUncondBranch:
1699 CHECK_EQ(overwrite_location_, branch->GetOffsetLocation());
1702 case Branch::kCondBranch:
1703 CHECK_EQ(overwrite_location_, branch->GetOffsetLocation());
1707 case Branch::kCall:
1708 CHECK_EQ(overwrite_location_, branch->GetOffsetLocation());
1714 case Branch::kLongUncondBranch:
1716 CHECK_EQ(overwrite_location_, branch->GetOffsetLocation());
1720 case Branch::kLongCondBranch:
1721 EmitBcondc(Branch::OppositeCondition(condition), lhs, rhs, 2);
1723 CHECK_EQ(overwrite_location_, branch->GetOffsetLocation());
1727 case Branch::kLongCall:
1729 CHECK_EQ(overwrite_location_, branch->GetOffsetLocation());
1735 CHECK_EQ(overwrite_location_, branch->GetEndLocation());
1736 CHECK_LT(branch->GetSize(), static_cast<uint32_t>(Branch::kMaxBranchSize));