Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Unified Diff: src/compiler/greedy-allocator.cc

Issue 1353023003: [turbofan] Merge group spill ranges. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/greedy-allocator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/greedy-allocator.cc
diff --git a/src/compiler/greedy-allocator.cc b/src/compiler/greedy-allocator.cc
index 0a8a1f7986c4129eea0f3f9ca236aac865d68a8c..7852830c03d439f86bc6dc818a63f32d81289d0b 100644
--- a/src/compiler/greedy-allocator.cc
+++ b/src/compiler/greedy-allocator.cc
@@ -479,11 +479,37 @@ void GreedyAllocator::AllocateRegisters() {
}
allocations_.clear();
+ TryReuseSpillRangesForGroups();
+
TRACE("End allocating function %s with the Greedy Allocator\n",
data()->debug_name());
}
+void GreedyAllocator::TryReuseSpillRangesForGroups() {
+ for (TopLevelLiveRange* top : data()->live_ranges()) {
+ if (!CanProcessRange(top) || !top->is_phi() || top->group() == nullptr) {
+ continue;
+ }
+
+ SpillRange* spill_range = nullptr;
+ for (LiveRange* member : top->group()->ranges()) {
+ if (!member->TopLevel()->HasSpillRange()) continue;
+ SpillRange* member_range = member->TopLevel()->GetSpillRange();
+ if (spill_range == nullptr) {
+ spill_range = member_range;
+ } else {
+ // This may not always succeed, because we group non-conflicting ranges
+ // that may have been splintered, and the splinters may cause conflicts
+ // in the spill ranges.
+ // TODO(mtrofin): should the splinters own their own spill ranges?
+ spill_range->TryMerge(member_range);
+ }
+ }
+ }
+}
+
+
float GreedyAllocator::GetMaximumConflictingWeight(
unsigned reg_id, const LiveRange* range, float competing_weight) const {
float ret = LiveRange::kInvalidWeight;
« no previous file with comments | « src/compiler/greedy-allocator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698