Lines Matching refs:range
212 // We cannot spill a live range that has a use requiring a register
310 ? after // Only interval in the range after split.
311 : last_interval_; // Last interval of the original range.
343 // to the use that no longer belongs to this live range.
347 // Link the new live range in the chain before any of the other
348 // ranges linked from the range before the split.
380 LAllocator::TraceAlloc("Shorten live range %d to [%d\n", id_, start.Value());
391 LAllocator::TraceAlloc("Ensure live range %d in interval [%d %d[\n",
416 LAllocator::TraceAlloc("Add to live range %d interval [%d %d[\n",
446 LAllocator::TraceAlloc("Add to live range %d use position %d\n",
592 // Add an interval that includes the entire block to the live range for
601 LiveRange* range = LiveRangeFor(operand_index);
602 range->AddUseInterval(start, end, zone_);
713 LiveRange* range = LiveRangeFor(operand);
714 if (range == NULL) return;
716 if (range->IsEmpty() || range->Start().Value() > position.Value()) {
718 range->AddUseInterval(position, position.NextInstruction(), zone_);
719 range->AddUsePosition(position.NextInstruction(), NULL, zone_);
721 range->ShortenTo(position);
726 range->AddUsePosition(position, unalloc_operand, zone_)->set_hint(hint);
735 LiveRange* range = LiveRangeFor(operand);
736 if (range == NULL) return;
739 range->AddUsePosition(position, unalloc_operand, zone_)->set_hint(hint);
741 range->AddUseInterval(block_start, position, zone_);
800 LiveRange* range = LiveRangeFor(first_output->virtual_register());
809 range->SetSpillOperand(first_output);
810 range->SetSpillStartIndex(gap_index - 1);
817 range->SetSpillStartIndex(gap_index);
825 move->AddMove(first_output, range->GetSpillOperand());
839 // The live range of writable input registers always goes until the end
953 LiveRange* range = FixedLiveRangeFor(i);
954 range->AddUseInterval(curr_position,
965 LiveRange* range = FixedDoubleLiveRangeFor(i);
966 range->AddUseInterval(curr_position,
1042 // it into a location different from the operand of a live range
1108 void LAllocator::ResolveControlFlow(LiveRange* range,
1117 LiveRange* cur_range = range;
1148 // it into a location different from the operand of a live range
1153 if (HasTaggedValue(range->id())) {
1265 // The live range interval already ends at the first instruction of the
1298 // in the loop information. Add a live range stretching from the first
1309 LiveRange* range = LiveRangeFor(operand_index);
1310 range->EnsureInterval(start, end, zone_);
1329 LiveRange* range = LiveRangeFor(operand_index);
1330 PrintF("First use is at %d\n", range->first_pos()->pos().Value());
1363 LiveRange* range = live_ranges()->at(range_idx);
1364 if (range == NULL) continue;
1366 if (range->parent() != NULL) continue;
1368 if (!HasTaggedValue(range->id())) continue;
1370 if (range->IsEmpty()) continue;
1372 // Find the extent of the range and its children.
1373 int start = range->Start().InstructionIndex();
1375 for (LiveRange* cur = range; cur != NULL; cur = cur->next()) {
1389 // Step across all the safe points that are before the start of this range,
1390 // recording how far we step in order to save doing this for the next range.
1398 // Step through the safe points to see whether they are in the range.
1408 // Advance to the next active range that covers the current
1412 LiveRange* cur = range;
1418 // Check if the live range
1420 if (range->HasAllocatedSpillOperand() &&
1421 safe_point >= range->spill_start_index()) {
1422 TraceAlloc("Pointer for range %d (spilled at %d) at safe point %d\n",
1423 range->id(), range->spill_start_index(), safe_point);
1424 map->RecordPointer(range->GetSpillOperand());
1428 TraceAlloc("Pointer in register for range %d (start at %d) "
1453 LiveRange* range = live_ranges()->at(i);
1454 if (range != NULL) {
1455 if (range->Covers(position) &&
1456 range->HasRegisterAssigned() &&
1457 range->TopLevel()->HasAllocatedSpillOperand()) {
1458 int reg_index = range->assigned_register();
1459 LOperand* spill_operand = range->TopLevel()->GetSpillOperand();
1460 if (range->IsDouble()) {
1529 TraceAlloc("Live range %d already has a spill operand\n", current->id());
1535 // If the range already has a spill operand and it doesn't need a
1536 // register immediately, split it and spill the first part of the range.
1542 // Do not spill live range eagerly if use position that can benefit from
1543 // the register is too close to the start of live range.
1555 --i; // The live range was removed from the list of active live ranges.
1558 --i; // The live range was removed from the list of active live ranges.
1566 --i; // Live range was removed from the list of inactive live ranges.
1569 --i; // Live range was removed from the list of inactive live ranges.
1633 void LAllocator::AddToActive(LiveRange* range) {
1634 TraceAlloc("Add live range %d to active\n", range->id());
1635 active_live_ranges_.Add(range);
1639 void LAllocator::AddToInactive(LiveRange* range) {
1640 TraceAlloc("Add live range %d to inactive\n", range->id());
1641 inactive_live_ranges_.Add(range);
1645 void LAllocator::AddToUnhandledSorted(LiveRange* range) {
1646 if (range == NULL || range->IsEmpty()) return;
1647 ASSERT(!range->HasRegisterAssigned() && !range->IsSpilled());
1650 if (range->ShouldBeAllocatedBefore(cur_range)) {
1651 TraceAlloc("Add live range %d to unhandled at %d\n", range->id(), i + 1);
1652 unhandled_live_ranges_.InsertAt(i + 1, range);
1657 TraceAlloc("Add live range %d to unhandled at start\n", range->id());
1658 unhandled_live_ranges_.InsertAt(0, range);
1663 void LAllocator::AddToUnhandledUnsorted(LiveRange* range) {
1664 if (range == NULL || range->IsEmpty()) return;
1665 ASSERT(!range->HasRegisterAssigned() && !range->IsSpilled());
1666 TraceAlloc("Add live range %d to unhandled unsorted at end\n", range->id());
1667 unhandled_live_ranges_.Add(range);
1700 void LAllocator::FreeSpillSlot(LiveRange* range) {
1701 // Check that we are the last range.
1702 if (range->next() != NULL) return;
1704 if (!range->TopLevel()->HasAllocatedSpillOperand()) return;
1706 int index = range->TopLevel()->GetSpillOperand()->index();
1708 reusable_slots_.Add(range);
1713 LOperand* LAllocator::TryReuseSpillSlot(LiveRange* range) {
1716 range->TopLevel()->Start().Value()) {
1725 void LAllocator::ActiveToHandled(LiveRange* range) {
1726 ASSERT(active_live_ranges_.Contains(range));
1727 active_live_ranges_.RemoveElement(range);
1728 TraceAlloc("Moving live range %d from active to handled\n", range->id());
1729 FreeSpillSlot(range);
1733 void LAllocator::ActiveToInactive(LiveRange* range) {
1734 ASSERT(active_live_ranges_.Contains(range));
1735 active_live_ranges_.RemoveElement(range);
1736 inactive_live_ranges_.Add(range);
1737 TraceAlloc("Moving live range %d from active to inactive\n", range->id());
1741 void LAllocator::InactiveToHandled(LiveRange* range) {
1742 ASSERT(inactive_live_ranges_.Contains(range));
1743 inactive_live_ranges_.RemoveElement(range);
1744 TraceAlloc("Moving live range %d from inactive to handled\n", range->id());
1745 FreeSpillSlot(range);
1749 void LAllocator::InactiveToActive(LiveRange* range) {
1750 ASSERT(inactive_live_ranges_.Contains(range));
1751 inactive_live_ranges_.RemoveElement(range);
1752 active_live_ranges_.Add(range);
1753 TraceAlloc("Moving live range %d from inactive to active\n", range->id());
1792 "Found reg hint %s (free until [%d) for live range %d (end %d[).\n",
1798 // The desired register is free until the end of the current live range.
1800 TraceAlloc("Assigning preferred reg %s to live range %d\n",
1825 // Register reg is available at the range start but becomes blocked before
1826 // the range end. Split current at position where it becomes blocked.
1833 // Register reg is available at the range start and is free until
1834 // the range end.
1836 TraceAlloc("Assigning free reg %s to live range %d\n",
1848 // There is no use in the current live range that requires a register.
1863 LiveRange* range = active_live_ranges_[i];
1864 int cur_reg = range->assigned_register();
1865 if (range->IsFixed() || !range->CanBeSpilled(current->Start())) {
1869 UsePosition* next_use = range->NextUsePositionRegisterIsBeneficial(
1872 use_pos[cur_reg] = range->End();
1880 LiveRange* range = inactive_live_ranges_.at(i);
1881 ASSERT(range->End().Value() > current->Start().Value());
1882 LifetimePosition next_intersection = range->FirstIntersection(current);
1884 int cur_reg = range->assigned_register();
1885 if (range->IsFixed()) {
1904 // Spill starting part of live range up to that use.
1906 // Corner case: the first use position is equal to the start of the range.
1908 // this range to the list of unhandled ones. This will lead to the infinite
1916 // Register becomes blocked before the current range end. Split before that
1924 // Register reg is not blocked for the whole range.
1926 TraceAlloc("Assigning blocked reg %s to live range %d\n",
1943 LiveRange* range = active_live_ranges_[i];
1944 if (range->assigned_register() == reg) {
1945 UsePosition* next_pos = range->NextRegisterPosition(current->Start());
1947 SpillAfter(range, split_pos);
1949 SpillBetween(range, split_pos, next_pos->pos());
1951 ActiveToHandled(range);
1957 LiveRange* range = inactive_live_ranges_[i];
1958 ASSERT(range->End().Value() > current->Start().Value());
1959 if (range->assigned_register() == reg && !range->IsFixed()) {
1960 LifetimePosition next_intersection = range->FirstIntersection(current);
1962 UsePosition* next_pos = range->NextRegisterPosition(current->Start());
1964 SpillAfter(range, split_pos);
1967 SpillBetween(range, split_pos, next_intersection);
1969 InactiveToHandled(range);
1983 LiveRange* LAllocator::SplitRangeAt(LiveRange* range, LifetimePosition pos) {
1984 ASSERT(!range->IsFixed());
1985 TraceAlloc("Splitting live range %d at %d\n", range->id(), pos.Value());
1987 if (pos.Value() <= range->Start().Value()) return range;
1996 range->SplitAt(pos, result, zone_);
2001 LiveRange* LAllocator::SplitBetween(LiveRange* range,
2004 ASSERT(!range->IsFixed());
2005 TraceAlloc("Splitting live range %d in position between [%d, %d]\n",
2006 range->id(),
2012 return SplitRangeAt(range, split_pos);
2050 void LAllocator::SpillAfter(LiveRange* range, LifetimePosition pos) {
2051 LiveRange* second_part = SplitRangeAt(range, pos);
2057 void LAllocator::SpillBetween(LiveRange* range,
2061 LiveRange* second_part = SplitRangeAt(range, start);
2085 void LAllocator::Spill(LiveRange* range) {
2086 ASSERT(!range->IsSpilled());
2087 TraceAlloc("Spilling live range %d\n", range->id());
2088 LiveRange* first = range->TopLevel();
2091 LOperand* op = TryReuseSpillSlot(range);
2095 range->MakeSpilled(zone_);