194 PhaseTransform( PhaseNumber pnum ); 195 PhaseTransform( Arena *arena, PhaseNumber pnum ); 196 PhaseTransform( PhaseTransform *phase, PhaseNumber pnum ); 197 198 Arena* arena() { return _arena; } 199 Type_Array& types() { return _types; } 200 void replace_types(Type_Array new_types) { 201 _types = new_types; 202 } 203 // _nodes is used in varying ways by subclasses, which define local accessors 204 uint nodes_size() { 205 return _nodes.size(); 206 } 207 208 public: 209 // Get a previously recorded type for the node n. 210 // This type must already have been recorded. 211 // If you want the type of a very new (untransformed) node, 212 // you must use type_or_null, and test the result for NULL. 213 const Type* type(const Node* n) const { 214 assert(n != NULL, "must not be null"); 215 const Type* t = _types.fast_lookup(n->_idx); 216 assert(t != NULL, "must set before get"); 217 return t; 218 } 219 // Get a previously recorded type for the node n, 220 // or else return NULL if there is none. 221 const Type* type_or_null(const Node* n) const { 222 return _types.fast_lookup(n->_idx); 223 } 224 // Record a type for a node. 225 void set_type(const Node* n, const Type *t) { 226 assert(t != NULL, "type must not be null"); 227 _types.map(n->_idx, t); 228 } 229 // Record an initial type for a node, the node's bottom type. 230 void set_type_bottom(const Node* n) { 231 // Use this for initialization when bottom_type() (or better) is not handy. 232 // Usually the initialization shoudl be to n->Value(this) instead, 233 // or a hand-optimized value like Type::MEMORY or Type::CONTROL. 234 assert(_types[n->_idx] == NULL, "must set the initial type just once"); 235 _types.map(n->_idx, n->bottom_type()); 236 } 237 // Make sure the types array is big enough to record a size for the node n. 238 // (In product builds, we never want to do range checks on the types array!) 239 void ensure_type_or_null(const Node* n) { 240 if (n->_idx >= _types.Size()) 241 _types.map(n->_idx, NULL); // Grow the types array as needed. | 194 PhaseTransform( PhaseNumber pnum ); 195 PhaseTransform( Arena *arena, PhaseNumber pnum ); 196 PhaseTransform( PhaseTransform *phase, PhaseNumber pnum ); 197 198 Arena* arena() { return _arena; } 199 Type_Array& types() { return _types; } 200 void replace_types(Type_Array new_types) { 201 _types = new_types; 202 } 203 // _nodes is used in varying ways by subclasses, which define local accessors 204 uint nodes_size() { 205 return _nodes.size(); 206 } 207 208 public: 209 // Get a previously recorded type for the node n. 210 // This type must already have been recorded. 211 // If you want the type of a very new (untransformed) node, 212 // you must use type_or_null, and test the result for NULL. 213 const Type* type(const Node* n) const { 214 assert(_pnum != Ideal_Loop, "should not be used from PhaseIdealLoop"); 215 assert(n != NULL, "must not be null"); 216 const Type* t = _types.fast_lookup(n->_idx); 217 assert(t != NULL, "must set before get"); 218 return t; 219 } 220 // Get a previously recorded type for the node n, 221 // or else return NULL if there is none. 222 const Type* type_or_null(const Node* n) const { 223 assert(_pnum != Ideal_Loop, "should not be used from PhaseIdealLoop"); 224 return _types.fast_lookup(n->_idx); 225 } 226 // Record a type for a node. 227 void set_type(const Node* n, const Type *t) { 228 assert(t != NULL, "type must not be null"); 229 _types.map(n->_idx, t); 230 } 231 // Record an initial type for a node, the node's bottom type. 232 void set_type_bottom(const Node* n) { 233 // Use this for initialization when bottom_type() (or better) is not handy. 234 // Usually the initialization shoudl be to n->Value(this) instead, 235 // or a hand-optimized value like Type::MEMORY or Type::CONTROL. 236 assert(_types[n->_idx] == NULL, "must set the initial type just once"); 237 _types.map(n->_idx, n->bottom_type()); 238 } 239 // Make sure the types array is big enough to record a size for the node n. 240 // (In product builds, we never want to do range checks on the types array!) 241 void ensure_type_or_null(const Node* n) { 242 if (n->_idx >= _types.Size()) 243 _types.map(n->_idx, NULL); // Grow the types array as needed. |