| 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 |
| 51 // Function properties. | 55 // Function properties. |
| 52 const ParsedFunction& parsed_function() const { | 56 const ParsedFunction& parsed_function() const { |
| 53 return parsed_function_; | 57 return parsed_function_; |
| 54 } | 58 } |
| 55 intptr_t parameter_count() const { | 59 intptr_t parameter_count() const { |
| 56 return num_copied_params_ + num_non_copied_params_; | 60 return num_copied_params_ + num_non_copied_params_; |
| 57 } | 61 } |
| 58 intptr_t variable_count() const { | 62 intptr_t variable_count() const { |
| 59 return parameter_count() + num_stack_locals_; | 63 return parameter_count() + num_stack_locals_; |
| 60 } | 64 } |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 | 239 |
| 236 // DiscoverBlocks computes parent_ and assigned_vars_ which are then used | 240 // DiscoverBlocks computes parent_ and assigned_vars_ which are then used |
| 237 // if/when computing SSA. | 241 // if/when computing SSA. |
| 238 GrowableArray<intptr_t> parent_; | 242 GrowableArray<intptr_t> parent_; |
| 239 GrowableArray<BitVector*> assigned_vars_; | 243 GrowableArray<BitVector*> assigned_vars_; |
| 240 | 244 |
| 241 intptr_t current_ssa_temp_index_; | 245 intptr_t current_ssa_temp_index_; |
| 242 intptr_t max_block_id_; | 246 intptr_t max_block_id_; |
| 243 | 247 |
| 244 // Flow graph fields. | 248 // Flow graph fields. |
| 249 const FlowGraphBuilder& builder_; |
| 245 const ParsedFunction& parsed_function_; | 250 const ParsedFunction& parsed_function_; |
| 246 const intptr_t num_copied_params_; | 251 const intptr_t num_copied_params_; |
| 247 const intptr_t num_non_copied_params_; | 252 const intptr_t num_non_copied_params_; |
| 248 const intptr_t num_stack_locals_; | 253 const intptr_t num_stack_locals_; |
| 249 GraphEntryInstr* graph_entry_; | 254 GraphEntryInstr* graph_entry_; |
| 250 GrowableArray<BlockEntryInstr*> preorder_; | 255 GrowableArray<BlockEntryInstr*> preorder_; |
| 251 GrowableArray<BlockEntryInstr*> postorder_; | 256 GrowableArray<BlockEntryInstr*> postorder_; |
| 252 GrowableArray<BlockEntryInstr*> reverse_postorder_; | 257 GrowableArray<BlockEntryInstr*> reverse_postorder_; |
| 253 GrowableArray<BlockEntryInstr*> optimized_block_order_; | 258 GrowableArray<BlockEntryInstr*> optimized_block_order_; |
| 254 ConstantInstr* constant_null_; | 259 ConstantInstr* constant_null_; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 // Per block sets of available blocks. Block A is available at the block B if | 363 // Per block sets of available blocks. Block A is available at the block B if |
| 359 // and only if A dominates B and all paths from A to B are free of side | 364 // and only if A dominates B and all paths from A to B are free of side |
| 360 // effects. | 365 // effects. |
| 361 GrowableArray<BitVector*> available_at_; | 366 GrowableArray<BitVector*> available_at_; |
| 362 }; | 367 }; |
| 363 | 368 |
| 364 | 369 |
| 365 } // namespace dart | 370 } // namespace dart |
| 366 | 371 |
| 367 #endif // VM_FLOW_GRAPH_H_ | 372 #endif // VM_FLOW_GRAPH_H_ |
| OLD | NEW |