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

Side by Side Diff: runtime/vm/flow_graph_allocator.h

Issue 13801014: Fix bug in ParallelMoveResolver::EmitSwap: implement swaps of FPU spill slots. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add comments Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_FLOW_GRAPH_ALLOCATOR_H_ 5 #ifndef VM_FLOW_GRAPH_ALLOCATOR_H_
6 #define VM_FLOW_GRAPH_ALLOCATOR_H_ 6 #define VM_FLOW_GRAPH_ALLOCATOR_H_
7 7
8 #include "vm/growable_array.h" 8 #include "vm/growable_array.h"
9 #include "vm/intermediate_language.h" 9 #include "vm/intermediate_language.h"
10 10
(...skipping 20 matching lines...) Expand all
31 void Compute(); 31 void Compute();
32 32
33 const FlowGraph& flow_graph_; 33 const FlowGraph& flow_graph_;
34 GrowableArray<PhiInstr*> phis_; 34 GrowableArray<PhiInstr*> phis_;
35 }; 35 };
36 36
37 37
38 class FlowGraphAllocator : public ValueObject { 38 class FlowGraphAllocator : public ValueObject {
39 public: 39 public:
40 // Number of stack slots needed for a fpu register spill slot. 40 // Number of stack slots needed for a fpu register spill slot.
41 static const intptr_t kFpuRegisterSpillFactor = kFpuRegisterSize / kWordSize; 41 static const intptr_t kDoubleSpillFactor = kDoubleSize / kWordSize;
42 42
43 explicit FlowGraphAllocator(const FlowGraph& flow_graph); 43 explicit FlowGraphAllocator(const FlowGraph& flow_graph);
44 44
45 void AllocateRegisters(); 45 void AllocateRegisters();
46 46
47 // Build live-in and live-out sets for each block. 47 // Build live-in and live-out sets for each block.
48 void AnalyzeLiveness(); 48 void AnalyzeLiveness();
49 49
50 // Map a virtual register number to its live range. 50 // Map a virtual register number to its live range.
51 LiveRange* GetLiveRange(intptr_t vreg); 51 LiveRange* GetLiveRange(intptr_t vreg);
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 // Spill the given live range from the given position until some 220 // Spill the given live range from the given position until some
221 // position preceding the to position. 221 // position preceding the to position.
222 void SpillBetween(LiveRange* range, intptr_t from, intptr_t to); 222 void SpillBetween(LiveRange* range, intptr_t from, intptr_t to);
223 223
224 // Mark the live range as a live object pointer at all safepoints 224 // Mark the live range as a live object pointer at all safepoints
225 // contained in the range. 225 // contained in the range.
226 void MarkAsObjectAtSafepoints(LiveRange* range); 226 void MarkAsObjectAtSafepoints(LiveRange* range);
227 227
228 MoveOperands* AddMoveAt(intptr_t pos, Location to, Location from); 228 MoveOperands* AddMoveAt(intptr_t pos, Location to, Location from);
229 229
230 Location MakeRegisterLocation(intptr_t reg, Representation rep) { 230 Location MakeRegisterLocation(intptr_t reg) {
231 return Location::MachineRegisterLocation(register_kind_, reg, rep); 231 return Location::MachineRegisterLocation(register_kind_, reg);
232 } 232 }
233 233
234 void PrintLiveRanges(); 234 void PrintLiveRanges();
235 235
236 const FlowGraph& flow_graph_; 236 const FlowGraph& flow_graph_;
237 237
238 ReachingDefs reaching_defs_; 238 ReachingDefs reaching_defs_;
239 239
240 // Representation for SSA values indexed by SSA temp index. 240 // Representation for SSA values indexed by SSA temp index.
241 GrowableArray<Representation> value_representations_; 241 GrowableArray<Representation> value_representations_;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 bool blocked_registers_[kNumberOfCpuRegisters]; 302 bool blocked_registers_[kNumberOfCpuRegisters];
303 303
304 304
305 // Worklist for register allocator. Always maintained sorted according 305 // Worklist for register allocator. Always maintained sorted according
306 // to ShouldBeAllocatedBefore predicate. 306 // to ShouldBeAllocatedBefore predicate.
307 GrowableArray<LiveRange*> unallocated_; 307 GrowableArray<LiveRange*> unallocated_;
308 308
309 // List of used spill slots. Contains positions after which spill slots 309 // List of used spill slots. Contains positions after which spill slots
310 // become free and can be reused for allocation. 310 // become free and can be reused for allocation.
311 GrowableArray<intptr_t> spill_slots_; 311 GrowableArray<intptr_t> spill_slots_;
312
313 // For every used spill slot contains a flag determines whether it is
314 // QuadSpillSlot to ensure that indexes of quad and double spill slots
315 // are disjoint.
316 GrowableArray<bool> quad_spill_slots_;
317
312 intptr_t cpu_spill_slot_count_; 318 intptr_t cpu_spill_slot_count_;
313 319
314
315 DISALLOW_COPY_AND_ASSIGN(FlowGraphAllocator); 320 DISALLOW_COPY_AND_ASSIGN(FlowGraphAllocator);
316 }; 321 };
317 322
318 323
319 // Additional information about a block that is not contained in a 324 // Additional information about a block that is not contained in a
320 // block entry. 325 // block entry.
321 class BlockInfo : public ZoneAllocated { 326 class BlockInfo : public ZoneAllocated {
322 public: 327 public:
323 explicit BlockInfo(BlockEntryInstr* entry) 328 explicit BlockInfo(BlockEntryInstr* entry)
324 : entry_(entry), 329 : entry_(entry),
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 661
657 AllocationFinger finger_; 662 AllocationFinger finger_;
658 663
659 DISALLOW_COPY_AND_ASSIGN(LiveRange); 664 DISALLOW_COPY_AND_ASSIGN(LiveRange);
660 }; 665 };
661 666
662 667
663 } // namespace dart 668 } // namespace dart
664 669
665 #endif // VM_FLOW_GRAPH_ALLOCATOR_H_ 670 #endif // VM_FLOW_GRAPH_ALLOCATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698