| 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/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 1985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1996 | 1996 |
| 1997 // We have a very good candidate (either hinted to us or completely free). | 1997 // We have a very good candidate (either hinted to us or completely free). |
| 1998 // If we are in a loop try to reduce number of moves on the back edge by | 1998 // If we are in a loop try to reduce number of moves on the back edge by |
| 1999 // searching for a candidate that does not interfere with phis on the back | 1999 // searching for a candidate that does not interfere with phis on the back |
| 2000 // edge. | 2000 // edge. |
| 2001 BlockInfo* loop_header = BlockInfoAt(unallocated->Start())->loop_header(); | 2001 BlockInfo* loop_header = BlockInfoAt(unallocated->Start())->loop_header(); |
| 2002 if ((unallocated->vreg() >= 0) && | 2002 if ((unallocated->vreg() >= 0) && |
| 2003 (loop_header != NULL) && | 2003 (loop_header != NULL) && |
| 2004 (free_until >= loop_header->last_block()->end_pos()) && | 2004 (free_until >= loop_header->last_block()->end_pos()) && |
| 2005 loop_header->backedge_interference()->Contains(unallocated->vreg())) { | 2005 loop_header->backedge_interference()->Contains(unallocated->vreg())) { |
| 2006 ASSERT(static_cast<intptr_t>(kNumberOfFpuRegisters) <= | 2006 GrowableArray<bool> used_on_backedge(number_of_registers_); |
| 2007 kNumberOfCpuRegisters); | 2007 for (intptr_t i = 0; i < number_of_registers_; i++) { |
| 2008 bool used_on_backedge[kNumberOfCpuRegisters] = { false }; | 2008 used_on_backedge.Add(false); |
| 2009 } |
| 2009 | 2010 |
| 2010 for (PhiIterator it(loop_header->entry()->AsJoinEntry()); | 2011 for (PhiIterator it(loop_header->entry()->AsJoinEntry()); |
| 2011 !it.Done(); | 2012 !it.Done(); |
| 2012 it.Advance()) { | 2013 it.Advance()) { |
| 2013 // TODO(johnmccutchan): Fix handling of PhiInstr with PairLocation. | 2014 // TODO(johnmccutchan): Fix handling of PhiInstr with PairLocation. |
| 2014 PhiInstr* phi = it.Current(); | 2015 PhiInstr* phi = it.Current(); |
| 2015 ASSERT(phi->is_alive()); | 2016 ASSERT(phi->is_alive()); |
| 2016 const intptr_t phi_vreg = phi->ssa_temp_index(); | 2017 const intptr_t phi_vreg = phi->ssa_temp_index(); |
| 2017 LiveRange* range = GetLiveRange(phi_vreg); | 2018 LiveRange* range = GetLiveRange(phi_vreg); |
| 2018 if (range->assigned_location().kind() == register_kind_) { | 2019 if (range->assigned_location().kind() == register_kind_) { |
| (...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2786 OS::Print("-- [after ssa allocator] ir [%s] -------------\n", | 2787 OS::Print("-- [after ssa allocator] ir [%s] -------------\n", |
| 2787 function.ToFullyQualifiedCString()); | 2788 function.ToFullyQualifiedCString()); |
| 2788 FlowGraphPrinter printer(flow_graph_, true); | 2789 FlowGraphPrinter printer(flow_graph_, true); |
| 2789 printer.PrintBlocks(); | 2790 printer.PrintBlocks(); |
| 2790 OS::Print("----------------------------------------------\n"); | 2791 OS::Print("----------------------------------------------\n"); |
| 2791 } | 2792 } |
| 2792 } | 2793 } |
| 2793 | 2794 |
| 2794 | 2795 |
| 2795 } // namespace dart | 2796 } // namespace dart |
| OLD | NEW |