< prev index next >

src/share/vm/opto/node.hpp

Print this page




 657     DEFINE_CLASS_ID(ClearArray, Node, 14)
 658 
 659     _max_classes  = ClassMask_ClearArray
 660   };
 661   #undef DEFINE_CLASS_ID
 662 
 663   // Flags are sorted by usage frequency.
 664   enum NodeFlags {
 665     Flag_is_Copy                     = 0x01, // should be first bit to avoid shift
 666     Flag_rematerialize               = Flag_is_Copy << 1,
 667     Flag_needs_anti_dependence_check = Flag_rematerialize << 1,
 668     Flag_is_macro                    = Flag_needs_anti_dependence_check << 1,
 669     Flag_is_Con                      = Flag_is_macro << 1,
 670     Flag_is_cisc_alternate           = Flag_is_Con << 1,
 671     Flag_is_dead_loop_safe           = Flag_is_cisc_alternate << 1,
 672     Flag_may_be_short_branch         = Flag_is_dead_loop_safe << 1,
 673     Flag_avoid_back_to_back_before   = Flag_may_be_short_branch << 1,
 674     Flag_avoid_back_to_back_after    = Flag_avoid_back_to_back_before << 1,
 675     Flag_has_call                    = Flag_avoid_back_to_back_after << 1,
 676     Flag_is_reduction                = Flag_has_call << 1,
 677     Flag_is_expensive                = Flag_is_reduction << 1,

 678     _max_flags = (Flag_is_expensive << 1) - 1 // allow flags combination
 679   };
 680 
 681 private:
 682   jushort _class_id;
 683   jushort _flags;
 684 
 685 protected:
 686   // These methods should be called from constructors only.
 687   void init_class_id(jushort c) {
 688     assert(c <= _max_classes, "invalid node class");
 689     _class_id = c; // cast out const
 690   }
 691   void init_flags(jushort fl) {
 692     assert(fl <= _max_flags, "invalid node flag");
 693     _flags |= fl;
 694   }
 695   void clear_flag(jushort fl) {
 696     assert(fl <= _max_flags, "invalid node flag");
 697     _flags &= ~fl;


 843   // Ideal beginning Nodes are RootNode, RegionNode and StartNode.
 844   bool is_block_start() const {
 845     if ( is_Region() )
 846       return this == (const Node*)in(0);
 847     else
 848       return is_Start();
 849   }
 850 
 851   // The Ideal control projection Nodes are IfTrue/IfFalse, JumpProjNode, Root,
 852   // Goto and Return.  This call also returns the block ending Node.
 853   virtual const Node *is_block_proj() const;
 854 
 855   // The node is a "macro" node which needs to be expanded before matching
 856   bool is_macro() const { return (_flags & Flag_is_macro) != 0; }
 857   // The node is expensive: the best control is set during loop opts
 858   bool is_expensive() const { return (_flags & Flag_is_expensive) != 0 && in(0) != NULL; }
 859 
 860   // An arithmetic node which accumulates a data in a loop.
 861   // It must have the loop's phi as input and provide a def to the phi.
 862   bool is_reduction() const { return (_flags & Flag_is_reduction) != 0; }



 863 
 864 //----------------- Optimization
 865 
 866   // Get the worst-case Type output for this Node.
 867   virtual const class Type *bottom_type() const;
 868 
 869   // If we find a better type for a node, try to record it permanently.
 870   // Return true if this node actually changed.
 871   // Be sure to do the hash_delete game in the "rehash" variant.
 872   void raise_bottom_type(const Type* new_type);
 873 
 874   // Get the address type with which this node uses and/or defs memory,
 875   // or NULL if none.  The address type is conservatively wide.
 876   // Returns non-null for calls, membars, loads, stores, etc.
 877   // Returns TypePtr::BOTTOM if the node touches memory "broadly".
 878   virtual const class TypePtr *adr_type() const { return NULL; }
 879 
 880   // Return an existing node which computes the same function as this node.
 881   // The optimistic combined algorithm requires this to return a Node which
 882   // is a small number of steps away (e.g., one of my inputs).




 657     DEFINE_CLASS_ID(ClearArray, Node, 14)
 658 
 659     _max_classes  = ClassMask_ClearArray
 660   };
 661   #undef DEFINE_CLASS_ID
 662 
 663   // Flags are sorted by usage frequency.
 664   enum NodeFlags {
 665     Flag_is_Copy                     = 0x01, // should be first bit to avoid shift
 666     Flag_rematerialize               = Flag_is_Copy << 1,
 667     Flag_needs_anti_dependence_check = Flag_rematerialize << 1,
 668     Flag_is_macro                    = Flag_needs_anti_dependence_check << 1,
 669     Flag_is_Con                      = Flag_is_macro << 1,
 670     Flag_is_cisc_alternate           = Flag_is_Con << 1,
 671     Flag_is_dead_loop_safe           = Flag_is_cisc_alternate << 1,
 672     Flag_may_be_short_branch         = Flag_is_dead_loop_safe << 1,
 673     Flag_avoid_back_to_back_before   = Flag_may_be_short_branch << 1,
 674     Flag_avoid_back_to_back_after    = Flag_avoid_back_to_back_before << 1,
 675     Flag_has_call                    = Flag_avoid_back_to_back_after << 1,
 676     Flag_is_reduction                = Flag_has_call << 1,
 677     Flag_is_scheduled                = Flag_is_reduction << 1,
 678     Flag_is_expensive                = Flag_is_scheduled << 1,
 679     _max_flags = (Flag_is_expensive << 1) - 1 // allow flags combination
 680   };
 681 
 682 private:
 683   jushort _class_id;
 684   jushort _flags;
 685 
 686 protected:
 687   // These methods should be called from constructors only.
 688   void init_class_id(jushort c) {
 689     assert(c <= _max_classes, "invalid node class");
 690     _class_id = c; // cast out const
 691   }
 692   void init_flags(jushort fl) {
 693     assert(fl <= _max_flags, "invalid node flag");
 694     _flags |= fl;
 695   }
 696   void clear_flag(jushort fl) {
 697     assert(fl <= _max_flags, "invalid node flag");
 698     _flags &= ~fl;


 844   // Ideal beginning Nodes are RootNode, RegionNode and StartNode.
 845   bool is_block_start() const {
 846     if ( is_Region() )
 847       return this == (const Node*)in(0);
 848     else
 849       return is_Start();
 850   }
 851 
 852   // The Ideal control projection Nodes are IfTrue/IfFalse, JumpProjNode, Root,
 853   // Goto and Return.  This call also returns the block ending Node.
 854   virtual const Node *is_block_proj() const;
 855 
 856   // The node is a "macro" node which needs to be expanded before matching
 857   bool is_macro() const { return (_flags & Flag_is_macro) != 0; }
 858   // The node is expensive: the best control is set during loop opts
 859   bool is_expensive() const { return (_flags & Flag_is_expensive) != 0 && in(0) != NULL; }
 860 
 861   // An arithmetic node which accumulates a data in a loop.
 862   // It must have the loop's phi as input and provide a def to the phi.
 863   bool is_reduction() const { return (_flags & Flag_is_reduction) != 0; }
 864 
 865   // Used in lcm to mark nodes that have scheduled
 866   bool is_scheduled() const { return (_flags & Flag_is_scheduled) != 0; }
 867 
 868 //----------------- Optimization
 869 
 870   // Get the worst-case Type output for this Node.
 871   virtual const class Type *bottom_type() const;
 872 
 873   // If we find a better type for a node, try to record it permanently.
 874   // Return true if this node actually changed.
 875   // Be sure to do the hash_delete game in the "rehash" variant.
 876   void raise_bottom_type(const Type* new_type);
 877 
 878   // Get the address type with which this node uses and/or defs memory,
 879   // or NULL if none.  The address type is conservatively wide.
 880   // Returns non-null for calls, membars, loads, stores, etc.
 881   // Returns TypePtr::BOTTOM if the node touches memory "broadly".
 882   virtual const class TypePtr *adr_type() const { return NULL; }
 883 
 884   // Return an existing node which computes the same function as this node.
 885   // The optimistic combined algorithm requires this to return a Node which
 886   // is a small number of steps away (e.g., one of my inputs).


< prev index next >