461
462 Node_Stack _stack; // Stack used to avoid recursion
463
464 protected:
465
466 // Warm up hash table, type table and initial worklist
467 void init_worklist( Node *a_root );
468
469 virtual const Type* saturate(const Type* new_type, const Type* old_type,
470 const Type* limit_type) const;
471 // Usually returns new_type. Returns old_type if new_type is only a slight
472 // improvement, such that it would take many (>>10) steps to reach 2**32.
473
474 public:
475 PhaseIterGVN( PhaseIterGVN *igvn ); // Used by CCP constructor
476 PhaseIterGVN( PhaseGVN *gvn ); // Used after Parser
477 PhaseIterGVN( PhaseIterGVN *igvn, const char *dummy ); // Used after +VerifyOpto
478
479 // Idealize new Node 'n' with respect to its inputs and its value
480 virtual Node *transform( Node *a_node );
481 virtual void record_for_igvn(Node *n) { }
482
483 virtual PhaseIterGVN *is_IterGVN() { return this; }
484
485 Unique_Node_List _worklist; // Iterative worklist
486
487 // Given def-use info and an initial worklist, apply Node::Ideal,
488 // Node::Value, Node::Identity, hash-based value numbering, Node::Ideal_DU
489 // and dominator info to a fixed point.
490 void optimize();
491
492 #ifndef PRODUCT
493 void trace_PhaseIterGVN(Node* n, Node* nn, const Type* old_type);
494 void init_verifyPhaseIterGVN();
495 void verify_PhaseIterGVN();
496 #endif
497
498 #ifdef ASSERT
499 void dump_infinite_loop_info(Node* n);
500 void trace_PhaseIterGVN_verbose(Node* n, int num_processed);
501 #endif
512 // aggressively trimmed.
513 void remove_globally_dead_node( Node *dead );
514
515 // Kill all inputs to a dead node, recursively making more dead nodes.
516 // The Node must be dead locally, i.e., have no uses.
517 void remove_dead_node( Node *dead ) {
518 assert(dead->outcnt() == 0 && !dead->is_top(), "node must be dead");
519 remove_globally_dead_node(dead);
520 }
521
522 // Add users of 'n' to worklist
523 void add_users_to_worklist0( Node *n );
524 void add_users_to_worklist ( Node *n );
525
526 // Replace old node with new one.
527 void replace_node( Node *old, Node *nn ) {
528 add_users_to_worklist(old);
529 hash_delete(old); // Yank from hash before hacking edges
530 subsume_node(old, nn);
531 }
532
533 // Delayed node rehash: remove a node from the hash table and rehash it during
534 // next optimizing pass
535 void rehash_node_delayed(Node* n) {
536 hash_delete(n);
537 _worklist.push(n);
538 }
539
540 void igvn_rehash_node_delayed(Node* n) {
541 rehash_node_delayed(n);
542 }
543
544 // Replace ith edge of "n" with "in"
545 void replace_input_of(Node* n, int i, Node* in) {
546 rehash_node_delayed(n);
547 n->set_req(i, in);
548 }
549
550 // Delete ith edge of "n"
551 void delete_input_of(Node* n, int i) {
|
461
462 Node_Stack _stack; // Stack used to avoid recursion
463
464 protected:
465
466 // Warm up hash table, type table and initial worklist
467 void init_worklist( Node *a_root );
468
469 virtual const Type* saturate(const Type* new_type, const Type* old_type,
470 const Type* limit_type) const;
471 // Usually returns new_type. Returns old_type if new_type is only a slight
472 // improvement, such that it would take many (>>10) steps to reach 2**32.
473
474 public:
475 PhaseIterGVN( PhaseIterGVN *igvn ); // Used by CCP constructor
476 PhaseIterGVN( PhaseGVN *gvn ); // Used after Parser
477 PhaseIterGVN( PhaseIterGVN *igvn, const char *dummy ); // Used after +VerifyOpto
478
479 // Idealize new Node 'n' with respect to its inputs and its value
480 virtual Node *transform( Node *a_node );
481 virtual void record_for_igvn(Node *n) { _worklist.push(n); }
482
483 virtual PhaseIterGVN *is_IterGVN() { return this; }
484
485 Unique_Node_List _worklist; // Iterative worklist
486
487 // Given def-use info and an initial worklist, apply Node::Ideal,
488 // Node::Value, Node::Identity, hash-based value numbering, Node::Ideal_DU
489 // and dominator info to a fixed point.
490 void optimize();
491
492 #ifndef PRODUCT
493 void trace_PhaseIterGVN(Node* n, Node* nn, const Type* old_type);
494 void init_verifyPhaseIterGVN();
495 void verify_PhaseIterGVN();
496 #endif
497
498 #ifdef ASSERT
499 void dump_infinite_loop_info(Node* n);
500 void trace_PhaseIterGVN_verbose(Node* n, int num_processed);
501 #endif
512 // aggressively trimmed.
513 void remove_globally_dead_node( Node *dead );
514
515 // Kill all inputs to a dead node, recursively making more dead nodes.
516 // The Node must be dead locally, i.e., have no uses.
517 void remove_dead_node( Node *dead ) {
518 assert(dead->outcnt() == 0 && !dead->is_top(), "node must be dead");
519 remove_globally_dead_node(dead);
520 }
521
522 // Add users of 'n' to worklist
523 void add_users_to_worklist0( Node *n );
524 void add_users_to_worklist ( Node *n );
525
526 // Replace old node with new one.
527 void replace_node( Node *old, Node *nn ) {
528 add_users_to_worklist(old);
529 hash_delete(old); // Yank from hash before hacking edges
530 subsume_node(old, nn);
531 }
532
533 void replace_in_uses(Node* n, Node* m);
534
535 // Delayed node rehash: remove a node from the hash table and rehash it during
536 // next optimizing pass
537 void rehash_node_delayed(Node* n) {
538 hash_delete(n);
539 _worklist.push(n);
540 }
541
542 void igvn_rehash_node_delayed(Node* n) {
543 rehash_node_delayed(n);
544 }
545
546 // Replace ith edge of "n" with "in"
547 void replace_input_of(Node* n, int i, Node* in) {
548 rehash_node_delayed(n);
549 n->set_req(i, in);
550 }
551
552 // Delete ith edge of "n"
553 void delete_input_of(Node* n, int i) {
|