< prev index next >

src/share/vm/opto/node.hpp

Print this page




 441   // NULL out all inputs to eliminate incoming Def-Use edges.
 442   // Return the number of edges between 'n' and 'this'
 443   int  disconnect_inputs(Node *n, Compile *c);
 444 
 445   // Quickly, return true if and only if I am Compile::current()->top().
 446   bool is_top() const {
 447     assert((this == (Node*) Compile::current()->top()) == (_out == NULL), "");
 448     return (_out == NULL);
 449   }
 450   // Reaffirm invariants for is_top.  (Only from Compile::set_cached_top_node.)
 451   void setup_is_top();
 452 
 453   // Strip away casting.  (It is depth-limited.)
 454   Node* uncast() const;
 455   // Return whether two Nodes are equivalent, after stripping casting.
 456   bool eqv_uncast(const Node* n) const {
 457     return (this->uncast() == n->uncast());
 458   }
 459 
 460   // Find out of current node that matches opcode.
 461   Node* find_out_with(int opcode);
 462   // Return true if the current node has an out that matches opcode.
 463   bool has_out_with(int opcode);
 464   // Return true if the current node has an out that matches any of the opcodes.
 465   bool has_out_with(int opcode1, int opcode2, int opcode3, int opcode4);
 466 
 467 private:
 468   static Node* uncast_helper(const Node* n);
 469 
 470   // Add an output edge to the end of the list
 471   void add_out( Node *n ) {
 472     if (is_top())  return;
 473     if( _outcnt == _outmax ) out_grow(_outcnt);
 474     _out[_outcnt++] = n;
 475   }
 476   // Delete an output edge
 477   void del_out( Node *n ) {
 478     if (is_top())  return;
 479     Node** outp = &_out[_outcnt];
 480     // Find and remove n
 481     do {
 482       assert(outp > _out, "Missing Def-Use edge");
 483     } while (*--outp != n);
 484     *outp = _out[--_outcnt];
 485     // Smash the old edge so it can't be used accidentally.


 740   }
 741   void init_flags(jushort fl) {
 742     assert(fl <= _max_flags, "invalid node flag");
 743     _flags |= fl;
 744   }
 745   void clear_flag(jushort fl) {
 746     assert(fl <= _max_flags, "invalid node flag");
 747     _flags &= ~fl;
 748   }
 749 
 750 public:
 751   const jushort class_id() const { return _class_id; }
 752 
 753   const jushort flags() const { return _flags; }
 754 
 755   void add_flag(jushort fl) { init_flags(fl); }
 756 
 757   void remove_flag(jushort fl) { clear_flag(fl); }
 758 
 759   // Return a dense integer opcode number
 760   virtual int Opcode() const;
 761 
 762   // Virtual inherited Node size
 763   virtual uint size_of() const;
 764 
 765   // Other interesting Node properties
 766   #define DEFINE_CLASS_QUERY(type)                           \
 767   bool is_##type() const {                                   \
 768     return ((_class_id & ClassMask_##type) == Class_##type); \
 769   }                                                          \
 770   type##Node *as_##type() const {                            \
 771     assert(is_##type(), "invalid node class");               \
 772     return (type##Node*)this;                                \
 773   }                                                          \
 774   type##Node* isa_##type() const {                           \
 775     return (is_##type()) ? as_##type() : NULL;               \
 776   }
 777 
 778   DEFINE_CLASS_QUERY(AbstractLock)
 779   DEFINE_CLASS_QUERY(Add)
 780   DEFINE_CLASS_QUERY(AddP)


 975 
 976   // If the hash function returns the special sentinel value NO_HASH,
 977   // the node is guaranteed never to compare equal to any other node.
 978   // If we accidentally generate a hash with value NO_HASH the node
 979   // won't go into the table and we'll lose a little optimization.
 980   enum { NO_HASH = 0 };
 981   virtual uint hash() const;
 982   virtual uint cmp( const Node &n ) const;
 983 
 984   // Operation appears to be iteratively computed (such as an induction variable)
 985   // It is possible for this operation to return false for a loop-varying
 986   // value, if it appears (by local graph inspection) to be computed by a simple conditional.
 987   bool is_iteratively_computed();
 988 
 989   // Determine if a node is Counted loop induction variable.
 990   // The method is defined in loopnode.cpp.
 991   const Node* is_loop_iv() const;
 992 
 993   // Return a node with opcode "opc" and same inputs as "this" if one can
 994   // be found; Otherwise return NULL;
 995   Node* find_similar(int opc);
 996 
 997   // Return the unique control out if only one. Null if none or more than one.
 998   Node* unique_ctrl_out() const;
 999 
1000   // Set control or add control as precedence edge
1001   void ensure_control_or_add_prec(Node* c);
1002 
1003 //----------------- Code Generation
1004 
1005   // Ideal register class for Matching.  Zero means unmatched instruction
1006   // (these are cloned instead of converted to machine nodes).
1007   virtual uint ideal_reg() const;
1008 
1009   static const uint NotAMachineReg;   // must be > max. machine register
1010 
1011   // Do we Match on this edge index or not?  Generally false for Control
1012   // and true for everything else.  Weird for calls & returns.
1013   virtual uint match_edge(uint idx) const;
1014 
1015   // Register class output is returned in




 441   // NULL out all inputs to eliminate incoming Def-Use edges.
 442   // Return the number of edges between 'n' and 'this'
 443   int  disconnect_inputs(Node *n, Compile *c);
 444 
 445   // Quickly, return true if and only if I am Compile::current()->top().
 446   bool is_top() const {
 447     assert((this == (Node*) Compile::current()->top()) == (_out == NULL), "");
 448     return (_out == NULL);
 449   }
 450   // Reaffirm invariants for is_top.  (Only from Compile::set_cached_top_node.)
 451   void setup_is_top();
 452 
 453   // Strip away casting.  (It is depth-limited.)
 454   Node* uncast() const;
 455   // Return whether two Nodes are equivalent, after stripping casting.
 456   bool eqv_uncast(const Node* n) const {
 457     return (this->uncast() == n->uncast());
 458   }
 459 
 460   // Find out of current node that matches opcode.
 461   Node* find_out_with(uint opcode);
 462   // Return true if the current node has an out that matches opcode.
 463   bool has_out_with(uint opcode);
 464   // Return true if the current node has an out that matches any of the opcodes.
 465   bool has_out_with(uint opcode1, uint opcode2, uint opcode3, uint opcode4);
 466 
 467 private:
 468   static Node* uncast_helper(const Node* n);
 469 
 470   // Add an output edge to the end of the list
 471   void add_out( Node *n ) {
 472     if (is_top())  return;
 473     if( _outcnt == _outmax ) out_grow(_outcnt);
 474     _out[_outcnt++] = n;
 475   }
 476   // Delete an output edge
 477   void del_out( Node *n ) {
 478     if (is_top())  return;
 479     Node** outp = &_out[_outcnt];
 480     // Find and remove n
 481     do {
 482       assert(outp > _out, "Missing Def-Use edge");
 483     } while (*--outp != n);
 484     *outp = _out[--_outcnt];
 485     // Smash the old edge so it can't be used accidentally.


 740   }
 741   void init_flags(jushort fl) {
 742     assert(fl <= _max_flags, "invalid node flag");
 743     _flags |= fl;
 744   }
 745   void clear_flag(jushort fl) {
 746     assert(fl <= _max_flags, "invalid node flag");
 747     _flags &= ~fl;
 748   }
 749 
 750 public:
 751   const jushort class_id() const { return _class_id; }
 752 
 753   const jushort flags() const { return _flags; }
 754 
 755   void add_flag(jushort fl) { init_flags(fl); }
 756 
 757   void remove_flag(jushort fl) { clear_flag(fl); }
 758 
 759   // Return a dense integer opcode number
 760   virtual uint Opcode() const;
 761 
 762   // Virtual inherited Node size
 763   virtual uint size_of() const;
 764 
 765   // Other interesting Node properties
 766   #define DEFINE_CLASS_QUERY(type)                           \
 767   bool is_##type() const {                                   \
 768     return ((_class_id & ClassMask_##type) == Class_##type); \
 769   }                                                          \
 770   type##Node *as_##type() const {                            \
 771     assert(is_##type(), "invalid node class");               \
 772     return (type##Node*)this;                                \
 773   }                                                          \
 774   type##Node* isa_##type() const {                           \
 775     return (is_##type()) ? as_##type() : NULL;               \
 776   }
 777 
 778   DEFINE_CLASS_QUERY(AbstractLock)
 779   DEFINE_CLASS_QUERY(Add)
 780   DEFINE_CLASS_QUERY(AddP)


 975 
 976   // If the hash function returns the special sentinel value NO_HASH,
 977   // the node is guaranteed never to compare equal to any other node.
 978   // If we accidentally generate a hash with value NO_HASH the node
 979   // won't go into the table and we'll lose a little optimization.
 980   enum { NO_HASH = 0 };
 981   virtual uint hash() const;
 982   virtual uint cmp( const Node &n ) const;
 983 
 984   // Operation appears to be iteratively computed (such as an induction variable)
 985   // It is possible for this operation to return false for a loop-varying
 986   // value, if it appears (by local graph inspection) to be computed by a simple conditional.
 987   bool is_iteratively_computed();
 988 
 989   // Determine if a node is Counted loop induction variable.
 990   // The method is defined in loopnode.cpp.
 991   const Node* is_loop_iv() const;
 992 
 993   // Return a node with opcode "opc" and same inputs as "this" if one can
 994   // be found; Otherwise return NULL;
 995   Node* find_similar(uint opc);
 996 
 997   // Return the unique control out if only one. Null if none or more than one.
 998   Node* unique_ctrl_out() const;
 999 
1000   // Set control or add control as precedence edge
1001   void ensure_control_or_add_prec(Node* c);
1002 
1003 //----------------- Code Generation
1004 
1005   // Ideal register class for Matching.  Zero means unmatched instruction
1006   // (these are cloned instead of converted to machine nodes).
1007   virtual uint ideal_reg() const;
1008 
1009   static const uint NotAMachineReg;   // must be > max. machine register
1010 
1011   // Do we Match on this edge index or not?  Generally false for Control
1012   // and true for everything else.  Weird for calls & returns.
1013   virtual uint match_edge(uint idx) const;
1014 
1015   // Register class output is returned in


< prev index next >