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