| 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 ReplaceBlock(BlockEntryInstr* old_block, BlockEntryInstr* new_block); |
| 155 |
| 153 // DiscoverBlocks computes parent_ and assigned_vars_ which are then used | 156 // DiscoverBlocks computes parent_ and assigned_vars_ which are then used |
| 154 // if/when computing SSA. | 157 // if/when computing SSA. |
| 155 GrowableArray<intptr_t> parent_; | 158 GrowableArray<intptr_t> parent_; |
| 156 GrowableArray<BitVector*> assigned_vars_; | 159 GrowableArray<BitVector*> assigned_vars_; |
| 157 | 160 |
| 158 intptr_t current_ssa_temp_index_; | 161 intptr_t current_ssa_temp_index_; |
| 159 intptr_t max_block_id_; | 162 intptr_t max_block_id_; |
| 160 | 163 |
| 161 // Flow graph fields. | 164 // Flow graph fields. |
| 162 const ParsedFunction& parsed_function_; | 165 const ParsedFunction& parsed_function_; |
| 163 const intptr_t num_copied_params_; | 166 const intptr_t num_copied_params_; |
| 164 const intptr_t num_non_copied_params_; | 167 const intptr_t num_non_copied_params_; |
| 165 const intptr_t num_stack_locals_; | 168 const intptr_t num_stack_locals_; |
| 166 GraphEntryInstr* graph_entry_; | 169 GraphEntryInstr* graph_entry_; |
| 167 GrowableArray<BlockEntryInstr*> preorder_; | 170 GrowableArray<BlockEntryInstr*> preorder_; |
| 168 GrowableArray<BlockEntryInstr*> postorder_; | 171 GrowableArray<BlockEntryInstr*> postorder_; |
| 169 GrowableArray<BlockEntryInstr*> reverse_postorder_; | 172 GrowableArray<BlockEntryInstr*> reverse_postorder_; |
| 170 ZoneGrowableArray<ReturnInstr*>* exits_; | 173 ZoneGrowableArray<ReturnInstr*>* exits_; |
| 174 bool invalid_dominator_tree_; |
| 171 }; | 175 }; |
| 172 | 176 |
| 173 } // namespace dart | 177 } // namespace dart |
| 174 | 178 |
| 175 #endif // VM_FLOW_GRAPH_H_ | 179 #endif // VM_FLOW_GRAPH_H_ |
| OLD | NEW |