| OLD | NEW |
| 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 |
| 11 namespace dart { | 11 namespace dart { |
| 12 | 12 |
| 13 class AllocationFinger; | 13 class AllocationFinger; |
| 14 class FlowGraphBuilder; | 14 class FlowGraphBuilder; |
| 15 class LiveRange; | 15 class LiveRange; |
| 16 class UseInterval; | 16 class UseInterval; |
| 17 class UsePosition; | 17 class UsePosition; |
| 18 | 18 |
| 19 class FlowGraphAllocator : public ValueObject { | 19 class FlowGraphAllocator : public ValueObject { |
| 20 public: | 20 public: |
| 21 FlowGraphAllocator(const GrowableArray<BlockEntryInstr*>& block_order, | 21 FlowGraphAllocator(const GrowableArray<BlockEntryInstr*>& block_order, |
| 22 FlowGraphBuilder* builder); | 22 FlowGraphBuilder* builder); |
| 23 | 23 |
| 24 void AllocateRegisters(); | 24 void AllocateRegisters(); |
| 25 | 25 |
| 26 // Build live-in and live-out sets for each block. | 26 // Build live-in and live-out sets for each block. |
| 27 void AnalyzeLiveness(); | 27 void AnalyzeLiveness(); |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 // Eliminate unnecessary environments from the IL. |
| 31 void EliminateEnvironmentUses(); |
| 32 |
| 30 // Compute initial values for live-out, kill and live-in sets. | 33 // Compute initial values for live-out, kill and live-in sets. |
| 31 void ComputeInitialSets(); | 34 void ComputeInitialSets(); |
| 32 | 35 |
| 33 // Update live-out set for the given block: live-out should contain | 36 // Update live-out set for the given block: live-out should contain |
| 34 // all values that are live-in for block's successors. | 37 // all values that are live-in for block's successors. |
| 35 // Returns true if live-out set was changed. | 38 // Returns true if live-out set was changed. |
| 36 bool UpdateLiveOut(const BlockEntryInstr& instr); | 39 bool UpdateLiveOut(const BlockEntryInstr& instr); |
| 37 | 40 |
| 38 // Update live-in set for the given block: live-in should contain | 41 // Update live-in set for the given block: live-in should contain |
| 39 // all values that are live-out from the block and are not defined | 42 // all values that are live-out from the block and are not defined |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 | 387 |
| 385 AllocationFinger finger_; | 388 AllocationFinger finger_; |
| 386 | 389 |
| 387 DISALLOW_COPY_AND_ASSIGN(LiveRange); | 390 DISALLOW_COPY_AND_ASSIGN(LiveRange); |
| 388 }; | 391 }; |
| 389 | 392 |
| 390 | 393 |
| 391 } // namespace dart | 394 } // namespace dart |
| 392 | 395 |
| 393 #endif // VM_FLOW_GRAPH_ALLOCATOR_H_ | 396 #endif // VM_FLOW_GRAPH_ALLOCATOR_H_ |
| OLD | NEW |