| 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 RUNTIME_VM_FLOW_GRAPH_ALLOCATOR_H_ | 5 #ifndef RUNTIME_VM_FLOW_GRAPH_ALLOCATOR_H_ |
| 6 #define RUNTIME_VM_FLOW_GRAPH_ALLOCATOR_H_ | 6 #define RUNTIME_VM_FLOW_GRAPH_ALLOCATOR_H_ |
| 7 | 7 |
| 8 #include "vm/flow_graph.h" | 8 #include "vm/flow_graph.h" |
| 9 #include "vm/growable_array.h" | 9 #include "vm/growable_array.h" |
| 10 #include "vm/intermediate_language.h" | 10 #include "vm/intermediate_language.h" |
| 11 | 11 |
| 12 namespace dart { | 12 namespace dart { |
| 13 | 13 |
| 14 class AllocationFinger; | 14 class AllocationFinger; |
| 15 class BlockInfo; | 15 class BlockInfo; |
| 16 class FlowGraph; | 16 class FlowGraph; |
| 17 class LiveRange; | 17 class LiveRange; |
| 18 class UseInterval; | 18 class UseInterval; |
| 19 class UsePosition; | 19 class UsePosition; |
| 20 | 20 |
| 21 | 21 |
| 22 class ReachingDefs : public ValueObject { | 22 class ReachingDefs : public ValueObject { |
| 23 public: | 23 public: |
| 24 explicit ReachingDefs(const FlowGraph& flow_graph) | 24 explicit ReachingDefs(const FlowGraph& flow_graph) |
| 25 : flow_graph_(flow_graph), | 25 : flow_graph_(flow_graph), phis_(10) {} |
| 26 phis_(10) { } | |
| 27 | 26 |
| 28 BitVector* Get(PhiInstr* phi); | 27 BitVector* Get(PhiInstr* phi); |
| 29 | 28 |
| 30 private: | 29 private: |
| 31 void AddPhi(PhiInstr* phi); | 30 void AddPhi(PhiInstr* phi); |
| 32 void Compute(); | 31 void Compute(); |
| 33 | 32 |
| 34 const FlowGraph& flow_graph_; | 33 const FlowGraph& flow_graph_; |
| 35 GrowableArray<PhiInstr*> phis_; | 34 GrowableArray<PhiInstr*> phis_; |
| 36 }; | 35 }; |
| 37 | 36 |
| 38 | 37 |
| 39 class SSALivenessAnalysis : public LivenessAnalysis { | 38 class SSALivenessAnalysis : public LivenessAnalysis { |
| 40 public: | 39 public: |
| 41 explicit SSALivenessAnalysis(const FlowGraph& flow_graph) | 40 explicit SSALivenessAnalysis(const FlowGraph& flow_graph) |
| 42 : LivenessAnalysis(flow_graph.max_virtual_register_number(), | 41 : LivenessAnalysis(flow_graph.max_virtual_register_number(), |
| 43 flow_graph.postorder()), | 42 flow_graph.postorder()), |
| 44 graph_entry_(flow_graph.graph_entry()) { } | 43 graph_entry_(flow_graph.graph_entry()) {} |
| 45 | 44 |
| 46 private: | 45 private: |
| 47 // Compute initial values for live-out, kill and live-in sets. | 46 // Compute initial values for live-out, kill and live-in sets. |
| 48 virtual void ComputeInitialSets(); | 47 virtual void ComputeInitialSets(); |
| 49 | 48 |
| 50 GraphEntryInstr* graph_entry_; | 49 GraphEntryInstr* graph_entry_; |
| 51 }; | 50 }; |
| 52 | 51 |
| 53 | 52 |
| 54 class FlowGraphAllocator : public ValueObject { | 53 class FlowGraphAllocator : public ValueObject { |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 // Assign selected non-free register to an unallocated live range and | 206 // Assign selected non-free register to an unallocated live range and |
| 208 // evict any interference that can be evicted by splitting and spilling | 207 // evict any interference that can be evicted by splitting and spilling |
| 209 // parts of interfering live ranges. Place non-spilled parts into | 208 // parts of interfering live ranges. Place non-spilled parts into |
| 210 // the list of unallocated ranges. | 209 // the list of unallocated ranges. |
| 211 void AssignNonFreeRegister(LiveRange* unallocated, intptr_t reg); | 210 void AssignNonFreeRegister(LiveRange* unallocated, intptr_t reg); |
| 212 bool EvictIntersection(LiveRange* allocated, LiveRange* unallocated); | 211 bool EvictIntersection(LiveRange* allocated, LiveRange* unallocated); |
| 213 void RemoveEvicted(intptr_t reg, intptr_t first_evicted); | 212 void RemoveEvicted(intptr_t reg, intptr_t first_evicted); |
| 214 | 213 |
| 215 // Find first intersection between unallocated live range and | 214 // Find first intersection between unallocated live range and |
| 216 // live ranges currently allocated to the given register. | 215 // live ranges currently allocated to the given register. |
| 217 intptr_t FirstIntersectionWithAllocated(intptr_t reg, | 216 intptr_t FirstIntersectionWithAllocated(intptr_t reg, LiveRange* unallocated); |
| 218 LiveRange* unallocated); | |
| 219 | 217 |
| 220 bool UpdateFreeUntil(intptr_t reg, | 218 bool UpdateFreeUntil(intptr_t reg, |
| 221 LiveRange* unallocated, | 219 LiveRange* unallocated, |
| 222 intptr_t* cur_free_until, | 220 intptr_t* cur_free_until, |
| 223 intptr_t* cur_blocked_at); | 221 intptr_t* cur_blocked_at); |
| 224 | 222 |
| 225 // Split given live range in an optimal position between given positions. | 223 // Split given live range in an optimal position between given positions. |
| 226 LiveRange* SplitBetween(LiveRange* range, intptr_t from, intptr_t to); | 224 LiveRange* SplitBetween(LiveRange* range, intptr_t from, intptr_t to); |
| 227 | 225 |
| 228 // Find a spill slot that can be used by the given live range. | 226 // Find a spill slot that can be used by the given live range. |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 | 336 |
| 339 DISALLOW_COPY_AND_ASSIGN(FlowGraphAllocator); | 337 DISALLOW_COPY_AND_ASSIGN(FlowGraphAllocator); |
| 340 }; | 338 }; |
| 341 | 339 |
| 342 | 340 |
| 343 // Additional information about a block that is not contained in a | 341 // Additional information about a block that is not contained in a |
| 344 // block entry. | 342 // block entry. |
| 345 class BlockInfo : public ZoneAllocated { | 343 class BlockInfo : public ZoneAllocated { |
| 346 public: | 344 public: |
| 347 explicit BlockInfo(BlockEntryInstr* entry) | 345 explicit BlockInfo(BlockEntryInstr* entry) |
| 348 : entry_(entry), | 346 : entry_(entry), |
| 349 loop_(NULL), | 347 loop_(NULL), |
| 350 is_loop_header_(false), | 348 is_loop_header_(false), |
| 351 backedge_interference_(NULL) { | 349 backedge_interference_(NULL) {} |
| 352 } | |
| 353 | 350 |
| 354 BlockEntryInstr* entry() const { return entry_; } | 351 BlockEntryInstr* entry() const { return entry_; } |
| 355 | 352 |
| 356 // Returns true is this node is a header of a structural loop. | 353 // Returns true is this node is a header of a structural loop. |
| 357 bool is_loop_header() const { return is_loop_header_; } | 354 bool is_loop_header() const { return is_loop_header_; } |
| 358 | 355 |
| 359 // Returns header of the innermost loop containing this block. | 356 // Returns header of the innermost loop containing this block. |
| 360 BlockInfo* loop_header() { | 357 BlockInfo* loop_header() { |
| 361 if (is_loop_header()) { | 358 if (is_loop_header()) { |
| 362 return this; | 359 return this; |
| 363 } else if (loop() != NULL) { | 360 } else if (loop() != NULL) { |
| 364 return loop(); | 361 return loop(); |
| 365 } else { | 362 } else { |
| 366 return NULL; | 363 return NULL; |
| 367 } | 364 } |
| 368 } | 365 } |
| 369 | 366 |
| 370 // Innermost reducible loop containing this node. Loop headers point to | 367 // Innermost reducible loop containing this node. Loop headers point to |
| 371 // outer loop not to themselves. | 368 // outer loop not to themselves. |
| 372 BlockInfo* loop() const { return loop_; } | 369 BlockInfo* loop() const { return loop_; } |
| 373 | 370 |
| 374 void mark_loop_header() { is_loop_header_ = true; } | 371 void mark_loop_header() { is_loop_header_ = true; } |
| 375 void set_loop(BlockInfo* loop) { | 372 void set_loop(BlockInfo* loop) { |
| 376 ASSERT(loop_ == NULL); | 373 ASSERT(loop_ == NULL); |
| 377 ASSERT((loop == NULL) || loop->is_loop_header()); | 374 ASSERT((loop == NULL) || loop->is_loop_header()); |
| 378 loop_ = loop; | 375 loop_ = loop; |
| 379 } | 376 } |
| 380 | 377 |
| 381 BlockEntryInstr* last_block() const { return last_block_; } | 378 BlockEntryInstr* last_block() const { return last_block_; } |
| 382 void set_last_block(BlockEntryInstr* last_block) { | 379 void set_last_block(BlockEntryInstr* last_block) { last_block_ = last_block; } |
| 383 last_block_ = last_block; | |
| 384 } | |
| 385 | 380 |
| 386 intptr_t loop_id() const { return loop_id_; } | 381 intptr_t loop_id() const { return loop_id_; } |
| 387 void set_loop_id(intptr_t loop_id) { loop_id_ = loop_id; } | 382 void set_loop_id(intptr_t loop_id) { loop_id_ = loop_id; } |
| 388 | 383 |
| 389 BitVector* backedge_interference() const { | 384 BitVector* backedge_interference() const { return backedge_interference_; } |
| 390 return backedge_interference_; | |
| 391 } | |
| 392 | 385 |
| 393 void set_backedge_interference(BitVector* backedge_interference) { | 386 void set_backedge_interference(BitVector* backedge_interference) { |
| 394 backedge_interference_ = backedge_interference; | 387 backedge_interference_ = backedge_interference; |
| 395 } | 388 } |
| 396 | 389 |
| 397 private: | 390 private: |
| 398 BlockEntryInstr* entry_; | 391 BlockEntryInstr* entry_; |
| 399 BlockInfo* loop_; | 392 BlockInfo* loop_; |
| 400 bool is_loop_header_; | 393 bool is_loop_header_; |
| 401 | 394 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 423 Location* location_slot() const { return location_slot_; } | 416 Location* location_slot() const { return location_slot_; } |
| 424 void set_location_slot(Location* location_slot) { | 417 void set_location_slot(Location* location_slot) { |
| 425 location_slot_ = location_slot; | 418 location_slot_ = location_slot; |
| 426 } | 419 } |
| 427 | 420 |
| 428 Location hint() const { | 421 Location hint() const { |
| 429 ASSERT(HasHint()); | 422 ASSERT(HasHint()); |
| 430 return *hint_; | 423 return *hint_; |
| 431 } | 424 } |
| 432 | 425 |
| 433 void set_hint(Location* hint) { | 426 void set_hint(Location* hint) { hint_ = hint; } |
| 434 hint_ = hint; | |
| 435 } | |
| 436 | 427 |
| 437 bool HasHint() const { | 428 bool HasHint() const { return (hint_ != NULL) && !hint_->IsUnallocated(); } |
| 438 return (hint_ != NULL) && !hint_->IsUnallocated(); | |
| 439 } | |
| 440 | 429 |
| 441 | 430 |
| 442 void set_next(UsePosition* next) { next_ = next; } | 431 void set_next(UsePosition* next) { next_ = next; } |
| 443 UsePosition* next() const { return next_; } | 432 UsePosition* next() const { return next_; } |
| 444 | 433 |
| 445 intptr_t pos() const { return pos_; } | 434 intptr_t pos() const { return pos_; } |
| 446 | 435 |
| 447 private: | 436 private: |
| 448 const intptr_t pos_; | 437 const intptr_t pos_; |
| 449 Location* location_slot_; | 438 Location* location_slot_; |
| 450 Location* hint_; | 439 Location* hint_; |
| 451 UsePosition* next_; | 440 UsePosition* next_; |
| 452 | 441 |
| 453 DISALLOW_COPY_AND_ASSIGN(UsePosition); | 442 DISALLOW_COPY_AND_ASSIGN(UsePosition); |
| 454 }; | 443 }; |
| 455 | 444 |
| 456 | 445 |
| 457 // UseInterval represents a holeless half open interval of liveness for a given | 446 // UseInterval represents a holeless half open interval of liveness for a given |
| 458 // SSA value: [start, end) in terms of lifetime positions that | 447 // SSA value: [start, end) in terms of lifetime positions that |
| 459 // NumberInstructions assigns to instructions. Register allocator has to keep | 448 // NumberInstructions assigns to instructions. Register allocator has to keep |
| 460 // a value live in the register or in a spill slot from start position and until | 449 // a value live in the register or in a spill slot from start position and until |
| 461 // the end position. The interval can cover zero or more uses. | 450 // the end position. The interval can cover zero or more uses. |
| 462 // Note: currently all uses of the same SSA value are linked together into a | 451 // Note: currently all uses of the same SSA value are linked together into a |
| 463 // single list (and not split between UseIntervals). | 452 // single list (and not split between UseIntervals). |
| 464 class UseInterval : public ZoneAllocated { | 453 class UseInterval : public ZoneAllocated { |
| 465 public: | 454 public: |
| 466 UseInterval(intptr_t start, intptr_t end, UseInterval* next) | 455 UseInterval(intptr_t start, intptr_t end, UseInterval* next) |
| 467 : start_(start), | 456 : start_(start), end_(end), next_(next) {} |
| 468 end_(end), | |
| 469 next_(next) { } | |
| 470 | 457 |
| 471 void Print(); | 458 void Print(); |
| 472 | 459 |
| 473 intptr_t start() const { return start_; } | 460 intptr_t start() const { return start_; } |
| 474 intptr_t end() const { return end_; } | 461 intptr_t end() const { return end_; } |
| 475 UseInterval* next() const { return next_; } | 462 UseInterval* next() const { return next_; } |
| 476 | 463 |
| 477 bool Contains(intptr_t pos) const { | 464 bool Contains(intptr_t pos) const { |
| 478 return (start() <= pos) && (pos < end()); | 465 return (start() <= pos) && (pos < end()); |
| 479 } | 466 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 494 | 481 |
| 495 | 482 |
| 496 // AllocationFinger is used to keep track of currently active position | 483 // AllocationFinger is used to keep track of currently active position |
| 497 // for the register allocator and cache lookup results. | 484 // for the register allocator and cache lookup results. |
| 498 class AllocationFinger : public ValueObject { | 485 class AllocationFinger : public ValueObject { |
| 499 public: | 486 public: |
| 500 AllocationFinger() | 487 AllocationFinger() |
| 501 : first_pending_use_interval_(NULL), | 488 : first_pending_use_interval_(NULL), |
| 502 first_register_use_(NULL), | 489 first_register_use_(NULL), |
| 503 first_register_beneficial_use_(NULL), | 490 first_register_beneficial_use_(NULL), |
| 504 first_hinted_use_(NULL) { | 491 first_hinted_use_(NULL) {} |
| 505 } | |
| 506 | 492 |
| 507 void Initialize(LiveRange* range); | 493 void Initialize(LiveRange* range); |
| 508 void UpdateAfterSplit(intptr_t first_use_after_split_pos); | 494 void UpdateAfterSplit(intptr_t first_use_after_split_pos); |
| 509 bool Advance(intptr_t start); | 495 bool Advance(intptr_t start); |
| 510 | 496 |
| 511 UseInterval* first_pending_use_interval() const { | 497 UseInterval* first_pending_use_interval() const { |
| 512 return first_pending_use_interval_; | 498 return first_pending_use_interval_; |
| 513 } | 499 } |
| 514 | 500 |
| 515 Location FirstHint(); | 501 Location FirstHint(); |
| 516 UsePosition* FirstRegisterUse(intptr_t after_pos); | 502 UsePosition* FirstRegisterUse(intptr_t after_pos); |
| 517 UsePosition* FirstRegisterBeneficialUse(intptr_t after_pos); | 503 UsePosition* FirstRegisterBeneficialUse(intptr_t after_pos); |
| 518 UsePosition* FirstInterferingUse(intptr_t after_pos); | 504 UsePosition* FirstInterferingUse(intptr_t after_pos); |
| 519 | 505 |
| 520 private: | 506 private: |
| 521 UseInterval* first_pending_use_interval_; | 507 UseInterval* first_pending_use_interval_; |
| 522 UsePosition* first_register_use_; | 508 UsePosition* first_register_use_; |
| 523 UsePosition* first_register_beneficial_use_; | 509 UsePosition* first_register_beneficial_use_; |
| 524 UsePosition* first_hinted_use_; | 510 UsePosition* first_hinted_use_; |
| 525 | 511 |
| 526 DISALLOW_COPY_AND_ASSIGN(AllocationFinger); | 512 DISALLOW_COPY_AND_ASSIGN(AllocationFinger); |
| 527 }; | 513 }; |
| 528 | 514 |
| 529 | 515 |
| 530 class SafepointPosition : public ZoneAllocated { | 516 class SafepointPosition : public ZoneAllocated { |
| 531 public: | 517 public: |
| 532 SafepointPosition(intptr_t pos, | 518 SafepointPosition(intptr_t pos, LocationSummary* locs) |
| 533 LocationSummary* locs) | 519 : pos_(pos), locs_(locs), next_(NULL) {} |
| 534 : pos_(pos), locs_(locs), next_(NULL) { } | |
| 535 | 520 |
| 536 void set_next(SafepointPosition* next) { next_ = next; } | 521 void set_next(SafepointPosition* next) { next_ = next; } |
| 537 SafepointPosition* next() const { return next_; } | 522 SafepointPosition* next() const { return next_; } |
| 538 | 523 |
| 539 intptr_t pos() const { return pos_; } | 524 intptr_t pos() const { return pos_; } |
| 540 | 525 |
| 541 LocationSummary* locs() const { return locs_; } | 526 LocationSummary* locs() const { return locs_; } |
| 542 | 527 |
| 543 private: | 528 private: |
| 544 const intptr_t pos_; | 529 const intptr_t pos_; |
| 545 LocationSummary* const locs_; | 530 LocationSummary* const locs_; |
| 546 | 531 |
| 547 SafepointPosition* next_; | 532 SafepointPosition* next_; |
| 548 }; | 533 }; |
| 549 | 534 |
| 550 | 535 |
| 551 // LiveRange represents a sequence of UseIntervals for a given SSA value. | 536 // LiveRange represents a sequence of UseIntervals for a given SSA value. |
| 552 class LiveRange : public ZoneAllocated { | 537 class LiveRange : public ZoneAllocated { |
| 553 public: | 538 public: |
| 554 explicit LiveRange(intptr_t vreg, Representation rep) | 539 explicit LiveRange(intptr_t vreg, Representation rep) |
| 555 : vreg_(vreg), | 540 : vreg_(vreg), |
| 556 representation_(rep), | 541 representation_(rep), |
| 557 assigned_location_(), | 542 assigned_location_(), |
| 558 spill_slot_(), | 543 spill_slot_(), |
| 559 uses_(NULL), | 544 uses_(NULL), |
| 560 first_use_interval_(NULL), | 545 first_use_interval_(NULL), |
| 561 last_use_interval_(NULL), | 546 last_use_interval_(NULL), |
| 562 first_safepoint_(NULL), | 547 first_safepoint_(NULL), |
| 563 last_safepoint_(NULL), | 548 last_safepoint_(NULL), |
| 564 next_sibling_(NULL), | 549 next_sibling_(NULL), |
| 565 has_only_any_uses_in_loops_(0), | 550 has_only_any_uses_in_loops_(0), |
| 566 is_loop_phi_(false), | 551 is_loop_phi_(false), |
| 567 finger_() { | 552 finger_() {} |
| 568 } | |
| 569 | 553 |
| 570 intptr_t vreg() const { return vreg_; } | 554 intptr_t vreg() const { return vreg_; } |
| 571 Representation representation() const { return representation_; } | 555 Representation representation() const { return representation_; } |
| 572 LiveRange* next_sibling() const { return next_sibling_; } | 556 LiveRange* next_sibling() const { return next_sibling_; } |
| 573 UsePosition* first_use() const { return uses_; } | 557 UsePosition* first_use() const { return uses_; } |
| 574 void set_first_use(UsePosition* use) { uses_ = use; } | 558 void set_first_use(UsePosition* use) { uses_ = use; } |
| 575 UseInterval* first_use_interval() const { return first_use_interval_; } | 559 UseInterval* first_use_interval() const { return first_use_interval_; } |
| 576 UseInterval* last_use_interval() const { return last_use_interval_; } | 560 UseInterval* last_use_interval() const { return last_use_interval_; } |
| 577 Location assigned_location() const { return assigned_location_; } | 561 Location assigned_location() const { return assigned_location_; } |
| 578 Location* assigned_location_slot() { return &assigned_location_; } | 562 Location* assigned_location_slot() { return &assigned_location_; } |
| 579 intptr_t Start() const { return first_use_interval()->start(); } | 563 intptr_t Start() const { return first_use_interval()->start(); } |
| 580 intptr_t End() const { return last_use_interval()->end(); } | 564 intptr_t End() const { return last_use_interval()->end(); } |
| 581 | 565 |
| 582 SafepointPosition* first_safepoint() const { return first_safepoint_; } | 566 SafepointPosition* first_safepoint() const { return first_safepoint_; } |
| 583 | 567 |
| 584 AllocationFinger* finger() { return &finger_; } | 568 AllocationFinger* finger() { return &finger_; } |
| 585 | 569 |
| 586 void set_assigned_location(Location location) { | 570 void set_assigned_location(Location location) { |
| 587 assigned_location_ = location; | 571 assigned_location_ = location; |
| 588 } | 572 } |
| 589 | 573 |
| 590 void set_spill_slot(Location spill_slot) { | 574 void set_spill_slot(Location spill_slot) { spill_slot_ = spill_slot; } |
| 591 spill_slot_ = spill_slot; | |
| 592 } | |
| 593 | 575 |
| 594 void DefineAt(intptr_t pos); | 576 void DefineAt(intptr_t pos); |
| 595 | 577 |
| 596 void AddSafepoint(intptr_t pos, LocationSummary* locs); | 578 void AddSafepoint(intptr_t pos, LocationSummary* locs); |
| 597 | 579 |
| 598 UsePosition* AddUse(intptr_t pos, Location* location_slot); | 580 UsePosition* AddUse(intptr_t pos, Location* location_slot); |
| 599 void AddHintedUse(intptr_t pos, Location* location_slot, Location* hint); | 581 void AddHintedUse(intptr_t pos, Location* location_slot, Location* hint); |
| 600 | 582 |
| 601 void AddUseInterval(intptr_t start, intptr_t end); | 583 void AddUseInterval(intptr_t start, intptr_t end); |
| 602 | 584 |
| 603 void Print(); | 585 void Print(); |
| 604 | 586 |
| 605 LiveRange* SplitAt(intptr_t pos); | 587 LiveRange* SplitAt(intptr_t pos); |
| 606 | 588 |
| 607 // A fast conservative check if the range might contain a given position | 589 // A fast conservative check if the range might contain a given position |
| 608 // -- can return true when the range does not contain the position (e.g., | 590 // -- can return true when the range does not contain the position (e.g., |
| 609 // the position lies in a lifetime hole between range start and end). | 591 // the position lies in a lifetime hole between range start and end). |
| 610 bool CanCover(intptr_t pos) const { | 592 bool CanCover(intptr_t pos) const { |
| 611 return (Start() <= pos) && (pos < End()); | 593 return (Start() <= pos) && (pos < End()); |
| 612 } | 594 } |
| 613 | 595 |
| 614 // True if the range contains the given position. | 596 // True if the range contains the given position. |
| 615 bool Contains(intptr_t pos) const; | 597 bool Contains(intptr_t pos) const; |
| 616 | 598 |
| 617 Location spill_slot() const { | 599 Location spill_slot() const { return spill_slot_; } |
| 618 return spill_slot_; | |
| 619 } | |
| 620 | 600 |
| 621 bool HasOnlyUnconstrainedUsesInLoop(intptr_t loop_id) const { | 601 bool HasOnlyUnconstrainedUsesInLoop(intptr_t loop_id) const { |
| 622 if (loop_id < kBitsPerWord) { | 602 if (loop_id < kBitsPerWord) { |
| 623 const intptr_t mask = static_cast<intptr_t>(1) << loop_id; | 603 const intptr_t mask = static_cast<intptr_t>(1) << loop_id; |
| 624 return (has_only_any_uses_in_loops_ & mask) != 0; | 604 return (has_only_any_uses_in_loops_ & mask) != 0; |
| 625 } | 605 } |
| 626 return false; | 606 return false; |
| 627 } | 607 } |
| 628 | 608 |
| 629 void MarkHasOnlyUnconstrainedUsesInLoop(intptr_t loop_id) { | 609 void MarkHasOnlyUnconstrainedUsesInLoop(intptr_t loop_id) { |
| 630 if (loop_id < kBitsPerWord) { | 610 if (loop_id < kBitsPerWord) { |
| 631 has_only_any_uses_in_loops_ |= static_cast<intptr_t>(1) << loop_id; | 611 has_only_any_uses_in_loops_ |= static_cast<intptr_t>(1) << loop_id; |
| 632 } | 612 } |
| 633 } | 613 } |
| 634 | 614 |
| 635 bool is_loop_phi() const { return is_loop_phi_; } | 615 bool is_loop_phi() const { return is_loop_phi_; } |
| 636 void mark_loop_phi() { | 616 void mark_loop_phi() { is_loop_phi_ = true; } |
| 637 is_loop_phi_ = true; | |
| 638 } | |
| 639 | 617 |
| 640 private: | 618 private: |
| 641 LiveRange(intptr_t vreg, | 619 LiveRange(intptr_t vreg, |
| 642 Representation rep, | 620 Representation rep, |
| 643 UsePosition* uses, | 621 UsePosition* uses, |
| 644 UseInterval* first_use_interval, | 622 UseInterval* first_use_interval, |
| 645 UseInterval* last_use_interval, | 623 UseInterval* last_use_interval, |
| 646 SafepointPosition* first_safepoint, | 624 SafepointPosition* first_safepoint, |
| 647 LiveRange* next_sibling) | 625 LiveRange* next_sibling) |
| 648 : vreg_(vreg), | 626 : vreg_(vreg), |
| 649 representation_(rep), | 627 representation_(rep), |
| 650 assigned_location_(), | 628 assigned_location_(), |
| 651 uses_(uses), | 629 uses_(uses), |
| 652 first_use_interval_(first_use_interval), | 630 first_use_interval_(first_use_interval), |
| 653 last_use_interval_(last_use_interval), | 631 last_use_interval_(last_use_interval), |
| 654 first_safepoint_(first_safepoint), | 632 first_safepoint_(first_safepoint), |
| 655 last_safepoint_(NULL), | 633 last_safepoint_(NULL), |
| 656 next_sibling_(next_sibling), | 634 next_sibling_(next_sibling), |
| 657 has_only_any_uses_in_loops_(0), | 635 has_only_any_uses_in_loops_(0), |
| 658 is_loop_phi_(false), | 636 is_loop_phi_(false), |
| 659 finger_() { | 637 finger_() {} |
| 660 } | |
| 661 | 638 |
| 662 const intptr_t vreg_; | 639 const intptr_t vreg_; |
| 663 Representation representation_; | 640 Representation representation_; |
| 664 Location assigned_location_; | 641 Location assigned_location_; |
| 665 Location spill_slot_; | 642 Location spill_slot_; |
| 666 | 643 |
| 667 UsePosition* uses_; | 644 UsePosition* uses_; |
| 668 UseInterval* first_use_interval_; | 645 UseInterval* first_use_interval_; |
| 669 UseInterval* last_use_interval_; | 646 UseInterval* last_use_interval_; |
| 670 | 647 |
| 671 SafepointPosition* first_safepoint_; | 648 SafepointPosition* first_safepoint_; |
| 672 SafepointPosition* last_safepoint_; | 649 SafepointPosition* last_safepoint_; |
| 673 | 650 |
| 674 LiveRange* next_sibling_; | 651 LiveRange* next_sibling_; |
| 675 | 652 |
| 676 intptr_t has_only_any_uses_in_loops_; | 653 intptr_t has_only_any_uses_in_loops_; |
| 677 bool is_loop_phi_; | 654 bool is_loop_phi_; |
| 678 | 655 |
| 679 AllocationFinger finger_; | 656 AllocationFinger finger_; |
| 680 | 657 |
| 681 DISALLOW_COPY_AND_ASSIGN(LiveRange); | 658 DISALLOW_COPY_AND_ASSIGN(LiveRange); |
| 682 }; | 659 }; |
| 683 | 660 |
| 684 | 661 |
| 685 } // namespace dart | 662 } // namespace dart |
| 686 | 663 |
| 687 #endif // RUNTIME_VM_FLOW_GRAPH_ALLOCATOR_H_ | 664 #endif // RUNTIME_VM_FLOW_GRAPH_ALLOCATOR_H_ |
| OLD | NEW |