275 // are required, from _cnt to _max-1 are precedence edges. 276 node_idx_t _cnt; // Total number of required Node inputs. 277 278 node_idx_t _max; // Actual length of input array. 279 280 // Output edges are an unordered list of def-use edges which exactly 281 // correspond to required input edges which point from other nodes 282 // to this one. Thus the count of the output edges is the number of 283 // users of this node. 284 node_idx_t _outcnt; // Total number of Node outputs. 285 286 node_idx_t _outmax; // Actual length of output array. 287 288 // Grow the actual input array to the next larger power-of-2 bigger than len. 289 void grow( uint len ); 290 // Grow the output array to the next larger power-of-2 bigger than len. 291 void out_grow( uint len ); 292 293 public: 294 // Each Node is assigned a unique small/dense number. This number is used 295 // to index into auxiliary arrays of data and bitvectors. 296 // It is declared const to defend against inadvertant assignment, 297 // since it is used by clients as a naked field. 298 const node_idx_t _idx; 299 300 // Get the (read-only) number of input edges 301 uint req() const { return _cnt; } 302 uint len() const { return _max; } 303 // Get the (read-only) number of output edges 304 uint outcnt() const { return _outcnt; } 305 306 #if OPTO_DU_ITERATOR_ASSERT 307 // Iterate over the out-edges of this node. Deletions are illegal. 308 inline DUIterator outs() const; 309 // Use this when the out array might have changed to suppress asserts. 310 inline DUIterator& refresh_out_pos(DUIterator& i) const; 311 // Does the node have an out at this position? (Used for iteration.) 312 inline bool has_out(DUIterator& i) const; 313 inline Node* out(DUIterator& i) const; 314 // Iterate over the out-edges of this node. All changes are illegal. 315 inline DUIterator_Fast fast_outs(DUIterator_Fast& max) const; 316 inline Node* fast_out(DUIterator_Fast& i) const; 317 // Iterate over the out-edges of this node, deleting one at a time. 318 inline DUIterator_Last last_outs(DUIterator_Last& min) const; | 275 // are required, from _cnt to _max-1 are precedence edges. 276 node_idx_t _cnt; // Total number of required Node inputs. 277 278 node_idx_t _max; // Actual length of input array. 279 280 // Output edges are an unordered list of def-use edges which exactly 281 // correspond to required input edges which point from other nodes 282 // to this one. Thus the count of the output edges is the number of 283 // users of this node. 284 node_idx_t _outcnt; // Total number of Node outputs. 285 286 node_idx_t _outmax; // Actual length of output array. 287 288 // Grow the actual input array to the next larger power-of-2 bigger than len. 289 void grow( uint len ); 290 // Grow the output array to the next larger power-of-2 bigger than len. 291 void out_grow( uint len ); 292 293 public: 294 // Each Node is assigned a unique small/dense number. This number is used 295 // to index into auxiliary arrays of data and bit vectors. 296 // The field _idx is declared constant to defend against inadvertent assignments, 297 // since it is used by clients as a naked field. However, the field's value can be 298 // changed using the set_idx() method. 299 // 300 // The PhaseRenumberLive phase renumbers nodes based on liveness information. 301 // Therefore, it updates the value of the _idx field. The parse-time _idx is 302 // preserved in _parse_idx. 303 const node_idx_t _idx; 304 DEBUG_ONLY(const node_idx_t _parse_idx;) 305 306 // Get the (read-only) number of input edges 307 uint req() const { return _cnt; } 308 uint len() const { return _max; } 309 // Get the (read-only) number of output edges 310 uint outcnt() const { return _outcnt; } 311 312 #if OPTO_DU_ITERATOR_ASSERT 313 // Iterate over the out-edges of this node. Deletions are illegal. 314 inline DUIterator outs() const; 315 // Use this when the out array might have changed to suppress asserts. 316 inline DUIterator& refresh_out_pos(DUIterator& i) const; 317 // Does the node have an out at this position? (Used for iteration.) 318 inline bool has_out(DUIterator& i) const; 319 inline Node* out(DUIterator& i) const; 320 // Iterate over the out-edges of this node. All changes are illegal. 321 inline DUIterator_Fast fast_outs(DUIterator_Fast& max) const; 322 inline Node* fast_out(DUIterator_Fast& i) const; 323 // Iterate over the out-edges of this node, deleting one at a time. 324 inline DUIterator_Last last_outs(DUIterator_Last& min) const; |