| 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 BlockInfo; | 14 class BlockInfo; |
| 15 class FlowGraphBuilder; | 15 class FlowGraphBuilder; |
| 16 class LiveRange; | 16 class LiveRange; |
| 17 class UseInterval; | 17 class UseInterval; |
| 18 class UsePosition; | 18 class UsePosition; |
| 19 | 19 |
| 20 class FlowGraphAllocator : public ValueObject { | 20 class FlowGraphAllocator : public ValueObject { |
| 21 public: | 21 public: |
| 22 FlowGraphAllocator(const GrowableArray<BlockEntryInstr*>& block_order, | 22 FlowGraphAllocator(const GrowableArray<BlockEntryInstr*>& block_order, |
| 23 FlowGraphBuilder* builder); | 23 FlowGraphBuilder* builder); |
| 24 | 24 |
| 25 void AllocateRegisters(); | 25 void AllocateRegisters(); |
| 26 | 26 |
| 27 // Build live-in and live-out sets for each block. | 27 // Build live-in and live-out sets for each block. |
| 28 void AnalyzeLiveness(); | 28 void AnalyzeLiveness(); |
| 29 | 29 |
| 30 // Map a virtual register number to its live range. |
| 31 LiveRange* GetLiveRange(intptr_t vreg); |
| 32 |
| 30 private: | 33 private: |
| 31 // Eliminate unnecessary environments from the IL. | 34 // Eliminate unnecessary environments from the IL. |
| 32 void EliminateEnvironmentUses(); | 35 void EliminateEnvironmentUses(); |
| 33 | 36 |
| 34 // Compute initial values for live-out, kill and live-in sets. | 37 // Compute initial values for live-out, kill and live-in sets. |
| 35 void ComputeInitialSets(); | 38 void ComputeInitialSets(); |
| 36 | 39 |
| 37 // Update live-out set for the given block: live-out should contain | 40 // Update live-out set for the given block: live-out should contain |
| 38 // all values that are live-in for block's successors. | 41 // all values that are live-in for block's successors. |
| 39 // Returns true if live-out set was changed. | 42 // Returns true if live-out set was changed. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 void NumberInstructions(); | 78 void NumberInstructions(); |
| 76 Instruction* InstructionAt(intptr_t pos) const; | 79 Instruction* InstructionAt(intptr_t pos) const; |
| 77 BlockInfo* BlockInfoAt(intptr_t pos) const; | 80 BlockInfo* BlockInfoAt(intptr_t pos) const; |
| 78 bool IsBlockEntry(intptr_t pos) const; | 81 bool IsBlockEntry(intptr_t pos) const; |
| 79 | 82 |
| 80 // Discover structural (reducible) loops nesting structure. | 83 // Discover structural (reducible) loops nesting structure. |
| 81 // It will be used later in SplitBetween heuristic that selects an | 84 // It will be used later in SplitBetween heuristic that selects an |
| 82 // optimal splitting position. | 85 // optimal splitting position. |
| 83 void DiscoverLoops(); | 86 void DiscoverLoops(); |
| 84 | 87 |
| 85 LiveRange* GetLiveRange(intptr_t vreg); | |
| 86 LiveRange* MakeLiveRangeForTemporary(); | 88 LiveRange* MakeLiveRangeForTemporary(); |
| 87 | 89 |
| 88 // Visit instructions in the postorder and build live ranges for | 90 // Visit instructions in the postorder and build live ranges for |
| 89 // all SSA values. | 91 // all SSA values. |
| 90 void BuildLiveRanges(); | 92 void BuildLiveRanges(); |
| 91 Instruction* ConnectOutgoingPhiMoves(BlockEntryInstr* block); | 93 Instruction* ConnectOutgoingPhiMoves(BlockEntryInstr* block); |
| 92 void ProcessOneInstruction(BlockEntryInstr* block, Instruction* instr); | 94 void ProcessOneInstruction(BlockEntryInstr* block, Instruction* instr); |
| 93 void ConnectIncomingPhiMoves(BlockEntryInstr* block); | 95 void ConnectIncomingPhiMoves(BlockEntryInstr* block); |
| 94 void BlockLocation(Location loc, intptr_t from, intptr_t to); | 96 void BlockLocation(Location loc, intptr_t from, intptr_t to); |
| 95 | 97 |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 | 451 |
| 450 AllocationFinger finger_; | 452 AllocationFinger finger_; |
| 451 | 453 |
| 452 DISALLOW_COPY_AND_ASSIGN(LiveRange); | 454 DISALLOW_COPY_AND_ASSIGN(LiveRange); |
| 453 }; | 455 }; |
| 454 | 456 |
| 455 | 457 |
| 456 } // namespace dart | 458 } // namespace dart |
| 457 | 459 |
| 458 #endif // VM_FLOW_GRAPH_ALLOCATOR_H_ | 460 #endif // VM_FLOW_GRAPH_ALLOCATOR_H_ |
| OLD | NEW |