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/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" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 explicit FlowGraphAllocator(const FlowGraph& flow_graph); | 59 explicit FlowGraphAllocator(const FlowGraph& flow_graph); |
60 | 60 |
61 void AllocateRegisters(); | 61 void AllocateRegisters(); |
62 | 62 |
63 // Map a virtual register number to its live range. | 63 // Map a virtual register number to its live range. |
64 LiveRange* GetLiveRange(intptr_t vreg); | 64 LiveRange* GetLiveRange(intptr_t vreg); |
65 | 65 |
66 private: | 66 private: |
67 void CollectRepresentations(); | 67 void CollectRepresentations(); |
68 | 68 |
69 // Eliminate unnecessary environments from the IL. | |
70 void EliminateEnvironments(); | |
71 | |
72 // Visit blocks in the code generation order (reverse post order) and | 69 // Visit blocks in the code generation order (reverse post order) and |
73 // linearly assign consequent lifetime positions to every instruction. | 70 // linearly assign consequent lifetime positions to every instruction. |
74 // We assign position as follows: | 71 // We assign position as follows: |
75 // | 72 // |
76 // 2 * n - even position corresponding to instruction's start; | 73 // 2 * n - even position corresponding to instruction's start; |
77 // | 74 // |
78 // 2 * n + 1 - odd position corresponding to instruction's end; | 75 // 2 * n + 1 - odd position corresponding to instruction's end; |
79 // | 76 // |
80 // Having two positions per instruction allows us to capture non-trivial | 77 // Having two positions per instruction allows us to capture non-trivial |
81 // shapes of use intervals: e.g. by placing a use at the start or the | 78 // shapes of use intervals: e.g. by placing a use at the start or the |
(...skipping 18 matching lines...) Expand all Loading... |
100 void DiscoverLoops(); | 97 void DiscoverLoops(); |
101 | 98 |
102 LiveRange* MakeLiveRangeForTemporary(); | 99 LiveRange* MakeLiveRangeForTemporary(); |
103 | 100 |
104 // Visit instructions in the postorder and build live ranges for | 101 // Visit instructions in the postorder and build live ranges for |
105 // all SSA values. | 102 // all SSA values. |
106 void BuildLiveRanges(); | 103 void BuildLiveRanges(); |
107 Instruction* ConnectOutgoingPhiMoves(BlockEntryInstr* block, | 104 Instruction* ConnectOutgoingPhiMoves(BlockEntryInstr* block, |
108 BitVector* interference_set); | 105 BitVector* interference_set); |
109 void ProcessEnvironmentUses(BlockEntryInstr* block, Instruction* current); | 106 void ProcessEnvironmentUses(BlockEntryInstr* block, Instruction* current); |
| 107 void ProcessMaterializationUses(BlockEntryInstr* block, |
| 108 const intptr_t block_start_pos, |
| 109 const intptr_t use_pos, |
| 110 MaterializeObjectInstr* mat); |
110 void ProcessOneInstruction(BlockEntryInstr* block, | 111 void ProcessOneInstruction(BlockEntryInstr* block, |
111 Instruction* instr, | 112 Instruction* instr, |
112 BitVector* interference_set); | 113 BitVector* interference_set); |
113 void ConnectIncomingPhiMoves(BlockEntryInstr* block); | 114 void ConnectIncomingPhiMoves(BlockEntryInstr* block); |
114 void BlockLocation(Location loc, intptr_t from, intptr_t to); | 115 void BlockLocation(Location loc, intptr_t from, intptr_t to); |
115 void BlockRegisterLocation(Location loc, | 116 void BlockRegisterLocation(Location loc, |
116 intptr_t from, | 117 intptr_t from, |
117 intptr_t to, | 118 intptr_t to, |
118 bool* blocked_registers, | 119 bool* blocked_registers, |
119 LiveRange** blocking_ranges); | 120 LiveRange** blocking_ranges); |
(...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 | 642 |
642 AllocationFinger finger_; | 643 AllocationFinger finger_; |
643 | 644 |
644 DISALLOW_COPY_AND_ASSIGN(LiveRange); | 645 DISALLOW_COPY_AND_ASSIGN(LiveRange); |
645 }; | 646 }; |
646 | 647 |
647 | 648 |
648 } // namespace dart | 649 } // namespace dart |
649 | 650 |
650 #endif // VM_FLOW_GRAPH_ALLOCATOR_H_ | 651 #endif // VM_FLOW_GRAPH_ALLOCATOR_H_ |
OLD | NEW |