< prev index next >
src/share/vm/opto/loopnode.hpp
Print this page
@@ -60,11 +60,13 @@
enum { Normal=0, Pre=1, Main=2, Post=3, PreMainPostFlagsMask=3,
MainHasNoPreLoop=4,
HasExactTripCount=8,
InnerLoop=16,
PartialPeelLoop=32,
- PartialPeelFailed=64 };
+ PartialPeelFailed=64,
+ HasReductions=128,
+ PassedSlpAnalysis=256 };
char _unswitch_count;
enum { _unswitch_max=3 };
public:
// Names for edge indices
@@ -75,10 +77,12 @@
int is_partial_peel_loop() const { return _loop_flags & PartialPeelLoop; }
void set_partial_peel_loop() { _loop_flags |= PartialPeelLoop; }
int partial_peel_has_failed() const { return _loop_flags & PartialPeelFailed; }
void mark_partial_peel_failed() { _loop_flags |= PartialPeelFailed; }
+ void mark_has_reductions() { _loop_flags |= HasReductions; }
+ void mark_passed_slp() { _loop_flags |= PassedSlpAnalysis; }
int unswitch_max() { return _unswitch_max; }
int unswitch_count() { return _unswitch_count; }
void set_unswitch_count(int val) {
assert (val <= unswitch_max(), "too many unswitches");
@@ -153,15 +157,19 @@
// Node count prior to last unrolling - used to decide if
// unroll,optimize,unroll,optimize,... is making progress
int _node_count_before_unroll;
+ // If slp analysis is performed we record the maximum
+ // vector mapped unroll factor here
+ int _slp_maximum_unroll_factor;
+
public:
CountedLoopNode( Node *entry, Node *backedge )
: LoopNode(entry, backedge), _main_idx(0), _trip_count(max_juint),
_profile_trip_cnt(COUNT_UNKNOWN), _unrolled_count_log2(0),
- _node_count_before_unroll(0) {
+ _node_count_before_unroll(0), _slp_maximum_unroll_factor(0) {
init_class_id(Class_CountedLoop);
// Initialize _trip_count to the largest possible value.
// Will be reset (lower) if the loop's trip count is known.
}
@@ -197,14 +205,16 @@
// so the following main loop 'knows' that it is striding down cache
// lines.
// A 'main' loop that is ONLY unrolled or peeled, never RCE'd or
// Aligned, may be missing it's pre-loop.
- int is_normal_loop() const { return (_loop_flags&PreMainPostFlagsMask) == Normal; }
+ int is_normal_loop () const { return (_loop_flags&PreMainPostFlagsMask) == Normal; }
int is_pre_loop () const { return (_loop_flags&PreMainPostFlagsMask) == Pre; }
int is_main_loop () const { return (_loop_flags&PreMainPostFlagsMask) == Main; }
int is_post_loop () const { return (_loop_flags&PreMainPostFlagsMask) == Post; }
+ int is_reduction_loop() const { return (_loop_flags&HasReductions) == HasReductions; }
+ int has_passed_slp () const { return (_loop_flags&PassedSlpAnalysis) == PassedSlpAnalysis; }
int is_main_no_pre_loop() const { return _loop_flags & MainHasNoPreLoop; }
void set_main_no_pre_loop() { _loop_flags |= MainHasNoPreLoop; }
int main_idx() const { return _main_idx; }
@@ -232,10 +242,12 @@
void double_unrolled_count() { _unrolled_count_log2++; }
int unrolled_count() { return 1 << MIN2(_unrolled_count_log2, BitsPerInt-3); }
void set_node_count_before_unroll(int ct) { _node_count_before_unroll = ct; }
int node_count_before_unroll() { return _node_count_before_unroll; }
+ void set_slp_max_unroll(int unroll_factor) { _slp_maximum_unroll_factor = unroll_factor; }
+ int slp_max_unroll() const { return _slp_maximum_unroll_factor; }
#ifndef PRODUCT
virtual void dump_spec(outputStream *st) const;
#endif
};
@@ -334,10 +346,12 @@
// them at the loop bottom and flow 1 real backedge into the loop.
Node *_head; // Head of loop
Node *_tail; // Tail of loop
inline Node *tail(); // Handle lazy update of _tail field
PhaseIdealLoop* _phase;
+ int _local_loop_unroll_limit;
+ int _local_loop_unroll_factor;
Node_List _body; // Loop body for inner loops
uint8_t _nest; // Nesting depth
uint8_t _irreducible:1, // True if irreducible
@@ -354,11 +368,12 @@
_head(head), _tail(tail),
_phase(phase),
_safepts(NULL),
_required_safept(NULL),
_allow_optimizations(true),
- _nest(0), _irreducible(0), _has_call(0), _has_sfpt(0), _rce_candidate(0)
+ _nest(0), _irreducible(0), _has_call(0), _has_sfpt(0), _rce_candidate(0),
+ _local_loop_unroll_limit(0), _local_loop_unroll_factor(0)
{ }
// Is 'l' a member of 'this'?
int is_member( const IdealLoopTree *l ) const; // Test for nested membership
@@ -442,11 +457,14 @@
// known trip count in the counted loop node.
bool policy_maximally_unroll( PhaseIdealLoop *phase ) const;
// Return TRUE or FALSE if the loop should be unrolled or not. Unroll if
// the loop is a CountedLoop and the body is small enough.
- bool policy_unroll( PhaseIdealLoop *phase ) const;
+ bool policy_unroll(PhaseIdealLoop *phase);
+
+ // Loop analyses to map to a maximal superword unrolling for vectorization.
+ void policy_unroll_slp_analysis(CountedLoopNode *cl, PhaseIdealLoop *phase, int future_unroll_ct);
// Return TRUE or FALSE if the loop should be range-check-eliminated.
// Gather a list of IF tests that are dominated by iteration splitting;
// also gather the end of the first split and the start of the 2nd split.
bool policy_range_check( PhaseIdealLoop *phase ) const;
< prev index next >