OLD | NEW |
---|---|
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 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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, Location::Representation rep) { | 230 Location MakeRegisterLocation(intptr_t reg, Representation rep) { |
231 return Location::MachineRegisterLocation(register_kind_, reg, rep); | 231 return Location::MachineRegisterLocation(register_kind_, reg, rep); |
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 // Set of SSA values that have unboxed mint representation. Indexed | 240 // Set of SSA values that have unboxed mint representation. Indexed |
241 // by SSA temp index. | 241 // by SSA temp index. |
242 BitVector* mint_values_; | 242 GrowableArray<Representation> value_representations_; |
Vyacheslav Egorov (Google)
2013/03/18 18:42:29
Comment above requires update.
Florian Schneider
2013/03/19 11:48:57
Done.
| |
243 | 243 |
244 const GrowableArray<BlockEntryInstr*>& block_order_; | 244 const GrowableArray<BlockEntryInstr*>& block_order_; |
245 const GrowableArray<BlockEntryInstr*>& postorder_; | 245 const GrowableArray<BlockEntryInstr*>& postorder_; |
246 | 246 |
247 // Mapping between lifetime positions and instructions. | 247 // Mapping between lifetime positions and instructions. |
248 GrowableArray<Instruction*> instructions_; | 248 GrowableArray<Instruction*> instructions_; |
249 | 249 |
250 // Mapping between lifetime positions and blocks containing them. | 250 // Mapping between lifetime positions and blocks containing them. |
251 GrowableArray<BlockInfo*> block_info_; | 251 GrowableArray<BlockInfo*> block_info_; |
252 | 252 |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
520 const intptr_t pos_; | 520 const intptr_t pos_; |
521 LocationSummary* const locs_; | 521 LocationSummary* const locs_; |
522 | 522 |
523 SafepointPosition* next_; | 523 SafepointPosition* next_; |
524 }; | 524 }; |
525 | 525 |
526 | 526 |
527 // LiveRange represents a sequence of UseIntervals for a given SSA value. | 527 // LiveRange represents a sequence of UseIntervals for a given SSA value. |
528 class LiveRange : public ZoneAllocated { | 528 class LiveRange : public ZoneAllocated { |
529 public: | 529 public: |
530 explicit LiveRange(intptr_t vreg, Location::Representation rep) | 530 explicit LiveRange(intptr_t vreg, Representation rep) |
531 : vreg_(vreg), | 531 : vreg_(vreg), |
532 representation_(rep), | 532 representation_(rep), |
533 assigned_location_(), | 533 assigned_location_(), |
534 spill_slot_(), | 534 spill_slot_(), |
535 uses_(NULL), | 535 uses_(NULL), |
536 first_use_interval_(NULL), | 536 first_use_interval_(NULL), |
537 last_use_interval_(NULL), | 537 last_use_interval_(NULL), |
538 first_safepoint_(NULL), | 538 first_safepoint_(NULL), |
539 last_safepoint_(NULL), | 539 last_safepoint_(NULL), |
540 next_sibling_(NULL), | 540 next_sibling_(NULL), |
541 has_only_any_uses_in_loops_(0), | 541 has_only_any_uses_in_loops_(0), |
542 is_loop_phi_(false), | 542 is_loop_phi_(false), |
543 finger_() { | 543 finger_() { |
544 } | 544 } |
545 | 545 |
546 static LiveRange* MakeTemp(intptr_t pos, Location* location_slot); | 546 static LiveRange* MakeTemp(intptr_t pos, Location* location_slot); |
547 | 547 |
548 intptr_t vreg() const { return vreg_; } | 548 intptr_t vreg() const { return vreg_; } |
549 Location::Representation representation() const { return representation_; } | 549 Representation representation() const { return representation_; } |
550 LiveRange* next_sibling() const { return next_sibling_; } | 550 LiveRange* next_sibling() const { return next_sibling_; } |
551 UsePosition* first_use() const { return uses_; } | 551 UsePosition* first_use() const { return uses_; } |
552 void set_first_use(UsePosition* use) { uses_ = use; } | 552 void set_first_use(UsePosition* use) { uses_ = use; } |
553 UseInterval* first_use_interval() const { return first_use_interval_; } | 553 UseInterval* first_use_interval() const { return first_use_interval_; } |
554 UseInterval* last_use_interval() const { return last_use_interval_; } | 554 UseInterval* last_use_interval() const { return last_use_interval_; } |
555 Location assigned_location() const { return assigned_location_; } | 555 Location assigned_location() const { return assigned_location_; } |
556 intptr_t Start() const { return first_use_interval()->start(); } | 556 intptr_t Start() const { return first_use_interval()->start(); } |
557 intptr_t End() const { return last_use_interval()->end(); } | 557 intptr_t End() const { return last_use_interval()->end(); } |
558 | 558 |
559 SafepointPosition* first_safepoint() const { return first_safepoint_; } | 559 SafepointPosition* first_safepoint() const { return first_safepoint_; } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
611 } | 611 } |
612 } | 612 } |
613 | 613 |
614 bool is_loop_phi() const { return is_loop_phi_; } | 614 bool is_loop_phi() const { return is_loop_phi_; } |
615 void mark_loop_phi() { | 615 void mark_loop_phi() { |
616 is_loop_phi_ = true; | 616 is_loop_phi_ = true; |
617 } | 617 } |
618 | 618 |
619 private: | 619 private: |
620 LiveRange(intptr_t vreg, | 620 LiveRange(intptr_t vreg, |
621 Location::Representation rep, | 621 Representation rep, |
622 UsePosition* uses, | 622 UsePosition* uses, |
623 UseInterval* first_use_interval, | 623 UseInterval* first_use_interval, |
624 UseInterval* last_use_interval, | 624 UseInterval* last_use_interval, |
625 SafepointPosition* first_safepoint, | 625 SafepointPosition* first_safepoint, |
626 LiveRange* next_sibling) | 626 LiveRange* next_sibling) |
627 : vreg_(vreg), | 627 : vreg_(vreg), |
628 representation_(rep), | 628 representation_(rep), |
629 assigned_location_(), | 629 assigned_location_(), |
630 uses_(uses), | 630 uses_(uses), |
631 first_use_interval_(first_use_interval), | 631 first_use_interval_(first_use_interval), |
632 last_use_interval_(last_use_interval), | 632 last_use_interval_(last_use_interval), |
633 first_safepoint_(first_safepoint), | 633 first_safepoint_(first_safepoint), |
634 last_safepoint_(NULL), | 634 last_safepoint_(NULL), |
635 next_sibling_(next_sibling), | 635 next_sibling_(next_sibling), |
636 has_only_any_uses_in_loops_(0), | 636 has_only_any_uses_in_loops_(0), |
637 is_loop_phi_(false), | 637 is_loop_phi_(false), |
638 finger_() { | 638 finger_() { |
639 } | 639 } |
640 | 640 |
641 const intptr_t vreg_; | 641 const intptr_t vreg_; |
642 Location::Representation representation_; | 642 Representation representation_; |
643 Location assigned_location_; | 643 Location assigned_location_; |
644 Location spill_slot_; | 644 Location spill_slot_; |
645 | 645 |
646 UsePosition* uses_; | 646 UsePosition* uses_; |
647 UseInterval* first_use_interval_; | 647 UseInterval* first_use_interval_; |
648 UseInterval* last_use_interval_; | 648 UseInterval* last_use_interval_; |
649 | 649 |
650 SafepointPosition* first_safepoint_; | 650 SafepointPosition* first_safepoint_; |
651 SafepointPosition* last_safepoint_; | 651 SafepointPosition* last_safepoint_; |
652 | 652 |
653 LiveRange* next_sibling_; | 653 LiveRange* next_sibling_; |
654 | 654 |
655 intptr_t has_only_any_uses_in_loops_; | 655 intptr_t has_only_any_uses_in_loops_; |
656 bool is_loop_phi_; | 656 bool is_loop_phi_; |
657 | 657 |
658 AllocationFinger finger_; | 658 AllocationFinger finger_; |
659 | 659 |
660 DISALLOW_COPY_AND_ASSIGN(LiveRange); | 660 DISALLOW_COPY_AND_ASSIGN(LiveRange); |
661 }; | 661 }; |
662 | 662 |
663 | 663 |
664 } // namespace dart | 664 } // namespace dart |
665 | 665 |
666 #endif // VM_FLOW_GRAPH_ALLOCATOR_H_ | 666 #endif // VM_FLOW_GRAPH_ALLOCATOR_H_ |
OLD | NEW |