| 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 30 matching lines...) Expand all Loading... |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 | 43 |
| 44 // Class to encapsulate the construction and manipulation of the flow graph. | 44 // Class to encapsulate the construction and manipulation of the flow graph. |
| 45 class FlowGraph : public ZoneAllocated { | 45 class FlowGraph : public ZoneAllocated { |
| 46 public: | 46 public: |
| 47 FlowGraph(const FlowGraphBuilder& builder, | 47 FlowGraph(const FlowGraphBuilder& builder, |
| 48 GraphEntryInstr* graph_entry, | 48 GraphEntryInstr* graph_entry, |
| 49 intptr_t max_block_id); | 49 intptr_t max_block_id); |
| 50 | 50 |
| 51 const FlowGraphBuilder& builder() const { | |
| 52 return builder_; | |
| 53 } | |
| 54 | |
| 55 // Function properties. | 51 // Function properties. |
| 56 const ParsedFunction& parsed_function() const { | 52 const ParsedFunction& parsed_function() const { |
| 57 return parsed_function_; | 53 return parsed_function_; |
| 58 } | 54 } |
| 59 intptr_t parameter_count() const { | 55 intptr_t parameter_count() const { |
| 60 return num_copied_params_ + num_non_copied_params_; | 56 return num_copied_params_ + num_non_copied_params_; |
| 61 } | 57 } |
| 62 intptr_t variable_count() const { | 58 intptr_t variable_count() const { |
| 63 return parameter_count() + num_stack_locals_; | 59 return parameter_count() + num_stack_locals_; |
| 64 } | 60 } |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 | 239 |
| 244 // DiscoverBlocks computes parent_ and assigned_vars_ which are then used | 240 // DiscoverBlocks computes parent_ and assigned_vars_ which are then used |
| 245 // if/when computing SSA. | 241 // if/when computing SSA. |
| 246 GrowableArray<intptr_t> parent_; | 242 GrowableArray<intptr_t> parent_; |
| 247 GrowableArray<BitVector*> assigned_vars_; | 243 GrowableArray<BitVector*> assigned_vars_; |
| 248 | 244 |
| 249 intptr_t current_ssa_temp_index_; | 245 intptr_t current_ssa_temp_index_; |
| 250 intptr_t max_block_id_; | 246 intptr_t max_block_id_; |
| 251 | 247 |
| 252 // Flow graph fields. | 248 // Flow graph fields. |
| 253 const FlowGraphBuilder& builder_; | |
| 254 const ParsedFunction& parsed_function_; | 249 const ParsedFunction& parsed_function_; |
| 255 const intptr_t num_copied_params_; | 250 const intptr_t num_copied_params_; |
| 256 const intptr_t num_non_copied_params_; | 251 const intptr_t num_non_copied_params_; |
| 257 const intptr_t num_stack_locals_; | 252 const intptr_t num_stack_locals_; |
| 258 GraphEntryInstr* graph_entry_; | 253 GraphEntryInstr* graph_entry_; |
| 259 GrowableArray<BlockEntryInstr*> preorder_; | 254 GrowableArray<BlockEntryInstr*> preorder_; |
| 260 GrowableArray<BlockEntryInstr*> postorder_; | 255 GrowableArray<BlockEntryInstr*> postorder_; |
| 261 GrowableArray<BlockEntryInstr*> reverse_postorder_; | 256 GrowableArray<BlockEntryInstr*> reverse_postorder_; |
| 262 GrowableArray<BlockEntryInstr*> optimized_block_order_; | 257 GrowableArray<BlockEntryInstr*> optimized_block_order_; |
| 263 ConstantInstr* constant_null_; | 258 ConstantInstr* constant_null_; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 // Per block sets of available blocks. Block A is available at the block B if | 362 // Per block sets of available blocks. Block A is available at the block B if |
| 368 // and only if A dominates B and all paths from A to B are free of side | 363 // and only if A dominates B and all paths from A to B are free of side |
| 369 // effects. | 364 // effects. |
| 370 GrowableArray<BitVector*> available_at_; | 365 GrowableArray<BitVector*> available_at_; |
| 371 }; | 366 }; |
| 372 | 367 |
| 373 | 368 |
| 374 } // namespace dart | 369 } // namespace dart |
| 375 | 370 |
| 376 #endif // VM_FLOW_GRAPH_H_ | 371 #endif // VM_FLOW_GRAPH_H_ |
| OLD | NEW |