170 void PhaseLive::stats(uint iters) const { 171 } 172 #endif 173 174 // Get an IndexSet for a block. Return existing one, if any. Make a new 175 // empty one if a prior one does not exist. 176 IndexSet *PhaseLive::getset( Block *p ) { 177 IndexSet *delta = _deltas[p->_pre_order-1]; 178 if( !delta ) // Not on worklist? 179 // Get a free set; flag as being on worklist 180 delta = _deltas[p->_pre_order-1] = getfreeset(); 181 return delta; // Return set of new live-out items 182 } 183 184 // Pull from free list, or allocate. Internal allocation on the returned set 185 // is always from thread local storage. 186 IndexSet *PhaseLive::getfreeset( ) { 187 IndexSet *f = _free_IndexSet; 188 if( !f ) { 189 f = new IndexSet; 190 // f->set_arena(Thread::current()->resource_area()); 191 f->initialize(_maxlrg, Thread::current()->resource_area()); 192 } else { 193 // Pull from free list 194 _free_IndexSet = f->next(); 195 //f->_cnt = 0; // Reset to empty 196 // f->set_arena(Thread::current()->resource_area()); 197 f->initialize(_maxlrg, Thread::current()->resource_area()); 198 } 199 return f; 200 } 201 202 // Free an IndexSet from a block. 203 void PhaseLive::freeset( const Block *p ) { 204 IndexSet *f = _deltas[p->_pre_order-1]; 205 f->set_next(_free_IndexSet); 206 _free_IndexSet = f; // Drop onto free list 207 _deltas[p->_pre_order-1] = NULL; 208 } 209 210 // Add a live-out value to a given blocks live-out set. If it is new, then 211 // also add it to the delta set and stick the block on the worklist. 212 void PhaseLive::add_liveout( Block *p, uint r, VectorSet &first_pass ) { 213 IndexSet *live = &_live[p->_pre_order-1]; 214 if( live->insert(r) ) { // If actually inserted... 215 // We extended the live-out set. See if the value is generated locally. 216 // If it is not, then we must extend the live-in set. 217 if( !_defs[p->_pre_order-1].member( r ) ) { | 170 void PhaseLive::stats(uint iters) const { 171 } 172 #endif 173 174 // Get an IndexSet for a block. Return existing one, if any. Make a new 175 // empty one if a prior one does not exist. 176 IndexSet *PhaseLive::getset( Block *p ) { 177 IndexSet *delta = _deltas[p->_pre_order-1]; 178 if( !delta ) // Not on worklist? 179 // Get a free set; flag as being on worklist 180 delta = _deltas[p->_pre_order-1] = getfreeset(); 181 return delta; // Return set of new live-out items 182 } 183 184 // Pull from free list, or allocate. Internal allocation on the returned set 185 // is always from thread local storage. 186 IndexSet *PhaseLive::getfreeset( ) { 187 IndexSet *f = _free_IndexSet; 188 if( !f ) { 189 f = new IndexSet; 190 f->initialize_in_resource_arena(_maxlrg); 191 } else { 192 // Pull from free list 193 _free_IndexSet = f->next(); 194 f->initialize_in_resource_arena(_maxlrg); 195 } 196 return f; 197 } 198 199 // Free an IndexSet from a block. 200 void PhaseLive::freeset( const Block *p ) { 201 IndexSet *f = _deltas[p->_pre_order-1]; 202 f->set_next(_free_IndexSet); 203 _free_IndexSet = f; // Drop onto free list 204 _deltas[p->_pre_order-1] = NULL; 205 } 206 207 // Add a live-out value to a given blocks live-out set. If it is new, then 208 // also add it to the delta set and stick the block on the worklist. 209 void PhaseLive::add_liveout( Block *p, uint r, VectorSet &first_pass ) { 210 IndexSet *live = &_live[p->_pre_order-1]; 211 if( live->insert(r) ) { // If actually inserted... 212 // We extended the live-out set. See if the value is generated locally. 213 // If it is not, then we must extend the live-in set. 214 if( !_defs[p->_pre_order-1].member( r ) ) { |