| 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/parser.h" | 9 #include "vm/parser.h" |
| 10 | 10 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 // Iterators. | 85 // Iterators. |
| 86 BlockIterator reverse_postorder_iterator() const { | 86 BlockIterator reverse_postorder_iterator() const { |
| 87 return BlockIterator(reverse_postorder()); | 87 return BlockIterator(reverse_postorder()); |
| 88 } | 88 } |
| 89 BlockIterator postorder_iterator() const { | 89 BlockIterator postorder_iterator() const { |
| 90 return BlockIterator(postorder()); | 90 return BlockIterator(postorder()); |
| 91 } | 91 } |
| 92 | 92 |
| 93 intptr_t current_ssa_temp_index() const { return current_ssa_temp_index_; } | 93 intptr_t current_ssa_temp_index() const { return current_ssa_temp_index_; } |
| 94 void set_current_ssa_temp_index(intptr_t index) { |
| 95 current_ssa_temp_index_ = index; |
| 96 } |
| 94 | 97 |
| 95 intptr_t max_virtual_register_number() const { | 98 intptr_t max_virtual_register_number() const { |
| 96 return current_ssa_temp_index(); | 99 return current_ssa_temp_index(); |
| 97 } | 100 } |
| 98 | 101 |
| 99 intptr_t max_block_id() const { | 102 intptr_t max_block_id() const { return max_block_id_; } |
| 100 return max_block_id_; | 103 void set_max_block_id(intptr_t id) { max_block_id_ = id; } |
| 101 } | |
| 102 | 104 |
| 103 GraphEntryInstr* graph_entry() const { | 105 GraphEntryInstr* graph_entry() const { |
| 104 return graph_entry_; | 106 return graph_entry_; |
| 105 } | 107 } |
| 106 | 108 |
| 107 ConstantInstr* constant_null() const { | 109 ConstantInstr* constant_null() const { |
| 108 return constant_null_; | 110 return constant_null_; |
| 109 } | 111 } |
| 110 | 112 |
| 111 intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; } | 113 intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; } |
| 112 | 114 |
| 113 intptr_t InstructionCount() const; | 115 intptr_t InstructionCount() const; |
| 114 | 116 |
| 115 ConstantInstr* AddConstantToInitialDefinitions(const Object& object); | 117 ConstantInstr* AddConstantToInitialDefinitions(const Object& object); |
| 116 void AddToInitialDefinitions(Definition* defn); | 118 void AddToInitialDefinitions(Definition* defn); |
| 117 | 119 |
| 118 // Operations on the flow graph. | 120 // Operations on the flow graph. |
| 119 void ComputeSSA(intptr_t next_virtual_register_number, | 121 void ComputeSSA(intptr_t next_virtual_register_number, |
| 120 GrowableArray<Definition*>* inlining_parameters); | 122 GrowableArray<Definition*>* inlining_parameters); |
| 121 void ComputeUseLists(); | 123 void ComputeUseLists(); |
| 122 | 124 |
| 123 // Finds natural loops in the flow graph and attaches a list of loop | 125 // Finds natural loops in the flow graph and attaches a list of loop |
| 124 // body blocks for each loop header. | 126 // body blocks for each loop header. |
| 125 void ComputeLoops(GrowableArray<BlockEntryInstr*>* loop_headers); | 127 void ComputeLoops(GrowableArray<BlockEntryInstr*>* loop_headers); |
| 126 | 128 |
| 127 void InlineCall(Definition* call, | |
| 128 FlowGraph* callee_graph, | |
| 129 ValueInliningContext* inlining_context); | |
| 130 void RepairGraphAfterInlining(); | 129 void RepairGraphAfterInlining(); |
| 131 | 130 |
| 132 // TODO(zerny): Once the SSA is feature complete this should be removed. | 131 // TODO(zerny): Once the SSA is feature complete this should be removed. |
| 133 void Bailout(const char* reason) const; | 132 void Bailout(const char* reason) const; |
| 134 | 133 |
| 134 void InvalidateDominatorTree() { invalid_dominator_tree_ = true; } |
| 135 |
| 135 #ifdef DEBUG | 136 #ifdef DEBUG |
| 136 // Validation methods for debugging. | 137 // Validation methods for debugging. |
| 137 bool ResetUseLists(); | 138 bool ResetUseLists(); |
| 138 bool ValidateUseLists(); | 139 bool ValidateUseLists(); |
| 139 #endif // DEBUG | 140 #endif // DEBUG |
| 140 | 141 |
| 141 private: | 142 private: |
| 142 friend class ConstantPropagator; | 143 friend class ConstantPropagator; |
| 143 | 144 |
| 144 void DiscoverBlocks(); | 145 void DiscoverBlocks(); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 GrowableArray<BlockEntryInstr*> preorder_; | 187 GrowableArray<BlockEntryInstr*> preorder_; |
| 187 GrowableArray<BlockEntryInstr*> postorder_; | 188 GrowableArray<BlockEntryInstr*> postorder_; |
| 188 GrowableArray<BlockEntryInstr*> reverse_postorder_; | 189 GrowableArray<BlockEntryInstr*> reverse_postorder_; |
| 189 bool invalid_dominator_tree_; | 190 bool invalid_dominator_tree_; |
| 190 ConstantInstr* constant_null_; | 191 ConstantInstr* constant_null_; |
| 191 }; | 192 }; |
| 192 | 193 |
| 193 } // namespace dart | 194 } // namespace dart |
| 194 | 195 |
| 195 #endif // VM_FLOW_GRAPH_H_ | 196 #endif // VM_FLOW_GRAPH_H_ |
| OLD | NEW |