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

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

Issue 10968059: Support for unboxed 64-bit integer bitwise operations and equality on ia32. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: fixed boxing of smis and added one more test Created 8 years, 3 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 15 matching lines...) Expand all
26 26
27 void AllocateRegisters(); 27 void AllocateRegisters();
28 28
29 // Build live-in and live-out sets for each block. 29 // Build live-in and live-out sets for each block.
30 void AnalyzeLiveness(); 30 void AnalyzeLiveness();
31 31
32 // Map a virtual register number to its live range. 32 // Map a virtual register number to its live range.
33 LiveRange* GetLiveRange(intptr_t vreg); 33 LiveRange* GetLiveRange(intptr_t vreg);
34 34
35 private: 35 private:
36 void CollectRepresentations();
37
36 // Eliminate unnecessary environments from the IL. 38 // Eliminate unnecessary environments from the IL.
37 void EliminateEnvironmentUses(); 39 void EliminateEnvironmentUses();
38 40
39 // Compute initial values for live-out, kill and live-in sets. 41 // Compute initial values for live-out, kill and live-in sets.
40 void ComputeInitialSets(); 42 void ComputeInitialSets();
41 43
42 // Update live-out set for the given block: live-out should contain 44 // Update live-out set for the given block: live-out should contain
43 // all values that are live-in for block's successors. 45 // all values that are live-in for block's successors.
44 // Returns true if live-out set was changed. 46 // Returns true if live-out set was changed.
45 bool UpdateLiveOut(const BlockEntryInstr& instr); 47 bool UpdateLiveOut(const BlockEntryInstr& instr);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 // Spill the given live range from the given position until some 186 // Spill the given live range from the given position until some
185 // position preceding the to position. 187 // position preceding the to position.
186 void SpillBetween(LiveRange* range, intptr_t from, intptr_t to); 188 void SpillBetween(LiveRange* range, intptr_t from, intptr_t to);
187 189
188 // Mark the live range as a live object pointer at all safepoints 190 // Mark the live range as a live object pointer at all safepoints
189 // contained in the range. 191 // contained in the range.
190 void MarkAsObjectAtSafepoints(LiveRange* range); 192 void MarkAsObjectAtSafepoints(LiveRange* range);
191 193
192 MoveOperands* AddMoveAt(intptr_t pos, Location to, Location from); 194 MoveOperands* AddMoveAt(intptr_t pos, Location to, Location from);
193 195
194 Location MakeRegisterLocation(intptr_t reg) { 196 Location MakeRegisterLocation(intptr_t reg, Location::Representation rep) {
195 return Location::MachineRegisterLocation(register_kind_, reg); 197 return Location::MachineRegisterLocation(register_kind_, reg, rep);
196 } 198 }
197 199
198 void PrintLiveRanges(); 200 void PrintLiveRanges();
199 201
200 const FlowGraph& flow_graph_; 202 const FlowGraph& flow_graph_;
203 BitVector* reps_;
201 const GrowableArray<BlockEntryInstr*>& block_order_; 204 const GrowableArray<BlockEntryInstr*>& block_order_;
202 const GrowableArray<BlockEntryInstr*>& postorder_; 205 const GrowableArray<BlockEntryInstr*>& postorder_;
203 206
204 // Mapping between lifetime positions and instructions. 207 // Mapping between lifetime positions and instructions.
205 GrowableArray<Instruction*> instructions_; 208 GrowableArray<Instruction*> instructions_;
206 209
207 // Mapping between lifetime positions and blocks containing them. 210 // Mapping between lifetime positions and blocks containing them.
208 GrowableArray<BlockInfo*> block_info_; 211 GrowableArray<BlockInfo*> block_info_;
209 212
210 // Live-out sets for each block. They contain indices of SSA values 213 // Live-out sets for each block. They contain indices of SSA values
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 const intptr_t pos_; 445 const intptr_t pos_;
443 LocationSummary* const locs_; 446 LocationSummary* const locs_;
444 447
445 SafepointPosition* next_; 448 SafepointPosition* next_;
446 }; 449 };
447 450
448 451
449 // LiveRange represents a sequence of UseIntervals for a given SSA value. 452 // LiveRange represents a sequence of UseIntervals for a given SSA value.
450 class LiveRange : public ZoneAllocated { 453 class LiveRange : public ZoneAllocated {
451 public: 454 public:
452 explicit LiveRange(intptr_t vreg) 455 explicit LiveRange(intptr_t vreg, Location::Representation rep)
453 : vreg_(vreg), 456 : vreg_(vreg),
457 representation_(rep),
454 assigned_location_(), 458 assigned_location_(),
455 spill_slot_(), 459 spill_slot_(),
456 uses_(NULL), 460 uses_(NULL),
457 first_use_interval_(NULL), 461 first_use_interval_(NULL),
458 last_use_interval_(NULL), 462 last_use_interval_(NULL),
459 first_safepoint_(NULL), 463 first_safepoint_(NULL),
460 last_safepoint_(NULL), 464 last_safepoint_(NULL),
461 next_sibling_(NULL), 465 next_sibling_(NULL),
462 finger_() { 466 finger_() {
463 } 467 }
464 468
465 static LiveRange* MakeTemp(intptr_t pos, Location* location_slot); 469 static LiveRange* MakeTemp(intptr_t pos, Location* location_slot);
466 470
467 intptr_t vreg() const { return vreg_; } 471 intptr_t vreg() const { return vreg_; }
472 Location::Representation representation() const { return representation_; }
468 LiveRange* next_sibling() const { return next_sibling_; } 473 LiveRange* next_sibling() const { return next_sibling_; }
469 UsePosition* first_use() const { return uses_; } 474 UsePosition* first_use() const { return uses_; }
470 void set_first_use(UsePosition* use) { uses_ = use; } 475 void set_first_use(UsePosition* use) { uses_ = use; }
471 UseInterval* first_use_interval() const { return first_use_interval_; } 476 UseInterval* first_use_interval() const { return first_use_interval_; }
472 UseInterval* last_use_interval() const { return last_use_interval_; } 477 UseInterval* last_use_interval() const { return last_use_interval_; }
473 Location assigned_location() const { return assigned_location_; } 478 Location assigned_location() const { return assigned_location_; }
474 intptr_t Start() const { return first_use_interval()->start(); } 479 intptr_t Start() const { return first_use_interval()->start(); }
475 intptr_t End() const { return last_use_interval()->end(); } 480 intptr_t End() const { return last_use_interval()->end(); }
476 481
477 SafepointPosition* first_safepoint() const { return first_safepoint_; } 482 SafepointPosition* first_safepoint() const { return first_safepoint_; }
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 515
511 // True if the range contains the given position. 516 // True if the range contains the given position.
512 bool Contains(intptr_t pos) const; 517 bool Contains(intptr_t pos) const;
513 518
514 Location spill_slot() const { 519 Location spill_slot() const {
515 return spill_slot_; 520 return spill_slot_;
516 } 521 }
517 522
518 private: 523 private:
519 LiveRange(intptr_t vreg, 524 LiveRange(intptr_t vreg,
525 Location::Representation rep,
520 UsePosition* uses, 526 UsePosition* uses,
521 UseInterval* first_use_interval, 527 UseInterval* first_use_interval,
522 UseInterval* last_use_interval, 528 UseInterval* last_use_interval,
523 SafepointPosition* first_safepoint, 529 SafepointPosition* first_safepoint,
524 LiveRange* next_sibling) 530 LiveRange* next_sibling)
525 : vreg_(vreg), 531 : vreg_(vreg),
532 representation_(rep),
526 assigned_location_(), 533 assigned_location_(),
527 uses_(uses), 534 uses_(uses),
528 first_use_interval_(first_use_interval), 535 first_use_interval_(first_use_interval),
529 last_use_interval_(last_use_interval), 536 last_use_interval_(last_use_interval),
530 first_safepoint_(first_safepoint), 537 first_safepoint_(first_safepoint),
531 last_safepoint_(NULL), 538 last_safepoint_(NULL),
532 next_sibling_(next_sibling), 539 next_sibling_(next_sibling),
533 finger_() { 540 finger_() {
534 } 541 }
535 542
536 const intptr_t vreg_; 543 const intptr_t vreg_;
544 Location::Representation representation_;
537 Location assigned_location_; 545 Location assigned_location_;
538 Location spill_slot_; 546 Location spill_slot_;
539 547
540 UsePosition* uses_; 548 UsePosition* uses_;
541 UseInterval* first_use_interval_; 549 UseInterval* first_use_interval_;
542 UseInterval* last_use_interval_; 550 UseInterval* last_use_interval_;
543 551
544 SafepointPosition* first_safepoint_; 552 SafepointPosition* first_safepoint_;
545 SafepointPosition* last_safepoint_; 553 SafepointPosition* last_safepoint_;
546 554
547 LiveRange* next_sibling_; 555 LiveRange* next_sibling_;
548 556
549 AllocationFinger finger_; 557 AllocationFinger finger_;
550 558
551 DISALLOW_COPY_AND_ASSIGN(LiveRange); 559 DISALLOW_COPY_AND_ASSIGN(LiveRange);
552 }; 560 };
553 561
554 562
555 } // namespace dart 563 } // namespace dart
556 564
557 #endif // VM_FLOW_GRAPH_ALLOCATOR_H_ 565 #endif // VM_FLOW_GRAPH_ALLOCATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698