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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 // Operations on the flow graph. | 107 // Operations on the flow graph. |
108 void ComputeSSA(intptr_t next_virtual_register_number); | 108 void ComputeSSA(intptr_t next_virtual_register_number); |
109 void ComputeUseLists(); | 109 void ComputeUseLists(); |
110 | 110 |
111 // Finds natural loops in the flow graph and attaches a list of loop | 111 // Finds natural loops in the flow graph and attaches a list of loop |
112 // body blocks for each loop header. | 112 // body blocks for each loop header. |
113 void ComputeLoops(GrowableArray<BlockEntryInstr*>* loop_headers); | 113 void ComputeLoops(GrowableArray<BlockEntryInstr*>* loop_headers); |
114 | 114 |
115 void InlineCall(Definition* call, FlowGraph* callee_graph); | 115 void InlineCall(Definition* call, FlowGraph* callee_graph); |
| 116 void RepairGraphAfterInlining(); |
116 | 117 |
117 // TODO(zerny): Once the SSA is feature complete this should be removed. | 118 // TODO(zerny): Once the SSA is feature complete this should be removed. |
118 void Bailout(const char* reason) const; | 119 void Bailout(const char* reason) const; |
119 | 120 |
120 #ifdef DEBUG | 121 #ifdef DEBUG |
121 // Validation methods for debugging. | 122 // Validation methods for debugging. |
122 bool ResetUseLists(); | 123 bool ResetUseLists(); |
123 bool ValidateUseLists(); | 124 bool ValidateUseLists(); |
124 #endif // DEBUG | 125 #endif // DEBUG |
125 | 126 |
(...skipping 17 matching lines...) Expand all Loading... |
143 GrowableArray<Definition*>* env, | 144 GrowableArray<Definition*>* env, |
144 GrowableArray<PhiInstr*>* live_phis); | 145 GrowableArray<PhiInstr*>* live_phis); |
145 | 146 |
146 void InsertPhis( | 147 void InsertPhis( |
147 const GrowableArray<BlockEntryInstr*>& preorder, | 148 const GrowableArray<BlockEntryInstr*>& preorder, |
148 const GrowableArray<BitVector*>& assigned_vars, | 149 const GrowableArray<BitVector*>& assigned_vars, |
149 const GrowableArray<BitVector*>& dom_frontier); | 150 const GrowableArray<BitVector*>& dom_frontier); |
150 | 151 |
151 void MarkLivePhis(GrowableArray<PhiInstr*>* live_phis); | 152 void MarkLivePhis(GrowableArray<PhiInstr*>* live_phis); |
152 | 153 |
| 154 void ReplacePredecessor(BlockEntryInstr* old_block, |
| 155 BlockEntryInstr* new_block); |
| 156 |
153 // DiscoverBlocks computes parent_ and assigned_vars_ which are then used | 157 // DiscoverBlocks computes parent_ and assigned_vars_ which are then used |
154 // if/when computing SSA. | 158 // if/when computing SSA. |
155 GrowableArray<intptr_t> parent_; | 159 GrowableArray<intptr_t> parent_; |
156 GrowableArray<BitVector*> assigned_vars_; | 160 GrowableArray<BitVector*> assigned_vars_; |
157 | 161 |
158 intptr_t current_ssa_temp_index_; | 162 intptr_t current_ssa_temp_index_; |
159 intptr_t max_block_id_; | 163 intptr_t max_block_id_; |
160 | 164 |
161 // Flow graph fields. | 165 // Flow graph fields. |
162 const ParsedFunction& parsed_function_; | 166 const ParsedFunction& parsed_function_; |
163 const intptr_t num_copied_params_; | 167 const intptr_t num_copied_params_; |
164 const intptr_t num_non_copied_params_; | 168 const intptr_t num_non_copied_params_; |
165 const intptr_t num_stack_locals_; | 169 const intptr_t num_stack_locals_; |
166 GraphEntryInstr* graph_entry_; | 170 GraphEntryInstr* graph_entry_; |
167 GrowableArray<BlockEntryInstr*> preorder_; | 171 GrowableArray<BlockEntryInstr*> preorder_; |
168 GrowableArray<BlockEntryInstr*> postorder_; | 172 GrowableArray<BlockEntryInstr*> postorder_; |
169 GrowableArray<BlockEntryInstr*> reverse_postorder_; | 173 GrowableArray<BlockEntryInstr*> reverse_postorder_; |
170 ZoneGrowableArray<ReturnInstr*>* exits_; | 174 ZoneGrowableArray<ReturnInstr*>* exits_; |
| 175 bool invalid_dominator_tree_; |
171 }; | 176 }; |
172 | 177 |
173 } // namespace dart | 178 } // namespace dart |
174 | 179 |
175 #endif // VM_FLOW_GRAPH_H_ | 180 #endif // VM_FLOW_GRAPH_H_ |
OLD | NEW |