< prev index next >

src/hotspot/share/opto/loopnode.hpp

Print this page




 908   }
 909   void set_idom(Node* d, Node* n, uint dom_depth);
 910   // Locally compute IDOM using dom_lca call
 911   Node *compute_idom( Node *region ) const;
 912   // Recompute dom_depth
 913   void recompute_dom_depth();
 914 
 915   // Is safept not required by an outer loop?
 916   bool is_deleteable_safept(Node* sfpt);
 917 
 918   // Replace parallel induction variable (parallel to trip counter)
 919   void replace_parallel_iv(IdealLoopTree *loop);
 920 
 921   // Perform verification that the graph is valid.
 922   PhaseIdealLoop( PhaseIterGVN &igvn) :
 923     PhaseTransform(Ideal_Loop),
 924     _igvn(igvn),
 925     _dom_lca_tags(arena()), // Thread::resource_area
 926     _verify_me(NULL),
 927     _verify_only(true) {
 928     build_and_optimize(false, false);
 929   }
 930 
 931   // build the loop tree and perform any requested optimizations
 932   void build_and_optimize(bool do_split_if, bool skip_loop_opts, bool last_round = false);
 933 
 934   // Dominators for the sea of nodes
 935   void Dominators();
 936   Node *dom_lca( Node *n1, Node *n2 ) const {
 937     return find_non_split_ctrl(dom_lca_internal(n1, n2));
 938   }
 939   Node *dom_lca_internal( Node *n1, Node *n2 ) const;
 940 
 941   // Compute the Ideal Node to Loop mapping
 942   PhaseIdealLoop( PhaseIterGVN &igvn, bool do_split_ifs, bool skip_loop_opts = false, bool last_round = false) :
 943     PhaseTransform(Ideal_Loop),
 944     _igvn(igvn),
 945     _dom_lca_tags(arena()), // Thread::resource_area
 946     _verify_me(NULL),
 947     _verify_only(false) {
 948     build_and_optimize(do_split_ifs, skip_loop_opts, last_round);
 949   }
 950 
 951   // Verify that verify_me made the same decisions as a fresh run.
 952   PhaseIdealLoop( PhaseIterGVN &igvn, const PhaseIdealLoop *verify_me) :
 953     PhaseTransform(Ideal_Loop),
 954     _igvn(igvn),
 955     _dom_lca_tags(arena()), // Thread::resource_area
 956     _verify_me(verify_me),
 957     _verify_only(false) {
 958     build_and_optimize(false, false);
 959   }
 960 
 961   // Build and verify the loop tree without modifying the graph.  This
 962   // is useful to verify that all inputs properly dominate their uses.
 963   static void verify(PhaseIterGVN& igvn) {
 964 #ifdef ASSERT
 965     PhaseIdealLoop v(igvn);
 966 #endif
 967   }
 968 
 969   // True if the method has at least 1 irreducible loop
 970   bool _has_irreducible_loops;
 971 
 972   // Per-Node transform
 973   virtual Node *transform( Node *a_node ) { return 0; }
 974 
 975   bool is_counted_loop(Node* x, IdealLoopTree*& loop);
 976   IdealLoopTree* create_outer_strip_mined_loop(BoolNode *test, Node *cmp, Node *init_control,
 977                                                IdealLoopTree* loop, float cl_prob, float le_fcnt,
 978                                                Node*& entry_control, Node*& iffalse);


1274   bool intrinsify_fill(IdealLoopTree* lpt);
1275   bool match_fill_loop(IdealLoopTree* lpt, Node*& store, Node*& store_value,
1276                        Node*& shift, Node*& offset);
1277 
1278 private:
1279   // Return a type based on condition control flow
1280   const TypeInt* filtered_type( Node *n, Node* n_ctrl);
1281   const TypeInt* filtered_type( Node *n ) { return filtered_type(n, NULL); }
1282  // Helpers for filtered type
1283   const TypeInt* filtered_type_from_dominators( Node* val, Node *val_ctrl);
1284 
1285   // Helper functions
1286   Node *spinup( Node *iff, Node *new_false, Node *new_true, Node *region, Node *phi, small_cache *cache );
1287   Node *find_use_block( Node *use, Node *def, Node *old_false, Node *new_false, Node *old_true, Node *new_true );
1288   void handle_use( Node *use, Node *def, small_cache *cache, Node *region_dom, Node *new_false, Node *new_true, Node *old_false, Node *old_true );
1289   bool split_up( Node *n, Node *blk1, Node *blk2 );
1290   void sink_use( Node *use, Node *post_loop );
1291   Node *place_near_use( Node *useblock ) const;
1292   Node* try_move_store_before_loop(Node* n, Node *n_ctrl);
1293   void try_move_store_after_loop(Node* n);

1294   bool identical_backtoback_ifs(Node *n);
1295   bool can_split_if(Node *n_ctrl);

1296 
1297   bool _created_loop_node;
1298 public:
1299   void set_created_loop_node() { _created_loop_node = true; }
1300   bool created_loop_node()     { return _created_loop_node; }
1301   void register_new_node( Node *n, Node *blk );
1302 
1303 #ifdef ASSERT
1304   void dump_bad_graph(const char* msg, Node* n, Node* early, Node* LCA);
1305 #endif
1306 
1307 #ifndef PRODUCT
1308   void dump( ) const;
1309   void dump( IdealLoopTree *loop, uint rpo_idx, Node_List &rpo_list ) const;
1310   void rpo( Node *start, Node_Stack &stk, VectorSet &visited, Node_List &rpo_list ) const;
1311   void verify() const;          // Major slow  :-)
1312   void verify_compare( Node *n, const PhaseIdealLoop *loop_verify, VectorSet &visited ) const;
1313   IdealLoopTree *get_loop_idx(Node* n) const {
1314     // Dead nodes have no loop, so return the top level loop instead
1315     return _nodes[n->_idx] ? (IdealLoopTree*)_nodes[n->_idx] : _ltree_root;
1316   }
1317   // Print some stats
1318   static void print_statistics();
1319   static int _loop_invokes;     // Count of PhaseIdealLoop invokes
1320   static int _loop_work;        // Sum of PhaseIdealLoop x _unique
1321 #endif



1322 };
1323 
1324 // This kit may be used for making of a reserved copy of a loop before this loop
1325 //  goes under non-reversible changes.
1326 //
1327 // Function create_reserve() creates a reserved copy (clone) of the loop.
1328 // The reserved copy is created by calling
1329 // PhaseIdealLoop::create_reserve_version_of_loop - see there how
1330 // the original and reserved loops are connected in the outer graph.
1331 // If create_reserve succeeded, it returns 'true' and _has_reserved is set to 'true'.
1332 //
1333 // By default the reserved copy (clone) of the loop is created as dead code - it is
1334 // dominated in the outer loop by this node chain:
1335 //   intcon(1)->If->IfFalse->reserved_copy.
1336 // The original loop is dominated by the the same node chain but IfTrue projection:
1337 //   intcon(0)->If->IfTrue->original_loop.
1338 //
1339 // In this implementation of CountedLoopReserveKit the ctor includes create_reserve()
1340 // and the dtor, checks _use_new value.
1341 // If _use_new == false, it "switches" control to reserved copy of the loop




 908   }
 909   void set_idom(Node* d, Node* n, uint dom_depth);
 910   // Locally compute IDOM using dom_lca call
 911   Node *compute_idom( Node *region ) const;
 912   // Recompute dom_depth
 913   void recompute_dom_depth();
 914 
 915   // Is safept not required by an outer loop?
 916   bool is_deleteable_safept(Node* sfpt);
 917 
 918   // Replace parallel induction variable (parallel to trip counter)
 919   void replace_parallel_iv(IdealLoopTree *loop);
 920 
 921   // Perform verification that the graph is valid.
 922   PhaseIdealLoop( PhaseIterGVN &igvn) :
 923     PhaseTransform(Ideal_Loop),
 924     _igvn(igvn),
 925     _dom_lca_tags(arena()), // Thread::resource_area
 926     _verify_me(NULL),
 927     _verify_only(true) {
 928     build_and_optimize(LoopOptsVerify);
 929   }
 930 
 931   // build the loop tree and perform any requested optimizations
 932   void build_and_optimize(LoopOptsMode mode);
 933 
 934   // Dominators for the sea of nodes
 935   void Dominators();
 936   Node *dom_lca( Node *n1, Node *n2 ) const {
 937     return find_non_split_ctrl(dom_lca_internal(n1, n2));
 938   }
 939   Node *dom_lca_internal( Node *n1, Node *n2 ) const;
 940 
 941   // Compute the Ideal Node to Loop mapping
 942   PhaseIdealLoop( PhaseIterGVN &igvn, LoopOptsMode mode) :
 943     PhaseTransform(Ideal_Loop),
 944     _igvn(igvn),
 945     _dom_lca_tags(arena()), // Thread::resource_area
 946     _verify_me(NULL),
 947     _verify_only(false) {
 948       build_and_optimize(mode);
 949   }
 950 
 951   // Verify that verify_me made the same decisions as a fresh run.
 952   PhaseIdealLoop( PhaseIterGVN &igvn, const PhaseIdealLoop *verify_me) :
 953     PhaseTransform(Ideal_Loop),
 954     _igvn(igvn),
 955     _dom_lca_tags(arena()), // Thread::resource_area
 956     _verify_me(verify_me),
 957     _verify_only(false) {
 958     build_and_optimize(LoopOptsVerify);
 959   }
 960 
 961   // Build and verify the loop tree without modifying the graph.  This
 962   // is useful to verify that all inputs properly dominate their uses.
 963   static void verify(PhaseIterGVN& igvn) {
 964 #ifdef ASSERT
 965     PhaseIdealLoop v(igvn);
 966 #endif
 967   }
 968 
 969   // True if the method has at least 1 irreducible loop
 970   bool _has_irreducible_loops;
 971 
 972   // Per-Node transform
 973   virtual Node *transform( Node *a_node ) { return 0; }
 974 
 975   bool is_counted_loop(Node* x, IdealLoopTree*& loop);
 976   IdealLoopTree* create_outer_strip_mined_loop(BoolNode *test, Node *cmp, Node *init_control,
 977                                                IdealLoopTree* loop, float cl_prob, float le_fcnt,
 978                                                Node*& entry_control, Node*& iffalse);


1274   bool intrinsify_fill(IdealLoopTree* lpt);
1275   bool match_fill_loop(IdealLoopTree* lpt, Node*& store, Node*& store_value,
1276                        Node*& shift, Node*& offset);
1277 
1278 private:
1279   // Return a type based on condition control flow
1280   const TypeInt* filtered_type( Node *n, Node* n_ctrl);
1281   const TypeInt* filtered_type( Node *n ) { return filtered_type(n, NULL); }
1282  // Helpers for filtered type
1283   const TypeInt* filtered_type_from_dominators( Node* val, Node *val_ctrl);
1284 
1285   // Helper functions
1286   Node *spinup( Node *iff, Node *new_false, Node *new_true, Node *region, Node *phi, small_cache *cache );
1287   Node *find_use_block( Node *use, Node *def, Node *old_false, Node *new_false, Node *old_true, Node *new_true );
1288   void handle_use( Node *use, Node *def, small_cache *cache, Node *region_dom, Node *new_false, Node *new_true, Node *old_false, Node *old_true );
1289   bool split_up( Node *n, Node *blk1, Node *blk2 );
1290   void sink_use( Node *use, Node *post_loop );
1291   Node *place_near_use( Node *useblock ) const;
1292   Node* try_move_store_before_loop(Node* n, Node *n_ctrl);
1293   void try_move_store_after_loop(Node* n);
1294 public:
1295   bool identical_backtoback_ifs(Node *n);
1296   bool can_split_if(Node *n_ctrl);
1297 private:
1298 
1299   bool _created_loop_node;
1300 public:
1301   void set_created_loop_node() { _created_loop_node = true; }
1302   bool created_loop_node()     { return _created_loop_node; }
1303   void register_new_node( Node *n, Node *blk );
1304 
1305 #ifdef ASSERT
1306   void dump_bad_graph(const char* msg, Node* n, Node* early, Node* LCA);
1307 #endif
1308 
1309 #ifndef PRODUCT
1310   void dump( ) const;
1311   void dump( IdealLoopTree *loop, uint rpo_idx, Node_List &rpo_list ) const;

1312   void verify() const;          // Major slow  :-)
1313   void verify_compare( Node *n, const PhaseIdealLoop *loop_verify, VectorSet &visited ) const;
1314   IdealLoopTree *get_loop_idx(Node* n) const {
1315     // Dead nodes have no loop, so return the top level loop instead
1316     return _nodes[n->_idx] ? (IdealLoopTree*)_nodes[n->_idx] : _ltree_root;
1317   }
1318   // Print some stats
1319   static void print_statistics();
1320   static int _loop_invokes;     // Count of PhaseIdealLoop invokes
1321   static int _loop_work;        // Sum of PhaseIdealLoop x _unique
1322 #endif
1323   void rpo( Node *start, Node_Stack &stk, VectorSet &visited, Node_List &rpo_list ) const;
1324 
1325   PhaseIterGVN& igvn() { return _igvn; }
1326 };
1327 
1328 // This kit may be used for making of a reserved copy of a loop before this loop
1329 //  goes under non-reversible changes.
1330 //
1331 // Function create_reserve() creates a reserved copy (clone) of the loop.
1332 // The reserved copy is created by calling
1333 // PhaseIdealLoop::create_reserve_version_of_loop - see there how
1334 // the original and reserved loops are connected in the outer graph.
1335 // If create_reserve succeeded, it returns 'true' and _has_reserved is set to 'true'.
1336 //
1337 // By default the reserved copy (clone) of the loop is created as dead code - it is
1338 // dominated in the outer loop by this node chain:
1339 //   intcon(1)->If->IfFalse->reserved_copy.
1340 // The original loop is dominated by the the same node chain but IfTrue projection:
1341 //   intcon(0)->If->IfTrue->original_loop.
1342 //
1343 // In this implementation of CountedLoopReserveKit the ctor includes create_reserve()
1344 // and the dtor, checks _use_new value.
1345 // If _use_new == false, it "switches" control to reserved copy of the loop


< prev index next >