286N/A/*
286N/A * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
286N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
286N/A *
286N/A * This code is free software; you can redistribute it and/or modify it
286N/A * under the terms of the GNU General Public License version 2 only, as
286N/A * published by the Free Software Foundation.
286N/A *
286N/A * This code is distributed in the hope that it will be useful, but WITHOUT
286N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
286N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
286N/A * version 2 for more details (a copy is included in the LICENSE file that
286N/A * accompanied this code).
286N/A *
286N/A * You should have received a copy of the GNU General Public License version
286N/A * 2 along with this work; if not, write to the Free Software Foundation,
286N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
286N/A *
286N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
286N/A * or visit www.oracle.com if you need additional information or have any
286N/A * questions.
286N/A *
286N/A */
286N/A
286N/A#ifndef SHARE_VM_OPTO_LIVE_HPP
286N/A#define SHARE_VM_OPTO_LIVE_HPP
286N/A
286N/A#include "libadt/port.hpp"
286N/A#include "libadt/vectset.hpp"
286N/A#include "opto/block.hpp"
286N/A#include "opto/indexSet.hpp"
286N/A#include "opto/phase.hpp"
286N/A#include "opto/regmask.hpp"
286N/A
286N/Aclass Block;
286N/Aclass LRG_List;
286N/Aclass PhaseCFG;
286N/Aclass VectorSet;
286N/Aclass IndexSet;
286N/A
286N/A//------------------------------PhaseLive--------------------------------------
286N/A// Compute live-in/live-out
286N/Aclass PhaseLive : public Phase {
286N/A // Array of Sets of values live at the start of a block.
286N/A // Indexed by block pre-order number.
286N/A IndexSet *_live;
286N/A
286N/A // Array of Sets of values defined locally in the block
286N/A // Indexed by block pre-order number.
286N/A IndexSet *_defs;
286N/A
286N/A // Array of delta-set pointers, indexed by block pre-order number
286N/A IndexSet **_deltas;
286N/A IndexSet *_free_IndexSet; // Free list of same
286N/A
286N/A Block_List *_worklist; // Worklist for iterative solution
286N/A
286N/A const PhaseCFG &_cfg; // Basic blocks
286N/A LRG_List &_names; // Mapping from Nodes to live ranges
286N/A uint _maxlrg; // Largest live-range number
286N/A Arena *_arena;
286N/A
286N/A IndexSet *getset( Block *p );
286N/A IndexSet *getfreeset( );
286N/A void freeset( const Block *p );
286N/A void add_liveout( Block *p, uint r, VectorSet &first_pass );
286N/A void add_liveout( Block *p, IndexSet *lo, VectorSet &first_pass );
286N/A
286N/Apublic:
286N/A PhaseLive( const PhaseCFG &cfg, LRG_List &names, Arena *arena );
286N/A ~PhaseLive() {}
286N/A // Compute liveness info
286N/A void compute(uint maxlrg);
286N/A // Reset arena storage
286N/A void reset() { _live = NULL; }
286N/A
286N/A // Return the live-out set for this block
286N/A IndexSet *live( const Block * b ) { return &_live[b->_pre_order-1]; }
286N/A
286N/A#ifndef PRODUCT
286N/A void dump( const Block *b ) const;
286N/A void stats(uint iters) const;
286N/A#endif
286N/A};
286N/A
286N/A#endif // SHARE_VM_OPTO_LIVE_HPP
286N/A