< prev index next >

src/hotspot/share/opto/superword.hpp

Print this page




  97   Node*    _node;     // Corresponding ideal node
  98   DepEdge* _in_head;  // Head of list of in edges, null terminated
  99   DepEdge* _out_head; // Head of list of out edges, null terminated
 100 
 101  public:
 102   DepMem(Node* node) : _node(node), _in_head(NULL), _out_head(NULL) {}
 103 
 104   Node*    node()                { return _node;     }
 105   DepEdge* in_head()             { return _in_head;  }
 106   DepEdge* out_head()            { return _out_head; }
 107   void set_in_head(DepEdge* hd)  { _in_head = hd;    }
 108   void set_out_head(DepEdge* hd) { _out_head = hd;   }
 109 
 110   int in_cnt();  // Incoming edge count
 111   int out_cnt(); // Outgoing edge count
 112 
 113   void print();
 114 };
 115 
 116 //------------------------------DepGraph---------------------------
 117 class DepGraph VALUE_OBJ_CLASS_SPEC {
 118  protected:
 119   Arena* _arena;
 120   GrowableArray<DepMem*> _map;
 121   DepMem* _root;
 122   DepMem* _tail;
 123 
 124  public:
 125   DepGraph(Arena* a) : _arena(a), _map(a, 8,  0, NULL) {
 126     _root = new (_arena) DepMem(NULL);
 127     _tail = new (_arena) DepMem(NULL);
 128   }
 129 
 130   DepMem* root() { return _root; }
 131   DepMem* tail() { return _tail; }
 132 
 133   // Return dependence node corresponding to an ideal node
 134   DepMem* dep(Node* node) { return _map.at(node->_idx); }
 135 
 136   // Make a new dependence graph node for an ideal node.
 137   DepMem* make_node(Node* node);


 173 class DepSuccs : public StackObj {
 174 private:
 175   Node*    _n;
 176   int      _next_idx, _end_idx;
 177   DepEdge* _dep_next;
 178   Node*    _current;
 179   bool     _done;
 180 
 181 public:
 182   DepSuccs(Node* n, DepGraph& dg);
 183   Node* current() { return _current; }
 184   bool  done()    { return _done; }
 185   void  next();
 186 };
 187 
 188 
 189 // ========================= SuperWord =====================
 190 
 191 // -----------------------------SWNodeInfo---------------------------------
 192 // Per node info needed by SuperWord
 193 class SWNodeInfo VALUE_OBJ_CLASS_SPEC {
 194  public:
 195   int         _alignment; // memory alignment for a node
 196   int         _depth;     // Max expression (DAG) depth from block start
 197   const Type* _velt_type; // vector element type
 198   Node_List*  _my_pack;   // pack containing this node
 199 
 200   SWNodeInfo() : _alignment(-1), _depth(0), _velt_type(NULL), _my_pack(NULL) {}
 201   static const SWNodeInfo initial;
 202 };
 203 
 204 class SuperWord;
 205 class CMoveKit {
 206  friend class SuperWord;
 207  private:
 208   SuperWord* _sw;
 209   Dict* _dict;
 210   CMoveKit(Arena* a, SuperWord* sw) : _sw(sw)  {_dict = new Dict(cmpkey, hashkey, a);}
 211   void*     _2p(Node* key)        const  { return (void*)(intptr_t)key; } // 2 conversion functions to make gcc happy
 212   Dict*     dict()                const  { return _dict; }
 213   void map(Node* key, Node_List* val)    { assert(_dict->operator[](_2p(key)) == NULL, "key existed"); _dict->Insert(_2p(key), (void*)val); }
 214   void unmap(Node* key)                  { _dict->Delete(_2p(key)); }
 215   Node_List* pack(Node* key)      const  { return (Node_List*)_dict->operator[](_2p(key)); }
 216   Node* is_Bool_candidate(Node* nd) const; // if it is the right candidate return corresponding CMove* ,
 217   Node* is_CmpD_candidate(Node* nd) const; // otherwise return NULL
 218   Node_List* make_cmovevd_pack(Node_List* cmovd_pk);
 219   bool test_cmpd_pack(Node_List* cmpd_pk, Node_List* cmovd_pk);
 220 };//class CMoveKit
 221 
 222 // JVMCI: OrderedPair is moved up to deal with compilation issues on Windows
 223 //------------------------------OrderedPair---------------------------
 224 // Ordered pair of Node*.
 225 class OrderedPair VALUE_OBJ_CLASS_SPEC {
 226  protected:
 227   Node* _p1;
 228   Node* _p2;
 229  public:
 230   OrderedPair() : _p1(NULL), _p2(NULL) {}
 231   OrderedPair(Node* p1, Node* p2) {
 232     if (p1->_idx < p2->_idx) {
 233       _p1 = p1; _p2 = p2;
 234     } else {
 235       _p1 = p2; _p2 = p1;
 236     }
 237   }
 238 
 239   bool operator==(const OrderedPair &rhs) {
 240     return _p1 == rhs._p1 && _p2 == rhs._p2;
 241   }
 242   void print() { tty->print("  (%d, %d)", _p1->_idx, _p2->_idx); }
 243 
 244   static const OrderedPair initial;
 245 };


 527   // Is the use of d1 in u1 at the same operand position as d2 in u2?
 528   bool opnd_positions_match(Node* d1, Node* u1, Node* d2, Node* u2);
 529   void init();
 530   // clean up some basic structures - used if the ideal graph was rebuilt
 531   void restart();
 532 
 533   // print methods
 534   void print_packset();
 535   void print_pack(Node_List* p);
 536   void print_bb();
 537   void print_stmt(Node* s);
 538   char* blank(uint depth);
 539 
 540   void packset_sort(int n);
 541 };
 542 
 543 
 544 
 545 //------------------------------SWPointer---------------------------
 546 // Information about an address for dependence checking and vector alignment
 547 class SWPointer VALUE_OBJ_CLASS_SPEC {
 548  protected:
 549   MemNode*   _mem;           // My memory reference node
 550   SuperWord* _slp;           // SuperWord class
 551 
 552   Node* _base;               // NULL if unsafe nonheap reference
 553   Node* _adr;                // address pointer
 554   jint  _scale;              // multiplier for iv (in bytes), 0 if no loop iv
 555   jint  _offset;             // constant offset (in bytes)
 556   Node* _invar;              // invariant offset (in bytes), NULL if none
 557   bool  _negate_invar;       // if true then use: (0 - _invar)
 558   Node_Stack* _nstack;       // stack used to record a swpointer trace of variants
 559   bool        _analyze_only; // Used in loop unrolling only for swpointer trace
 560   uint        _stack_idx;    // Used in loop unrolling only for swpointer trace
 561 
 562   PhaseIdealLoop* phase() { return _slp->phase(); }
 563   IdealLoopTree*  lpt()   { return _slp->lpt(); }
 564   PhiNode*        iv()    { return _slp->iv();  } // Induction var
 565 
 566   bool invariant(Node* n);
 567 




  97   Node*    _node;     // Corresponding ideal node
  98   DepEdge* _in_head;  // Head of list of in edges, null terminated
  99   DepEdge* _out_head; // Head of list of out edges, null terminated
 100 
 101  public:
 102   DepMem(Node* node) : _node(node), _in_head(NULL), _out_head(NULL) {}
 103 
 104   Node*    node()                { return _node;     }
 105   DepEdge* in_head()             { return _in_head;  }
 106   DepEdge* out_head()            { return _out_head; }
 107   void set_in_head(DepEdge* hd)  { _in_head = hd;    }
 108   void set_out_head(DepEdge* hd) { _out_head = hd;   }
 109 
 110   int in_cnt();  // Incoming edge count
 111   int out_cnt(); // Outgoing edge count
 112 
 113   void print();
 114 };
 115 
 116 //------------------------------DepGraph---------------------------
 117 class DepGraph {
 118  protected:
 119   Arena* _arena;
 120   GrowableArray<DepMem*> _map;
 121   DepMem* _root;
 122   DepMem* _tail;
 123 
 124  public:
 125   DepGraph(Arena* a) : _arena(a), _map(a, 8,  0, NULL) {
 126     _root = new (_arena) DepMem(NULL);
 127     _tail = new (_arena) DepMem(NULL);
 128   }
 129 
 130   DepMem* root() { return _root; }
 131   DepMem* tail() { return _tail; }
 132 
 133   // Return dependence node corresponding to an ideal node
 134   DepMem* dep(Node* node) { return _map.at(node->_idx); }
 135 
 136   // Make a new dependence graph node for an ideal node.
 137   DepMem* make_node(Node* node);


 173 class DepSuccs : public StackObj {
 174 private:
 175   Node*    _n;
 176   int      _next_idx, _end_idx;
 177   DepEdge* _dep_next;
 178   Node*    _current;
 179   bool     _done;
 180 
 181 public:
 182   DepSuccs(Node* n, DepGraph& dg);
 183   Node* current() { return _current; }
 184   bool  done()    { return _done; }
 185   void  next();
 186 };
 187 
 188 
 189 // ========================= SuperWord =====================
 190 
 191 // -----------------------------SWNodeInfo---------------------------------
 192 // Per node info needed by SuperWord
 193 class SWNodeInfo {
 194  public:
 195   int         _alignment; // memory alignment for a node
 196   int         _depth;     // Max expression (DAG) depth from block start
 197   const Type* _velt_type; // vector element type
 198   Node_List*  _my_pack;   // pack containing this node
 199 
 200   SWNodeInfo() : _alignment(-1), _depth(0), _velt_type(NULL), _my_pack(NULL) {}
 201   static const SWNodeInfo initial;
 202 };
 203 
 204 class SuperWord;
 205 class CMoveKit {
 206  friend class SuperWord;
 207  private:
 208   SuperWord* _sw;
 209   Dict* _dict;
 210   CMoveKit(Arena* a, SuperWord* sw) : _sw(sw)  {_dict = new Dict(cmpkey, hashkey, a);}
 211   void*     _2p(Node* key)        const  { return (void*)(intptr_t)key; } // 2 conversion functions to make gcc happy
 212   Dict*     dict()                const  { return _dict; }
 213   void map(Node* key, Node_List* val)    { assert(_dict->operator[](_2p(key)) == NULL, "key existed"); _dict->Insert(_2p(key), (void*)val); }
 214   void unmap(Node* key)                  { _dict->Delete(_2p(key)); }
 215   Node_List* pack(Node* key)      const  { return (Node_List*)_dict->operator[](_2p(key)); }
 216   Node* is_Bool_candidate(Node* nd) const; // if it is the right candidate return corresponding CMove* ,
 217   Node* is_CmpD_candidate(Node* nd) const; // otherwise return NULL
 218   Node_List* make_cmovevd_pack(Node_List* cmovd_pk);
 219   bool test_cmpd_pack(Node_List* cmpd_pk, Node_List* cmovd_pk);
 220 };//class CMoveKit
 221 
 222 // JVMCI: OrderedPair is moved up to deal with compilation issues on Windows
 223 //------------------------------OrderedPair---------------------------
 224 // Ordered pair of Node*.
 225 class OrderedPair {
 226  protected:
 227   Node* _p1;
 228   Node* _p2;
 229  public:
 230   OrderedPair() : _p1(NULL), _p2(NULL) {}
 231   OrderedPair(Node* p1, Node* p2) {
 232     if (p1->_idx < p2->_idx) {
 233       _p1 = p1; _p2 = p2;
 234     } else {
 235       _p1 = p2; _p2 = p1;
 236     }
 237   }
 238 
 239   bool operator==(const OrderedPair &rhs) {
 240     return _p1 == rhs._p1 && _p2 == rhs._p2;
 241   }
 242   void print() { tty->print("  (%d, %d)", _p1->_idx, _p2->_idx); }
 243 
 244   static const OrderedPair initial;
 245 };


 527   // Is the use of d1 in u1 at the same operand position as d2 in u2?
 528   bool opnd_positions_match(Node* d1, Node* u1, Node* d2, Node* u2);
 529   void init();
 530   // clean up some basic structures - used if the ideal graph was rebuilt
 531   void restart();
 532 
 533   // print methods
 534   void print_packset();
 535   void print_pack(Node_List* p);
 536   void print_bb();
 537   void print_stmt(Node* s);
 538   char* blank(uint depth);
 539 
 540   void packset_sort(int n);
 541 };
 542 
 543 
 544 
 545 //------------------------------SWPointer---------------------------
 546 // Information about an address for dependence checking and vector alignment
 547 class SWPointer {
 548  protected:
 549   MemNode*   _mem;           // My memory reference node
 550   SuperWord* _slp;           // SuperWord class
 551 
 552   Node* _base;               // NULL if unsafe nonheap reference
 553   Node* _adr;                // address pointer
 554   jint  _scale;              // multiplier for iv (in bytes), 0 if no loop iv
 555   jint  _offset;             // constant offset (in bytes)
 556   Node* _invar;              // invariant offset (in bytes), NULL if none
 557   bool  _negate_invar;       // if true then use: (0 - _invar)
 558   Node_Stack* _nstack;       // stack used to record a swpointer trace of variants
 559   bool        _analyze_only; // Used in loop unrolling only for swpointer trace
 560   uint        _stack_idx;    // Used in loop unrolling only for swpointer trace
 561 
 562   PhaseIdealLoop* phase() { return _slp->phase(); }
 563   IdealLoopTree*  lpt()   { return _slp->lpt(); }
 564   PhiNode*        iv()    { return _slp->iv();  } // Induction var
 565 
 566   bool invariant(Node* n);
 567 


< prev index next >