< prev index next >

src/hotspot/share/opto/phaseX.hpp

Print this page

450   // Subsume users of node 'old' into node 'nn'
451   void subsume_node( Node *old, Node *nn );
452 
453   Node_Stack _stack;      // Stack used to avoid recursion
454 protected:
455 
456   // Shuffle worklist, for stress testing
457   void shuffle_worklist();
458 
459   virtual const Type* saturate(const Type* new_type, const Type* old_type,
460                                const Type* limit_type) const;
461   // Usually returns new_type.  Returns old_type if new_type is only a slight
462   // improvement, such that it would take many (>>10) steps to reach 2**32.
463 
464 public:
465   PhaseIterGVN(PhaseIterGVN* igvn); // Used by CCP constructor
466   PhaseIterGVN(PhaseGVN* gvn); // Used after Parser
467 
468   // Idealize new Node 'n' with respect to its inputs and its value
469   virtual Node *transform( Node *a_node );
470   virtual void record_for_igvn(Node *n) { }
471 
472   Unique_Node_List _worklist;       // Iterative worklist
473 
474   // Given def-use info and an initial worklist, apply Node::Ideal,
475   // Node::Value, Node::Identity, hash-based value numbering, Node::Ideal_DU
476   // and dominator info to a fixed point.
477   void optimize();
478 
479 #ifndef PRODUCT
480   void trace_PhaseIterGVN(Node* n, Node* nn, const Type* old_type);
481   void init_verifyPhaseIterGVN();
482   void verify_PhaseIterGVN();
483 #endif
484 
485 #ifdef ASSERT
486   void dump_infinite_loop_info(Node* n, const char* where);
487   void trace_PhaseIterGVN_verbose(Node* n, int num_processed);
488 #endif
489 
490   // Register a new node with the iter GVN pass without transforming it.

500   void remove_globally_dead_node( Node *dead );
501 
502   // Kill all inputs to a dead node, recursively making more dead nodes.
503   // The Node must be dead locally, i.e., have no uses.
504   void remove_dead_node( Node *dead ) {
505     assert(dead->outcnt() == 0 && !dead->is_top(), "node must be dead");
506     remove_globally_dead_node(dead);
507   }
508 
509   // Add users of 'n' to worklist
510   void add_users_to_worklist0( Node *n );
511   void add_users_to_worklist ( Node *n );
512 
513   // Replace old node with new one.
514   void replace_node( Node *old, Node *nn ) {
515     add_users_to_worklist(old);
516     hash_delete(old); // Yank from hash before hacking edges
517     subsume_node(old, nn);
518   }
519 


520   // Delayed node rehash: remove a node from the hash table and rehash it during
521   // next optimizing pass
522   void rehash_node_delayed(Node* n) {
523     hash_delete(n);
524     _worklist.push(n);
525   }
526 
527   // Replace ith edge of "n" with "in"
528   void replace_input_of(Node* n, int i, Node* in) {
529     rehash_node_delayed(n);
530     n->set_req_X(i, in, this);
531   }
532 
533   // Delete ith edge of "n"
534   void delete_input_of(Node* n, int i) {
535     rehash_node_delayed(n);
536     n->del_req(i);
537   }
538 
539   bool delay_transform() const { return _delay_transform; }

548   }
549 
550   bool is_dominator(Node *d, Node *n) { return is_dominator_helper(d, n, false); }
551   bool no_dependent_zero_check(Node* n) const;
552 
553 #ifndef PRODUCT
554 protected:
555   // Sub-quadratic implementation of VerifyIterativeGVN.
556   julong _verify_counter;
557   julong _verify_full_passes;
558   enum { _verify_window_size = 30 };
559   Node* _verify_window[_verify_window_size];
560   void verify_step(Node* n);
561 #endif
562 };
563 
564 //------------------------------PhaseCCP---------------------------------------
565 // Phase for performing global Conditional Constant Propagation.
566 // Should be replaced with combined CCP & GVN someday.
567 class PhaseCCP : public PhaseIterGVN {



568   // Non-recursive.  Use analysis to transform single Node.
569   virtual Node *transform_once( Node *n );
570 
571 public:
572   PhaseCCP( PhaseIterGVN *igvn ); // Compute conditional constants
573   NOT_PRODUCT( ~PhaseCCP(); )
574 
575   // Worklist algorithm identifies constants
576   void analyze();
577   // Recursive traversal of program.  Used analysis to modify program.
578   virtual Node *transform( Node *n );
579   // Do any transformation after analysis
580   void          do_transform();
581 
582   virtual const Type* saturate(const Type* new_type, const Type* old_type,
583                                const Type* limit_type) const;
584   // Returns new_type->widen(old_type), which increments the widen bits until
585   // giving up with TypeInt::INT or TypeLong::LONG.
586   // Result is clipped to limit_type if necessary.
587 

450   // Subsume users of node 'old' into node 'nn'
451   void subsume_node( Node *old, Node *nn );
452 
453   Node_Stack _stack;      // Stack used to avoid recursion
454 protected:
455 
456   // Shuffle worklist, for stress testing
457   void shuffle_worklist();
458 
459   virtual const Type* saturate(const Type* new_type, const Type* old_type,
460                                const Type* limit_type) const;
461   // Usually returns new_type.  Returns old_type if new_type is only a slight
462   // improvement, such that it would take many (>>10) steps to reach 2**32.
463 
464 public:
465   PhaseIterGVN(PhaseIterGVN* igvn); // Used by CCP constructor
466   PhaseIterGVN(PhaseGVN* gvn); // Used after Parser
467 
468   // Idealize new Node 'n' with respect to its inputs and its value
469   virtual Node *transform( Node *a_node );
470   virtual void record_for_igvn(Node *n) { _worklist.push(n); }
471 
472   Unique_Node_List _worklist;       // Iterative worklist
473 
474   // Given def-use info and an initial worklist, apply Node::Ideal,
475   // Node::Value, Node::Identity, hash-based value numbering, Node::Ideal_DU
476   // and dominator info to a fixed point.
477   void optimize();
478 
479 #ifndef PRODUCT
480   void trace_PhaseIterGVN(Node* n, Node* nn, const Type* old_type);
481   void init_verifyPhaseIterGVN();
482   void verify_PhaseIterGVN();
483 #endif
484 
485 #ifdef ASSERT
486   void dump_infinite_loop_info(Node* n, const char* where);
487   void trace_PhaseIterGVN_verbose(Node* n, int num_processed);
488 #endif
489 
490   // Register a new node with the iter GVN pass without transforming it.

500   void remove_globally_dead_node( Node *dead );
501 
502   // Kill all inputs to a dead node, recursively making more dead nodes.
503   // The Node must be dead locally, i.e., have no uses.
504   void remove_dead_node( Node *dead ) {
505     assert(dead->outcnt() == 0 && !dead->is_top(), "node must be dead");
506     remove_globally_dead_node(dead);
507   }
508 
509   // Add users of 'n' to worklist
510   void add_users_to_worklist0( Node *n );
511   void add_users_to_worklist ( Node *n );
512 
513   // Replace old node with new one.
514   void replace_node( Node *old, Node *nn ) {
515     add_users_to_worklist(old);
516     hash_delete(old); // Yank from hash before hacking edges
517     subsume_node(old, nn);
518   }
519 
520   void replace_in_uses(Node* n, Node* m);
521 
522   // Delayed node rehash: remove a node from the hash table and rehash it during
523   // next optimizing pass
524   void rehash_node_delayed(Node* n) {
525     hash_delete(n);
526     _worklist.push(n);
527   }
528 
529   // Replace ith edge of "n" with "in"
530   void replace_input_of(Node* n, int i, Node* in) {
531     rehash_node_delayed(n);
532     n->set_req_X(i, in, this);
533   }
534 
535   // Delete ith edge of "n"
536   void delete_input_of(Node* n, int i) {
537     rehash_node_delayed(n);
538     n->del_req(i);
539   }
540 
541   bool delay_transform() const { return _delay_transform; }

550   }
551 
552   bool is_dominator(Node *d, Node *n) { return is_dominator_helper(d, n, false); }
553   bool no_dependent_zero_check(Node* n) const;
554 
555 #ifndef PRODUCT
556 protected:
557   // Sub-quadratic implementation of VerifyIterativeGVN.
558   julong _verify_counter;
559   julong _verify_full_passes;
560   enum { _verify_window_size = 30 };
561   Node* _verify_window[_verify_window_size];
562   void verify_step(Node* n);
563 #endif
564 };
565 
566 //------------------------------PhaseCCP---------------------------------------
567 // Phase for performing global Conditional Constant Propagation.
568 // Should be replaced with combined CCP & GVN someday.
569 class PhaseCCP : public PhaseIterGVN {
570   GrowableArray<Node*> _trstack; // Stack for transform operation
571   Unique_Node_List _useful;      // Nodes reachable from the bottom
572 
573   // Non-recursive.  Use analysis to transform single Node.
574   virtual Node *transform_once( Node *n );
575 
576 public:
577   PhaseCCP( PhaseIterGVN *igvn ); // Compute conditional constants
578   NOT_PRODUCT( ~PhaseCCP(); )
579 
580   // Worklist algorithm identifies constants
581   void analyze();
582   // Recursive traversal of program.  Used analysis to modify program.
583   virtual Node *transform( Node *n );
584   // Do any transformation after analysis
585   void          do_transform();
586 
587   virtual const Type* saturate(const Type* new_type, const Type* old_type,
588                                const Type* limit_type) const;
589   // Returns new_type->widen(old_type), which increments the widen bits until
590   // giving up with TypeInt::INT or TypeLong::LONG.
591   // Result is clipped to limit_type if necessary.
592 
< prev index next >