< prev index next >

src/share/vm/opto/superword.hpp

Print this page




 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 // -----------------------------SuperWord---------------------------------
 205 // Transforms scalar operations into packed (superword) operations.
 206 class SuperWord : public ResourceObj {
 207  private:
 208   PhaseIdealLoop* _phase;
 209   Arena*          _arena;
 210   PhaseIterGVN   &_igvn;
 211 
 212   enum consts { top_align = -1, bottom_align = -666 };
 213 
 214   GrowableArray<Node_List*> _packset;    // Packs for the current block
 215 
 216   GrowableArray<int> _bb_idx;            // Map from Node _idx to index within block
 217 
 218   GrowableArray<Node*> _block;           // Nodes in current block
 219   GrowableArray<Node*> _data_entry;      // Nodes with all inputs from outside
 220   GrowableArray<Node*> _mem_slice_head;  // Memory slice head nodes
 221   GrowableArray<Node*> _mem_slice_tail;  // Memory slice tail nodes
 222 
 223   GrowableArray<SWNodeInfo> _node_info;  // Info needed per node


 407   // Smallest type containing range of values
 408   const Type* container_type(Node* n);
 409   // Adjust pre-loop limit so that in main loop, a load/store reference
 410   // to align_to_ref will be a position zero in the vector.
 411   void align_initial_loop_index(MemNode* align_to_ref);
 412   // Find pre loop end from main loop.  Returns null if none.
 413   CountedLoopEndNode* get_pre_loop_end(CountedLoopNode *cl);
 414   // Is the use of d1 in u1 at the same operand position as d2 in u2?
 415   bool opnd_positions_match(Node* d1, Node* u1, Node* d2, Node* u2);
 416   void init();
 417 
 418   // print methods
 419   void print_packset();
 420   void print_pack(Node_List* p);
 421   void print_bb();
 422   void print_stmt(Node* s);
 423   char* blank(uint depth);
 424 };
 425 
 426 

 427 //------------------------------SWPointer---------------------------
 428 // Information about an address for dependence checking and vector alignment
 429 class SWPointer VALUE_OBJ_CLASS_SPEC {
 430  protected:
 431   MemNode*   _mem;     // My memory reference node
 432   SuperWord* _slp;     // SuperWord class
 433 
 434   Node* _base;         // NULL if unsafe nonheap reference
 435   Node* _adr;          // address pointer
 436   jint  _scale;        // multiplier for iv (in bytes), 0 if no loop iv
 437   jint  _offset;       // constant offset (in bytes)
 438   Node* _invar;        // invariant offset (in bytes), NULL if none
 439   bool  _negate_invar; // if true then use: (0 - _invar)
 440 
 441   PhaseIdealLoop* phase() { return _slp->phase(); }
 442   IdealLoopTree*  lpt()   { return _slp->lpt(); }
 443   PhiNode*        iv()    { return _slp->iv();  } // Induction var
 444 
 445   bool invariant(Node* n) {
 446     Node *n_c = phase()->get_ctrl(n);


 486         (_adr == q._adr || _base == _adr && q._base == q._adr) &&
 487         _scale == q._scale   &&
 488         _invar == q._invar   &&
 489         _negate_invar == q._negate_invar) {
 490       bool overlap = q._offset <   _offset +   memory_size() &&
 491                        _offset < q._offset + q.memory_size();
 492       return overlap ? Equal : (_offset < q._offset ? Less : Greater);
 493     } else {
 494       return NotComparable;
 495     }
 496   }
 497 
 498   bool not_equal(SWPointer& q)    { return not_equal(cmp(q)); }
 499   bool equal(SWPointer& q)        { return equal(cmp(q)); }
 500   bool comparable(SWPointer& q)   { return comparable(cmp(q)); }
 501   static bool not_equal(int cmp)  { return cmp <= NotEqual; }
 502   static bool equal(int cmp)      { return cmp == Equal; }
 503   static bool comparable(int cmp) { return cmp < NotComparable; }
 504 
 505   void print();
 506 };
 507 
 508 
 509 //------------------------------OrderedPair---------------------------
 510 // Ordered pair of Node*.
 511 class OrderedPair VALUE_OBJ_CLASS_SPEC {
 512  protected:
 513   Node* _p1;
 514   Node* _p2;
 515  public:
 516   OrderedPair() : _p1(NULL), _p2(NULL) {}
 517   OrderedPair(Node* p1, Node* p2) {
 518     if (p1->_idx < p2->_idx) {
 519       _p1 = p1; _p2 = p2;
 520     } else {
 521       _p1 = p2; _p2 = p1;
 522     }
 523   }
 524 
 525   bool operator==(const OrderedPair &rhs) {
 526     return _p1 == rhs._p1 && _p2 == rhs._p2;
 527   }
 528   void print() { tty->print("  (%d, %d)", _p1->_idx, _p2->_idx); }
 529 
 530   static const OrderedPair initial;
 531 };
 532 
 533 #endif // SHARE_VM_OPTO_SUPERWORD_HPP


 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 // JVMCI: OrderedPair is moved up to deal with compilation issues on Windows
 205 //------------------------------OrderedPair---------------------------
 206 // Ordered pair of Node*.
 207 class OrderedPair VALUE_OBJ_CLASS_SPEC {
 208  protected:
 209   Node* _p1;
 210   Node* _p2;
 211  public:
 212   OrderedPair() : _p1(NULL), _p2(NULL) {}
 213   OrderedPair(Node* p1, Node* p2) {
 214     if (p1->_idx < p2->_idx) {
 215       _p1 = p1; _p2 = p2;
 216     } else {
 217       _p1 = p2; _p2 = p1;
 218     }
 219   }
 220 
 221   bool operator==(const OrderedPair &rhs) {
 222     return _p1 == rhs._p1 && _p2 == rhs._p2;
 223   }
 224   void print() { tty->print("  (%d, %d)", _p1->_idx, _p2->_idx); }
 225 
 226   static const OrderedPair initial;
 227 };
 228 
 229 // -----------------------------SuperWord---------------------------------
 230 // Transforms scalar operations into packed (superword) operations.
 231 class SuperWord : public ResourceObj {
 232  private:
 233   PhaseIdealLoop* _phase;
 234   Arena*          _arena;
 235   PhaseIterGVN   &_igvn;
 236 
 237   enum consts { top_align = -1, bottom_align = -666 };
 238 
 239   GrowableArray<Node_List*> _packset;    // Packs for the current block
 240 
 241   GrowableArray<int> _bb_idx;            // Map from Node _idx to index within block
 242 
 243   GrowableArray<Node*> _block;           // Nodes in current block
 244   GrowableArray<Node*> _data_entry;      // Nodes with all inputs from outside
 245   GrowableArray<Node*> _mem_slice_head;  // Memory slice head nodes
 246   GrowableArray<Node*> _mem_slice_tail;  // Memory slice tail nodes
 247 
 248   GrowableArray<SWNodeInfo> _node_info;  // Info needed per node


 432   // Smallest type containing range of values
 433   const Type* container_type(Node* n);
 434   // Adjust pre-loop limit so that in main loop, a load/store reference
 435   // to align_to_ref will be a position zero in the vector.
 436   void align_initial_loop_index(MemNode* align_to_ref);
 437   // Find pre loop end from main loop.  Returns null if none.
 438   CountedLoopEndNode* get_pre_loop_end(CountedLoopNode *cl);
 439   // Is the use of d1 in u1 at the same operand position as d2 in u2?
 440   bool opnd_positions_match(Node* d1, Node* u1, Node* d2, Node* u2);
 441   void init();
 442 
 443   // print methods
 444   void print_packset();
 445   void print_pack(Node_List* p);
 446   void print_bb();
 447   void print_stmt(Node* s);
 448   char* blank(uint depth);
 449 };
 450 
 451 
 452 
 453 //------------------------------SWPointer---------------------------
 454 // Information about an address for dependence checking and vector alignment
 455 class SWPointer VALUE_OBJ_CLASS_SPEC {
 456  protected:
 457   MemNode*   _mem;     // My memory reference node
 458   SuperWord* _slp;     // SuperWord class
 459 
 460   Node* _base;         // NULL if unsafe nonheap reference
 461   Node* _adr;          // address pointer
 462   jint  _scale;        // multiplier for iv (in bytes), 0 if no loop iv
 463   jint  _offset;       // constant offset (in bytes)
 464   Node* _invar;        // invariant offset (in bytes), NULL if none
 465   bool  _negate_invar; // if true then use: (0 - _invar)
 466 
 467   PhaseIdealLoop* phase() { return _slp->phase(); }
 468   IdealLoopTree*  lpt()   { return _slp->lpt(); }
 469   PhiNode*        iv()    { return _slp->iv();  } // Induction var
 470 
 471   bool invariant(Node* n) {
 472     Node *n_c = phase()->get_ctrl(n);


 512         (_adr == q._adr || _base == _adr && q._base == q._adr) &&
 513         _scale == q._scale   &&
 514         _invar == q._invar   &&
 515         _negate_invar == q._negate_invar) {
 516       bool overlap = q._offset <   _offset +   memory_size() &&
 517                        _offset < q._offset + q.memory_size();
 518       return overlap ? Equal : (_offset < q._offset ? Less : Greater);
 519     } else {
 520       return NotComparable;
 521     }
 522   }
 523 
 524   bool not_equal(SWPointer& q)    { return not_equal(cmp(q)); }
 525   bool equal(SWPointer& q)        { return equal(cmp(q)); }
 526   bool comparable(SWPointer& q)   { return comparable(cmp(q)); }
 527   static bool not_equal(int cmp)  { return cmp <= NotEqual; }
 528   static bool equal(int cmp)      { return cmp == Equal; }
 529   static bool comparable(int cmp) { return cmp < NotComparable; }
 530 
 531   void print();

























 532 };
 533 
 534 #endif // SHARE_VM_OPTO_SUPERWORD_HPP
< prev index next >