876
877 //----------------- Optimization
878
879 // Get the worst-case Type output for this Node.
880 virtual const class Type *bottom_type() const;
881
882 // If we find a better type for a node, try to record it permanently.
883 // Return true if this node actually changed.
884 // Be sure to do the hash_delete game in the "rehash" variant.
885 void raise_bottom_type(const Type* new_type);
886
887 // Get the address type with which this node uses and/or defs memory,
888 // or NULL if none. The address type is conservatively wide.
889 // Returns non-null for calls, membars, loads, stores, etc.
890 // Returns TypePtr::BOTTOM if the node touches memory "broadly".
891 virtual const class TypePtr *adr_type() const { return NULL; }
892
893 // Return an existing node which computes the same function as this node.
894 // The optimistic combined algorithm requires this to return a Node which
895 // is a small number of steps away (e.g., one of my inputs).
896 virtual Node *Identity( PhaseTransform *phase );
897
898 // Return the set of values this Node can take on at runtime.
899 virtual const Type *Value( PhaseTransform *phase ) const;
900
901 // Return a node which is more "ideal" than the current node.
902 // The invariants on this call are subtle. If in doubt, read the
903 // treatise in node.cpp above the default implemention AND TEST WITH
904 // +VerifyIterativeGVN!
905 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
906
907 // Some nodes have specific Ideal subgraph transformations only if they are
908 // unique users of specific nodes. Such nodes should be put on IGVN worklist
909 // for the transformations to happen.
910 bool has_special_unique_user() const;
911
912 // Skip Proj and CatchProj nodes chains. Check for Null and Top.
913 Node* find_exact_control(Node* ctrl);
914
915 // Check if 'this' node dominates or equal to 'sub'.
916 bool dominates(Node* sub, Node_List &nlist);
917
918 protected:
919 bool remove_dead_region(PhaseGVN *phase, bool can_reshape);
1646 //------------------------------TypeNode---------------------------------------
1647 // Node with a Type constant.
1648 class TypeNode : public Node {
1649 protected:
1650 virtual uint hash() const; // Check the type
1651 virtual uint cmp( const Node &n ) const;
1652 virtual uint size_of() const; // Size is bigger
1653 const Type* const _type;
1654 public:
1655 void set_type(const Type* t) {
1656 assert(t != NULL, "sanity");
1657 debug_only(uint check_hash = (VerifyHashTableKeys && _hash_lock) ? hash() : NO_HASH);
1658 *(const Type**)&_type = t; // cast away const-ness
1659 // If this node is in the hash table, make sure it doesn't need a rehash.
1660 assert(check_hash == NO_HASH || check_hash == hash(), "type change must preserve hash code");
1661 }
1662 const Type* type() const { assert(_type != NULL, "sanity"); return _type; };
1663 TypeNode( const Type *t, uint required ) : Node(required), _type(t) {
1664 init_class_id(Class_Type);
1665 }
1666 virtual const Type *Value( PhaseTransform *phase ) const;
1667 virtual const Type *bottom_type() const;
1668 virtual uint ideal_reg() const;
1669 #ifndef PRODUCT
1670 virtual void dump_spec(outputStream *st) const;
1671 virtual void dump_compact_spec(outputStream *st) const;
1672 #endif
1673 };
1674
1675 #endif // SHARE_VM_OPTO_NODE_HPP
|
876
877 //----------------- Optimization
878
879 // Get the worst-case Type output for this Node.
880 virtual const class Type *bottom_type() const;
881
882 // If we find a better type for a node, try to record it permanently.
883 // Return true if this node actually changed.
884 // Be sure to do the hash_delete game in the "rehash" variant.
885 void raise_bottom_type(const Type* new_type);
886
887 // Get the address type with which this node uses and/or defs memory,
888 // or NULL if none. The address type is conservatively wide.
889 // Returns non-null for calls, membars, loads, stores, etc.
890 // Returns TypePtr::BOTTOM if the node touches memory "broadly".
891 virtual const class TypePtr *adr_type() const { return NULL; }
892
893 // Return an existing node which computes the same function as this node.
894 // The optimistic combined algorithm requires this to return a Node which
895 // is a small number of steps away (e.g., one of my inputs).
896 virtual Node* Identity(PhaseGVN* phase);
897
898 // Return the set of values this Node can take on at runtime.
899 virtual const Type* Value(PhaseGVN* phase) const;
900
901 // Return a node which is more "ideal" than the current node.
902 // The invariants on this call are subtle. If in doubt, read the
903 // treatise in node.cpp above the default implemention AND TEST WITH
904 // +VerifyIterativeGVN!
905 virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
906
907 // Some nodes have specific Ideal subgraph transformations only if they are
908 // unique users of specific nodes. Such nodes should be put on IGVN worklist
909 // for the transformations to happen.
910 bool has_special_unique_user() const;
911
912 // Skip Proj and CatchProj nodes chains. Check for Null and Top.
913 Node* find_exact_control(Node* ctrl);
914
915 // Check if 'this' node dominates or equal to 'sub'.
916 bool dominates(Node* sub, Node_List &nlist);
917
918 protected:
919 bool remove_dead_region(PhaseGVN *phase, bool can_reshape);
1646 //------------------------------TypeNode---------------------------------------
1647 // Node with a Type constant.
1648 class TypeNode : public Node {
1649 protected:
1650 virtual uint hash() const; // Check the type
1651 virtual uint cmp( const Node &n ) const;
1652 virtual uint size_of() const; // Size is bigger
1653 const Type* const _type;
1654 public:
1655 void set_type(const Type* t) {
1656 assert(t != NULL, "sanity");
1657 debug_only(uint check_hash = (VerifyHashTableKeys && _hash_lock) ? hash() : NO_HASH);
1658 *(const Type**)&_type = t; // cast away const-ness
1659 // If this node is in the hash table, make sure it doesn't need a rehash.
1660 assert(check_hash == NO_HASH || check_hash == hash(), "type change must preserve hash code");
1661 }
1662 const Type* type() const { assert(_type != NULL, "sanity"); return _type; };
1663 TypeNode( const Type *t, uint required ) : Node(required), _type(t) {
1664 init_class_id(Class_Type);
1665 }
1666 virtual const Type* Value(PhaseGVN* phase) const;
1667 virtual const Type *bottom_type() const;
1668 virtual uint ideal_reg() const;
1669 #ifndef PRODUCT
1670 virtual void dump_spec(outputStream *st) const;
1671 virtual void dump_compact_spec(outputStream *st) const;
1672 #endif
1673 };
1674
1675 #endif // SHARE_VM_OPTO_NODE_HPP
|