1// Copyright 2015 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_COMPILER_BACKEND_LIVE_RANGE_SEPARATOR_H_
6#define V8_COMPILER_BACKEND_LIVE_RANGE_SEPARATOR_H_
7
8#include "src/zone/zone.h"
9namespace v8 {
10namespace internal {
11
12class Zone;
13
14namespace compiler {
15
16class RegisterAllocationData;
17
18// A register allocation pair of transformations: splinter and merge live ranges
19class LiveRangeSeparator final : public ZoneObject {
20 public:
21 LiveRangeSeparator(RegisterAllocationData* data, Zone* zone)
22 : data_(data), zone_(zone) {}
23
24 void Splinter();
25
26 private:
27 RegisterAllocationData* data() const { return data_; }
28 Zone* zone() const { return zone_; }
29
30 RegisterAllocationData* const data_;
31 Zone* const zone_;
32
33 DISALLOW_COPY_AND_ASSIGN(LiveRangeSeparator);
34};
35
36class LiveRangeMerger final : public ZoneObject {
37 public:
38 LiveRangeMerger(RegisterAllocationData* data, Zone* zone)
39 : data_(data), zone_(zone) {}
40
41 void Merge();
42
43 private:
44 RegisterAllocationData* data() const { return data_; }
45 Zone* zone() const { return zone_; }
46
47 // Mark ranges spilled in deferred blocks, that also cover non-deferred code.
48 // We do nothing special for ranges fully contained in deferred blocks,
49 // because they would "spill in deferred blocks" anyway.
50 void MarkRangesSpilledInDeferredBlocks();
51
52 RegisterAllocationData* const data_;
53 Zone* const zone_;
54
55 DISALLOW_COPY_AND_ASSIGN(LiveRangeMerger);
56};
57
58} // namespace compiler
59} // namespace internal
60} // namespace v8
61#endif // V8_COMPILER_BACKEND_LIVE_RANGE_SEPARATOR_H_
62