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

Side by Side Diff: src/compiler/greedy-allocator.h

Issue 1184183002: Separate greedy regalloc in its own files (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
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_GREEDY_ALLOCATOR_H_
6 #define V8_GREEDY_ALLOCATOR_H_
7
8 #include "src/compiler/register-allocator.h"
9 #include "src/zone-containers.h"
10
11 namespace v8 {
12 namespace internal {
13 namespace compiler {
14
15 class CoalescedLiveRanges;
16
17
18 // A variant of the LLVM Greedy Register Allocator. See
19 // http://blog.llvm.org/2011/09/greedy-register-allocation-in-llvm-30.html
20 class GreedyAllocator final : public RegisterAllocator {
21 public:
22 explicit GreedyAllocator(RegisterAllocationData* data, RegisterKind kind,
23 Zone* local_zone);
24
25 void AllocateRegisters();
26
27 private:
28 LifetimePosition GetSplittablePos(LifetimePosition pos);
29 const RegisterConfiguration* config() const { return data()->config(); }
30 Zone* local_zone() const { return local_zone_; }
31
32 int GetHintedRegister(LiveRange* range);
33
34 typedef ZonePriorityQueue<std::pair<unsigned, LiveRange*>> PQueue;
35
36 unsigned GetLiveRangeSize(LiveRange* range);
37 void Enqueue(LiveRange* range);
38
39 void Evict(LiveRange* range);
40 float CalculateSpillWeight(LiveRange* range);
41 float CalculateMaxSpillWeight(const ZoneSet<LiveRange*>& ranges);
42
43
44 bool TryAllocate(LiveRange* current, ZoneSet<LiveRange*>* conflicting);
45 bool TryAllocatePhysicalRegister(unsigned reg_id, LiveRange* range,
46 ZoneSet<LiveRange*>* conflicting);
47 bool HandleSpillOperands(LiveRange* range);
48 void AllocateBlockedRange(LiveRange* current, LifetimePosition pos,
49 bool spill);
50
51 LiveRange* SpillBetweenUntil(LiveRange* range, LifetimePosition start,
52 LifetimePosition until, LifetimePosition end);
53 void AssignRangeToRegister(int reg_id, LiveRange* range);
54
55 LifetimePosition FindProgressingSplitPosition(LiveRange* range,
56 bool* is_spill_pos);
57
58 Zone* local_zone_;
59 ZoneVector<CoalescedLiveRanges*> allocations_;
60 PQueue queue_;
61 DISALLOW_COPY_AND_ASSIGN(GreedyAllocator);
62 };
63 }
Jarin 2015/06/16 06:39:40 Missing comments for namespace endings.
Mircea Trofin 2015/06/16 16:16:25 Done.
64 }
65 }
66 #endif // V8_GREEDY_ALLOCATOR_H_
OLDNEW
« BUILD.gn ('K') | « BUILD.gn ('k') | src/compiler/greedy-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698