| 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 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 // Replace a target entry instruction with a join entry instruction. Does | 294 // Replace a target entry instruction with a join entry instruction. Does |
| 295 // not update the original target's predecessors to point to the new block | 295 // not update the original target's predecessors to point to the new block |
| 296 // and does not replace the target in already computed block order lists. | 296 // and does not replace the target in already computed block order lists. |
| 297 static JoinEntryInstr* ToJoinEntry(TargetEntryInstr* target); | 297 static JoinEntryInstr* ToJoinEntry(TargetEntryInstr* target); |
| 298 | 298 |
| 299 private: | 299 private: |
| 300 // Match an instance of the pattern to rewrite. See the implementation | 300 // Match an instance of the pattern to rewrite. See the implementation |
| 301 // for the patterns that are handled by this pass. | 301 // for the patterns that are handled by this pass. |
| 302 static bool Match(JoinEntryInstr* block); | 302 static bool Match(JoinEntryInstr* block); |
| 303 | 303 |
| 304 // Duplicate a constant, assigning it a new SSA name. | |
| 305 static ConstantInstr* CloneConstant(FlowGraph* flow_graph, | |
| 306 ConstantInstr* constant); | |
| 307 | |
| 308 // Duplicate a branch while replacing its comparison's left and right | 304 // Duplicate a branch while replacing its comparison's left and right |
| 309 // inputs. | 305 // inputs. |
| 310 static BranchInstr* CloneBranch(BranchInstr* branch, | 306 static BranchInstr* CloneBranch(BranchInstr* branch, |
| 311 Value* left, | 307 Value* left, |
| 312 Value* right); | 308 Value* right); |
| 313 }; | 309 }; |
| 314 | 310 |
| 315 | 311 |
| 316 // Rewrite diamond control flow patterns that materialize values to use more | 312 // Rewrite diamond control flow patterns that materialize values to use more |
| 317 // efficient branchless code patterns if such are supported on the current | 313 // efficient branchless code patterns if such are supported on the current |
| 318 // platform. | 314 // platform. |
| 319 class IfConverter : public AllStatic { | 315 class IfConverter : public AllStatic { |
| 320 public: | 316 public: |
| 321 static void Simplify(FlowGraph* flow_graph); | 317 static void Simplify(FlowGraph* flow_graph); |
| 322 }; | 318 }; |
| 323 | 319 |
| 324 | 320 |
| 325 } // namespace dart | 321 } // namespace dart |
| 326 | 322 |
| 327 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ | 323 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ |
| OLD | NEW |