src/share/vm/opto/loopnode.hpp

changeset 2877
bad7ecd0b6ed
parent 2747
3af54845df98
child 2915
38569792a45a
     1.1 --- a/src/share/vm/opto/loopnode.hpp	Wed May 04 03:42:58 2011 -0700
     1.2 +++ b/src/share/vm/opto/loopnode.hpp	Wed May 04 13:12:42 2011 -0700
     1.3 @@ -289,6 +289,28 @@
     1.4  inline Node *CountedLoopNode::incr() const { return loopexit() ? loopexit()->incr() : NULL; }
     1.5  inline Node *CountedLoopNode::phi() const { return loopexit() ? loopexit()->phi() : NULL; }
     1.6  
     1.7 +//------------------------------LoopLimitNode-----------------------------
     1.8 +// Counted Loop limit node which represents exact final iterator value:
     1.9 +// trip_count = (limit - init_trip + stride - 1)/stride
    1.10 +// final_value= trip_count * stride + init_trip.
    1.11 +// Use HW instructions to calculate it when it can overflow in integer.
    1.12 +// Note, final_value should fit into integer since counted loop has
    1.13 +// limit check: limit <= max_int-stride.
    1.14 +class LoopLimitNode : public Node {
    1.15 +  enum { Init=1, Limit=2, Stride=3 };
    1.16 + public:
    1.17 +  LoopLimitNode( Compile* C, Node *init, Node *limit, Node *stride ) : Node(0,init,limit,stride) {
    1.18 +    // Put it on the Macro nodes list to optimize during macro nodes expansion.
    1.19 +    init_flags(Flag_is_macro);
    1.20 +    C->add_macro_node(this);
    1.21 +  }
    1.22 +  virtual int Opcode() const;
    1.23 +  virtual const Type *bottom_type() const { return TypeInt::INT; }
    1.24 +  virtual uint ideal_reg() const { return Op_RegI; }
    1.25 +  virtual const Type *Value( PhaseTransform *phase ) const;
    1.26 +  virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
    1.27 +  virtual Node *Identity( PhaseTransform *phase );
    1.28 +};
    1.29  
    1.30  // -----------------------------IdealLoopTree----------------------------------
    1.31  class IdealLoopTree : public ResourceObj {
    1.32 @@ -775,6 +797,8 @@
    1.33  
    1.34    bool is_counted_loop( Node *x, IdealLoopTree *loop );
    1.35  
    1.36 +  Node* exact_limit( IdealLoopTree *loop );
    1.37 +
    1.38    // Return a post-walked LoopNode
    1.39    IdealLoopTree *get_loop( Node *n ) const {
    1.40      // Dead nodes have no loop, so return the top level loop instead
    1.41 @@ -837,7 +861,6 @@
    1.42    bool is_scaled_iv_plus_offset(Node* exp, Node* iv, int* p_scale, Node** p_offset, int depth = 0);
    1.43  
    1.44    // Return true if proj is for "proj->[region->..]call_uct"
    1.45 -  // Return true if proj is for "proj->[region->..]call_uct"
    1.46    static bool is_uncommon_trap_proj(ProjNode* proj, Deoptimization::DeoptReason reason);
    1.47    // Return true for    "if(test)-> proj -> ...
    1.48    //                          |
    1.49 @@ -860,10 +883,11 @@
    1.50                                     PhaseIterGVN* igvn);
    1.51    static Node* clone_loop_predicates(Node* old_entry, Node* new_entry,
    1.52                                           bool move_predicates,
    1.53 +                                         bool clone_limit_check,
    1.54                                           PhaseIdealLoop* loop_phase,
    1.55                                           PhaseIterGVN* igvn);
    1.56 -  Node* clone_loop_predicates(Node* old_entry, Node* new_entry);
    1.57 -  Node*  move_loop_predicates(Node* old_entry, Node* new_entry);
    1.58 +  Node* clone_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check);
    1.59 +  Node*  move_loop_predicates(Node* old_entry, Node* new_entry, bool clone_limit_check);
    1.60  
    1.61    void eliminate_loop_predicates(Node* entry);
    1.62    static Node* skip_loop_predicates(Node* entry);
    1.63 @@ -873,7 +897,7 @@
    1.64    // Find a predicate
    1.65    static Node* find_predicate(Node* entry);
    1.66    // Construct a range check for a predicate if
    1.67 -  BoolNode* rc_predicate(Node* ctrl,
    1.68 +  BoolNode* rc_predicate(IdealLoopTree *loop, Node* ctrl,
    1.69                           int scale, Node* offset,
    1.70                           Node* init, Node* limit, Node* stride,
    1.71                           Node* range, bool upper);
    1.72 @@ -903,11 +927,11 @@
    1.73  
    1.74    // Range Check Elimination uses this function!
    1.75    // Constrain the main loop iterations so the affine function:
    1.76 -  //    scale_con * I + offset  <  limit
    1.77 +  //    low_limit <= scale_con * I + offset  <  upper_limit
    1.78    // always holds true.  That is, either increase the number of iterations in
    1.79    // the pre-loop or the post-loop until the condition holds true in the main
    1.80    // loop.  Scale_con, offset and limit are all loop invariant.
    1.81 -  void add_constraint( int stride_con, int scale_con, Node *offset, Node *limit, Node *pre_ctrl, Node **pre_limit, Node **main_limit );
    1.82 +  void add_constraint( int stride_con, int scale_con, Node *offset, Node *low_limit, Node *upper_limit, Node *pre_ctrl, Node **pre_limit, Node **main_limit );
    1.83  
    1.84    // Partially peel loop up through last_peel node.
    1.85    bool partial_peel( IdealLoopTree *loop, Node_List &old_new );

mercurial