OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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/parser.h" | 9 #include "vm/parser.h" |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 return postorder_; | 49 return postorder_; |
50 } | 50 } |
51 const GrowableArray<BlockEntryInstr*>& reverse_postorder() const { | 51 const GrowableArray<BlockEntryInstr*>& reverse_postorder() const { |
52 return reverse_postorder_; | 52 return reverse_postorder_; |
53 } | 53 } |
54 | 54 |
55 intptr_t max_virtual_register_number() const { | 55 intptr_t max_virtual_register_number() const { |
56 return current_ssa_temp_index(); | 56 return current_ssa_temp_index(); |
57 } | 57 } |
58 | 58 |
| 59 intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; } |
| 60 |
59 // Operations on the flow graph. | 61 // Operations on the flow graph. |
60 void ComputeSSA(); | 62 void ComputeSSA(); |
61 | 63 |
62 // TODO(zerny): Once the SSA is feature complete this should be removed. | 64 // TODO(zerny): Once the SSA is feature complete this should be removed. |
63 void Bailout(const char* reason) const; | 65 void Bailout(const char* reason) const; |
64 | 66 |
65 private: | 67 private: |
66 void DiscoverBlocks(); | 68 void DiscoverBlocks(); |
67 | 69 |
68 // SSA transformation methods and fields. | 70 // SSA transformation methods and fields. |
(...skipping 15 matching lines...) Expand all Loading... |
84 GrowableArray<PhiInstr*>* live_phis); | 86 GrowableArray<PhiInstr*>* live_phis); |
85 | 87 |
86 void InsertPhis( | 88 void InsertPhis( |
87 const GrowableArray<BlockEntryInstr*>& preorder, | 89 const GrowableArray<BlockEntryInstr*>& preorder, |
88 const GrowableArray<BitVector*>& assigned_vars, | 90 const GrowableArray<BitVector*>& assigned_vars, |
89 const GrowableArray<BitVector*>& dom_frontier); | 91 const GrowableArray<BitVector*>& dom_frontier); |
90 | 92 |
91 void MarkLivePhis(GrowableArray<PhiInstr*>* live_phis); | 93 void MarkLivePhis(GrowableArray<PhiInstr*>* live_phis); |
92 | 94 |
93 intptr_t current_ssa_temp_index() const { return current_ssa_temp_index_; } | 95 intptr_t current_ssa_temp_index() const { return current_ssa_temp_index_; } |
94 intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; } | |
95 | 96 |
96 // DiscoverBlocks computes parent_ and assigned_vars_ which are then used | 97 // DiscoverBlocks computes parent_ and assigned_vars_ which are then used |
97 // if/when computing SSA. | 98 // if/when computing SSA. |
98 GrowableArray<intptr_t> parent_; | 99 GrowableArray<intptr_t> parent_; |
99 GrowableArray<BitVector*> assigned_vars_; | 100 GrowableArray<BitVector*> assigned_vars_; |
100 | 101 |
101 intptr_t current_ssa_temp_index_; | 102 intptr_t current_ssa_temp_index_; |
102 | 103 |
103 // Flow graph fields. | 104 // Flow graph fields. |
104 const ParsedFunction& parsed_function_; | 105 const ParsedFunction& parsed_function_; |
105 const intptr_t copied_parameter_count_; | 106 const intptr_t copied_parameter_count_; |
106 const intptr_t non_copied_parameter_count_; | 107 const intptr_t non_copied_parameter_count_; |
107 const intptr_t stack_local_count_; | 108 const intptr_t stack_local_count_; |
108 GraphEntryInstr* graph_entry_; | 109 GraphEntryInstr* graph_entry_; |
109 GrowableArray<BlockEntryInstr*> preorder_; | 110 GrowableArray<BlockEntryInstr*> preorder_; |
110 GrowableArray<BlockEntryInstr*> postorder_; | 111 GrowableArray<BlockEntryInstr*> postorder_; |
111 GrowableArray<BlockEntryInstr*> reverse_postorder_; | 112 GrowableArray<BlockEntryInstr*> reverse_postorder_; |
112 }; | 113 }; |
113 | 114 |
114 } // namespace dart | 115 } // namespace dart |
115 | 116 |
116 #endif // VM_FLOW_GRAPH_H_ | 117 #endif // VM_FLOW_GRAPH_H_ |
OLD | NEW |