23
24 #ifndef SHARE_VM_OPTO_SUPERWORD_HPP
25 #define SHARE_VM_OPTO_SUPERWORD_HPP
26
27 #include "opto/loopnode.hpp"
28 #include "opto/node.hpp"
29 #include "opto/phaseX.hpp"
30 #include "opto/vectornode.hpp"
31 #include "utilities/growableArray.hpp"
32
33 //
34 // S U P E R W O R D T R A N S F O R M
35 //
36 // SuperWords are short, fixed length vectors.
37 //
38 // Algorithm from:
39 //
40 // Exploiting SuperWord Level Parallelism with
41 // Multimedia Instruction Sets
42 // by
43 // Samuel Larsen and Saman Amarasighe
44 // MIT Laboratory for Computer Science
45 // date
46 // May 2000
47 // published in
48 // ACM SIGPLAN Notices
49 // Proceedings of ACM PLDI '00, Volume 35 Issue 5
50 //
51 // Definition 3.1 A Pack is an n-tuple, <s1, ...,sn>, where
52 // s1,...,sn are independent isomorphic statements in a basic
53 // block.
54 //
55 // Definition 3.2 A PackSet is a set of Packs.
56 //
57 // Definition 3.3 A Pair is a Pack of size two, where the
58 // first statement is considered the left element, and the
59 // second statement is considered the right element.
60
61 class SWPointer;
62 class OrderedPair;
63
422 void print_packset();
423 void print_pack(Node_List* p);
424 void print_bb();
425 void print_stmt(Node* s);
426 char* blank(uint depth);
427
428 void packset_sort(int n);
429 };
430
431
432
433 //------------------------------SWPointer---------------------------
434 // Information about an address for dependence checking and vector alignment
435 class SWPointer VALUE_OBJ_CLASS_SPEC {
436 protected:
437 MemNode* _mem; // My memory reference node
438 SuperWord* _slp; // SuperWord class
439
440 Node* _base; // NULL if unsafe nonheap reference
441 Node* _adr; // address pointer
442 jint _scale; // multipler for iv (in bytes), 0 if no loop iv
443 jint _offset; // constant offset (in bytes)
444 Node* _invar; // invariant offset (in bytes), NULL if none
445 bool _negate_invar; // if true then use: (0 - _invar)
446
447 PhaseIdealLoop* phase() { return _slp->phase(); }
448 IdealLoopTree* lpt() { return _slp->lpt(); }
449 PhiNode* iv() { return _slp->iv(); } // Induction var
450
451 bool invariant(Node* n) {
452 Node *n_c = phase()->get_ctrl(n);
453 return !lpt()->is_member(phase()->get_loop(n_c));
454 }
455
456 // Match: k*iv + offset
457 bool scaled_iv_plus_offset(Node* n);
458 // Match: k*iv where k is a constant that's not zero
459 bool scaled_iv(Node* n);
460 // Match: offset is (k [+/- invariant])
461 bool offset_plus_k(Node* n, bool negate = false);
462
|
23
24 #ifndef SHARE_VM_OPTO_SUPERWORD_HPP
25 #define SHARE_VM_OPTO_SUPERWORD_HPP
26
27 #include "opto/loopnode.hpp"
28 #include "opto/node.hpp"
29 #include "opto/phaseX.hpp"
30 #include "opto/vectornode.hpp"
31 #include "utilities/growableArray.hpp"
32
33 //
34 // S U P E R W O R D T R A N S F O R M
35 //
36 // SuperWords are short, fixed length vectors.
37 //
38 // Algorithm from:
39 //
40 // Exploiting SuperWord Level Parallelism with
41 // Multimedia Instruction Sets
42 // by
43 // Samuel Larsen and Saman Amarasinghe
44 // MIT Laboratory for Computer Science
45 // date
46 // May 2000
47 // published in
48 // ACM SIGPLAN Notices
49 // Proceedings of ACM PLDI '00, Volume 35 Issue 5
50 //
51 // Definition 3.1 A Pack is an n-tuple, <s1, ...,sn>, where
52 // s1,...,sn are independent isomorphic statements in a basic
53 // block.
54 //
55 // Definition 3.2 A PackSet is a set of Packs.
56 //
57 // Definition 3.3 A Pair is a Pack of size two, where the
58 // first statement is considered the left element, and the
59 // second statement is considered the right element.
60
61 class SWPointer;
62 class OrderedPair;
63
422 void print_packset();
423 void print_pack(Node_List* p);
424 void print_bb();
425 void print_stmt(Node* s);
426 char* blank(uint depth);
427
428 void packset_sort(int n);
429 };
430
431
432
433 //------------------------------SWPointer---------------------------
434 // Information about an address for dependence checking and vector alignment
435 class SWPointer VALUE_OBJ_CLASS_SPEC {
436 protected:
437 MemNode* _mem; // My memory reference node
438 SuperWord* _slp; // SuperWord class
439
440 Node* _base; // NULL if unsafe nonheap reference
441 Node* _adr; // address pointer
442 jint _scale; // multiplier for iv (in bytes), 0 if no loop iv
443 jint _offset; // constant offset (in bytes)
444 Node* _invar; // invariant offset (in bytes), NULL if none
445 bool _negate_invar; // if true then use: (0 - _invar)
446
447 PhaseIdealLoop* phase() { return _slp->phase(); }
448 IdealLoopTree* lpt() { return _slp->lpt(); }
449 PhiNode* iv() { return _slp->iv(); } // Induction var
450
451 bool invariant(Node* n) {
452 Node *n_c = phase()->get_ctrl(n);
453 return !lpt()->is_member(phase()->get_loop(n_c));
454 }
455
456 // Match: k*iv + offset
457 bool scaled_iv_plus_offset(Node* n);
458 // Match: k*iv where k is a constant that's not zero
459 bool scaled_iv(Node* n);
460 // Match: offset is (k [+/- invariant])
461 bool offset_plus_k(Node* n, bool negate = false);
462
|