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

Unified Diff: src/compiler/register-allocator.h

Issue 1100713003: [turbofan] split all functions off of LinearScanAllocator which are unrelated to LinearScan (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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 | « no previous file | src/compiler/register-allocator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/register-allocator.h
diff --git a/src/compiler/register-allocator.h b/src/compiler/register-allocator.h
index d62ffb32fca1e0ef101a0838d3e06f692e807f12..47ff02a7ae61924fa4bba696fac997f573917ea0 100644
--- a/src/compiler/register-allocator.h
+++ b/src/compiler/register-allocator.h
@@ -583,7 +583,50 @@ class LiveRangeBuilder final : public ZoneObject {
};
-class LinearScanAllocator final : public ZoneObject {
+class RegisterAllocator : public ZoneObject {
+ public:
+ explicit RegisterAllocator(RegisterAllocationData* data);
+
+ protected:
+ RegisterAllocationData* data() const { return data_; }
+ InstructionSequence* code() const { return data()->code(); }
+ Zone* allocation_zone() const { return data()->allocation_zone(); }
+
+ LiveRange* LiveRangeFor(int index) { return data()->LiveRangeFor(index); }
+
+ // Split the given range at the given position.
+ // If range starts at or after the given position then the
+ // original range is returned.
+ // Otherwise returns the live range that starts at pos and contains
+ // all uses from the original range that follow pos. Uses at pos will
+ // still be owned by the original range after splitting.
+ LiveRange* SplitRangeAt(LiveRange* range, LifetimePosition pos);
+
+ // Split the given range in a position from the interval [start, end].
+ LiveRange* SplitBetween(LiveRange* range, LifetimePosition start,
+ LifetimePosition end);
+
+ // Find a lifetime position in the interval [start, end] which
+ // is optimal for splitting: it is either header of the outermost
+ // loop covered by this interval or the latest possible position.
+ LifetimePosition FindOptimalSplitPos(LifetimePosition start,
+ LifetimePosition end);
+
+ void Spill(LiveRange* range);
+
+ // If we are trying to spill a range inside the loop try to
+ // hoist spill position out to the point just before the loop.
+ LifetimePosition FindOptimalSpillingPos(LiveRange* range,
+ LifetimePosition pos);
+
+ private:
+ RegisterAllocationData* const data_;
+
+ DISALLOW_COPY_AND_ASSIGN(RegisterAllocator);
+};
+
+
+class LinearScanAllocator final : public RegisterAllocator {
public:
LinearScanAllocator(RegisterAllocationData* data, RegisterKind kind,
Zone* local_zone);
@@ -592,9 +635,6 @@ class LinearScanAllocator final : public ZoneObject {
void AllocateRegisters();
private:
- RegisterAllocationData* data() const { return data_; }
- InstructionSequence* code() const { return data()->code(); }
- Zone* allocation_zone() const { return data()->allocation_zone(); }
int num_registers() const { return num_registers_; }
const char* RegisterName(int allocation_index) const;
@@ -606,8 +646,6 @@ class LinearScanAllocator final : public ZoneObject {
return inactive_live_ranges_;
}
- LiveRange* LiveRangeFor(int index) { return data()->LiveRangeFor(index); }
-
// Helper methods for updating the life range lists.
void AddToActive(LiveRange* range);
void AddToInactive(LiveRange* range);
@@ -625,28 +663,6 @@ class LinearScanAllocator final : public ZoneObject {
bool TryAllocateFreeReg(LiveRange* range);
void AllocateBlockedReg(LiveRange* range);
- // Live range splitting helpers.
-
- // Split the given range at the given position.
- // If range starts at or after the given position then the
- // original range is returned.
- // Otherwise returns the live range that starts at pos and contains
- // all uses from the original range that follow pos. Uses at pos will
- // still be owned by the original range after splitting.
- LiveRange* SplitRangeAt(LiveRange* range, LifetimePosition pos);
-
- // Split the given range in a position from the interval [start, end].
- LiveRange* SplitBetween(LiveRange* range, LifetimePosition start,
- LifetimePosition end);
-
- // Find a lifetime position in the interval [start, end] which
- // is optimal for splitting: it is either header of the outermost
- // loop covered by this interval or the latest possible position.
- LifetimePosition FindOptimalSplitPos(LifetimePosition start,
- LifetimePosition end);
-
- void Spill(LiveRange* range);
-
// Spill the given life range after position pos.
void SpillAfter(LiveRange* range, LifetimePosition pos);
@@ -661,12 +677,6 @@ class LinearScanAllocator final : public ZoneObject {
void SplitAndSpillIntersecting(LiveRange* range);
- // If we are trying to spill a range inside the loop try to
- // hoist spill position out to the point just before the loop.
- LifetimePosition FindOptimalSpillingPos(LiveRange* range,
- LifetimePosition pos);
-
- RegisterAllocationData* const data_;
const RegisterKind mode_;
const int num_registers_;
« no previous file with comments | « no previous file | src/compiler/register-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698