Lines Matching refs:range
203 // We cannot spill a live range that has a use requiring a register
299 ? after // Only interval in the range after split.
300 : last_interval_; // Last interval of the original range.
332 // to the use that no longer belongs to this live range.
336 // Link the new live range in the chain before any of the other
337 // ranges linked from the range before the split.
370 LAllocator::TraceAlloc("Shorten live range %d to [%d\n", id_, start.Value());
381 LAllocator::TraceAlloc("Ensure live range %d in interval [%d %d[\n",
406 LAllocator::TraceAlloc("Add to live range %d interval [%d %d[\n",
437 LAllocator::TraceAlloc("Add to live range %d use position %d\n",
587 // Add an interval that includes the entire block to the live range for
596 LiveRange* range = LiveRangeFor(operand_index);
597 range->AddUseInterval(start, end, zone());
711 LiveRange* range = LiveRangeFor(operand);
712 if (range == NULL) return;
714 if (range->IsEmpty() || range->Start().Value() > position.Value()) {
716 range->AddUseInterval(position, position.NextInstruction(), zone());
717 range->AddUsePosition(position.NextInstruction(), NULL, NULL, zone());
719 range->ShortenTo(position);
724 range->AddUsePosition(position, unalloc_operand, hint, zone());
733 LiveRange* range = LiveRangeFor(operand);
734 if (range == NULL) return;
737 range->AddUsePosition(position, unalloc_operand, hint, zone());
739 range->AddUseInterval(block_start, position, zone());
800 LiveRange* range = LiveRangeFor(first_output->virtual_register());
810 range->SetSpillOperand(first_output);
811 range->SetSpillStartIndex(gap_index - 1);
818 range->SetSpillStartIndex(gap_index);
827 move->AddMove(first_output, range->GetSpillOperand(),
843 // The live range of writable input registers always goes until the end
961 LiveRange* range = FixedLiveRangeFor(i);
962 range->AddUseInterval(curr_position,
973 LiveRange* range = FixedDoubleLiveRangeFor(i);
974 range->AddUseInterval(curr_position,
1061 // it into a location different from the operand of a live range
1131 void LAllocator::ResolveControlFlow(LiveRange* range,
1140 LiveRange* cur_range = range;
1171 // it into a location different from the operand of a live range
1176 if (HasTaggedValue(range->id())) {
1293 // The live range interval already ends at the first instruction of the
1327 // in the loop information. Add a live range stretching from the first
1338 LiveRange* range = LiveRangeFor(operand_index);
1339 range->EnsureInterval(start, end, zone());
1365 LiveRange* range = LiveRangeFor(operand_index);
1366 PrintF("First use is at %d\n", range->first_pos()->pos().Value());
1405 LiveRange* range = live_ranges()->at(range_idx);
1406 if (range == NULL) continue;
1408 if (range->parent() != NULL) continue;
1410 if (!HasTaggedValue(range->id())) continue;
1412 if (range->IsEmpty()) continue;
1414 // Find the extent of the range and its children.
1415 int start = range->Start().InstructionIndex();
1417 for (LiveRange* cur = range; cur != NULL; cur = cur->next()) {
1431 // Step across all the safe points that are before the start of this range,
1432 // recording how far we step in order to save doing this for the next range.
1440 // Step through the safe points to see whether they are in the range.
1450 // Advance to the next active range that covers the current
1454 LiveRange* cur = range;
1460 // Check if the live range is spilled and the safe point is after
1462 if (range->HasAllocatedSpillOperand() &&
1463 safe_point >= range->spill_start_index()) {
1464 TraceAlloc("Pointer for range %d (spilled at %d) at safe point %d\n",
1465 range->id(), range->spill_start_index(), safe_point);
1466 map->RecordPointer(range->GetSpillOperand(), chunk()->zone());
1470 TraceAlloc("Pointer in register for range %d (start at %d) "
1545 TraceAlloc("Live range %d already has a spill operand\n", current->id());
1551 // If the range already has a spill operand and it doesn't need a
1552 // register immediately, split it and spill the first part of the range.
1558 // Do not spill live range eagerly if use position that can benefit from
1559 // the register is too close to the start of live range.
1571 --i; // The live range was removed from the list of active live ranges.
1574 --i; // The live range was removed from the list of active live ranges.
1582 --i; // Live range was removed from the list of inactive live ranges.
1585 --i; // Live range was removed from the list of inactive live ranges.
1649 void LAllocator::AddToActive(LiveRange* range) {
1650 TraceAlloc("Add live range %d to active\n", range->id());
1651 active_live_ranges_.Add(range, zone());
1655 void LAllocator::AddToInactive(LiveRange* range) {
1656 TraceAlloc("Add live range %d to inactive\n", range->id());
1657 inactive_live_ranges_.Add(range, zone());
1661 void LAllocator::AddToUnhandledSorted(LiveRange* range) {
1662 if (range == NULL || range->IsEmpty()) return;
1663 ASSERT(!range->HasRegisterAssigned() && !range->IsSpilled());
1664 ASSERT(allocation_finger_.Value() <= range->Start().Value());
1667 if (range->ShouldBeAllocatedBefore(cur_range)) {
1668 TraceAlloc("Add live range %d to unhandled at %d\n", range->id(), i + 1);
1669 unhandled_live_ranges_.InsertAt(i + 1, range, zone());
1674 TraceAlloc("Add live range %d to unhandled at start\n", range->id());
1675 unhandled_live_ranges_.InsertAt(0, range, zone());
1680 void LAllocator::AddToUnhandledUnsorted(LiveRange* range) {
1681 if (range == NULL || range->IsEmpty()) return;
1682 ASSERT(!range->HasRegisterAssigned() && !range->IsSpilled());
1683 TraceAlloc("Add live range %d to unhandled unsorted at end\n", range->id());
1684 unhandled_live_ranges_.Add(range, zone());
1717 void LAllocator::FreeSpillSlot(LiveRange* range) {
1718 // Check that we are the last range.
1719 if (range->next() != NULL) return;
1721 if (!range->TopLevel()->HasAllocatedSpillOperand()) return;
1723 int index = range->TopLevel()->GetSpillOperand()->index();
1725 reusable_slots_.Add(range, zone());
1730 LOperand* LAllocator::TryReuseSpillSlot(LiveRange* range) {
1733 range->TopLevel()->Start().Value()) {
1742 void LAllocator::ActiveToHandled(LiveRange* range) {
1743 ASSERT(active_live_ranges_.Contains(range));
1744 active_live_ranges_.RemoveElement(range);
1745 TraceAlloc("Moving live range %d from active to handled\n", range->id());
1746 FreeSpillSlot(range);
1750 void LAllocator::ActiveToInactive(LiveRange* range) {
1751 ASSERT(active_live_ranges_.Contains(range));
1752 active_live_ranges_.RemoveElement(range);
1753 inactive_live_ranges_.Add(range, zone());
1754 TraceAlloc("Moving live range %d from active to inactive\n", range->id());
1758 void LAllocator::InactiveToHandled(LiveRange* range) {
1759 ASSERT(inactive_live_ranges_.Contains(range));
1760 inactive_live_ranges_.RemoveElement(range);
1761 TraceAlloc("Moving live range %d from inactive to handled\n", range->id());
1762 FreeSpillSlot(range);
1766 void LAllocator::InactiveToActive(LiveRange* range) {
1767 ASSERT(inactive_live_ranges_.Contains(range));
1768 inactive_live_ranges_.RemoveElement(range);
1769 active_live_ranges_.Add(range, zone());
1770 TraceAlloc("Moving live range %d from inactive to active\n", range->id());
1807 "Found reg hint %s (free until [%d) for live range %d (end %d[).\n",
1813 // The desired register is free until the end of the current live range.
1815 TraceAlloc("Assigning preferred reg %s to live range %d\n",
1839 // Register reg is available at the range start but becomes blocked before
1840 // the range end. Split current at position where it becomes blocked.
1847 // Register reg is available at the range start and is free until
1848 // the range end.
1850 TraceAlloc("Assigning free reg %s to live range %d\n",
1862 // There is no use in the current live range that requires a register.
1877 LiveRange* range = active_live_ranges_[i];
1878 int cur_reg = range->assigned_register();
1879 if (range->IsFixed() || !range->CanBeSpilled(current->Start())) {
1883 UsePosition* next_use = range->NextUsePositionRegisterIsBeneficial(
1886 use_pos[cur_reg] = range->End();
1894 LiveRange* range = inactive_live_ranges_.at(i);
1895 ASSERT(range->End().Value() > current->Start().Value());
1896 LifetimePosition next_intersection = range->FirstIntersection(current);
1898 int cur_reg = range->assigned_register();
1899 if (range->IsFixed()) {
1918 // Spill starting part of live range up to that use.
1924 // Register becomes blocked before the current range end. Split before that
1933 // Register reg is not blocked for the whole range.
1935 TraceAlloc("Assigning blocked reg %s to live range %d\n",
1947 LifetimePosition LAllocator::FindOptimalSpillingPos(LiveRange* range,
1956 range->PreviousUsePositionRegisterIsBeneficial(pos);
1959 // We are going to spill live range inside the loop.
1965 if (range->Covers(loop_start)) {
1985 LiveRange* range = active_live_ranges_[i];
1986 if (range->assigned_register() == reg) {
1987 UsePosition* next_pos = range->NextRegisterPosition(current->Start());
1988 LifetimePosition spill_pos = FindOptimalSpillingPos(range, split_pos);
1990 SpillAfter(range, spill_pos);
1992 // When spilling between spill_pos and next_pos ensure that the range
1993 // remains spilled at least until the start of the current live range.
1995 // start before the current range as this violates allocation invariant
1999 // current live-range is larger than their end.
2000 SpillBetweenUntil(range, spill_pos, current->Start(), next_pos->pos());
2003 ActiveToHandled(range);
2009 LiveRange* range = inactive_live_ranges_[i];
2010 ASSERT(range->End().Value() > current->Start().Value());
2011 if (range->assigned_register() == reg && !range->IsFixed()) {
2012 LifetimePosition next_intersection = range->FirstIntersection(current);
2014 UsePosition* next_pos = range->NextRegisterPosition(current->Start());
2016 SpillAfter(range, split_pos);
2019 SpillBetween(range, split_pos, next_intersection);
2022 InactiveToHandled(range);
2036 LiveRange* LAllocator::SplitRangeAt(LiveRange* range, LifetimePosition pos) {
2037 ASSERT(!range->IsFixed());
2038 TraceAlloc("Splitting live range %d at %d\n", range->id(), pos.Value());
2040 if (pos.Value() <= range->Start().Value()) return range;
2050 range->SplitAt(pos, result, zone());
2055 LiveRange* LAllocator::SplitBetween(LiveRange* range,
2058 ASSERT(!range->IsFixed());
2059 TraceAlloc("Splitting live range %d in position between [%d, %d]\n",
2060 range->id(),
2066 return SplitRangeAt(range, split_pos);
2104 void LAllocator::SpillAfter(LiveRange* range, LifetimePosition pos) {
2105 LiveRange* second_part = SplitRangeAt(range, pos);
2111 void LAllocator::SpillBetween(LiveRange* range,
2114 SpillBetweenUntil(range, start, start, end);
2118 void LAllocator::SpillBetweenUntil(LiveRange* range,
2123 LiveRange* second_part = SplitRangeAt(range, start);
2148 void LAllocator::Spill(LiveRange* range) {
2149 ASSERT(!range->IsSpilled());
2150 TraceAlloc("Spilling live range %d\n", range->id());
2151 LiveRange* first = range->TopLevel();
2154 LOperand* op = TryReuseSpillSlot(range);
2155 if (op == NULL) op = chunk_->GetNextSpillSlot(range->Kind());
2158 range->MakeSpilled(chunk()->zone());