| 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 #include "vm/flow_graph_allocator.h" | 5 #include "vm/flow_graph_allocator.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 #include "vm/il_printer.h" | 9 #include "vm/il_printer.h" |
| 10 #include "vm/flow_graph.h" | 10 #include "vm/flow_graph.h" |
| (...skipping 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1763 | 1763 |
| 1764 TRACE_ALLOC(OS::Print("range [%d, %d) for v%d has been allocated to ", | 1764 TRACE_ALLOC(OS::Print("range [%d, %d) for v%d has been allocated to ", |
| 1765 range->Start(), range->End(), range->vreg())); | 1765 range->Start(), range->End(), range->vreg())); |
| 1766 TRACE_ALLOC(loc.Print()); | 1766 TRACE_ALLOC(loc.Print()); |
| 1767 TRACE_ALLOC(OS::Print(":\n")); | 1767 TRACE_ALLOC(OS::Print(":\n")); |
| 1768 | 1768 |
| 1769 for (UsePosition* use = range->first_use(); use != NULL; use = use->next()) { | 1769 for (UsePosition* use = range->first_use(); use != NULL; use = use->next()) { |
| 1770 ConvertUseTo(use, loc); | 1770 ConvertUseTo(use, loc); |
| 1771 } | 1771 } |
| 1772 | 1772 |
| 1773 // Add live registers at all safepoints for instructions with slow-path |
| 1774 // code. |
| 1773 if (loc.IsMachineRegister()) { | 1775 if (loc.IsMachineRegister()) { |
| 1774 for (SafepointPosition* safepoint = range->first_safepoint(); | 1776 for (SafepointPosition* safepoint = range->first_safepoint(); |
| 1775 safepoint != NULL; | 1777 safepoint != NULL; |
| 1776 safepoint = safepoint->next()) { | 1778 safepoint = safepoint->next()) { |
| 1777 safepoint->locs()->live_registers()->Add(loc); | 1779 if (!safepoint->locs()->always_calls()) { |
| 1780 ASSERT(safepoint->locs()->can_call()); |
| 1781 safepoint->locs()->live_registers()->Add(loc); |
| 1782 } |
| 1778 } | 1783 } |
| 1779 } | 1784 } |
| 1780 } | 1785 } |
| 1781 | 1786 |
| 1782 | 1787 |
| 1783 void FlowGraphAllocator::AdvanceActiveIntervals(const intptr_t start) { | 1788 void FlowGraphAllocator::AdvanceActiveIntervals(const intptr_t start) { |
| 1784 for (intptr_t reg = 0; reg < NumberOfRegisters(); reg++) { | 1789 for (intptr_t reg = 0; reg < NumberOfRegisters(); reg++) { |
| 1785 if (registers_[reg].is_empty()) continue; | 1790 if (registers_[reg].is_empty()) continue; |
| 1786 | 1791 |
| 1787 intptr_t first_evicted = -1; | 1792 intptr_t first_evicted = -1; |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2147 OS::Print("-- [after ssa allocator] ir [%s] -------------\n", | 2152 OS::Print("-- [after ssa allocator] ir [%s] -------------\n", |
| 2148 function.ToFullyQualifiedCString()); | 2153 function.ToFullyQualifiedCString()); |
| 2149 FlowGraphPrinter printer(flow_graph_, true); | 2154 FlowGraphPrinter printer(flow_graph_, true); |
| 2150 printer.PrintBlocks(); | 2155 printer.PrintBlocks(); |
| 2151 OS::Print("----------------------------------------------\n"); | 2156 OS::Print("----------------------------------------------\n"); |
| 2152 } | 2157 } |
| 2153 } | 2158 } |
| 2154 | 2159 |
| 2155 | 2160 |
| 2156 } // namespace dart | 2161 } // namespace dart |
| OLD | NEW |