| 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_OPTIMIZER_H_ | 5 #ifndef VM_FLOW_GRAPH_OPTIMIZER_H_ |
| 6 #define VM_FLOW_GRAPH_OPTIMIZER_H_ | 6 #define VM_FLOW_GRAPH_OPTIMIZER_H_ |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 #include "vm/flow_graph.h" | 9 #include "vm/flow_graph.h" |
| 10 | 10 |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 BlockEntryInstr* header, | 148 BlockEntryInstr* header, |
| 149 BlockEntryInstr* pre_header, | 149 BlockEntryInstr* pre_header, |
| 150 CheckSmiInstr* current); | 150 CheckSmiInstr* current); |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 | 153 |
| 154 // A simple common subexpression elimination based | 154 // A simple common subexpression elimination based |
| 155 // on the dominator tree. | 155 // on the dominator tree. |
| 156 class DominatorBasedCSE : public AllStatic { | 156 class DominatorBasedCSE : public AllStatic { |
| 157 public: | 157 public: |
| 158 static void Optimize(FlowGraph* graph); | 158 // Return true, if the optimization changed the flow graph. |
| 159 // False, if nothing changed. |
| 160 static bool Optimize(FlowGraph* graph); |
| 159 | 161 |
| 160 private: | 162 private: |
| 161 static void OptimizeRecursive( | 163 static bool OptimizeRecursive( |
| 162 BlockEntryInstr* entry, | 164 BlockEntryInstr* entry, |
| 163 DirectChainedHashMap<Instruction*>* map); | 165 DirectChainedHashMap<Instruction*>* map); |
| 164 }; | 166 }; |
| 165 | 167 |
| 166 | 168 |
| 167 // Sparse conditional constant propagation and unreachable code elimination. | 169 // Sparse conditional constant propagation and unreachable code elimination. |
| 168 // Assumes that use lists are computed and preserves them. | 170 // Assumes that use lists are computed and preserves them. |
| 169 class ConstantPropagator : public FlowGraphVisitor { | 171 class ConstantPropagator : public FlowGraphVisitor { |
| 170 public: | 172 public: |
| 171 ConstantPropagator(FlowGraph* graph, | 173 ConstantPropagator(FlowGraph* graph, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 | 222 |
| 221 // Worklists of blocks and definitions. | 223 // Worklists of blocks and definitions. |
| 222 GrowableArray<BlockEntryInstr*> block_worklist_; | 224 GrowableArray<BlockEntryInstr*> block_worklist_; |
| 223 GrowableArray<Definition*> definition_worklist_; | 225 GrowableArray<Definition*> definition_worklist_; |
| 224 }; | 226 }; |
| 225 | 227 |
| 226 | 228 |
| 227 } // namespace dart | 229 } // namespace dart |
| 228 | 230 |
| 229 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ | 231 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ |
| OLD | NEW |