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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 // Rewrite branches to eliminate materialization of boolean values after | 317 // Rewrite branches to eliminate materialization of boolean values after |
318 // inlining, and to expose other optimizations (e.g., constant folding of | 318 // inlining, and to expose other optimizations (e.g., constant folding of |
319 // branches, unreachable code elimination). | 319 // branches, unreachable code elimination). |
320 class BranchSimplifier : public AllStatic { | 320 class BranchSimplifier : public AllStatic { |
321 public: | 321 public: |
322 static void Simplify(FlowGraph* flow_graph); | 322 static void Simplify(FlowGraph* flow_graph); |
323 | 323 |
324 // Replace a target entry instruction with a join entry instruction. Does | 324 // Replace a target entry instruction with a join entry instruction. Does |
325 // not update the original target's predecessors to point to the new block | 325 // not update the original target's predecessors to point to the new block |
326 // and does not replace the target in already computed block order lists. | 326 // and does not replace the target in already computed block order lists. |
327 static JoinEntryInstr* ToJoinEntry(Isolate* isolate, | 327 static JoinEntryInstr* ToJoinEntry(Zone* zone, |
328 TargetEntryInstr* target); | 328 TargetEntryInstr* target); |
329 | 329 |
330 private: | 330 private: |
331 // Match an instance of the pattern to rewrite. See the implementation | 331 // Match an instance of the pattern to rewrite. See the implementation |
332 // for the patterns that are handled by this pass. | 332 // for the patterns that are handled by this pass. |
333 static bool Match(JoinEntryInstr* block); | 333 static bool Match(JoinEntryInstr* block); |
334 | 334 |
335 // Duplicate a branch while replacing its comparison's left and right | 335 // Duplicate a branch while replacing its comparison's left and right |
336 // inputs. | 336 // inputs. |
337 static BranchInstr* CloneBranch(Isolate* isolate, | 337 static BranchInstr* CloneBranch(Zone* zone, |
338 BranchInstr* branch, | 338 BranchInstr* branch, |
339 Value* new_left, | 339 Value* new_left, |
340 Value* new_right); | 340 Value* new_right); |
341 }; | 341 }; |
342 | 342 |
343 | 343 |
344 // Rewrite diamond control flow patterns that materialize values to use more | 344 // Rewrite diamond control flow patterns that materialize values to use more |
345 // efficient branchless code patterns if such are supported on the current | 345 // efficient branchless code patterns if such are supported on the current |
346 // platform. | 346 // platform. |
347 class IfConverter : public AllStatic { | 347 class IfConverter : public AllStatic { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 // Optimize spill stores inside try-blocks by identifying values that always | 426 // Optimize spill stores inside try-blocks by identifying values that always |
427 // contain a single known constant at catch block entry. | 427 // contain a single known constant at catch block entry. |
428 class TryCatchAnalyzer : public AllStatic { | 428 class TryCatchAnalyzer : public AllStatic { |
429 public: | 429 public: |
430 static void Optimize(FlowGraph* flow_graph); | 430 static void Optimize(FlowGraph* flow_graph); |
431 }; | 431 }; |
432 | 432 |
433 } // namespace dart | 433 } // namespace dart |
434 | 434 |
435 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ | 435 #endif // VM_FLOW_GRAPH_OPTIMIZER_H_ |
OLD | NEW |