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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 | 243 |
240 // DiscoverBlocks computes parent_ and assigned_vars_ which are then used | 244 // DiscoverBlocks computes parent_ and assigned_vars_ which are then used |
241 // if/when computing SSA. | 245 // if/when computing SSA. |
242 GrowableArray<intptr_t> parent_; | 246 GrowableArray<intptr_t> parent_; |
243 GrowableArray<BitVector*> assigned_vars_; | 247 GrowableArray<BitVector*> assigned_vars_; |
244 | 248 |
245 intptr_t current_ssa_temp_index_; | 249 intptr_t current_ssa_temp_index_; |
246 intptr_t max_block_id_; | 250 intptr_t max_block_id_; |
247 | 251 |
248 // Flow graph fields. | 252 // Flow graph fields. |
| 253 const FlowGraphBuilder& builder_; |
249 const ParsedFunction& parsed_function_; | 254 const ParsedFunction& parsed_function_; |
250 const intptr_t num_copied_params_; | 255 const intptr_t num_copied_params_; |
251 const intptr_t num_non_copied_params_; | 256 const intptr_t num_non_copied_params_; |
252 const intptr_t num_stack_locals_; | 257 const intptr_t num_stack_locals_; |
253 GraphEntryInstr* graph_entry_; | 258 GraphEntryInstr* graph_entry_; |
254 GrowableArray<BlockEntryInstr*> preorder_; | 259 GrowableArray<BlockEntryInstr*> preorder_; |
255 GrowableArray<BlockEntryInstr*> postorder_; | 260 GrowableArray<BlockEntryInstr*> postorder_; |
256 GrowableArray<BlockEntryInstr*> reverse_postorder_; | 261 GrowableArray<BlockEntryInstr*> reverse_postorder_; |
257 GrowableArray<BlockEntryInstr*> optimized_block_order_; | 262 GrowableArray<BlockEntryInstr*> optimized_block_order_; |
258 ConstantInstr* constant_null_; | 263 ConstantInstr* constant_null_; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 // Per block sets of available blocks. Block A is available at the block B if | 367 // Per block sets of available blocks. Block A is available at the block B if |
363 // and only if A dominates B and all paths from A to B are free of side | 368 // and only if A dominates B and all paths from A to B are free of side |
364 // effects. | 369 // effects. |
365 GrowableArray<BitVector*> available_at_; | 370 GrowableArray<BitVector*> available_at_; |
366 }; | 371 }; |
367 | 372 |
368 | 373 |
369 } // namespace dart | 374 } // namespace dart |
370 | 375 |
371 #endif // VM_FLOW_GRAPH_H_ | 376 #endif // VM_FLOW_GRAPH_H_ |
OLD | NEW |