< 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
1016   virtual const RegMask &out_RegMask() const;
1017   // Register class input is expected in
1018   virtual const RegMask &in_RegMask(uint) const;
1019   // Should we clone rather than spill this instruction?
1020   bool rematerialize() const;
1021 
1022   // Return JVM State Object if this Node carries debug info, or NULL otherwise
1023   virtual JVMState* jvms() const;
1024 
1025   // Print as assembly
1026   virtual void format( PhaseRegAlloc *, outputStream* st = tty ) const;
1027   // Emit bytes starting at parameter 'ptr'
1028   // Bump 'ptr' by the number of output bytes
1029   virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;


1693 class TypeNode : public Node {
1694 protected:
1695   virtual uint hash() const;    // Check the type
1696   virtual uint cmp( const Node &n ) const;
1697   virtual uint size_of() const; // Size is bigger
1698   const Type* const _type;
1699 public:
1700   void set_type(const Type* t) {
1701     assert(t != NULL, "sanity");
1702     debug_only(uint check_hash = (VerifyHashTableKeys && _hash_lock) ? hash() : NO_HASH);
1703     *(const Type**)&_type = t;   // cast away const-ness
1704     // If this node is in the hash table, make sure it doesn't need a rehash.
1705     assert(check_hash == NO_HASH || check_hash == hash(), "type change must preserve hash code");
1706   }
1707   const Type* type() const { assert(_type != NULL, "sanity"); return _type; };
1708   TypeNode( const Type *t, uint required ) : Node(required), _type(t) {
1709     init_class_id(Class_Type);
1710   }
1711   virtual const Type* Value(PhaseGVN* phase) const;
1712   virtual const Type *bottom_type() const;
1713   virtual       uint  ideal_reg() const;
1714 #ifndef PRODUCT
1715   virtual void dump_spec(outputStream *st) const;
1716   virtual void dump_compact_spec(outputStream *st) const;
1717 #endif
1718 };
1719 
1720 #endif // SHARE_VM_OPTO_NODE_HPP


 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(Opcodes opcode);
 462   // Return true if the current node has an out that matches opcode.
 463   bool has_out_with(Opcodes opcode);
 464   // Return true if the current node has an out that matches any of the opcodes.
 465   bool has_out_with(Opcodes opcode1, Opcodes opcode2, Opcodes opcode3, Opcodes 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 Opcodes 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(Opcodes 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 Opcodes ideal_reg() const;


1008 
1009   // Do we Match on this edge index or not?  Generally false for Control
1010   // and true for everything else.  Weird for calls & returns.
1011   virtual uint match_edge(uint idx) const;
1012 
1013   // Register class output is returned in
1014   virtual const RegMask &out_RegMask() const;
1015   // Register class input is expected in
1016   virtual const RegMask &in_RegMask(uint) const;
1017   // Should we clone rather than spill this instruction?
1018   bool rematerialize() const;
1019 
1020   // Return JVM State Object if this Node carries debug info, or NULL otherwise
1021   virtual JVMState* jvms() const;
1022 
1023   // Print as assembly
1024   virtual void format( PhaseRegAlloc *, outputStream* st = tty ) const;
1025   // Emit bytes starting at parameter 'ptr'
1026   // Bump 'ptr' by the number of output bytes
1027   virtual void emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const;


1691 class TypeNode : public Node {
1692 protected:
1693   virtual uint hash() const;    // Check the type
1694   virtual uint cmp( const Node &n ) const;
1695   virtual uint size_of() const; // Size is bigger
1696   const Type* const _type;
1697 public:
1698   void set_type(const Type* t) {
1699     assert(t != NULL, "sanity");
1700     debug_only(uint check_hash = (VerifyHashTableKeys && _hash_lock) ? hash() : NO_HASH);
1701     *(const Type**)&_type = t;   // cast away const-ness
1702     // If this node is in the hash table, make sure it doesn't need a rehash.
1703     assert(check_hash == NO_HASH || check_hash == hash(), "type change must preserve hash code");
1704   }
1705   const Type* type() const { assert(_type != NULL, "sanity"); return _type; };
1706   TypeNode( const Type *t, uint required ) : Node(required), _type(t) {
1707     init_class_id(Class_Type);
1708   }
1709   virtual const Type* Value(PhaseGVN* phase) const;
1710   virtual const Type *bottom_type() const;
1711   virtual       Opcodes  ideal_reg() const;
1712 #ifndef PRODUCT
1713   virtual void dump_spec(outputStream *st) const;
1714   virtual void dump_compact_spec(outputStream *st) const;
1715 #endif
1716 };
1717 
1718 #endif // SHARE_VM_OPTO_NODE_HPP
< prev index next >