src/share/vm/opto/live.cpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "incls/_precompiled.incl"
  26 #include "incls/_live.cpp.incl"




  27 
  28 
  29 
  30 //=============================================================================
  31 //------------------------------PhaseLive--------------------------------------
  32 // Compute live-in/live-out.  We use a totally incremental algorithm.  The LIVE
  33 // problem is monotonic.  The steady-state solution looks like this: pull a
  34 // block from the worklist.  It has a set of delta's - values which are newly
  35 // live-in from the block.  Push these to the live-out sets of all predecessor
  36 // blocks.  At each predecessor, the new live-out values are ANDed with what is
  37 // already live-out (extra stuff is added to the live-out sets).  Then the
  38 // remaining new live-out values are ANDed with what is locally defined.
  39 // Leftover bits become the new live-in for the predecessor block, and the pred
  40 // block is put on the worklist.
  41 //   The locally live-in stuff is computed once and added to predecessor
  42 // live-out sets.  This separate compilation is done in the outer loop below.
  43 PhaseLive::PhaseLive( const PhaseCFG &cfg, LRG_List &names, Arena *arena ) : Phase(LIVE), _cfg(cfg), _names(names), _arena(arena), _live(0) {
  44 }
  45 
  46 void PhaseLive::compute(uint maxlrg) {


   1 /*
   2  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "memory/allocation.inline.hpp"
  27 #include "opto/callnode.hpp"
  28 #include "opto/chaitin.hpp"
  29 #include "opto/live.hpp"
  30 #include "opto/machnode.hpp"
  31 
  32 
  33 
  34 //=============================================================================
  35 //------------------------------PhaseLive--------------------------------------
  36 // Compute live-in/live-out.  We use a totally incremental algorithm.  The LIVE
  37 // problem is monotonic.  The steady-state solution looks like this: pull a
  38 // block from the worklist.  It has a set of delta's - values which are newly
  39 // live-in from the block.  Push these to the live-out sets of all predecessor
  40 // blocks.  At each predecessor, the new live-out values are ANDed with what is
  41 // already live-out (extra stuff is added to the live-out sets).  Then the
  42 // remaining new live-out values are ANDed with what is locally defined.
  43 // Leftover bits become the new live-in for the predecessor block, and the pred
  44 // block is put on the worklist.
  45 //   The locally live-in stuff is computed once and added to predecessor
  46 // live-out sets.  This separate compilation is done in the outer loop below.
  47 PhaseLive::PhaseLive( const PhaseCFG &cfg, LRG_List &names, Arena *arena ) : Phase(LIVE), _cfg(cfg), _names(names), _arena(arena), _live(0) {
  48 }
  49 
  50 void PhaseLive::compute(uint maxlrg) {