| 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 #include "vm/constant_propagator.h" | 5 #include "vm/constant_propagator.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/flow_graph_builder.h" | 8 #include "vm/flow_graph_builder.h" |
| 9 #include "vm/flow_graph_compiler.h" | 9 #include "vm/flow_graph_compiler.h" |
| 10 #include "vm/flow_graph_range_analysis.h" | 10 #include "vm/flow_graph_range_analysis.h" |
| (...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1505 graph_->DiscoverBlocks(); | 1505 graph_->DiscoverBlocks(); |
| 1506 // TODO(fschneider): Update dominator tree in place instead of recomputing. | 1506 // TODO(fschneider): Update dominator tree in place instead of recomputing. |
| 1507 GrowableArray<BitVector*> dominance_frontier; | 1507 GrowableArray<BitVector*> dominance_frontier; |
| 1508 graph_->ComputeDominators(&dominance_frontier); | 1508 graph_->ComputeDominators(&dominance_frontier); |
| 1509 } | 1509 } |
| 1510 } | 1510 } |
| 1511 | 1511 |
| 1512 | 1512 |
| 1513 void ConstantPropagator::Transform() { | 1513 void ConstantPropagator::Transform() { |
| 1514 if (FLAG_trace_constant_propagation) { | 1514 if (FLAG_trace_constant_propagation) { |
| 1515 OS::Print("\n==== Before constant propagation ====\n"); | 1515 FlowGraphPrinter::PrintGraph("Before CP", graph_); |
| 1516 FlowGraphPrinter printer(*graph_); | |
| 1517 printer.PrintBlocks(); | |
| 1518 } | 1516 } |
| 1519 | 1517 |
| 1520 // We will recompute dominators, block ordering, block ids, block last | 1518 // We will recompute dominators, block ordering, block ids, block last |
| 1521 // instructions, previous pointers, predecessors, etc. after eliminating | 1519 // instructions, previous pointers, predecessors, etc. after eliminating |
| 1522 // unreachable code. We do not maintain those properties during the | 1520 // unreachable code. We do not maintain those properties during the |
| 1523 // transformation. | 1521 // transformation. |
| 1524 for (BlockIterator b = graph_->reverse_postorder_iterator(); | 1522 for (BlockIterator b = graph_->reverse_postorder_iterator(); |
| 1525 !b.Done(); | 1523 !b.Done(); |
| 1526 b.Advance()) { | 1524 b.Advance()) { |
| 1527 BlockEntryInstr* block = b.Current(); | 1525 BlockEntryInstr* block = b.Current(); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1655 } | 1653 } |
| 1656 } | 1654 } |
| 1657 } | 1655 } |
| 1658 | 1656 |
| 1659 graph_->DiscoverBlocks(); | 1657 graph_->DiscoverBlocks(); |
| 1660 graph_->MergeBlocks(); | 1658 graph_->MergeBlocks(); |
| 1661 GrowableArray<BitVector*> dominance_frontier; | 1659 GrowableArray<BitVector*> dominance_frontier; |
| 1662 graph_->ComputeDominators(&dominance_frontier); | 1660 graph_->ComputeDominators(&dominance_frontier); |
| 1663 | 1661 |
| 1664 if (FLAG_trace_constant_propagation) { | 1662 if (FLAG_trace_constant_propagation) { |
| 1665 OS::Print("\n==== After constant propagation ====\n"); | 1663 FlowGraphPrinter::PrintGraph("After CP", graph_); |
| 1666 FlowGraphPrinter printer(*graph_); | |
| 1667 printer.PrintBlocks(); | |
| 1668 } | 1664 } |
| 1669 } | 1665 } |
| 1670 | 1666 |
| 1671 } // namespace dart | 1667 } // namespace dart |
| OLD | NEW |