| 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_H_ | 5 #ifndef VM_FLOW_GRAPH_H_ |
| 6 #define VM_FLOW_GRAPH_H_ | 6 #define VM_FLOW_GRAPH_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 #include "vm/parser.h" | 10 #include "vm/parser.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 95 |
| 96 intptr_t current_ssa_temp_index() const { return current_ssa_temp_index_; } | 96 intptr_t current_ssa_temp_index() const { return current_ssa_temp_index_; } |
| 97 void set_current_ssa_temp_index(intptr_t index) { | 97 void set_current_ssa_temp_index(intptr_t index) { |
| 98 current_ssa_temp_index_ = index; | 98 current_ssa_temp_index_ = index; |
| 99 } | 99 } |
| 100 | 100 |
| 101 intptr_t max_virtual_register_number() const { | 101 intptr_t max_virtual_register_number() const { |
| 102 return current_ssa_temp_index(); | 102 return current_ssa_temp_index(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 Isolate* isolate() const { return isolate_; } |
| 106 |
| 105 intptr_t max_block_id() const { return max_block_id_; } | 107 intptr_t max_block_id() const { return max_block_id_; } |
| 106 void set_max_block_id(intptr_t id) { max_block_id_ = id; } | 108 void set_max_block_id(intptr_t id) { max_block_id_ = id; } |
| 107 intptr_t allocate_block_id() { return ++max_block_id_; } | 109 intptr_t allocate_block_id() { return ++max_block_id_; } |
| 108 | 110 |
| 109 GraphEntryInstr* graph_entry() const { | 111 GraphEntryInstr* graph_entry() const { |
| 110 return graph_entry_; | 112 return graph_entry_; |
| 111 } | 113 } |
| 112 | 114 |
| 113 ConstantInstr* constant_null() const { | 115 ConstantInstr* constant_null() const { |
| 114 return constant_null_; | 116 return constant_null_; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 void ComputeBlockEffects(); | 169 void ComputeBlockEffects(); |
| 168 BlockEffects* block_effects() const { return block_effects_; } | 170 BlockEffects* block_effects() const { return block_effects_; } |
| 169 | 171 |
| 170 // Remove the redefinition instructions inserted to inhibit code motion. | 172 // Remove the redefinition instructions inserted to inhibit code motion. |
| 171 void RemoveRedefinitions(); | 173 void RemoveRedefinitions(); |
| 172 | 174 |
| 173 // Copy deoptimization target from one instruction to another if we still | 175 // Copy deoptimization target from one instruction to another if we still |
| 174 // have to keep deoptimization environment at gotos for LICM purposes. | 176 // have to keep deoptimization environment at gotos for LICM purposes. |
| 175 void CopyDeoptTarget(Instruction* to, Instruction* from) { | 177 void CopyDeoptTarget(Instruction* to, Instruction* from) { |
| 176 if (is_licm_allowed()) { | 178 if (is_licm_allowed()) { |
| 177 to->InheritDeoptTarget(from); | 179 to->InheritDeoptTarget(isolate(), from); |
| 178 } | 180 } |
| 179 } | 181 } |
| 180 | 182 |
| 181 // Returns true if every Goto in the graph is expected to have a | 183 // Returns true if every Goto in the graph is expected to have a |
| 182 // deoptimization environment and can be used as deoptimization target | 184 // deoptimization environment and can be used as deoptimization target |
| 183 // for hoisted instructions. | 185 // for hoisted instructions. |
| 184 bool is_licm_allowed() const { return licm_allowed_; } | 186 bool is_licm_allowed() const { return licm_allowed_; } |
| 185 | 187 |
| 186 // Stop preserving environments on Goto instructions. LICM is not allowed | 188 // Stop preserving environments on Goto instructions. LICM is not allowed |
| 187 // after this point. | 189 // after this point. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 // information to block n (loop header). The algorithm is described in | 261 // information to block n (loop header). The algorithm is described in |
| 260 // "Advanced Compiler Design & Implementation" (Muchnick) p192. | 262 // "Advanced Compiler Design & Implementation" (Muchnick) p192. |
| 261 // Returns a BitVector indexed by block pre-order number where each bit | 263 // Returns a BitVector indexed by block pre-order number where each bit |
| 262 // indicates membership in the loop. | 264 // indicates membership in the loop. |
| 263 BitVector* FindLoop(BlockEntryInstr* m, BlockEntryInstr* n); | 265 BitVector* FindLoop(BlockEntryInstr* m, BlockEntryInstr* n); |
| 264 | 266 |
| 265 // Finds natural loops in the flow graph and attaches a list of loop | 267 // Finds natural loops in the flow graph and attaches a list of loop |
| 266 // body blocks for each loop header. | 268 // body blocks for each loop header. |
| 267 ZoneGrowableArray<BlockEntryInstr*>* ComputeLoops(); | 269 ZoneGrowableArray<BlockEntryInstr*>* ComputeLoops(); |
| 268 | 270 |
| 271 Isolate* isolate_; |
| 272 |
| 269 // DiscoverBlocks computes parent_ and assigned_vars_ which are then used | 273 // DiscoverBlocks computes parent_ and assigned_vars_ which are then used |
| 270 // if/when computing SSA. | 274 // if/when computing SSA. |
| 271 GrowableArray<intptr_t> parent_; | 275 GrowableArray<intptr_t> parent_; |
| 272 GrowableArray<BitVector*> assigned_vars_; | 276 GrowableArray<BitVector*> assigned_vars_; |
| 273 | 277 |
| 274 intptr_t current_ssa_temp_index_; | 278 intptr_t current_ssa_temp_index_; |
| 275 intptr_t max_block_id_; | 279 intptr_t max_block_id_; |
| 276 | 280 |
| 277 // Flow graph fields. | 281 // Flow graph fields. |
| 278 const FlowGraphBuilder& builder_; | 282 const FlowGraphBuilder& builder_; |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 // Per block sets of available blocks. Block A is available at the block B if | 398 // Per block sets of available blocks. Block A is available at the block B if |
| 395 // and only if A dominates B and all paths from A to B are free of side | 399 // and only if A dominates B and all paths from A to B are free of side |
| 396 // effects. | 400 // effects. |
| 397 GrowableArray<BitVector*> available_at_; | 401 GrowableArray<BitVector*> available_at_; |
| 398 }; | 402 }; |
| 399 | 403 |
| 400 | 404 |
| 401 } // namespace dart | 405 } // namespace dart |
| 402 | 406 |
| 403 #endif // VM_FLOW_GRAPH_H_ | 407 #endif // VM_FLOW_GRAPH_H_ |
| OLD | NEW |