| 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 |
| 11 namespace dart { | 11 namespace dart { |
| 12 | 12 |
| 13 class BlockEntryInstr; | 13 class BlockEntryInstr; |
| 14 class ConstantInstr; |
| 14 class Definition; | 15 class Definition; |
| 15 class FlowGraphBuilder; | 16 class FlowGraphBuilder; |
| 16 class GraphEntryInstr; | 17 class GraphEntryInstr; |
| 17 class PhiInstr; | 18 class PhiInstr; |
| 18 class ReturnInstr; | 19 class ReturnInstr; |
| 19 | 20 |
| 20 class BlockIterator : public ValueObject { | 21 class BlockIterator : public ValueObject { |
| 21 public: | 22 public: |
| 22 explicit BlockIterator(const GrowableArray<BlockEntryInstr*>& block_order) | 23 explicit BlockIterator(const GrowableArray<BlockEntryInstr*>& block_order) |
| 23 : block_order_(block_order), current_(0) { } | 24 : block_order_(block_order), current_(0) { } |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 return graph_entry_; | 98 return graph_entry_; |
| 98 } | 99 } |
| 99 | 100 |
| 100 ZoneGrowableArray<ReturnInstr*>* exits() const { return exits_; } | 101 ZoneGrowableArray<ReturnInstr*>* exits() const { return exits_; } |
| 101 void set_exits(ZoneGrowableArray<ReturnInstr*>* exits) { exits_ = exits; } | 102 void set_exits(ZoneGrowableArray<ReturnInstr*>* exits) { exits_ = exits; } |
| 102 | 103 |
| 103 intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; } | 104 intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; } |
| 104 | 105 |
| 105 intptr_t InstructionCount() const; | 106 intptr_t InstructionCount() const; |
| 106 | 107 |
| 108 ConstantInstr* AddConstantToInitialDefinitions(const Object& object); |
| 109 |
| 107 // Operations on the flow graph. | 110 // Operations on the flow graph. |
| 108 void ComputeSSA(intptr_t next_virtual_register_number); | 111 void ComputeSSA(intptr_t next_virtual_register_number, |
| 112 GrowableArray<Definition*>* inlining_parameters); |
| 109 void ComputeUseLists(); | 113 void ComputeUseLists(); |
| 110 | 114 |
| 111 // Finds natural loops in the flow graph and attaches a list of loop | 115 // Finds natural loops in the flow graph and attaches a list of loop |
| 112 // body blocks for each loop header. | 116 // body blocks for each loop header. |
| 113 void ComputeLoops(GrowableArray<BlockEntryInstr*>* loop_headers); | 117 void ComputeLoops(GrowableArray<BlockEntryInstr*>* loop_headers); |
| 114 | 118 |
| 115 void InlineCall(Definition* call, FlowGraph* callee_graph); | 119 void InlineCall(Definition* call, FlowGraph* callee_graph); |
| 116 void RepairGraphAfterInlining(); | 120 void RepairGraphAfterInlining(); |
| 117 | 121 |
| 118 // TODO(zerny): Once the SSA is feature complete this should be removed. | 122 // TODO(zerny): Once the SSA is feature complete this should be removed. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 131 | 135 |
| 132 // SSA transformation methods and fields. | 136 // SSA transformation methods and fields. |
| 133 void ComputeDominators(GrowableArray<BitVector*>* dominance_frontier); | 137 void ComputeDominators(GrowableArray<BitVector*>* dominance_frontier); |
| 134 | 138 |
| 135 void CompressPath( | 139 void CompressPath( |
| 136 intptr_t start_index, | 140 intptr_t start_index, |
| 137 intptr_t current_index, | 141 intptr_t current_index, |
| 138 GrowableArray<intptr_t>* parent, | 142 GrowableArray<intptr_t>* parent, |
| 139 GrowableArray<intptr_t>* label); | 143 GrowableArray<intptr_t>* label); |
| 140 | 144 |
| 141 void Rename(GrowableArray<PhiInstr*>* live_phis); | 145 void Rename(GrowableArray<PhiInstr*>* live_phis, |
| 146 GrowableArray<Definition*>* inlining_parameters); |
| 142 void RenameRecursive( | 147 void RenameRecursive( |
| 143 BlockEntryInstr* block_entry, | 148 BlockEntryInstr* block_entry, |
| 144 GrowableArray<Definition*>* env, | 149 GrowableArray<Definition*>* env, |
| 145 GrowableArray<PhiInstr*>* live_phis); | 150 GrowableArray<PhiInstr*>* live_phis); |
| 146 | 151 |
| 147 void InsertPhis( | 152 void InsertPhis( |
| 148 const GrowableArray<BlockEntryInstr*>& preorder, | 153 const GrowableArray<BlockEntryInstr*>& preorder, |
| 149 const GrowableArray<BitVector*>& assigned_vars, | 154 const GrowableArray<BitVector*>& assigned_vars, |
| 150 const GrowableArray<BitVector*>& dom_frontier); | 155 const GrowableArray<BitVector*>& dom_frontier); |
| 151 | 156 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 171 GrowableArray<BlockEntryInstr*> preorder_; | 176 GrowableArray<BlockEntryInstr*> preorder_; |
| 172 GrowableArray<BlockEntryInstr*> postorder_; | 177 GrowableArray<BlockEntryInstr*> postorder_; |
| 173 GrowableArray<BlockEntryInstr*> reverse_postorder_; | 178 GrowableArray<BlockEntryInstr*> reverse_postorder_; |
| 174 ZoneGrowableArray<ReturnInstr*>* exits_; | 179 ZoneGrowableArray<ReturnInstr*>* exits_; |
| 175 bool invalid_dominator_tree_; | 180 bool invalid_dominator_tree_; |
| 176 }; | 181 }; |
| 177 | 182 |
| 178 } // namespace dart | 183 } // namespace dart |
| 179 | 184 |
| 180 #endif // VM_FLOW_GRAPH_H_ | 185 #endif // VM_FLOW_GRAPH_H_ |
| OLD | NEW |